#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 hanoi(int n, char departure[], char stopover[], char destination[]) {
  if (n == 1)
    printf("board%2d move %s -> %s\n", n, departure, destination);
  else {
    hanoi(n - 1, departure, destination, stopover);
    printf("board%2d move %s -> %s\n", n, departure, destination);
    hanoi(n - 1, stopover, departure, destination);
  }
}


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    115d <hanoi+0x3d>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <hanoi+0x82>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1040 <hanoi@plt>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <hanoi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rsi,%r15
cmp    $0x1,%edi
jne    113b <hanoi+0x1b>
mov    %r15,%r12
jmp    1181 <hanoi+0x61>
mov    %edi,%ebx
add    $0xffffffff,%ebx
lea    0xeb9(%rip),%r13
nopw   0x0(%rax,%rax,1)
mov    %rdx,%r12
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %r12,%rcx
call   1040 <hanoi@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <printf@plt>
mov    %r15,%rdx
mov    %r12,%r15
add    $0xffffffff,%ebx
jne    1150 <hanoi+0x30>
lea    0xe78(%rip),%rdi
mov    $0x1,%esi
mov    %r12,%rdx
mov    %r14,%rcx
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"board%2d move %s -> %s\0A\00"
define void @hanoi(i32 %0, i8* %1, i8* %2, i8* %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** %8
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %13, i8* %14)
br label %31
16: ; preds = %4
%17 = load i32, i32* %5
%18 = sub nsw i32 %17, 1
%19 = load i8*, i8** %6
%20 = load i8*, i8** %8
%21 = load i8*, i8** %7
%22 = load i32, i32* %5
%23 = load i8*, i8** %6
%24 = load i8*, i8** %8
%25 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %22, i8* %23, i8* %24)
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = load i8*, i8** %7
%29 = load i8*, i8** %6
%30 = load i8*, i8** %8
br label %31
31: ; preds = %16, %11
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"board%2d move %s -> %s\0A\00"
define void @hanoi(i32 %0, i8* %1, i8* %2, i8* %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 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 1, i8* %7, i8* %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* %11, i8* %3, i8* %10)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %11, i8* %3)
%15 = icmp eq i32 %13, 1
br i1 %15, label %6, label %9
}