#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 foo(int *, int *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int x, y, z;
  x = 7;
  y = 8;
  z = 9;
  printf("The origianl values are: x = %d, y = %d, z = %d\n", x, y, z);
  int ret = foo(&x, &y, z);
  printf("The value returned by foo function is %d\n", ret);
  printf("After using foo function, the values are: 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)
movl   $0x7,-0x8(%rbp)
movl   $0x8,-0xc(%rbp)
movl   $0x9,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%edx
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <foo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x7,0x4(%rsp)
movl   $0x8,(%rsp)
lea    0xec9(%rip),%rdi
mov    $0x7,%esi
mov    $0x8,%edx
mov    $0x9,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x9,%edx
call   1040 <foo@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xede(%rip),%rdi
mov    $0x9,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"The origianl values are: x = %d, y = %d, z = %d\0A\00"
@.str.1 = [42 x i8] c"The value returned by foo function is %d\0A\00"
@.str.2 = [66 x i8] c"After using foo function, the values are: x = %d, y = %d, z = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 7, i32* %2
store i32 8, i32* %3
store i32 9, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8)
%10 = load i32, i32* %4
%11 = call i32 @foo(i32* %2, i32* %3, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15, i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"The origianl values are: x = %d, y = %d, z = %d\0A\00"
@.str.1 = [42 x i8] c"The value returned by foo function is %d\0A\00"
@.str.2 = [66 x i8] c"After using foo function, the values are: x = %d, y = %d, z = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store i32 7, i32* %1
store i32 8, i32* %2
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 7, i32 8, i32 9)
%6 = call i32 @foo(i32* %1, i32* %2, i32 9)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9, i32 9)
ret i32 0
}