#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) {
  int i;
  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    $0x30,%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    $0x30,%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*
%9 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32*, i32** %6
%14 = load i32*, i32** %7
%15 = call i32 @Move(i32* %13, i32* %14)
br label %30
16: ; preds = %4
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = load i32*, i32** %6
%20 = load i32*, i32** %8
%21 = load i32*, i32** %7
%22 = load i32*, i32** %6
%23 = load i32*, i32** %7
%24 = call i32 @Move(i32* %22, i32* %23)
%25 = load i32, i32* %5
%26 = sub nsw i32 %25, 1
%27 = load i32*, i32** %8
%28 = load i32*, i32** %7
%29 = load i32*, i32** %6
br label %30
30: ; preds = %16, %12
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
}