#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*/ move(int, char, char);
void hanoi(int n, char from, char denpend_on, char to) {
  if (n == 1)
    move(1, from, to);
  else {
    hanoi(n - 1, from, to, denpend_on);
    move(n, from, to);
    hanoi(n - 1, denpend_on, from, to);
  }
}


x86 assembly (clang, -O0):
<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)
jne    115e <hanoi+0x3e>
mov    -0x5(%rbp),%al
mov    $0x1,%edi
movsbl %al,%esi
movsbl -0x7(%rbp),%edx
call   1040 <move@plt>
jmp    11a6 <hanoi+0x86>
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 <hanoi@plt>
mov    -0x4(%rbp),%edi
mov    -0x5(%rbp),%al
movsbl %al,%esi
movsbl -0x7(%rbp),%edx
call   1040 <move@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 <hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r12d
movsbl %cl,%r14d
cmp    $0x1,%edi
jne    113c <hanoi+0x1c>
mov    %r12d,%r13d
jmp    1182 <hanoi+0x62>
mov    %edi,%ebx
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %edx,%r13d
lea    0x1(%rbx),%r15d
movsbl %r12b,%ebp
movsbl %dl,%ecx
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <hanoi@plt>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <move@plt>
mov    %r12d,%edx
mov    %r13d,%r12d
add    $0xffffffff,%ebx
jne    1150 <hanoi+0x30>
movsbl %r13b,%esi
mov    $0x1,%edi
mov    %r14d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <move@plt>

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

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