#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int div(int, int);
int mul(int, int);
int /*<<< orphan*/ printf(char *, int, int, ...);
int prod(int);
int sigma(int);
int sub(int, int);
int sum(int, int);
int main(void) {
  printf("%d + %d = %d\n", 10, 9, sum(10, 9));
  printf("%d + %d = %d\n", 10, -3, sum(10, -3));
  printf("%d - %d = %d\n", -10, 9, sub(-10, 9));
  printf("%d - %d = %d\n", 5, -6, sub(5, -6));
  printf("%d * %d = %d\n", 10, 5, mul(10, 5));
  printf("%d * %d = %d\n", 2, -3, mul(2, -3));
  printf("%d / %d = %d\n", 20, 3, div(20, 3));
  printf("Sigma(%d) = %d\n", -7, sigma(-7));
  printf("Prod(%d) = %d\n", 5, prod(5));
  printf("Prod(%d) = %d\n", -5, prod(-5));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <sum@plt>
mov    %eax,%ecx
lea    0xe69(%rip),%rdi
mov    $0xa,%esi
mov    $0x9,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1050 <sum@plt>
mov    %eax,%ecx
lea    0xe40(%rip),%rdi
mov    $0xa,%esi
mov    $0xfffffffd,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xfffffff6,%edi
mov    $0x9,%esi
call   1090 <sub@plt>
mov    %eax,%ecx
lea    0xe25(%rip),%rdi
mov    $0xfffffff6,%esi
mov    $0x9,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0xfffffffa,%esi
call   1090 <sub@plt>
mov    %eax,%ecx
lea    0xdfc(%rip),%rdi
mov    $0x5,%esi
mov    $0xfffffffa,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1070 <mul@plt>
mov    %eax,%ecx
lea    0xde1(%rip),%rdi
mov    $0xa,%esi
mov    $0x5,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0xfffffffd,%esi
call   1070 <mul@plt>
mov    %eax,%ecx
lea    0xdb8(%rip),%rdi
mov    $0x2,%esi
mov    $0xfffffffd,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x14,%edi
mov    $0x3,%esi
call   1060 <div@plt>
mov    %eax,%ecx
lea    0xd9d(%rip),%rdi
mov    $0x14,%esi
mov    $0x3,%edx
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xfffffff9,%edi
call   1030 <sigma@plt>
mov    %eax,%edx
lea    0xd87(%rip),%rdi
mov    $0xfffffff9,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x5,%edi
call   1080 <prod@plt>
mov    %eax,%edx
lea    0xd78(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xfffffffb,%edi
call   1080 <prod@plt>
mov    %eax,%edx
lea    0xd59(%rip),%rdi
mov    $0xfffffffb,%esi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <sum@plt>
lea    0xe79(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x9,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0xfffffffd,%esi
call   1050 <sum@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0xfffffffd,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff6,%edi
mov    $0x9,%esi
call   1090 <sub@plt>
lea    0xe36(%rip),%rbx
mov    %rbx,%rdi
mov    $0xfffffff6,%esi
mov    $0x9,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
mov    $0xfffffffa,%esi
call   1090 <sub@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0xfffffffa,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1070 <mul@plt>
lea    0xdf3(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x5,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0xfffffffd,%esi
call   1070 <mul@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0xfffffffd,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x14,%edi
mov    $0x3,%esi
call   1060 <div@plt>
lea    0xdb0(%rip),%rdi
mov    $0x14,%esi
mov    $0x3,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffff9,%edi
call   1030 <sigma@plt>
lea    0xd9a(%rip),%rdi
mov    $0xfffffff9,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
call   1080 <prod@plt>
lea    0xd8b(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffb,%edi
call   1080 <prod@plt>
mov    %rbx,%rdi
mov    $0xfffffffb,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [14 x i8] c"%d - %d = %d\0A\00"
@.str.2 = [14 x i8] c"%d * %d = %d\0A\00"
@.str.3 = [14 x i8] c"%d / %d = %d\0A\00"
@.str.4 = [16 x i8] c"Sigma(%d) = %d\0A\00"
@.str.5 = [15 x i8] c"Prod(%d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sum(i32 10, i32 9)
%3 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 9, i32 %2)
%4 = call i32 @sum(i32 10, i32 -3)
%5 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 -3, i32 %4)
%6 = call i32 @sub(i32 -10, i32 9)
%7 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 -10, i32 9, i32 %6)
%8 = call i32 @sub(i32 5, i32 -6)
%9 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 -6, i32 %8)
%10 = call i32 @mul(i32 10, i32 5)
%11 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 5, i32 %10)
%12 = call i32 @mul(i32 2, i32 -3)
%13 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 -3, i32 %12)
%14 = call i32 @div(i32 20, i32 3)
%15 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 20, i32 3, i32 %14)
%16 = call i32 @sigma(i32 -7)
%17 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 -7, i32 %16)
%18 = call i32 @prod(i32 5)
%19 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 5, i32 %18)
%20 = call i32 @prod(i32 -5)
%21 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 -5, i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [14 x i8] c"%d - %d = %d\0A\00"
@.str.2 = [14 x i8] c"%d * %d = %d\0A\00"
@.str.3 = [14 x i8] c"%d / %d = %d\0A\00"
@.str.4 = [16 x i8] c"Sigma(%d) = %d\0A\00"
@.str.5 = [15 x i8] c"Prod(%d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @sum(i32 10, i32 9)
%2 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 9, i32 %1)
%3 = tail call i32 @sum(i32 10, i32 -3)
%4 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 -3, i32 %3)
%5 = tail call i32 @sub(i32 -10, i32 9)
%6 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 -10, i32 9, i32 %5)
%7 = tail call i32 @sub(i32 5, i32 -6)
%8 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 -6, i32 %7)
%9 = tail call i32 @mul(i32 10, i32 5)
%10 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 5, i32 %9)
%11 = tail call i32 @mul(i32 2, i32 -3)
%12 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 2, i32 -3, i32 %11)
%13 = tail call i32 @div(i32 20, i32 3)
%14 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 20, i32 3, i32 %13)
%15 = tail call i32 @sigma(i32 -7)
%16 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 -7, i32 %15)
%17 = tail call i32 @prod(i32 5)
%18 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 5, i32 %17)
%19 = tail call i32 @prod(i32 -5)
%20 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 -5, i32 %19)
ret i32 0
}