#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 /*<<< orphan*/ writeLeftTower(int, int);
int /*<<< orphan*/ writeMiddleTower(int, int);
int main() {
  int max = 10;
  for (int j = 1; j < max; j++) {
    writeLeftTower(j, max - 1);
    writeMiddleTower(1, j);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118e <main+0x5e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1040 <writeLeftTower@plt>
mov    -0xc(%rbp),%esi
mov    $0x1,%edi
call   1050 <writeMiddleTower@plt>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x2,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x3,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x4,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x4,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x5,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x5,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x6,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x7,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x7,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
mov    $0x9,%esi
call   1040 <writeLeftTower@plt>
mov    $0x1,%edi
mov    $0x9,%esi
call   1050 <writeMiddleTower@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %19
8: ; preds = %4
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = call i32 @writeLeftTower(i32 %9, i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @writeMiddleTower(i32 1, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %8
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %4
19: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @writeLeftTower(i32 1, i32 9)
%2 = tail call i32 @writeMiddleTower(i32 1, i32 1)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @writeLeftTower(i32 2, i32 9)
%5 = tail call i32 @writeMiddleTower(i32 1, i32 2)
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 @writeLeftTower(i32 3, i32 9)
%8 = tail call i32 @writeMiddleTower(i32 1, i32 3)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 @writeLeftTower(i32 4, i32 9)
%11 = tail call i32 @writeMiddleTower(i32 1, i32 4)
%12 = tail call i32 @putchar(i32 10)
%13 = tail call i32 @writeLeftTower(i32 5, i32 9)
%14 = tail call i32 @writeMiddleTower(i32 1, i32 5)
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 @writeLeftTower(i32 6, i32 9)
%17 = tail call i32 @writeMiddleTower(i32 1, i32 6)
%18 = tail call i32 @putchar(i32 10)
%19 = tail call i32 @writeLeftTower(i32 7, i32 9)
%20 = tail call i32 @writeMiddleTower(i32 1, i32 7)
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 @writeLeftTower(i32 8, i32 9)
%23 = tail call i32 @writeMiddleTower(i32 1, i32 8)
%24 = tail call i32 @putchar(i32 10)
%25 = tail call i32 @writeLeftTower(i32 9, i32 9)
%26 = tail call i32 @writeMiddleTower(i32 1, i32 9)
%27 = tail call i32 @putchar(i32 10)
ret i32 0
}