#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);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ menu();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  int i;
  printf("Rock Lock RLK8239 Wireless Management Interface\n");
  system("date");
  printf("\nPassword: ");
  fflush(stdout);
  char pwd[256];
  if (!fgets(pwd, 255, stdin))
    _exit(1);
  if (strcmp(pwd, "letmeinplz\n") != 0)
    return 1;
  menu();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
call   1060 <printf@plt>
lea    0xe9c(%rip),%rdi
call   1050 <system@plt>
lea    0xe95(%rip),%rdi
call   1060 <printf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e26(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%eax
jne    11e1 <main+0x71>
mov    $0x1,%edi
call   1030 <_exit@plt>
lea    -0x110(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     120a <main+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    1218 <main+0xa8>
mov    $0x0,%al
call   1040 <menu@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xe8e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe65(%rip),%rdi
call   1060 <system@plt>
lea    0xe5e(%rip),%rdi
call   1070 <printf@plt>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   10a0 <fflush@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0xff,%esi
call   1080 <fgets@plt>
test   %eax,%eax
je     1201 <main+0x81>
lea    0xe36(%rip),%rsi
mov    %rsp,%rdi
call   1090 <strcmp@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11f6 <main+0x76>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <menu@plt>
mov    %ebx,%eax
add    $0x100,%rsp
pop    %rbx
ret
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"Rock Lock RLK8239 Wireless Management Interface\0A\00"
@.str.1 = [5 x i8] c"date\00"
@.str.2 = [12 x i8] c"\0APassword: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.3 = [12 x i8] c"letmeinplz\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [256 x i8]
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 255, i32 %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %0
%14 = call i32 @_exit(i32 1)
unreachable
15: ; preds = %0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %1
br label %22
20: ; preds = %15
%21 = call i32 (...) @menu()
store i32 0, i32* %1
br label %22
22: ; preds = %20, %19
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"date\00"
@.str.2 = [12 x i8] c"\0APassword: \00"
@stdout = global i32 0
@stdin = global i32 0
@.str.3 = [12 x i8] c"letmeinplz\0A\00"
@str = [48 x i8] c"Rock Lock RLK8239 Wireless Management Interface\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 255, i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @_exit(i32 1)
unreachable
13: ; preds = %0
%14 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @menu()
br label %18
18: ; preds = %13, %16
%19 = phi i32 [ 0, %16 ], [ 1, %13 ]
ret i32 %19
}