int main(void) {
  int theVar = 12;
  int result = addOne(theVar);
  printf(" theVar = %d, result = %d \n", theVar, result);
  int theVar2 = 7;
  printf("theVar2 before = %d, address = 0x%x\n", theVar2, &theVar2);
  addOneP(&theVar2);
  printf("theVar2 after = %d\n", theVar2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1050 <addOne@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x7,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <addOneP@plt>
mov    -0x10(%rbp),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    $0xc,%edi
xor    %eax,%eax
call   1050 <addOne@plt>
lea    0xeb8(%rip),%rdi
mov    $0xc,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x7,0xc(%rsp)
lea    0xeb7(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    $0x7,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <addOneP@plt>
mov    0xc(%rsp),%esi
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c" theVar = %d, result = %d \0A\00"
@.str.1 = [37 x i8] c"theVar2 before = %d, address = 0x%x\0A\00"
@.str.2 = [20 x i8] c"theVar2 after = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i32, ...) bitcast (i32 (...)* @addOne to i32 (i32, ...)*)(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
store i32 7, i32* %4
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32* %4)
%12 = call i32 (i32*, ...) bitcast (i32 (...)* @addOneP to i32 (i32*, ...)*)(i32* %4)
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c" theVar = %d, result = %d \0A\00"
@.str.1 = [37 x i8] c"theVar2 before = %d, address = 0x%x\0A\00"
@.str.2 = [20 x i8] c"theVar2 after = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @addOne to i32 (i32, ...)*)(i32 12)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 12, i32 %2)
%4 = bitcast i32* %1 to i8*
store i32 7, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 7, i32* %1)
%6 = call i32 (i32*, ...) bitcast (i32 (...)* @addOneP to i32 (i32*, ...)*)(i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}