#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*/ exit(int);
char ***findLadders(char *, char *, char **, int, int *, int **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc < 3) {
    fprintf(stderr, "Usage: ./test begin end dict...\n");
    exit(-1);
  }
  int i, j, *sizes, count = 0;
  char ***lists =
      findLadders(argv[1], argv[2], argv + 3, argc - 3, &count, &sizes);
  for (i = 0; i < count; i++) {
    for (j = 0; j < sizes[i]; j++) {
      printf("%s ", lists[i][j]);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x10(%rbp),%rdx
add    $0x18,%rdx
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
lea    -0x24(%rbp),%r8
lea    -0x20(%rbp),%r9
call   1050 <findLadders@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    122f <main+0xef>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x20(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1213 <main+0xd3>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cf <main+0x8f>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bc <main+0x7c>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jle    1214 <main+0xc4>
mov    %rsi,%rdx
mov    %edi,%ecx
movl   $0x0,0xc(%rsp)
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
add    $0x18,%rdx
add    $0xfffffffd,%ecx
lea    0xc(%rsp),%r8
lea    0x10(%rsp),%r9
call   1060 <findLadders@plt>
cmpl   $0x0,0xc(%rsp)
jle    1206 <main+0xb6>
mov    %rax,%r15
lea    0xe81(%rip),%r14
xor    %r12d,%r12d
jmp    11c8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
movslq 0xc(%rsp),%rax
cmp    %rax,%r12
jge    1206 <main+0xb6>
mov    0x10(%rsp),%rax
cmpl   $0x0,(%rax,%r12,4)
jle    11b0 <main+0x60>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%r12,8),%rax
mov    (%rax,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
mov    0x10(%rsp),%rax
movslq (%rax,%r12,4),%rax
cmp    %rax,%rbx
jl     11e0 <main+0x90>
jmp    11b0 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xddc(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Usage: ./test begin end dict...\0A\00"
@.str.1 = [4 x i8] c"%s \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %2
%11 = bitcast i32** %3 to i8*
%12 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = add nsw i32 %0, -3
%19 = call i8*** @findLadders(i8* %14, i8* %16, i8** %17, i32 %18, i32* %4, i32** %3)
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %48
22: ; preds = %10, %42
%23 = phi i64 [ %44, %42 ], [ 0, %10 ]
%24 = load i32*, i32** %3
%25 = getelementptr inbounds i32, i32* %24, i64 %23
%26 = load i32, i32* %25
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %22
%29 = getelementptr inbounds i8**, i8*** %19, i64 %23
br label %30
30: ; preds = %28, %30
%31 = phi i64 [ 0, %28 ], [ %36, %30 ]
%32 = load i8**, i8*** %29
%33 = getelementptr inbounds i8*, i8** %32, i64 %31
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = add nuw nsw i64 %31, 1
%37 = load i32*, i32** %3
%38 = getelementptr inbounds i32, i32* %37, i64 %23
%39 = load i32, i32* %38
%40 = sext i32 %39 to i64
%41 = icmp slt i64 %36, %40
br i1 %41, label %30, label %42
42: ; preds = %30, %22
%43 = call i32 @putchar(i32 10)
%44 = add nuw nsw i64 %23, 1
%45 = load i32, i32* %4
%46 = sext i32 %45 to i64
%47 = icmp slt i64 %44, %46
br i1 %47, label %22, label %48
48: ; preds = %42, %10
ret i32 0
}