#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*/ getword(char *, int);
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  int c, i, ii, listsize;
  char *list[1000];
  char *word = malloc(100 + 1);
  for (i = 0; i < 1000; i++)
    if (!getword(word, 100))
      break;
    else
      memcpy(list[i] = malloc(strlen(word) + 1), word, strlen(word) + 1);
  listsize = ++i;
  for (i = 0; i < listsize; i++)
    for (ii = i + 1; ii < listsize - 1; ii++)
      printf("./justkeys %s %s\n", list[i], list[ii]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x65,%edi
call   1070 <malloc@plt>
mov    %rax,-0x1f68(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    121e <main+0xce>
mov    -0x1f68(%rbp),%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
cmp    $0x0,%eax
jne    11ad <main+0x5d>
jmp    121e <main+0xce>
mov    -0x1f68(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x1f78(%rbp)
movslq -0x18(%rbp),%rax
mov    %rcx,-0x1f60(%rbp,%rax,8)
ff
mov    -0x1f68(%rbp),%rax
mov    %rax,-0x1f70(%rbp)
mov    -0x1f68(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1f78(%rbp),%rdi
mov    -0x1f70(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1060 <memcpy@plt>
jmp    1210 <main+0xc0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1181 <main+0x31>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    129c <main+0x14c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1289 <main+0x139>
movslq -0x18(%rbp),%rax
mov    -0x1f60(%rbp,%rax,8),%rsi
ff
movslq -0x1c(%rbp),%rax
mov    -0x1f60(%rbp,%rax,8),%rdx
ff
lea    0xd8a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1246 <main+0xf6>
jmp    128e <main+0x13e>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1231 <main+0xe1>
mov    -0x4(%rbp),%eax
add    $0x1f80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f58,%rsp
mov    $0x65,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
xor    %ebx,%ebx
mov    %r14,%rdi
mov    $0x64,%esi
call   1050 <getword@plt>
test   %eax,%eax
je     11c1 <main+0x71>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x10(%rsp,%rbx,8)
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbp,%rdi
mov    %r14,%rsi
call   1060 <memcpy@plt>
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1170 <main+0x20>
mov    $0x3e8,%ebx
mov    %ebx,%ebp
add    $0x1,%ebx
lea    0x10(%rsp),%r13
xor    %r12d,%r12d
lea    0xe2b(%rip),%r14
mov    %rbp,(%rsp)
mov    %rbx,0x8(%rsp)
jmp    11f2 <main+0xa2>
add    $0x8,%r13
add    $0xffffffffffffffff,%rbp
mov    0x8(%rsp),%rbx
cmp    %rbx,%r12
je     122b <main+0xdb>
mov    %r12,%rax
add    $0x1,%r12
cmp    (%rsp),%r12
jae    11e0 <main+0x90>
mov    0x10(%rsp,%rax,8),%rbx
mov    $0x1,%r15d
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%r15,8),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1210 <main+0xc0>
jmp    11e0 <main+0x90>
xor    %eax,%eax
add    $0x1f58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"./justkeys %s %s\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 [1000 x i8*]
%11 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i8* @malloc(i32 101)
store i8* %12, i8** %11
store i32 0, i32* %7
br label %13
13: ; preds = %35, %2
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 1000
br i1 %15, label %16, label %38
16: ; preds = %13
%17 = load i8*, i8** %11
%18 = call i32 @getword(i8* %17, i32 100)
%19 = icmp ne i32 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %16
br label %38
21: ; preds = %16
%22 = load i8*, i8** %11
%23 = call i32 @strlen(i8* %22)
%24 = add nsw i32 %23, 1
%25 = call i8* @malloc(i32 %24)
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %10, i64 0, i64 %27
store i8* %25, i8** %28
%29 = load i8*, i8** %11
%30 = load i8*, i8** %11
%31 = call i32 @strlen(i8* %30)
%32 = add nsw i32 %31, 1
%33 = call i32 @memcpy(i8* %25, i8* %29, i32 %32)
br label %34
34: ; preds = %21
br label %35
35: ; preds = %34
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %13
38: ; preds = %20, %13
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
store i32 %40, i32* %9
store i32 0, i32* %7
br label %41
41: ; preds = %67, %38
%42 = load i32, i32* %7
%43 = load i32, i32* %9
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %70
45: ; preds = %41
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %8
br label %48
48: ; preds = %63, %45
%49 = load i32, i32* %8
%50 = load i32, i32* %9
%51 = sub nsw i32 %50, 1
%52 = icmp slt i32 %49, %51
br i1 %52, label %53, label %66
53: ; preds = %48
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %10, i64 0, i64 %55
%57 = load i8*, i8** %56
%58 = load i32, i32* %8
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %10, i64 0, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %57, i8* %61)
br label %63
63: ; preds = %53
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
br label %48
66: ; preds = %48
br label %67
67: ; preds = %66
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %41
70: ; preds = %41
%71 = load i32, i32* %3
ret i32 %71
}

LLVM IR (-O2):
@.str = [18 x i8] c"./justkeys %s %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8*]
%4 = bitcast [1000 x i8*]* %3 to i8*
%5 = tail call dereferenceable_or_null(101) i8* @malloc(i32 101)
br label %6
6: ; preds = %2, %10
%7 = phi i64 [ 0, %2 ], [ %18, %10 ]
%8 = tail call i32 @getword(i8* %5, i32 100)
%9 = icmp eq i32 %8, 0
br i1 %9, label %20, label %10
10: ; preds = %6
%11 = tail call i32 @strlen(i8* %5)
%12 = add nsw i32 %11, 1
%13 = tail call i8* @malloc(i32 %12)
%14 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 %7
store i8* %13, i8** %14
%15 = tail call i32 @strlen(i8* %5)
%16 = add nsw i32 %15, 1
%17 = tail call i32 @memcpy(i8* %13, i8* %5, i32 %16)
%18 = add nuw nsw i64 %7, 1
%19 = icmp eq i64 %18, 1000
br i1 %19, label %22, label %6
20: ; preds = %6
%21 = trunc i64 %7 to i32
br label %22
22: ; preds = %10, %20
%23 = phi i32 [ %21, %20 ], [ 1000, %10 ]
%24 = zext i32 %23 to i64
%25 = add nuw nsw i32 %23, 1
%26 = zext i32 %25 to i64
br label %30
27: ; preds = %38, %30
%28 = add nuw nsw i64 %32, 1
%29 = icmp eq i64 %33, %26
br i1 %29, label %45, label %30
30: ; preds = %22, %27
%31 = phi i64 [ 0, %22 ], [ %33, %27 ]
%32 = phi i64 [ 1, %22 ], [ %28, %27 ]
%33 = add nuw nsw i64 %31, 1
%34 = icmp ult i64 %33, %24
br i1 %34, label %35, label %27
35: ; preds = %30
%36 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 %31
%37 = load i8*, i8** %36
br label %38
38: ; preds = %35, %38
%39 = phi i64 [ %32, %35 ], [ %43, %38 ]
%40 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 %39
%41 = load i8*, i8** %40
%42 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %37, i8* %41)
%43 = add nuw nsw i64 %39, 1
%44 = icmp eq i64 %43, %24
br i1 %44, label %27, label %38
45: ; preds = %27
ret i32 0
}