#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, int, int);
void move(int n, int from, int to, int via) {
  if (n > 0) {
    move(n - 1, from, via, to);
    printf("Move disk %d from pole %d to pole %d\n", n, from, to);
    move(n - 1, via, to, from);
  }
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    117b <move+0x5b>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1040 <move@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1040 <move@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1172 <move+0x52>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xec3(%rip),%r15
nopl   (%rax)
mov    %ecx,%r12d
lea    -0x1(%rbx),%r13d
mov    %r13d,%edi
mov    %ebp,%esi
mov    %ecx,%edx
mov    %r14d,%ecx
call   1040 <move@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
mov    %ebp,%ecx
mov    %r12d,%ebp
cmp    $0x1,%ebx
mov    %r13d,%ebx
ja     1140 <move+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Move disk %d from pole %d to pole %d\0A\00"
define void @move(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 sgt i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %6
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19)
%21 = load i32, i32* %5
%22 = sub nsw i32 %21, 1
%23 = load i32, i32* %8
%24 = load i32, i32* %7
%25 = load i32, i32* %6
br label %26
26: ; preds = %11, %4
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Move disk %d from pole %d to pole %d\0A\00"
define void @move(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %13
6: ; preds = %4, %6
%7 = phi i32 [ %8, %6 ], [ %3, %4 ]
%8 = phi i32 [ %7, %6 ], [ %1, %4 ]
%9 = phi i32 [ %10, %6 ], [ %0, %4 ]
%10 = add nsw i32 %9, -1
tail call void @move(i32 %10, i32 %8, i32 %7, i32 %2)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %8, i32 %2)
%12 = icmp ugt i32 %9, 1
br i1 %12, label %6, label %13
13: ; preds = %6, %4
ret void
}