#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*/ mov(char, char);
void hanoi_2(int n, char src, char dest, char spare) {
  if (n == 0) {
    return;
  } else {
    hanoi_2(n - 1, src, spare, dest);
    mov(src, dest);
    hanoi_2(n - 1, spare, dest, src);
  }
}


x86 assembly (clang, -O0):
<hanoi_2>:
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   $0x0,-0x4(%rbp)
jne    114a <hanoi_2+0x2a>
jmp    118f <hanoi_2+0x6f>
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 <hanoi_2@plt>
mov    -0x5(%rbp),%al
movsbl %al,%edi
movsbl -0x6(%rbp),%esi
call   1030 <mov@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 <hanoi_2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hanoi_2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edi,%edi
je     116b <hanoi_2+0x4b>
mov    %esi,%r15d
mov    %edi,%ebp
add    $0xffffffff,%ebp
movsbl %dl,%r14d
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r12d
movsbl %r15b,%ebx
movsbl %cl,%edx
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r14d,%ecx
call   1040 <hanoi_2@plt>
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <mov@plt>
mov    %r15d,%ecx
mov    %r12d,%r15d
add    $0xffffffff,%ebp
jb     1140 <hanoi_2+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @hanoi_2(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, 0
br i1 %10, label %11, label %12
11: ; preds = %4
br label %26
12: ; preds = %4
%13 = load i32, i32* %5
%14 = sub nsw i32 %13, 1
%15 = load i8, i8* %6
%16 = load i8, i8* %8
%17 = load i8, i8* %7
%18 = load i8, i8* %6
%19 = load i8, i8* %7
%20 = call i32 @mov(i8 signext %18, i8 signext %19)
%21 = load i32, i32* %5
%22 = sub nsw i32 %21, 1
%23 = load i8, i8* %8
%24 = load i8, i8* %7
%25 = load i8, i8* %6
br label %26
26: ; preds = %11, %12
ret void
}

LLVM IR (-O2):
define void @hanoi_2(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %13, label %6
6: ; preds = %4, %6
%7 = phi i8 [ %8, %6 ], [ %3, %4 ]
%8 = phi i8 [ %7, %6 ], [ %1, %4 ]
%9 = phi i32 [ %10, %6 ], [ %0, %4 ]
%10 = add nsw i32 %9, -1
tail call void @hanoi_2(i32 %10, i8 signext %8, i8 signext %7, i8 signext %2)
%11 = tail call i32 @mov(i8 signext %8, i8 signext %2)
%12 = icmp eq i32 %10, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %4
ret void
}