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