#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 */
long atol(char *);
int /*<<< orphan*/ func_ref(long);
int /*<<< orphan*/ func_test(long);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  long from, i, j = 18L;
  if (argc > 1)
    from = atol(argv[1]);
  else
    from = 18L;
  printf("%ld\n", func_ref(18L));
  printf("%ld\n", func_test(from));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x12,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    117e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %rax,-0x18(%rbp)
jmp    1186 <main+0x46>
movq   $0x12,-0x18(%rbp)
mov    $0x12,%edi
call   1030 <func_ref@plt>
mov    %eax,%esi
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <func_test@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x12,%ebx
cmp    $0x2,%edi
jl     115a <main+0x1a>
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
mov    %rax,%rbx
mov    $0x12,%edi
call   1030 <func_ref@plt>
lea    0xe95(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <func_test@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\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 i64 @atol(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i64 [ %7, %4 ], [ 18, %2 ]
%10 = tail call i32 @func_ref(i64 18)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = tail call i32 @func_test(i64 %9)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}