#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int hash_password(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char buf[0x10];
  memset(buf, 0, 0x10);
  while (fgets(buf, 0x10 - 1, stdin)) {
    if (hash_password(&buf[0]) == 0xd386d209) {
      printf("Found \"%s\"\n", buf);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
mov    $0xf,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11a9 <main+0x69>
lea    -0x20(%rbp),%rdi
call   1060 <hash_password@plt>
cmp    $0xd386d209,%eax
jne    11a4 <main+0x64>
lea    -0x20(%rbp),%rsi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e86(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11c1 <main+0x81>
mov    %rsp,%rbx
lea    0xe7f(%rip),%r14
jmp    11a5 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11c1 <main+0x81>
mov    %rbx,%rdi
call   1060 <hash_password@plt>
cmp    $0xd386d209,%eax
jne    1190 <main+0x50>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [12 x i8] c"Found \22%s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [16 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 16)
br label %5
5: ; preds = %17, %0
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i64 @fgets(i8* %6, i32 15, i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %5
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%12 = call i32 @hash_password(i8* %11)
%13 = icmp eq i32 %12, -746139127
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %10
br label %5
18: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [12 x i8] c"Found \22%s\22\0A\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 0, i32 16)
%4 = load i32, i32* @stdin
%5 = call i64 @fgets(i8* %2, i32 15, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %12
%8 = call i32 @hash_password(i8* %2)
%9 = icmp eq i32 %8, -746139127
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* @stdin
%14 = call i64 @fgets(i8* %2, i32 15, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %12, %0
ret i32 0
}