#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 leaf(int *);
int /*<<< orphan*/ printf(char *, ...);
int function(int some_arg) {
  int some_local_variable = some_arg + 92;
  int retval;
  printf("function: received %d\n", some_arg);
  if (some_arg != 47)
    printf("function: ERROR: expected %d\n", 47);
  printf("function: Calling leaf() with %d\n", some_local_variable);
  retval = leaf(&some_local_variable);
  printf("function: ERROR -- leaf returned!\n");
  return retval;
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x5c,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x2f,-0x4(%rbp)
je     1162 <function+0x42>
lea    0xec1(%rip),%rdi
mov    $0x2f,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <leaf@plt>
mov    %eax,-0xc(%rbp)
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x5c(%rbx),%ebp
mov    %ebp,0x4(%rsp)
lea    0xebd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2f,%ebx
je     1164 <function+0x34>
lea    0xebf(%rip),%rdi
mov    $0x2f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <leaf@plt>
mov    %eax,%ebx
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"function: received %d\0A\00"
@.str.1 = [30 x i8] c"function: ERROR: expected %d\0A\00"
@.str.2 = [34 x i8] c"function: Calling leaf() with %d\0A\00"
@.str.3 = [35 x i8] c"function: ERROR -- leaf returned!\0A\00"
define i32 @function(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 92
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 47
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 47)
br label %13
13: ; preds = %11, %1
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = call i32 @leaf(i32* %3)
store i32 %16, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
@.str = [23 x i8] c"function: received %d\0A\00"
@.str.1 = [30 x i8] c"function: ERROR: expected %d\0A\00"
@.str.2 = [34 x i8] c"function: Calling leaf() with %d\0A\00"
@str = [34 x i8] c"function: ERROR -- leaf returned!\00"
define i32 @function(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = add nsw i32 %0, 92
store i32 %4, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = icmp eq i32 %0, 47
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 47)
br label %9
9: ; preds = %7, %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%11 = call i32 @leaf(i32* %2)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 %11
}