#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int verify_pw(char *);
int main(int argc, char *argv[]) {
  int flag = 0;
  char pw[1024];
  while (1) {
    printf("input ur password:\n");
    scanf("%s", pw);
    flag = verify_pw(pw);
    if (flag) {
      printf("incorrect!\n");
    } else {
      printf("bingo!\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x420(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x420(%rbp),%rdi
call   1040 <verify_pw@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1199 <main+0x69>
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    11aa <main+0x7a>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
jmp    11af <main+0x7f>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <verify_pw@plt>
test   %eax,%eax
je     11a7 <main+0x77>
lea    0xeae(%rip),%r14
lea    0xe8d(%rip),%r15
lea    0xe83(%rip),%r12
mov    %rsp,%rbx
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <verify_pw@plt>
test   %eax,%eax
jne    1180 <main+0x50>
lea    0xe68(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"input ur password:\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"incorrect!\0A\00"
@.str.3 = [8 x i8] c"bingo!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %8
8: ; preds = %2, %20
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%13 = call i32 @verify_pw(i8* %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %20
18: ; preds = %8
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %21
20: ; preds = %16
br label %8
21: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [19 x i8] c"input ur password:\00"
@str.4 = [7 x i8] c"bingo!\00"
@str.5 = [11 x i8] c"incorrect!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i32 @verify_pw(i8* %4)
%8 = icmp eq i32 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2, %9
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0))
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%13 = call i32 @verify_pw(i8* %4)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9, %2
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}