#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, char, char);
void move(int n, char from, char target, char middle) {
  if (n == 1) {
    printf("Move %d from %c to %c\n", n, from, target);
  } else {
    move(n - 1, from, middle, target);
    printf("Move %d from %c to %c\n", n, from, target);
    move(n - 1, middle, target, from);
  }
}


x86 assembly (clang, -O0):
<move>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1163 <move+0x43>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xeae(%rip),%rdi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <printf@plt>
jmp    11b2 <move+0x92>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x5(%rbp),%cl
mov    -0x7(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1040 <move@plt>
mov    -0x4(%rbp),%esi
mov    -0x5(%rbp),%al
lea    0xe75(%rip),%rdi
movsbl %al,%edx
movsbl -0x6(%rbp),%ecx
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x7(%rbp),%cl
mov    -0x6(%rbp),%al
movsbl %cl,%esi
movsbl %al,%edx
movsbl -0x5(%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
mov    %esi,%r13d
movsbl %dl,%r14d
cmp    $0x1,%edi
jne    113c <move+0x1c>
mov    %r13d,%r15d
jmp    1189 <move+0x69>
mov    %edi,%ebx
add    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r15d
lea    0x1(%rbx),%r12d
movsbl %r13b,%ebp
movsbl %cl,%edx
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%ecx
call   1040 <move@plt>
lea    0xe8f(%rip),%rdi
mov    %r12d,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <printf@plt>
mov    %r13d,%ecx
mov    %r15d,%r13d
add    $0xffffffff,%ebx
jne    1150 <move+0x30>
movsbl %r15b,%edx
lea    0xe6c(%rip),%rdi
mov    $0x1,%esi
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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