#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 atol(char *);
void *init();
int num1(void *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ release(void *);
int /*<<< orphan*/ setNum1(void *, int);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  void *ptr;
  int i;
  i = 0;
  if (argc > 1)
    i = atol(argv[1]);
  ptr = init();
  setNum1(ptr, 5);
  printf("number: %i\n", num1(ptr));
  sleep(i);
  release(ptr);
  ptr = NULL;
  sleep(i);
  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   $0x0,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11a7 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atol@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x5,%esi
call   1040 <setNum1@plt>
mov    -0x18(%rbp),%rdi
call   1060 <num1@plt>
mov    %eax,%esi
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1090 <sleep@plt>
mov    -0x18(%rbp),%rdi
call   1080 <release@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x1c(%rbp),%edi
call   1090 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cmp    $0x2,%edi
jl     1185 <main+0x15>
mov    0x8(%rsi),%rdi
call   1070 <atol@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <init@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x5,%esi
call   1040 <setNum1@plt>
mov    %rbx,%rdi
call   1060 <num1@plt>
lea    0xe55(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebp,%edi
call   1090 <sleep@plt>
mov    %rbx,%rdi
call   1080 <release@plt>
mov    %ebp,%edi
call   1090 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"number: %i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @atol(i8* %13)
store i32 %14, i32* %7
br label %15
15: ; preds = %10, %2
%16 = call i8* (...) @init()
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 @setNum1(i8* %17, i32 5)
%19 = load i8*, i8** %6
%20 = call i32 @num1(i8* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %7
%23 = call i32 @sleep(i32 %22)
%24 = load i8*, i8** %6
%25 = call i32 @release(i8* %24)
store i8* null, i8** %6
%26 = load i32, i32* %7
%27 = call i32 @sleep(i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"number: %i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atol(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
%10 = tail call i8* (...) @init()
%11 = tail call i32 @setNum1(i8* %10, i32 5)
%12 = tail call i32 @num1(i8* %10)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = tail call i32 @sleep(i32 %9)
%15 = tail call i32 @release(i8* %10)
%16 = tail call i32 @sleep(i32 %9)
ret i32 0
}