#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*/ hanoi_non_recursive(int, char, char, char);
int /*<<< orphan*/ hanoi_recursive(int, char, char, char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int count;
  printf("heap count : ");
  scanf("%d", &count);
  printf("recursive solution :\n");
  hanoi_recursive(count, 'X', 'Y', 'Z');
  printf("non-recursive solution :\n");
  hanoi_non_recursive(count, 'X', 'Y', 'Z');
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x58,%esi
mov    $0x59,%edx
mov    $0x5a,%ecx
call   1030 <hanoi_recursive@plt>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x58,%esi
mov    $0x59,%edx
mov    $0x5a,%ecx
call   1050 <hanoi_non_recursive@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1050 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edi
mov    $0x58,%esi
mov    $0x59,%edx
mov    $0x5a,%ecx
call   1030 <hanoi_recursive@plt>
lea    0xe78(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edi
mov    $0x58,%esi
mov    $0x59,%edx
mov    $0x5a,%ecx
call   1060 <hanoi_non_recursive@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"heap count : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"recursive solution :\0A\00"
@.str.3 = [26 x i8] c"non-recursive solution :\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* %1
%6 = call i32 @hanoi_recursive(i32 %5, i8 signext 88, i8 signext 89, i8 signext 90)
%7 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = call i32 @hanoi_non_recursive(i32 %8, i8 signext 88, i8 signext 89, i8 signext 90)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"heap count : \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [21 x i8] c"recursive solution :\00"
@str.4 = [25 x i8] c"non-recursive solution :\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = call i32 @hanoi_recursive(i32 %6, i8 signext 88, i8 signext 89, i8 signext 90)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.4, i64 0, i64 0))
%9 = load i32, i32* %1
%10 = call i32 @hanoi_non_recursive(i32 %9, i8 signext 88, i8 signext 89, i8 signext 90)
ret void
}