#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 add(int, int);
int double_plus_one(int);
int first_nonzero(int, int);
int /*<<< orphan*/ printf(char *, int);
int subtract(int, int);
int main(int argc, char *argv[]) {
  printf("2:%d\n", add(1, 1));
  printf("7:%d\n", add(3, 4));
  printf("-1:%d\n", subtract(3, 4));
  printf("1:%d\n", subtract(2, 1));
  printf("3:%d\n", first_nonzero(0, 3));
  printf("0:%d\n", first_nonzero(0, 0));
  printf("1:%d\n", first_nonzero(1, 0));
  printf("15:%d\n", double_plus_one(7));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <add@plt>
mov    %eax,%esi
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1070 <subtract@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1070 <subtract@plt>
mov    %eax,%esi
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1060 <first_nonzero@plt>
mov    %eax,%esi
lea    0xe27(%rip),%rdi
call   1040 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1060 <first_nonzero@plt>
mov    %eax,%esi
lea    0xe16(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <first_nonzero@plt>
mov    %eax,%esi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x7,%edi
call   1050 <double_plus_one@plt>
mov    %eax,%esi
lea    0xdea(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <add@plt>
lea    0xe99(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <add@plt>
lea    0xe82(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0x4,%esi
call   1070 <subtract@plt>
lea    0xe6b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1070 <subtract@plt>
lea    0xe4f(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1060 <first_nonzero@plt>
lea    0xe38(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1060 <first_nonzero@plt>
lea    0xe27(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1060 <first_nonzero@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x7,%edi
call   1050 <double_plus_one@plt>
lea    0xdff(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"2:%d\0A\00"
@.str.1 = [6 x i8] c"7:%d\0A\00"
@.str.2 = [7 x i8] c"-1:%d\0A\00"
@.str.3 = [6 x i8] c"1:%d\0A\00"
@.str.4 = [6 x i8] c"3:%d\0A\00"
@.str.5 = [6 x i8] c"0:%d\0A\00"
@.str.6 = [7 x i8] c"15:%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @add(i32 1, i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @add(i32 3, i32 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = tail call i32 @subtract(i32 3, i32 4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @subtract(i32 2, i32 1)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @first_nonzero(i32 0, i32 3)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = tail call i32 @first_nonzero(i32 0, i32 0)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%15 = tail call i32 @first_nonzero(i32 1, i32 0)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = tail call i32 @double_plus_one(i32 7)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %17)
ret i32 0
}