#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);
int test_1(int);
int test_2(int);
int main() {
  int x = 37;
  printf("x = %d (0x%x)\n", x, x);
  int r1 = test_1(x);
  printf("test_1(x) = %d (0x%x)\n", r1, r1);
  int r2 = test_2(x);
  printf("test_2(x) = %d (0x%x)\n", r2, r2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x25,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <test_1@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1050 <test_2@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x25,%esi
mov    $0x25,%edx
call   1040 <printf@plt>
mov    $0x25,%edi
call   1030 <test_1@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    $0x25,%edi
call   1050 <test_2@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"x = %d (0x%x)\0A\00"
@.str.1 = [23 x i8] c"test_1(x) = %d (0x%x)\0A\00"
@.str.2 = [23 x i8] c"test_2(x) = %d (0x%x)\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 37, i32 37)
%2 = tail call i32 @test_1(i32 37)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %2)
%4 = tail call i32 @test_2(i32 37)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %4)
ret i32 0
}