#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*/ accepted();
int authenticate(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read(int /*<<< orphan*/, ...);
int /*<<< orphan*/ rejected();
int main(int argc, char **argv) {
  char username[9];
  char password[9];
  int authed;
  username[8] = 0;
  password[8] = 0;
  printf("Username: \n");
  read(0, username, 8);
  read(0, &authed, 1);
  printf("Password: \n");
  read(0, password, 8);
  read(0, &authed, 1);
  authed = authenticate(username, password);
  if (authed)
    accepted();
  else
    rejected();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x1a(%rbp)
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x19(%rbp),%rsi
xor    %edi,%edi
mov    $0x8,%edx
mov    $0x0,%al
call   1050 <read@plt>
xor    %edi,%edi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1050 <read@plt>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
lea    -0x22(%rbp),%rsi
xor    %edi,%edi
mov    $0x8,%edx
mov    $0x0,%al
call   1050 <read@plt>
xor    %edi,%edi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1050 <read@plt>
lea    -0x19(%rbp),%rdi
lea    -0x22(%rbp),%rsi
call   1030 <authenticate@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     11f4 <main+0xa4>
mov    $0x0,%al
call   1070 <accepted@plt>
jmp    11fb <main+0xab>
mov    $0x0,%al
call   1060 <rejected@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movb   $0x0,0x1f(%rsp)
movb   $0x0,0x16(%rsp)
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
lea    0x17(%rsp),%r14
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <read@plt>
lea    0x8(%rsp),%r15
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <read@plt>
lea    0xe69(%rip),%rdi
call   1040 <puts@plt>
lea    0xe(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <read@plt>
xor    %edi,%edi
mov    %r15,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <read@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <authenticate@plt>
mov    %eax,0x8(%rsp)
test   %eax,%eax
je     11ea <main+0x9a>
xor    %eax,%eax
call   1070 <accepted@plt>
jmp    11f1 <main+0xa1>
xor    %eax,%eax
call   1060 <rejected@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Username: \0A\00"
@.str.1 = [12 x i8] c"Password: \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [9 x i8]
%7 = alloca [9 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 8
store i8 0, i8* %9
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 8
store i8 0, i8* %10
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%13 = call i32 (i32, ...) @read(i32 0, i8* %12, i32 8)
%14 = call i32 (i32, ...) @read(i32 0, i32* %8, i32 1)
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%17 = call i32 (i32, ...) @read(i32 0, i8* %16, i32 8)
%18 = call i32 (i32, ...) @read(i32 0, i32* %8, i32 1)
%19 = getelementptr inbounds [9 x i8], [9 x i8]* %6, i64 0, i64 0
%20 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%21 = call i32 @authenticate(i8* %19, i8* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 (...) @accepted()
br label %28
26: ; preds = %2
%27 = call i32 (...) @rejected()
br label %28
28: ; preds = %26, %24
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@str = [11 x i8] c"Username: \00"
@str.2 = [11 x i8] c"Password: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [9 x i8]
%4 = alloca [9 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 8
store i8 0, i8* %9
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 8
store i8 0, i8* %10
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i32, ...) @read(i32 0, i8* %6, i32 8)
%13 = call i32 (i32, ...) @read(i32 0, i32* %5, i32 1)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
%15 = call i32 (i32, ...) @read(i32 0, i8* %7, i32 8)
%16 = call i32 (i32, ...) @read(i32 0, i32* %5, i32 1)
%17 = call i32 @authenticate(i8* %6, i8* %7)
store i32 %17, i32* %5
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %2
%20 = call i32 (...) @accepted()
br label %23
21: ; preds = %2
%22 = call i32 (...) @rejected()
br label %23
23: ; preds = %21, %19
ret i32 0
}