#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 *, char, char);
int TOH(int n, char x, char y, char z) {
  if (n > 0) {
    TOH(n - 1, x, z, y);
    printf("%c -> %c\n", x, y);
    TOH(n - 1, z, y, x);
  }
}


x86 assembly (clang, -O0):
<TOH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1191 <TOH+0x71>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x9(%rbp),%cl
mov    -0xb(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0xa(%rbp),%ecx
call   1040 <TOH@plt>
mov    -0x9(%rbp),%al
lea    0xe96(%rip),%rdi
movsbl %al,%esi
movsbl -0xa(%rbp),%edx
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xb(%rbp),%cl
mov    -0xa(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x9(%rbp),%ecx
call   1040 <TOH@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOH>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1182 <TOH+0x62>
mov    %esi,%r12d
mov    %edi,%ebx
add    $0x1,%ebx
movsbl %dl,%r14d
lea    0xebe(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%r13d
lea    -0x2(%rbx),%edi
movsbl %r12b,%ebp
movsbl %cl,%edx
mov    %ebp,%esi
mov    %r14d,%ecx
call   1040 <TOH@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <printf@plt>
add    $0xffffffff,%ebx
mov    %r12d,%ecx
mov    %r13d,%r12d
cmp    $0x1,%ebx
ja     1150 <TOH+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%c -> %c\0A\00"
define i32 @TOH(i32 %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i32 %0, i32* %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
%10 = load i32, i32* %6
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %4
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = load i8, i8* %7
%16 = load i8, i8* %9
%17 = load i8, i8* %8
%18 = call i32 @TOH(i32 %14, i8 signext %15, i8 signext %16, i8 signext %17)
%19 = load i8, i8* %7
%20 = load i8, i8* %8
%21 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext %19, i8 signext %20)
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 1
%24 = load i8, i8* %9
%25 = load i8, i8* %8
%26 = load i8, i8* %7
%27 = call i32 @TOH(i32 %23, i8 signext %24, i8 signext %25, i8 signext %26)
br label %28
28: ; preds = %12, %4
%29 = load i32, i32* %5
ret i32 %29
}

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