#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ getword(int /*<<< orphan*/ *, char **);
int loadfile(FILE *wordlist, char *buf[6000], unsigned int *size) {
  unsigned int i = 0;
  while (i < 6000 && getword(wordlist, &buf[i]))
    i++;
  (*size) = i;
  if (i == 0)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<loadfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x1770,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jae    115e <loadfile+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%eax
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <getword@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    116e <loadfile+0x5e>
jmp    117c <loadfile+0x6c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112b <loadfile+0x1b>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x24(%rbp)
jne    119b <loadfile+0x8b>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <loadfile+0x92>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadfile>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <getword@plt>
test   %rax,%rax
je     1157 <loadfile+0x47>
add    $0x1,%r12
add    $0x8,%rbx
cmp    $0x1770,%r12
jne    1130 <loadfile+0x20>
mov    $0x1770,%r12d
mov    %r12d,(%r14)
xor    %eax,%eax
test   %r12d,%r12d
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @loadfile(i32* %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
store i32 0, i32* %8
br label %9
9: ; preds = %22, %3
%10 = load i32, i32* %8
%11 = icmp ult i32 %10, 6000
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32*, i32** %5
%14 = load i8**, i8*** %6
%15 = load i32, i32* %8
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = call i64 @getword(i32* %13, i8** %17)
%19 = icmp ne i64 %18, 0
br label %20
20: ; preds = %12, %9
%21 = phi i1 [ false, %9 ], [ %19, %12 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i32, i32* %8
%24 = add i32 %23, 1
store i32 %24, i32* %8
br label %9
25: ; preds = %20
%26 = load i32, i32* %8
%27 = load i32*, i32** %7
store i32 %26, i32* %27
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 0, i32* %4
br label %32
31: ; preds = %25
store i32 1, i32* %4
br label %32
32: ; preds = %31, %30
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
define i32 @loadfile(i32* %0, i8** %1, i32* nocapture writeonly %2) {
br label %4
4: ; preds = %3, %9
%5 = phi i64 [ 0, %3 ], [ %10, %9 ]
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
%7 = tail call i64 @getword(i32* %0, i8** %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = add nuw nsw i64 %5, 1
%11 = icmp eq i64 %10, 6000
br i1 %11, label %14, label %4
12: ; preds = %4
%13 = trunc i64 %5 to i32
br label %14
14: ; preds = %9, %12
%15 = phi i32 [ %13, %12 ], [ 6000, %9 ]
store i32 %15, i32* %2
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}