1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <cstdlib>
10 #include <string>
11 #include <fstream>
12 #include <iostream>
13 
14 
15 #define INLINE inline __attribute__((always_inline))
16 
17 INLINE int
18 product (int x, int y)
19 {
20     int result = x * y;
21     return result;
22 }
23 
24 INLINE int
25 sum (int a, int b)
26 {
27     int result = a + b;
28     return result;
29 }
30 
31 int
32 strange_max (int m, int n)
33 {
34     if (m > n)
35         return m;
36     else if (n > m)
37         return n;
38     else
39         return 0;
40 }
41 
42 int
43 foo (int i, int j)
44 {
45     if (strange_max (i, j) == i)
46         return product (i, j);
47     else if (strange_max  (i, j) == j)
48         return sum (i, j);
49     else
50         return product (sum (i, i), sum (j, j));
51 }
52 
53 int
54 main(int argc, char const *argv[])
55 {
56 
57     int array[3];
58 
59     array[0] = foo (1238, 78392);
60     array[1] = foo (379265, 23674);
61     array[2] = foo (872934, 234);
62 
63     return 0;
64 }
65