#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*/ printf(char *, unsigned long long, unsigned long long,
                          unsigned long long);
unsigned long long llfgh(unsigned long long a, unsigned long long b,
                         unsigned long long recurrenceCounter) {
  printf("Status : %llu, %llu, %llu\n", a, b, recurrenceCounter);
  if (b == 0 && recurrenceCounter == 0) {
    return a + 1;
  } else if (recurrenceCounter == 0) {
    return llfgh(a, b - 1, a);
  } else {
    return llfgh(llfgh(a, b, recurrenceCounter - 1), b, 0);
  }
}


x86 assembly (clang, -O0):
<llfgh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
jne    1173 <llfgh+0x53>
cmpq   $0x0,-0x20(%rbp)
jne    1173 <llfgh+0x53>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11c5 <llfgh+0xa5>
cmpq   $0x0,-0x20(%rbp)
jne    119c <llfgh+0x7c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x10(%rbp),%rdx
call   1030 <llfgh@plt>
mov    %rax,-0x8(%rbp)
jmp    11c5 <llfgh+0xa5>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <llfgh@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <llfgh@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llfgh>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xec8(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1040 <printf@plt>
mov    %r12,%rax
or     %rbx,%rax
je     11b7 <llfgh+0x97>
lea    0xeab(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
test   %r12,%r12
jne    1187 <llfgh+0x67>
add    $0xffffffffffffffff,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <printf@plt>
mov    %r14,%rax
or     %rbx,%rax
mov    %r14,%r12
jne    1160 <llfgh+0x40>
jmp    11b7 <llfgh+0x97>
add    $0xffffffffffffffff,%r12
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <llfgh@plt>
mov    %rax,%r14
mov    %r15,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1040 <printf@plt>
mov    $0x0,%r12d
test   %rbx,%rbx
jne    1160 <llfgh+0x40>
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Status : %llu, %llu, %llu\0A\00"
define i64 @llfgh(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = load i64, i64* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %9, i64 %10)
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load i64, i64* %7
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %4
br label %37
20: ; preds = %14, %3
%21 = load i64, i64* %7
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i64, i64* %5
%25 = load i64, i64* %6
%26 = sub i64 %25, 1
%27 = load i64, i64* %5
%28 = call i64 @llfgh(i64 %24, i64 %26, i64 %27)
store i64 %28, i64* %4
br label %37
29: ; preds = %20
%30 = load i64, i64* %5
%31 = load i64, i64* %6
%32 = load i64, i64* %7
%33 = sub i64 %32, 1
%34 = call i64 @llfgh(i64 %30, i64 %31, i64 %33)
%35 = load i64, i64* %6
%36 = call i64 @llfgh(i64 %34, i64 %35, i64 0)
store i64 %36, i64* %4
br label %37
37: ; preds = %29, %23, %17
%38 = load i64, i64* %4
ret i64 %38
}

LLVM IR (-O2):
@.str = [27 x i8] c"Status : %llu, %llu, %llu\0A\00"
define i64 @llfgh(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1, i64 %2)
%5 = or i64 %2, %1
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %3, %23
%8 = phi i64 [ 0, %23 ], [ %2, %3 ]
%9 = phi i64 [ %16, %23 ], [ %1, %3 ]
%10 = phi i64 [ %25, %23 ], [ %0, %3 ]
br label %14
11: ; preds = %23, %18, %3
%12 = phi i64 [ %0, %3 ], [ %10, %18 ], [ %25, %23 ]
%13 = add i64 %12, 1
ret i64 %13
14: ; preds = %7, %18
%15 = phi i64 [ %8, %7 ], [ %10, %18 ]
%16 = phi i64 [ %9, %7 ], [ %19, %18 ]
%17 = icmp eq i64 %15, 0
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = add i64 %16, -1
%20 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %19, i64 %10)
%21 = or i64 %10, %19
%22 = icmp eq i64 %21, 0
br i1 %22, label %11, label %14
23: ; preds = %14
%24 = add i64 %15, -1
%25 = tail call i64 @llfgh(i64 %10, i64 %16, i64 %24)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 %25, i64 %16, i64 0)
%27 = icmp eq i64 %16, 0
br i1 %27, label %11, label %7
}