#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*/ add_disk(int, int /*<<< orphan*/);
int /*<<< orphan*/ remove_disk(int);
void move(int n, int from, int to, int via) {
  if (!n)
    return;
  move(n - 1, from, via, to);
  add_disk(to, remove_disk(from));
  move(n - 1, via, to, from);
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1153 <move+0x23>
jmp    1193 <move+0x63>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
call   1050 <move@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <remove_disk@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <add_disk@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1050 <move@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
je     117c <move+0x4c>
mov    %edx,%r14d
mov    %esi,%ebx
mov    %edi,%ebp
add    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%r15d
mov    %ebp,%edi
mov    %ebx,%esi
mov    %ecx,%edx
mov    %r14d,%ecx
call   1050 <move@plt>
mov    %ebx,%edi
call   1040 <remove_disk@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1030 <add_disk@plt>
mov    %ebx,%ecx
mov    %r15d,%ebx
add    $0xffffffff,%ebp
jb     1150 <move+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @move(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %14, label %6
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 @remove_disk(i32 %8)
%12 = tail call i32 @add_disk(i32 %2, i32 %11)
%13 = icmp eq i32 %10, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %4
ret void
}