#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*/ gets(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argn, char **argv) {
  unsigned char unauthenticated = 1;
  char user[10];
  char password[10];
  while (unauthenticated) {
    puts("User:");
    gets(user);
    puts("Password:");
    gets(password);
    if ((!strcmp("root", user)) && (!strcmp("unknown_password", password)))
      unauthenticated = 0;
  }
  puts("Congratulation, you reach reserved area.");
  return 0;
}


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   $0x1,-0x11(%rbp)
cmpb   $0x0,-0x11(%rbp)
je     11b9 <main+0x89>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    -0x1b(%rbp),%rdi
call   1050 <gets@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
lea    -0x25(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b4 <main+0x84>
lea    -0x25(%rbp),%rsi
lea    0xe73(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11b4 <main+0x84>
movb   $0x0,-0x11(%rbp)
jmp    114a <main+0x1a>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xeb5(%rip),%r12
lea    0xe(%rsp),%rbx
mov    $0x746f6f72,%ebp
lea    0xeb3(%rip),%r13
jmp    1174 <main+0x44>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %al,%al
je     11b7 <main+0x87>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1050 <gets@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    0x4(%rsp),%eax
xor    %ebp,%eax
movzbl 0x8(%rsp),%ecx
or     %eax,%ecx
mov    $0x1,%al
jne    1170 <main+0x40>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
setne  %al
jmp    1170 <main+0x40>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"User:\00"
@.str.1 = [10 x i8] c"Password:\00"
@.str.2 = [5 x i8] c"root\00"
@.str.3 = [17 x i8] c"unknown_password\00"
@.str.4 = [41 x i8] c"Congratulation, you reach reserved area.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca [10 x i8]
%8 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 1, i8* %6
br label %9
9: ; preds = %27, %2
%10 = load i8, i8* %6
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%15 = call i32 @gets(i8* %14)
%16 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%18 = call i32 @gets(i8* %17)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%20 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %12
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%24 = call i32 @strcmp(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22
store i8 0, i8* %6
br label %27
27: ; preds = %26, %22, %12
br label %9
28: ; preds = %9
%29 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"User:\00"
@.str.1 = [10 x i8] c"Password:\00"
@.str.2 = [5 x i8] c"root\00"
@.str.3 = [17 x i8] c"unknown_password\00"
@.str.4 = [41 x i8] c"Congratulation, you reach reserved area.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %2, %18
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @gets(i8* %5)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @gets(i8* %6)
%12 = call i32 @bcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* dereferenceable(5) %5, i64 5)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %7
%15 = call i32 @strcmp(i8* dereferenceable(17) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i8
br label %18
18: ; preds = %14, %7
%19 = phi i8 [ 1, %7 ], [ %17, %14 ]
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %7
21: ; preds = %18
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}