#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 atoi(char const *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ solution(int, char, char, char);
int main(int argc, const char *argv[]) {
  int n;
  printf("Tower of honai problem.\n");
  printf("Enter the no. disks:");
  if (argc == 1)
    scanf("%d", &n);
  else
    n = atoi(argv[1]);
  printf("The solution.\n");
  solution(n, 'L', 'R', 'C');
  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)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x8(%rbp)
jne    118d <main+0x4d>
lea    0xeaf(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
jmp    119d <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x4c,%esi
mov    $0x52,%edx
mov    $0x43,%ecx
call   1030 <solution@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
cmp    $0x1,%ebp
jne    1188 <main+0x38>
lea    0xe99(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
jmp    1195 <main+0x45>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,0x4(%rsp)
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%edi
mov    $0x4c,%esi
mov    $0x52,%edx
mov    $0x43,%ecx
call   1030 <solution@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Tower of honai problem.\0A\00"
@.str.1 = [21 x i8] c"Enter the no. disks:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [15 x i8] c"The solution.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
br label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %6
br label %18
18: ; preds = %13, %11
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %6
%21 = call i32 @solution(i32 %20, i8 signext 76, i8 signext 82, i8 signext 67)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"Enter the no. disks:\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [24 x i8] c"Tower of honai problem.\00"
@str.4 = [14 x i8] c"The solution.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
br label %14
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %10, %8
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
%16 = load i32, i32* %3
%17 = call i32 @solution(i32 %16, i8 signext 76, i8 signext 82, i8 signext 67)
ret i32 0
}