#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*/ by_ref(int *, int *, int *);
int /*<<< orphan*/ by_value(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  int x = 2, y = 4, z = 6;
  printf("\nBefore calling by_value(), x = %d, y = %d, z = %d.", x, y, z);
  by_value(x, y, z);
  printf("\nAfter calling by_value(), x = %d, y = %d, z = %d.", x, y, z);
  by_ref(&x, &y, &z);
  printf("\nAfter calling by_ref(), x = %d, y = %d, z = %d.\n", x, y, z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
movl   $0x6,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1050 <by_value@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x14(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1040 <by_ref@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x2,0x14(%rsp)
movl   $0x4,0x10(%rsp)
movl   $0x6,0xc(%rsp)
lea    0xead(%rip),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x6,%ecx
call   1030 <printf@plt>
mov    $0x2,%edi
mov    $0x4,%esi
mov    $0x6,%edx
call   1050 <by_value@plt>
lea    0xeb2(%rip),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
mov    $0x6,%ecx
call   1030 <printf@plt>
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1040 <by_ref@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0ABefore calling by_value(), x = %d, y = %d, z = %d.\00"
@.str.1 = [51 x i8] c"\0AAfter calling by_value(), x = %d, y = %d, z = %d.\00"
@.str.2 = [50 x i8] c"\0AAfter calling by_ref(), x = %d, y = %d, z = %d.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2, i32* %6
store i32 4, i32* %7
store i32 6, i32* %8
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 @by_value(i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i32, i32* %8
%20 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
%21 = call i32 @by_ref(i32* %6, i32* %7, i32* %8)
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = load i32, i32* %8
%25 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [52 x i8] c"\0ABefore calling by_value(), x = %d, y = %d, z = %d.\00"
@.str.1 = [51 x i8] c"\0AAfter calling by_value(), x = %d, y = %d, z = %d.\00"
@.str.2 = [50 x i8] c"\0AAfter calling by_ref(), x = %d, y = %d, z = %d.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
store i32 2, i32* %3
%7 = bitcast i32* %4 to i8*
store i32 4, i32* %4
%8 = bitcast i32* %5 to i8*
store i32 6, i32* %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 2, i32 4, i32 6)
%10 = tail call i32 @by_value(i32 2, i32 4, i32 6)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 4, i32 6)
%12 = call i32 @by_ref(i32* %3, i32* %4, i32* %5)
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
ret i32 0
}