#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, ...);
int towerOfHanoi(int n, char barFrom, char barTo, char barAuxillary) {
  if (n == 1) {
    printf("\nMove disk 1 from %c to %c", barFrom, barTo);
    return 1;
  }
  towerOfHanoi(n - 1, barFrom, barAuxillary, barTo);
  printf("\nMove disk %d from %c to %c", n, barFrom, barTo);
  towerOfHanoi(n - 1, barAuxillary, barTo, barFrom);
}


x86 assembly (clang, -O0):
<towerOfHanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1167 <towerOfHanoi+0x47>
movsbl -0x9(%rbp),%esi
lea    0xeb0(%rip),%rdi
movsbl -0xa(%rbp),%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b8 <towerOfHanoi+0x98>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x9(%rbp),%cl
mov    -0xb(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0xa(%rbp),%ecx
call   1040 <towerOfHanoi@plt>
mov    -0x8(%rbp),%esi
mov    -0x9(%rbp),%al
movsbl -0xa(%rbp),%ecx
lea    0xe88(%rip),%rdi
movsbl %al,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xb(%rbp),%cl
mov    -0xa(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x9(%rbp),%ecx
call   1040 <towerOfHanoi@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<towerOfHanoi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
movsbl %dl,%r14d
cmp    $0x1,%edi
jne    113c <towerOfHanoi+0x1c>
mov    %r13d,%r15d
jmp    118b <towerOfHanoi+0x6b>
mov    %edi,%ebx
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r15d
lea    0x1(%rbx),%r12d
movsbl %r13b,%ebp
movsbl %cl,%edx
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%ecx
call   1040 <towerOfHanoi@plt>
lea    0xeaa(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13d,%ecx
mov    %r15d,%r13d
add    $0xffffffff,%ebx
jne    1150 <towerOfHanoi+0x30>
movsbl %r15b,%esi
lea    0xe6a(%rip),%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c"\0AMove disk 1 from %c to %c\00"
@.str.1 = [28 x i8] c"\0AMove disk %d from %c to %c\00"
define i32 @towerOfHanoi(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = icmp eq i32 %0, 1
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = sext i8 %2 to i32
br label %12
8: ; preds = %12, %4
%9 = phi i8 [ %1, %4 ], [ %13, %12 ]
%10 = sext i8 %9 to i32
%11 = tail call i32 (i8*, i32, i8, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10, i8 signext %2)
ret i32 1
12: ; preds = %6, %12
%13 = phi i8 [ %3, %6 ], [ %14, %12 ]
%14 = phi i8 [ %1, %6 ], [ %13, %12 ]
%15 = phi i32 [ %0, %6 ], [ %16, %12 ]
%16 = add nsw i32 %15, -1
%17 = tail call i32 @towerOfHanoi(i32 %16, i8 signext %14, i8 signext %13, i8 signext %2)
%18 = tail call i32 (i8*, i32, i8, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %15, i8 signext %14, i32 %7)
%19 = icmp eq i32 %16, 1
br i1 %19, label %8, label %12
}