#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int, int, ...);
int sumByReference(int *, int *);
int sumByValue(int, int);
int main(int argc, char **argv) {
  int a = 10;
  int b = 37;
  printf("a:%d, b%d\n", a, b);
  printf("a:%d, b%d => sumByValue() = %d\n", a, b, sumByValue(a, b));
  printf("a:%d, b%d => sumByReference() = %d\n", a, b, sumByReference(&a, &b));
  printf("a:%d, b%d\n", a, b);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
movl   $0x25,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <sumByValue@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    %eax,%ecx
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <sumByReference@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0xc(%rsp)
movl   $0x25,0x8(%rsp)
lea    0xeb4(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x25,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0x25,%esi
call   1040 <sumByValue@plt>
lea    0xe95(%rip),%rdi
mov    $0xa,%esi
mov    $0x25,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1050 <sumByReference@plt>
lea    0xe8c(%rip),%rdi
mov    $0xa,%esi
mov    $0x25,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"a:%d, b%d\0A\00"
@.str.1 = [32 x i8] c"a:%d, b%d => sumByValue() = %d\0A\00"
@.str.2 = [36 x i8] c"a:%d, b%d => sumByReference() = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %6
store i32 37, i32* %7
%8 = load i32, i32* %6
%9 = load i32, i32* %7
%10 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = call i32 @sumByValue(i32 %13, i32 %14)
%16 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12, i32 %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 @sumByReference(i32* %6, i32* %7)
%20 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [11 x i8] c"a:%d, b%d\0A\00"
@.str.1 = [32 x i8] c"a:%d, b%d => sumByValue() = %d\0A\00"
@.str.2 = [36 x i8] c"a:%d, b%d => sumByReference() = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 10, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 37, i32* %4
%7 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 10, i32 37)
%8 = tail call i32 @sumByValue(i32 10, i32 37)
%9 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 37, i32 %8)
%10 = call i32 @sumByReference(i32* %3, i32* %4)
%11 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 37, i32 %10)
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}