#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 /*<<< orphan*/);
scalar_t__ mystrcmp(char *, char *);
int readn(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ system(char *);
void __attribute__((no)) pass_func(char *admin_password) {
  char mypassword[128] = {0};
  if (readn(0, mypassword, 4096) % 8 != 0)
    _exit(0);
  if (mystrcmp(mypassword, admin_password)) {
    _exit(system("cat flag.txt"));
  }
}


x86 assembly (clang, -O0):
<pass_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1060 <memset@plt>
lea    -0x90(%rbp),%rsi
xor    %edi,%edi
mov    $0x1000,%edx
call   1070 <readn@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     119d <pass_func+0x4d>
xor    %edi,%edi
call   1040 <_exit@plt>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <mystrcmp@plt>
cmp    $0x0,%rax
je     11ca <pass_func+0x7a>
lea    0xe42(%rip),%rdi
call   1050 <system@plt>
mov    %eax,%edi
call   1040 <_exit@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pass_func>:
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
xor    %edi,%edi
mov    $0x1000,%edx
call   1060 <readn@plt>
test   $0x7,%al
jne    11a1 <pass_func+0x61>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <mystrcmp@plt>
test   %rax,%rax
jne    11a8 <pass_func+0x68>
add    $0x80,%rsp
pop    %rbx
ret
xor    %edi,%edi
call   1040 <_exit@plt>
lea    0xe51(%rip),%rdi
call   1050 <system@plt>
mov    %eax,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"cat flag.txt\00"
define void @pass_func(i8* %0) {
%2 = alloca i8*
%3 = alloca [128 x i8]
store i8* %0, i8** %2
%4 = bitcast [128 x i8]* %3 to i8*
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = call i32 @readn(i32 0, i8* %5, i32 4096)
%7 = srem i32 %6, 8
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @_exit(i32 0)
unreachable
11: ; preds = %1
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%13 = load i8*, i8** %2
%14 = call i64 @mystrcmp(i8* %12, i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @_exit(i32 %17)
unreachable
19: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"cat flag.txt\00"
define void @pass_func(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i32 @readn(i32 0, i8* %3, i32 4096)
%5 = and i32 %4, 7
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @_exit(i32 0)
unreachable
9: ; preds = %1
%10 = call i64 @mystrcmp(i8* %3, i8* %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @_exit(i32 %13)
unreachable
15: ; preds = %9
ret void
}