#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*/ DISPLAY_INT(int);
int /*<<< orphan*/ outchar(char);
void Hanoi(int n, int x, int y) {
  if (n >= 2)
    Hanoi(n - 1, x, 6 - x - y);
  DISPLAY_INT(n);
  outchar(' ');
  DISPLAY_INT(x);
  outchar(' ');
  DISPLAY_INT(y);
  outchar('\n');
  if (n >= 2)
    Hanoi(n - 1, 6 - x - y, y);
  return;
}


x86 assembly (clang, -O0):
<Hanoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     1164 <Hanoi+0x34>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    $0x6,%edx
sub    -0x8(%rbp),%edx
sub    -0xc(%rbp),%edx
call   1030 <Hanoi@plt>
mov    -0x4(%rbp),%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    -0x8(%rbp),%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    -0xc(%rbp),%edi
call   1040 <DISPLAY_INT@plt>
mov    $0xa,%edi
call   1050 <outchar@plt>
cmpl   $0x2,-0x4(%rbp)
jl     11bd <Hanoi+0x8d>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    $0x6,%esi
sub    -0x8(%rbp),%esi
sub    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <Hanoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hanoi>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%r12d
cmp    $0x2,%edi
jl     11b1 <Hanoi+0x81>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%ebx
lea    -0x1(%r12),%r15d
mov    $0x6,%ebp
sub    %ebx,%ebp
sub    %r14d,%ebp
mov    %r15d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <Hanoi@plt>
mov    %r12d,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    %ebx,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    %r14d,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0xa,%edi
call   1050 <outchar@plt>
cmp    $0x2,%r12d
mov    %r15d,%r12d
ja     1150 <Hanoi+0x20>
mov    $0x1,%r12d
mov    %r12d,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    %ebp,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0x20,%edi
call   1050 <outchar@plt>
mov    %r14d,%edi
call   1040 <DISPLAY_INT@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <outchar@plt>

LLVM IR (-O0):
define void @Hanoi(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = sub nsw i32 6, %13
%15 = load i32, i32* %6
%16 = sub nsw i32 %14, %15
br label %17
17: ; preds = %9, %3
%18 = load i32, i32* %4
%19 = call i32 @DISPLAY_INT(i32 %18)
%20 = call i32 @outchar(i8 signext 32)
%21 = load i32, i32* %5
%22 = call i32 @DISPLAY_INT(i32 %21)
%23 = call i32 @outchar(i8 signext 32)
%24 = load i32, i32* %6
%25 = call i32 @DISPLAY_INT(i32 %24)
%26 = call i32 @outchar(i8 signext 10)
%27 = load i32, i32* %4
%28 = icmp sge i32 %27, 2
br i1 %28, label %29, label %37
29: ; preds = %17
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 1
%32 = load i32, i32* %5
%33 = sub nsw i32 6, %32
%34 = load i32, i32* %6
%35 = sub nsw i32 %33, %34
%36 = load i32, i32* %6
br label %37
37: ; preds = %29, %17
ret void
}

LLVM IR (-O2):
define void @Hanoi(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %18
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ %1, %3 ]
%7 = phi i32 [ %8, %5 ], [ %0, %3 ]
%8 = add nsw i32 %7, -1
%9 = add i32 %6, %2
%10 = sub i32 6, %9
tail call void @Hanoi(i32 %8, i32 %6, i32 %10)
%11 = tail call i32 @DISPLAY_INT(i32 %7)
%12 = tail call i32 @outchar(i8 signext 32)
%13 = tail call i32 @DISPLAY_INT(i32 %6)
%14 = tail call i32 @outchar(i8 signext 32)
%15 = tail call i32 @DISPLAY_INT(i32 %2)
%16 = tail call i32 @outchar(i8 signext 10)
%17 = icmp ugt i32 %7, 2
br i1 %17, label %5, label %18
18: ; preds = %5, %3
%19 = phi i32 [ %0, %3 ], [ 1, %5 ]
%20 = phi i32 [ %1, %3 ], [ %10, %5 ]
%21 = tail call i32 @DISPLAY_INT(i32 %19)
%22 = tail call i32 @outchar(i8 signext 32)
%23 = tail call i32 @DISPLAY_INT(i32 %20)
%24 = tail call i32 @outchar(i8 signext 32)
%25 = tail call i32 @DISPLAY_INT(i32 %2)
%26 = tail call i32 @outchar(i8 signext 10)
ret void
}