#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*/ delay();
int /*<<< orphan*/ showNewFrame();
void moveTower(unsigned int **tower1, unsigned int **tower2,
               unsigned int **tower3, unsigned int n) {
  if (n == 1) {
    (*tower3)++;
    **tower3 = **tower1;
    **tower1 = 0;
    (*tower1)--;
    delay();
    showNewFrame();
  } else {
    moveTower(tower1, tower3, tower2, n - 1);
    (*tower3)++;
    **tower3 = **tower1;
    **tower1 = 0;
    (*tower1)--;
    delay();
    showNewFrame();
    moveTower(tower2, tower1, tower3, n - 1);
  }
}


x86 assembly (clang, -O0):
<moveTower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    119f <moveTower+0x6f>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <delay@plt>
mov    $0x0,%al
call   1040 <showNewFrame@plt>
jmp    1216 <moveTower+0xe6>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
call   1050 <moveTower@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xfffffffffffffffc,%rcx
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <delay@plt>
mov    $0x0,%al
call   1040 <showNewFrame@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
call   1050 <moveTower@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveTower>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
cmp    $0x1,%ecx
jne    1147 <moveTower+0x17>
mov    %rbx,%r15
jmp    119b <moveTower+0x6b>
mov    %ecx,%ebp
add    $0xffffffff,%ebp
nopl   0x0(%rax)
mov    %rsi,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %ebp,%ecx
call   1050 <moveTower@plt>
mov    (%r14),%rax
lea    0x4(%rax),%rcx
mov    %rcx,(%r14)
mov    (%rbx),%rcx
mov    (%rcx),%edx
mov    %edx,0x4(%rax)
movl   $0x0,(%rcx)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,(%rbx)
xor    %eax,%eax
call   1030 <delay@plt>
xor    %eax,%eax
call   1040 <showNewFrame@plt>
mov    %rbx,%rsi
mov    %r15,%rbx
add    $0xffffffff,%ebp
jne    1150 <moveTower+0x20>
mov    (%r14),%rax
lea    0x4(%rax),%rcx
mov    %rcx,(%r14)
mov    (%r15),%rcx
mov    (%rcx),%edx
mov    %edx,0x4(%rax)
movl   $0x0,(%rcx)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,(%r15)
xor    %eax,%eax
call   1030 <delay@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <showNewFrame@plt>

LLVM IR (-O0):
define void @moveTower(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* %8
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %27
11: ; preds = %4
%12 = load i32**, i32*** %7
%13 = load i32*, i32** %12
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %12
%15 = load i32**, i32*** %5
%16 = load i32*, i32** %15
%17 = load i32, i32* %16
%18 = load i32**, i32*** %7
%19 = load i32*, i32** %18
store i32 %17, i32* %19
%20 = load i32**, i32*** %5
%21 = load i32*, i32** %20
store i32 0, i32* %21
%22 = load i32**, i32*** %5
%23 = load i32*, i32** %22
%24 = getelementptr inbounds i32, i32* %23, i32 -1
store i32* %24, i32** %22
%25 = call i32 (...) @delay()
%26 = call i32 (...) @showNewFrame()
br label %53
27: ; preds = %4
%28 = load i32**, i32*** %5
%29 = load i32**, i32*** %7
%30 = load i32**, i32*** %6
%31 = load i32, i32* %8
%32 = sub i32 %31, 1
%33 = load i32**, i32*** %7
%34 = load i32*, i32** %33
%35 = getelementptr inbounds i32, i32* %34, i32 1
store i32* %35, i32** %33
%36 = load i32**, i32*** %5
%37 = load i32*, i32** %36
%38 = load i32, i32* %37
%39 = load i32**, i32*** %7
%40 = load i32*, i32** %39
store i32 %38, i32* %40
%41 = load i32**, i32*** %5
%42 = load i32*, i32** %41
store i32 0, i32* %42
%43 = load i32**, i32*** %5
%44 = load i32*, i32** %43
%45 = getelementptr inbounds i32, i32* %44, i32 -1
store i32* %45, i32** %43
%46 = call i32 (...) @delay()
%47 = call i32 (...) @showNewFrame()
%48 = load i32**, i32*** %6
%49 = load i32**, i32*** %5
%50 = load i32**, i32*** %7
%51 = load i32, i32* %8
%52 = sub i32 %51, 1
br label %53
53: ; preds = %27, %11
ret void
}

LLVM IR (-O2):
define void @moveTower(i32** nocapture %0, i32** nocapture %1, i32** nocapture %2, i32 %3) {
%5 = icmp eq i32 %3, 1
br i1 %5, label %6, label %15
6: ; preds = %15, %4
%7 = phi i32** [ %0, %4 ], [ %17, %15 ]
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32* %9, i32** %2
%10 = load i32*, i32** %7
%11 = load i32, i32* %10
store i32 %11, i32* %9
store i32 0, i32* %10
%12 = getelementptr inbounds i32, i32* %10, i64 -1
store i32* %12, i32** %7
%13 = tail call i32 (...) @delay()
%14 = tail call i32 (...) @showNewFrame()
ret void
15: ; preds = %4, %15
%16 = phi i32 [ %19, %15 ], [ %3, %4 ]
%17 = phi i32** [ %18, %15 ], [ %1, %4 ]
%18 = phi i32** [ %17, %15 ], [ %0, %4 ]
%19 = add i32 %16, -1
tail call void @moveTower(i32** %18, i32** %2, i32** %17, i32 %19)
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 1
store i32* %21, i32** %2
%22 = load i32*, i32** %18
%23 = load i32, i32* %22
store i32 %23, i32* %21
store i32 0, i32* %22
%24 = getelementptr inbounds i32, i32* %22, i64 -1
store i32* %24, i32** %18
%25 = tail call i32 (...) @delay()
%26 = tail call i32 (...) @showNewFrame()
%27 = icmp eq i32 %19, 1
br i1 %27, label %6, label %15
}