#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 /*<<< orphan*/ test_ref(int *, int *);
int /*<<< orphan*/ test_val(int, int);
int main() {
  int a = 213;
  int b = 513;
  printf("Main: int a = %d, int b = %d\n\n", a, b);
  printf("Calling test_val(a, b)...\n");
  test_val(a, b);
  printf(
      "Main: after test_val, a = %d, b = %d ... Did test_val do anything?\n\n",
      a, b);
  printf("Calling test_ref(&a, &b)...\n");
  test_ref(&a, &b);
  printf("Main: after test_ref, a = %d, b = %d ... Did test_ref do anything?\n",
         a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd5,-0x8(%rbp)
movl   $0x201,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <test_val@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <test_ref@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xd5,0x4(%rsp)
movl   $0x201,(%rsp)
lea    0xea9(%rip),%rdi
mov    $0xd5,%esi
mov    $0x201,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf39(%rip),%rdi
call   1030 <puts@plt>
mov    $0xd5,%edi
mov    $0x201,%esi
call   1060 <test_val@plt>
lea    0xe95(%rip),%rdi
mov    $0xd5,%esi
mov    $0x201,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <test_ref@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Main: int a = %d, int b = %d\0A\0A\00"
@.str.1 = [27 x i8] c"Calling test_val(a, b)...\0A\00"
@.str.2 = [69 x i8] c"Main: after test_val, a = %d, b = %d ... Did test_val do anything?\0A\0A\00"
@.str.3 = [29 x i8] c"Calling test_ref(&a, &b)...\0A\00"
@.str.4 = [68 x i8] c"Main: after test_ref, a = %d, b = %d ... Did test_ref do anything?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 213, i32* %2
store i32 513, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @test_val(i32 %8, i32 %9)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @test_ref(i32* %2, i32* %3)
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"Main: int a = %d, int b = %d\0A\0A\00"
@.str.2 = [69 x i8] c"Main: after test_val, a = %d, b = %d ... Did test_val do anything?\0A\0A\00"
@.str.4 = [68 x i8] c"Main: after test_ref, a = %d, b = %d ... Did test_ref do anything?\0A\00"
@str = [26 x i8] c"Calling test_val(a, b)...\00"
@str.5 = [28 x i8] c"Calling test_ref(&a, &b)...\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 213, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 513, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 213, i32 513)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @test_val(i32 213, i32 513)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i32 213, i32 513)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 @test_ref(i32* %1, i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %12)
ret i32 0
}