#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 *, int, int);
void Hanoi(int StartCol, int EndCol, int nDisks) {
  if (nDisks) {
    Hanoi(StartCol, 6 - (StartCol + EndCol), nDisks - 1);
    printf("Move disk from column %d to column %d\n", StartCol, EndCol);
    Hanoi(6 - (StartCol + EndCol), EndCol, nDisks - 1);
  }
}


x86 assembly (clang, -O0):
<Hanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1183 <Hanoi+0x63>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x6,%esi
sub    %eax,%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <Hanoi@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe9d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    $0x6,%edi
sub    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <Hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
je     116d <Hanoi+0x4d>
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%r15d
add    $0xffffffff,%ebx
lea    0xec2(%rip),%r12
xchg   %ax,%ax
mov    $0x6,%ebp
sub    %r15d,%ebp
sub    %r14d,%ebp
mov    %r15d,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <Hanoi@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <printf@plt>
mov    %ebp,%r15d
add    $0xffffffff,%ebx
jb     1140 <Hanoi+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Move disk from column %d to column %d\0A\00"
define void @Hanoi(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %3
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = sub nsw i32 6, %13
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = sub nsw i32 6, %22
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = sub nsw i32 %25, 1
br label %27
27: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"Move disk from column %d to column %d\0A\00"
define void @Hanoi(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ %2, %3 ]
%7 = phi i32 [ %9, %5 ], [ %0, %3 ]
%8 = add i32 %7, %1
%9 = sub i32 6, %8
%10 = add nsw i32 %6, -1
tail call void @Hanoi(i32 %7, i32 %9, i32 %10)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %1)
%12 = icmp eq i32 %10, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %3
ret void
}