#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 adders(int, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main() {
  int inA, inB, inC;
  int sum;
  int refOut[5] = {60, 90, 120, 150, 180};
  int pass;
  int i;
  inA = 10;
  inB = 20;
  inC = 30;
  for (i = 0; i < 5; i++) {
    sum = adders(inA, inB, inC);
    fprintf(stdout, "  %d+%d+%d=%d \n", inA, inB, inC, sum);
    if (sum == refOut[i])
      pass = 1;
    else
      pass = 0;
    inA = inA + 10;
    inB = inB + 10;
    inC = inC + 10;
  }
  if (pass) {
    fprintf(stdout, "----------Pass!------------\n");
    return 0;
  } else {
    fprintf(stderr, "----------Fail!------------\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0x1e,-0x10(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x5,-0x38(%rbp)
jge    11f7 <main+0xd7>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <adders@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jne    11c7 <main+0xa7>
movl   $0x1,-0x34(%rbp)
jmp    11ce <main+0xae>
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    116a <main+0x4a>
cmpl   $0x0,-0x34(%rbp)
je     1224 <main+0x104>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
lea    0xe13(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1242 <main+0x122>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xa,%edi
mov    $0x14,%esi
mov    $0x1e,%edx
call   1030 <adders@plt>
mov    0x2e99(%rip),%r14
mov    (%r14),%edi
lea    0xeb7(%rip),%rbx
mov    %rbx,%rsi
mov    $0xa,%edx
mov    $0x14,%ecx
mov    $0x1e,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x14,%edi
mov    $0x1e,%esi
mov    $0x28,%edx
call   1030 <adders@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x14,%edx
mov    $0x1e,%ecx
mov    $0x28,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1e,%edi
mov    $0x28,%esi
mov    $0x32,%edx
call   1030 <adders@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x1e,%edx
mov    $0x28,%ecx
mov    $0x32,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x28,%edi
mov    $0x32,%esi
mov    $0x3c,%edx
call   1030 <adders@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x28,%edx
mov    $0x32,%ecx
mov    $0x3c,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x32,%edi
mov    $0x3c,%esi
mov    $0x46,%edx
call   1030 <adders@plt>
mov    %eax,%ebp
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x32,%edx
mov    $0x3c,%ecx
mov    $0x46,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %ebx,%ebx
cmp    $0xb4,%ebp
setne  %bl
lea    0xdc6(%rip),%rax
lea    0xddc(%rip),%rsi
cmove  %rax,%rsi
cmovne 0x2d83(%rip),%r14
mov    (%r14),%edi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.refOut = [5 x i32] [i32 60, i32 90, i32 120, i32 150, i32 180]
@stdout = global i32 0
@.str = [16 x i8] c" %d+%d+%d=%d \0A\00"
@.str.1 = [29 x i8] c"----------Pass!------------\0A\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"----------Fail!------------\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [5 x i32]* %6 to i8*
store i32 10, i32* %2
store i32 20, i32* %3
store i32 30, i32* %4
store i32 0, i32* %8
br label %10
10: ; preds = %39, %0
%11 = load i32, i32* %8
%12 = icmp slt i32 %11, 5
br i1 %12, label %13, label %42
13: ; preds = %10
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @adders(i32 %14, i32 %15, i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* @stdout
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i32 %22)
%24 = load i32, i32* %5
%25 = load i32, i32* %8
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = icmp eq i32 %24, %28
br i1 %29, label %30, label %31
30: ; preds = %13
store i32 1, i32* %7
br label %32
31: ; preds = %13
store i32 0, i32* %7
br label %32
32: ; preds = %31, %30
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 10
store i32 %34, i32* %2
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 10
store i32 %36, i32* %3
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 10
store i32 %38, i32* %4
br label %39
39: ; preds = %32
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %10
42: ; preds = %10
%43 = load i32, i32* %7
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %42
%46 = load i32, i32* @stdout
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %51
48: ; preds = %42
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %51
51: ; preds = %48, %45
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [16 x i8] c" %d+%d+%d=%d \0A\00"
@.str.1 = [29 x i8] c"----------Pass!------------\0A\00"
@stderr = global i32 0
@.str.2 = [29 x i8] c"----------Fail!------------\0A\00"
define i32 @main() {
%1 = tail call i32 @adders(i32 10, i32 20, i32 30)
%2 = load i32, i32* @stdout
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 30, i32 %1)
%4 = tail call i32 @adders(i32 20, i32 30, i32 40)
%5 = load i32, i32* @stdout
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 20, i32 30, i32 40, i32 %4)
%7 = tail call i32 @adders(i32 30, i32 40, i32 50)
%8 = load i32, i32* @stdout
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 30, i32 40, i32 50, i32 %7)
%10 = tail call i32 @adders(i32 40, i32 50, i32 60)
%11 = load i32, i32* @stdout
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 40, i32 50, i32 60, i32 %10)
%13 = tail call i32 @adders(i32 50, i32 60, i32 70)
%14 = load i32, i32* @stdout
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 50, i32 60, i32 70, i32 %13)
%16 = icmp eq i32 %13, 180
%17 = select i1 %16, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0)
%18 = xor i1 %16, true
%19 = zext i1 %18 to i32
%20 = load i32, i32* @stdout
%21 = load i32, i32* @stderr
%22 = select i1 %16, i32 %20, i32 %21
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* %17)
ret i32 %19
}