#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 mvdisk(int fr, int to, int spare, int n) {
  if (n <= 1) {
    printf("%d%d\n", fr, to);
    return 0;
  }
  mvdisk(fr, spare, to, n - 1);
  printf("%d%d\n", fr, to);
  mvdisk(spare, to, fr, n - 1);
  return 0;
}


x86 assembly (clang, -O0):
<mvdisk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jg     115c <mvdisk+0x3c>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    119d <mvdisk+0x7d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
call   1040 <mvdisk@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
call   1040 <mvdisk@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvdisk>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
cmp    $0x2,%ecx
jge    1137 <mvdisk+0x17>
mov    %ebp,%r12d
jmp    117c <mvdisk+0x5c>
mov    %ecx,%ebx
add    $0x1,%ebx
lea    0xebd(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edx,%r12d
lea    -0x2(%rbx),%ecx
mov    %ebp,%edi
mov    %edx,%esi
mov    %r14d,%edx
call   1040 <mvdisk@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
add    $0xffffffff,%ebx
mov    %ebp,%edx
mov    %r12d,%ebp
cmp    $0x3,%ebx
jae    1150 <mvdisk+0x30>
lea    0xe7d(%rip),%rdi
mov    %r12d,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d%d\0A\00"
define i32 @mvdisk(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* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = icmp sle 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 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
store i32 0, i32* %5
br label %32
16: ; preds = %4
%17 = load i32, i32* %6
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = load i32, i32* %9
%21 = sub nsw i32 %20, 1
%22 = call i32 @mvdisk(i32 %17, i32 %18, i32 %19, i32 %21)
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %8
%27 = load i32, i32* %7
%28 = load i32, i32* %6
%29 = load i32, i32* %9
%30 = sub nsw i32 %29, 1
%31 = call i32 @mvdisk(i32 %26, i32 %27, i32 %28, i32 %30)
store i32 0, i32* %5
br label %32
32: ; preds = %16, %12
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d%d\0A\00"
define i32 @mvdisk(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp slt i32 %3, 2
br i1 %5, label %6, label %9
6: ; preds = %9, %4
%7 = phi i32 [ %0, %4 ], [ %11, %9 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %1)
ret i32 0
9: ; preds = %4, %9
%10 = phi i32 [ %13, %9 ], [ %3, %4 ]
%11 = phi i32 [ %12, %9 ], [ %2, %4 ]
%12 = phi i32 [ %11, %9 ], [ %0, %4 ]
%13 = add nsw i32 %10, -1
%14 = tail call i32 @mvdisk(i32 %12, i32 %11, i32 %1, i32 %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %1)
%16 = icmp ult i32 %10, 3
br i1 %16, label %6, label %9
}