#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 */
int NAME_MAX;
scalar_t__ compare(char *, char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ *safeopen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int main(int argc, char **argv) {
  FILE *fp;
  int i, ch;
  if (argc != 2) {
    printf("\n\tRequires one string of characters to be input\n\n");
    return 1;
  }
  char buf[NAME_MAX];
  sprintf(buf, "%s/.config/jumble/wordlist", getenv("HOME"));
  fp = safeopen(buf, "r");
  ch = fgetc(fp);
  i = 0;
  while (!feof(fp)) {
    if (ch == 10) {
      buf[i] = 0;
      i = 0;
      if (compare(buf, argv[1]))
        printf("%s\n", buf);
    } else {
      buf[i++] = ch;
    }
    ch = fgetc(fp);
  }
  if (i > 0) {
    buf[i] = 0;
    if (compare(buf, argv[1]))
      printf("%s\n", buf);
  }
  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)
cmpl   $0x2,-0x8(%rbp)
je     11aa <main+0x3a>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1302 <main+0x192>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
lea    0xe70(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rdx
lea    0xe42(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xe52(%rip),%rsi
call   1070 <safeopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    123a <main+0xca>
jmp    12b0 <main+0x140>
cmpl   $0xa,-0x20(%rbp)
jne    1285 <main+0x115>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
movb   $0x0,(%rdi,%rax,1)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <compare@plt>
cmp    $0x0,%rax
je     1280 <main+0x110>
mov    -0x38(%rbp),%rsi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129f <main+0x12f>
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %cl,%dl
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x20(%rbp)
jmp    121c <main+0xac>
cmpl   $0x0,-0x1c(%rbp)
jle    12f4 <main+0x184>
mov    -0x38(%rbp),%rdi
movslq -0x1c(%rbp),%rax
movb   $0x0,(%rdi,%rax,1)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1090 <compare@plt>
cmp    $0x0,%rax
je     12ef <main+0x17f>
mov    -0x38(%rbp),%rsi
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12f4 <main+0x184>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    124c <main+0xdc>
mov    %rsi,%r14
mov    %rsp,-0x30(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe45(%rip),%rsi
mov    %r15,%rdi
mov    %rax,%rdx
call   1080 <sprintf@plt>
lea    0xe53(%rip),%rsi
mov    %r15,%rdi
call   1070 <safeopen@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    1285 <main+0x115>
xor    %r13d,%r13d
jmp    1221 <main+0xb1>
nopw   0x0(%rax,%rax,1)
movslq %r13d,%rax
add    $0x1,%r13d
mov    %bl,(%r15,%rax,1)
mov    %r12,%rdi
call   1050 <fgetc@plt>
mov    %eax,%ebx
mov    %r12,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    125f <main+0xef>
cmp    $0xa,%ebx
jne    1200 <main+0x90>
movslq %r13d,%rax
movb   $0x0,(%r15,%rax,1)
mov    0x8(%r14),%rsi
mov    %r15,%rdi
call   1090 <compare@plt>
xor    %r13d,%r13d
test   %rax,%rax
je     120b <main+0x9b>
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    120b <main+0x9b>
lea    0xdcf(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
jmp    128b <main+0x11b>
test   %r13d,%r13d
jle    1285 <main+0x115>
mov    %r13d,%eax
movb   $0x0,(%r15,%rax,1)
mov    0x8(%r14),%rsi
mov    %r15,%rdi
call   1090 <compare@plt>
test   %rax,%rax
je     1285 <main+0x115>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    -0x30(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"\0A\09Requires one string of characters to be input\0A\0A\00"
@NAME_MAX = global i32 0
@.str.1 = [27 x i8] c"%s/.config/jumble/wordlist\00"
@.str.2 = [5 x i8] c"HOME\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [4 x i8] c"%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 i8*
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %72
15: ; preds = %2
%16 = load i32, i32* @NAME_MAX
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %9
%19 = alloca i8, i64 %17
store i64 %17, i64* %10
%20 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = call i32* @safeopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %22, i32** %6
%23 = load i32*, i32** %6
%24 = call i32 @fgetc(i32* %23)
store i32 %24, i32* %8
store i32 0, i32* %7
br label %25
25: ; preds = %52, %15
%26 = load i32*, i32** %6
%27 = call i32 @feof(i32* %26)
%28 = icmp ne i32 %27, 0
%29 = xor i1 %28, true
br i1 %29, label %30, label %55
30: ; preds = %25
%31 = load i32, i32* %8
%32 = icmp eq i32 %31, 10
br i1 %32, label %33, label %45
33: ; preds = %30
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %19, i64 %35
store i8 0, i8* %36
store i32 0, i32* %7
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 1
%39 = load i8*, i8** %38
%40 = call i64 @compare(i8* %19, i8* %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %33
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %19)
br label %44
44: ; preds = %42, %33
br label %52
45: ; preds = %30
%46 = load i32, i32* %8
%47 = trunc i32 %46 to i8
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds i8, i8* %19, i64 %50
store i8 %47, i8* %51
br label %52
52: ; preds = %45, %44
%53 = load i32*, i32** %6
%54 = call i32 @fgetc(i32* %53)
store i32 %54, i32* %8
br label %25
55: ; preds = %25
%56 = load i32, i32* %7
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %70
58: ; preds = %55
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %19, i64 %60
store i8 0, i8* %61
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i64 @compare(i8* %19, i8* %64)
%66 = icmp ne i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %58
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %19)
br label %69
69: ; preds = %67, %58
br label %70
70: ; preds = %69, %55
store i32 0, i32* %3
%71 = load i8*, i8** %9
br label %72
72: ; preds = %70, %13
%73 = load i32, i32* %3
ret i32 %73
}

LLVM IR (-O2):
@NAME_MAX = global i32 0
@.str.1 = [27 x i8] c"%s/.config/jumble/wordlist\00"
@.str.2 = [5 x i8] c"HOME\00"
@.str.3 = [2 x i8] c"r\00"
@str = [49 x i8] c"\0A\09Requires one string of characters to be input\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %53
6: ; preds = %2
%7 = load i32, i32* @NAME_MAX
%8 = zext i32 %7 to i64
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %8
%11 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32* @safeopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @fgetc(i32* %13)
%15 = call i32 @feof(i32* %13)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %52
17: ; preds = %6
%18 = getelementptr inbounds i8*, i8** %1, i64 1
br label %19
19: ; preds = %17, %36
%20 = phi i32 [ 0, %17 ], [ %37, %36 ]
%21 = phi i32 [ %14, %17 ], [ %38, %36 ]
%22 = icmp eq i32 %21, 10
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = sext i32 %20 to i64
%25 = getelementptr inbounds i8, i8* %10, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %18
%27 = call i64 @compare(i8* %10, i8* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %36, label %29
29: ; preds = %23
%30 = call i32 @puts(i8* %10)
br label %36
31: ; preds = %19
%32 = trunc i32 %21 to i8
%33 = add nsw i32 %20, 1
%34 = sext i32 %20 to i64
%35 = getelementptr inbounds i8, i8* %10, i64 %34
store i8 %32, i8* %35
br label %36
36: ; preds = %23, %29, %31
%37 = phi i32 [ 0, %29 ], [ 0, %23 ], [ %33, %31 ]
%38 = call i32 @fgetc(i32* %13)
%39 = call i32 @feof(i32* %13)
%40 = icmp eq i32 %39, 0
br i1 %40, label %19, label %41
41: ; preds = %36
%42 = icmp sgt i32 %37, 0
br i1 %42, label %43, label %52
43: ; preds = %41
%44 = zext i32 %37 to i64
%45 = getelementptr inbounds i8, i8* %10, i64 %44
store i8 0, i8* %45
%46 = getelementptr inbounds i8*, i8** %1, i64 1
%47 = load i8*, i8** %46
%48 = call i64 @compare(i8* %10, i8* %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %43
%51 = call i32 @puts(i8* %10)
br label %52
52: ; preds = %6, %43, %50, %41
br label %53
53: ; preds = %52, %4
%54 = phi i32 [ 1, %4 ], [ 0, %52 ]
ret i32 %54
}