#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*/ bar(int *);
int /*<<< orphan*/ different_line(int *);
int /*<<< orphan*/ foo(int *);
int /*<<< orphan*/ nested(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 4;
  printf("x = %d\n", x);
  foo(&x);
  printf("x = %d\n", x);
  bar(&x);
  printf("x = %d\n", x);
  nested(&x);
  printf("x = %d\n", x);
  different_line(&x);
  printf("x = %d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1060 <foo@plt>
mov    -0x8(%rbp),%esi
lea    0xe78(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1040 <bar@plt>
mov    -0x8(%rbp),%esi
lea    0xe60(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <nested@plt>
mov    -0x8(%rbp),%esi
lea    0xe48(%rip),%rdi
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1070 <different_line@plt>
mov    -0x8(%rbp),%esi
lea    0xe30(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x4,0x4(%rsp)
lea    0xe9d(%rip),%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1050 <printf@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <foo@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <bar@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <nested@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1070 <different_line@plt>
mov    0x4(%rsp),%esi
mov    %r14,%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"x = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 4, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = call i32 @foo(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @bar(i32* %1)
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @nested(i32* %1)
%11 = load i32, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @different_line(i32* %1)
%14 = load i32, i32* %1
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}