#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 /*<<< orphan*/ printf(char *, int);
int sum3(int, int, int);
int sum3_v2(int, int, int);
int sum4(int, int, int, int);
int sum4_v2(int, int, int, int);
int main() {
  printf("sum3(1, 2, 3)       = %d\n", sum3(1, 2, 3));
  printf("sum3_v2(1, 2, 3)    = %d\n", sum3_v2(1, 2, 3));
  printf("sum4(1, 2, 3, 4)    = %d\n", sum4(1, 2, 3, 4));
  printf("sum4_v2(1, 2, 3, 4) = %d\n", sum4_v2(1, 2, 3, 4));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <sum3@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <sum3_v2@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1070 <sum4@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1060 <sum4_v2@plt>
mov    %eax,%esi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1050 <sum3@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <sum3_v2@plt>
lea    0xe8c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1070 <sum4@plt>
lea    0xe7f(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
call   1060 <sum4_v2@plt>
lea    0xe72(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"sum3(1, 2, 3) = %d\0A\00"
@.str.1 = [26 x i8] c"sum3_v2(1, 2, 3) = %d\0A\00"
@.str.2 = [26 x i8] c"sum4(1, 2, 3, 4) = %d\0A\00"
@.str.3 = [26 x i8] c"sum4_v2(1, 2, 3, 4) = %d\0A\00"
define i32 @main() {
%1 = call i32 @sum3(i32 1, i32 2, i32 3)
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @sum3_v2(i32 1, i32 2, i32 3)
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 @sum4(i32 1, i32 2, i32 3, i32 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 @sum4_v2(i32 1, i32 2, i32 3, i32 4)
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"sum3(1, 2, 3) = %d\0A\00"
@.str.1 = [26 x i8] c"sum3_v2(1, 2, 3) = %d\0A\00"
@.str.2 = [26 x i8] c"sum4(1, 2, 3, 4) = %d\0A\00"
@.str.3 = [26 x i8] c"sum4_v2(1, 2, 3, 4) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @sum3(i32 1, i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @sum3_v2(i32 1, i32 2, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @sum4(i32 1, i32 2, i32 3, i32 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @sum4_v2(i32 1, i32 2, i32 3, i32 4)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %7)
ret i32 0
}