#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 *, int *);
void Hanoi(int n, int *source, int *dest, int *spare) {
  if (n == 1) {
    Move(source, dest);
    return;
  }
  Hanoi(n - 1, source, spare, dest);
  Move(source, dest);
  Hanoi(n - 1, spare, dest, source);
  return;
}


x86 assembly (clang, -O0):
<Hanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1153 <Hanoi+0x33>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <Move@plt>
jmp    118e <Hanoi+0x6e>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <Hanoi@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <Move@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
call   1030 <Hanoi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hanoi>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
cmp    $0x1,%edi
jne    1137 <Hanoi+0x17>
mov    %rbx,%r15
jmp    1169 <Hanoi+0x49>
mov    %edi,%ebp
add    $0xffffffff,%ebp
nopl   0x0(%rax)
mov    %rcx,%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %rcx,%rdx
mov    %r14,%rcx
call   1030 <Hanoi@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <Move@plt>
mov    %rbx,%rcx
mov    %r15,%rbx
add    $0xffffffff,%ebp
jne    1140 <Hanoi+0x20>
mov    %r15,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Move@plt>

LLVM IR (-O0):
define void @Hanoi(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32*, i32** %6
%13 = load i32*, i32** %7
%14 = call i32 @Move(i32* %12, i32* %13)
br label %29
15: ; preds = %4
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = load i32*, i32** %6
%19 = load i32*, i32** %8
%20 = load i32*, i32** %7
%21 = load i32*, i32** %6
%22 = load i32*, i32** %7
%23 = call i32 @Move(i32* %21, i32* %22)
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = load i32*, i32** %8
%27 = load i32*, i32** %7
%28 = load i32*, i32** %6
br label %29
29: ; preds = %15, %11
ret void
}

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