#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, char, char);
void tower_of_hanoi(int disk, char from, char aux, char to) {
  if (disk <= 1) {
    printf("Move disk %d from pole %c to %c\n", disk, from, to);
    return;
  }
  tower_of_hanoi(disk - 1, from, to, aux);
  printf("Move disk %d from pole %c to %c\n", disk, from, to);
  tower_of_hanoi(disk - 1, aux, from, to);
}


x86 assembly (clang, -O0):
<tower_of_hanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     1163 <tower_of_hanoi+0x43>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xeae(%rip),%rdi
movsbl %al,%edx
movsbl -0x7(%rbp),%ecx
call   1040 <printf@plt>
jmp    11b2 <tower_of_hanoi+0x92>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x5(%rbp),%cl
mov    -0x7(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <tower_of_hanoi@plt>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xe75(%rip),%rdi
movsbl %al,%edx
movsbl -0x7(%rbp),%ecx
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x6(%rbp),%cl
mov    -0x5(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x7(%rbp),%ecx
call   1030 <tower_of_hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tower_of_hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %edi,%ebx
cmp    $0x2,%edi
jl     1184 <tower_of_hanoi+0x64>
mov    %ecx,0x4(%rsp)
movsbl %cl,%r15d
nopl   (%rax)
mov    %r13d,%r12d
mov    %edx,%r13d
lea    -0x1(%rbx),%ebp
movsbl %r12b,%r14d
movsbl %dl,%ecx
mov    %ebp,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   1030 <tower_of_hanoi@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
call   1040 <printf@plt>
mov    %r12d,%edx
cmp    $0x3,%ebx
mov    %ebp,%ebx
jae    1140 <tower_of_hanoi+0x20>
mov    $0x1,%ebx
mov    0x4(%rsp),%ecx
movsbl %r13b,%edx
movsbl %cl,%ecx
lea    0xe6e(%rip),%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

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

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