#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  FILE *authf =
      fopen("../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/auth", "r");
  if (authf == NULL) {
    printf("could not find auth file in "
           "../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/\n");
    return 0;
  }
  char auth[8];
  fgets(auth, 8, authf);
  fclose(authf);
  if (strcmp(auth, "no") != 0) {
    FILE *flagf;
    flagf = fopen("/problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/flag", "r");
    char flag[64];
    fgets(flag, 64, flagf);
    printf("Oh. Well the auth file doesn't say no anymore so... Here's the "
           "flag: %s",
           flag);
    fclose(flagf);
  } else {
    printf("auth file says no. So no. Just... no.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    0xec1(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a2 <main+0x52>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1235 <main+0xe5>
lea    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x8,%esi
call   1050 <fgets@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1220 <main+0xd0>
lea    0xeaa(%rip),%rdi
lea    0xe50(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x40,%esi
call   1050 <fgets@plt>
lea    -0x70(%rbp),%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
jmp    122e <main+0xde>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
lea    0xe92(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     11f9 <main+0x99>
mov    %rax,%rbx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    $0x8,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe91(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1202 <main+0xa2>
lea    0xe80(%rip),%rdi
lea    0xe74(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x40,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
lea    0xe85(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    120e <main+0xae>
lea    0xed8(%rip),%rdi
jmp    1209 <main+0xa9>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [53 x i8] c"../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/auth\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [78 x i8] c"could not find auth file in ../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/\0A\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [48 x i8] c"/problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/flag\00"
@.str.5 = [72 x i8] c"Oh. Well the auth file doesn't say no anymore so... Here's the flag: %s\00"
@.str.6 = [39 x i8] c"auth file says no. So no. Just... no.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [8 x i8]
%8 = alloca i32*
%9 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32* @fopen(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %6
%11 = load i32*, i32** %6
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %36
15: ; preds = %2
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%17 = load i32*, i32** %6
%18 = call i32 @fgets(i8* %16, i32 8, i32* %17)
%19 = load i32*, i32** %6
%20 = call i32 @fclose(i32* %19)
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %15
%25 = call i32* @fopen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %8
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%27 = load i32*, i32** %8
%28 = call i32 @fgets(i8* %26, i32 64, i32* %27)
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%31 = load i32*, i32** %8
%32 = call i32 @fclose(i32* %31)
br label %35
33: ; preds = %15
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
br label %35
35: ; preds = %33, %24
store i32 0, i32* %3
br label %36
36: ; preds = %35, %13
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [53 x i8] c"../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/auth\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"no\00"
@.str.4 = [48 x i8] c"/problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/flag\00"
@.str.5 = [72 x i8] c"Oh. Well the auth file doesn't say no anymore so... Here's the flag: %s\00"
@str = [38 x i8] c"auth file says no. So no. Just... no.\00"
@str.7 = [77 x i8] c"could not find auth file in ../../problems/fcf3cfa90b13f6ed463d61aa9b4da4ce/\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i8]
%4 = alloca [64 x i8]
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.7, i64 0, i64 0))
br label %24
9: ; preds = %2
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%11 = call i32 @fgets(i8* %10, i32 8, i32* %5)
%12 = call i32 @fclose(i32* %5)
%13 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %9
%16 = call i32* @fopen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%18 = call i32 @fgets(i8* %17, i32 64, i32* %16)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @.str.5, i64 0, i64 0), i8* %17)
%20 = call i32 @fclose(i32* %16)
br label %23
21: ; preds = %9
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %23
23: ; preds = %21, %15
br label %24
24: ; preds = %23, %7
ret i32 0
}