#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 */
char *combo(int, char *);
int /*<<< orphan*/ free(char *);
char *phrase(int);
int /*<<< orphan*/ puts(char *);
char **read(char *);
int main(int argc, char *argv[]) {
  char **items = read("..\\twelve_input_1.txt");
  for (int i = 0; i < 12; i++) {
    char *verse = phrase(i);
    if (i == 0) {
      puts(verse + 1);
      char *line = combo(0, items[0]);
      puts(line + 4);
      free(line);
    } else {
      puts(verse);
      for (int j = i; j >= 0; j--) {
        char *line = combo(j, items[j]);
        puts(line);
        free(line);
      }
    }
    free(verse);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
call   1060 <read@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xc,-0x1c(%rbp)
jge    1244 <main+0xf4>
mov    -0x1c(%rbp),%edi
call   1070 <phrase@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11d7 <main+0x87>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
xor    %edi,%edi
call   1050 <combo@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
add    $0x4,%rdi
call   1040 <puts@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
jmp    122d <main+0xdd>
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     1228 <main+0xd8>
mov    -0x34(%rbp),%edi
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <combo@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    11e6 <main+0x96>
jmp    122d <main+0xdd>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117d <main+0x2d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xea0(%rip),%rdi
call   1060 <read@plt>
mov    %rax,%r12
xor    %r14d,%r14d
jmp    11aa <main+0x5a>
nopl   (%rax)
add    $0x1,%rdi
call   1040 <puts@plt>
mov    (%r12),%rsi
xor    %edi,%edi
call   1050 <combo@plt>
mov    %rax,%rbx
lea    0x4(%rax),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x1,%r14
cmp    $0xc,%r14
je     11fc <main+0xac>
mov    %r14d,%edi
call   1070 <phrase@plt>
mov    %rax,%r15
mov    %rax,%rdi
test   %r14d,%r14d
je     1170 <main+0x20>
call   1040 <puts@plt>
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,8),%rsi
mov    %ebx,%edi
call   1050 <combo@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1030 <free@plt>
lea    -0x1(%rbx),%rax
test   %rbx,%rbx
mov    %rax,%rbx
jg     11d0 <main+0x80>
jmp    1198 <main+0x48>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"..\\twelve_input_1.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i8** @read(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i8** %12, i8*** %6
store i32 0, i32* %7
br label %13
13: ; preds = %60, %2
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 12
br i1 %15, label %16, label %63
16: ; preds = %13
%17 = load i32, i32* %7
%18 = call i8* @phrase(i32 %17)
store i8* %18, i8** %8
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %16
%22 = load i8*, i8** %8
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = call i32 @puts(i8* %23)
%25 = load i8**, i8*** %6
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i8* @combo(i32 0, i8* %27)
store i8* %28, i8** %9
%29 = load i8*, i8** %9
%30 = getelementptr inbounds i8, i8* %29, i64 4
%31 = call i32 @puts(i8* %30)
%32 = load i8*, i8** %9
%33 = call i32 @free(i8* %32)
br label %57
34: ; preds = %16
%35 = load i8*, i8** %8
%36 = call i32 @puts(i8* %35)
%37 = load i32, i32* %7
store i32 %37, i32* %10
br label %38
38: ; preds = %53, %34
%39 = load i32, i32* %10
%40 = icmp sge i32 %39, 0
br i1 %40, label %41, label %56
41: ; preds = %38
%42 = load i32, i32* %10
%43 = load i8**, i8*** %6
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %43, i64 %45
%47 = load i8*, i8** %46
%48 = call i8* @combo(i32 %42, i8* %47)
store i8* %48, i8** %11
%49 = load i8*, i8** %11
%50 = call i32 @puts(i8* %49)
%51 = load i8*, i8** %11
%52 = call i32 @free(i8* %51)
br label %53
53: ; preds = %41
%54 = load i32, i32* %10
%55 = add nsw i32 %54, -1
store i32 %55, i32* %10
br label %38
56: ; preds = %38
br label %57
57: ; preds = %56, %21
%58 = load i8*, i8** %8
%59 = call i32 @free(i8* %58)
br label %60
60: ; preds = %57
%61 = load i32, i32* %7
%62 = add nsw i32 %61, 1
store i32 %62, i32* %7
br label %13
63: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"..\\twelve_input_1.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8** @read(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %5
4: ; preds = %30
ret i32 0
5: ; preds = %2, %30
%6 = phi i64 [ 0, %2 ], [ %32, %30 ]
%7 = trunc i64 %6 to i32
%8 = tail call i8* @phrase(i32 %7)
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %8, i64 1
%12 = tail call i32 @puts(i8* %11)
%13 = load i8*, i8** %3
%14 = tail call i8* @combo(i32 0, i8* %13)
%15 = getelementptr inbounds i8, i8* %14, i64 4
%16 = tail call i32 @puts(i8* %15)
%17 = tail call i32 @free(i8* %14)
br label %30
18: ; preds = %5
%19 = tail call i32 @puts(i8* dereferenceable(1) %8)
br label %20
20: ; preds = %18, %20
%21 = phi i64 [ %6, %18 ], [ %28, %20 ]
%22 = getelementptr inbounds i8*, i8** %3, i64 %21
%23 = load i8*, i8** %22
%24 = trunc i64 %21 to i32
%25 = tail call i8* @combo(i32 %24, i8* %23)
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
%27 = tail call i32 @free(i8* %25)
%28 = add nsw i64 %21, -1
%29 = icmp sgt i64 %21, 0
br i1 %29, label %20, label %30
30: ; preds = %20, %10
%31 = tail call i32 @free(i8* %8)
%32 = add nuw nsw i64 %6, 1
%33 = icmp eq i64 %32, 12
br i1 %33, label %4, label %5
}