#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 moves(int n, char a, char c, char b) {
  if (n == 1) {
    printf("Disk %d from %c to %c \n", n, a, c);
    return;
  }
  if (n == 0) {
    return;
  }
  moves(n - 1, a, b, c);
  printf("Disk %d from %c to %c \n", n, a, c);
  moves(n - 1, b, c, a);
}


x86 assembly (clang, -O0):
<moves>:
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)
jne    1163 <moves+0x43>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xeae(%rip),%rdi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <printf@plt>
jmp    11c1 <moves+0xa1>
cmpl   $0x0,-0x4(%rbp)
jne    1172 <moves+0x52>
jmp    11c1 <moves+0xa1>
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   1040 <moves@plt>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xe66(%rip),%rdi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x7(%rbp),%cl
mov    -0x6(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x5(%rbp),%ecx
call   1040 <moves@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moves>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r12d
mov    %edi,%ebx
movsbl %dl,%r15d
test   %ebx,%ebx
je     1181 <moves+0x61>
nopl   0x0(%rax,%rax,1)
mov    %esi,%r14d
movsbl %sil,%ebp
cmp    $0x1,%ebx
je     1190 <moves+0x70>
lea    -0x1(%rbx),%r13d
movsbl %r12b,%edx
mov    %r13d,%edi
mov    %ebp,%esi
mov    %r15d,%ecx
call   1040 <moves@plt>
lea    0xe98(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1030 <printf@plt>
mov    %r13d,%ebx
mov    %r12d,%esi
mov    %r14d,%r12d
test   %ebx,%ebx
jne    1140 <moves+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe69(%rip),%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Disk %d from %c to %c \0A\00"
define void @moves(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 eq 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* %7
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %12, i8 signext %13, i8 signext %14)
br label %35
16: ; preds = %4
%17 = load i32, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
br label %35
20: ; preds = %16
%21 = load i32, i32* %5
%22 = sub nsw i32 %21, 1
%23 = load i8, i8* %6
%24 = load i8, i8* %8
%25 = load i8, i8* %7
%26 = load i32, i32* %5
%27 = load i8, i8* %6
%28 = load i8, i8* %7
%29 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %26, i8 signext %27, i8 signext %28)
%30 = load i32, i32* %5
%31 = sub nsw i32 %30, 1
%32 = load i8, i8* %8
%33 = load i8, i8* %7
%34 = load i8, i8* %6
br label %35
35: ; preds = %20, %19, %11
ret void
}

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