#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*/ _IONBF;
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
__attribute__((section(".txet"))) int check(void) {
  char buffer[1024];
  int i;
  setvbuf(stdout, NULL, _IONBF, 0);
  printf("PolyCrypt password checker v 0.1\n");
  printf("$ ");
  fgets(buffer, 1024, stdin);
  printf("Checking Password %s", buffer);
  printf(" Please wait ");
  for (i = 0; i < 20; i++) {
    putchar('.');
    sleep(1);
  }
  printf("\nCommunications Error. Please try again later :P\n");
  return 0;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1060 <setvbuf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    0x2e46(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    -0x400(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x404(%rbp)
cmpl   $0x14,-0x404(%rbp)
jge    1210 <check+0xc0>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x404(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x404(%rbp)
jmp    11db <check+0x8b>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbx
sub    $0x400,%rsp
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1070 <setvbuf@plt>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1060 <fgets@plt>
lea    0xe46(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xcdb(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [34 x i8] c"PolyCrypt password checker v 0.1\0A\00"
@.str.1 = [3 x i8] c"$ \00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"Checking Password %s\00"
@.str.3 = [14 x i8] c" Please wait \00"
@.str.4 = [50 x i8] c"\0ACommunications Error. Please try again later :P\0A\00"
define i32 @check() section ".txet" {
%1 = alloca [1024 x i8]
%2 = alloca i32
%3 = load i32, i32* @stdout
%4 = load i32, i32* @_IONBF
%5 = call i32 @setvbuf(i32 %3, i32* null, i32 %4, i32 0)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 1024, i32 %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %14
14: ; preds = %20, %0
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 20
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = call i32 @putchar(i8 signext 46)
%19 = call i32 @sleep(i32 1)
br label %20
20: ; preds = %17
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %14
23: ; preds = %14
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@.str.1 = [3 x i8] c"$ \00"
@stdin = global i32 0
@.str.2 = [21 x i8] c"Checking Password %s\00"
@.str.3 = [14 x i8] c" Please wait \00"
@str = [33 x i8] c"PolyCrypt password checker v 0.1\00"
@str.5 = [49 x i8] c"\0ACommunications Error. Please try again later :P\00"
define i32 @check() section ".txet" {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdout
%4 = load i32, i32* @_IONBF
%5 = tail call i32 @setvbuf(i32 %3, i32* null, i32 %4, i32 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %2, i32 1024, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @putchar(i8 signext 46)
%13 = call i32 @sleep(i32 1)
%14 = call i32 @putchar(i8 signext 46)
%15 = call i32 @sleep(i32 1)
%16 = call i32 @putchar(i8 signext 46)
%17 = call i32 @sleep(i32 1)
%18 = call i32 @putchar(i8 signext 46)
%19 = call i32 @sleep(i32 1)
%20 = call i32 @putchar(i8 signext 46)
%21 = call i32 @sleep(i32 1)
%22 = call i32 @putchar(i8 signext 46)
%23 = call i32 @sleep(i32 1)
%24 = call i32 @putchar(i8 signext 46)
%25 = call i32 @sleep(i32 1)
%26 = call i32 @putchar(i8 signext 46)
%27 = call i32 @sleep(i32 1)
%28 = call i32 @putchar(i8 signext 46)
%29 = call i32 @sleep(i32 1)
%30 = call i32 @putchar(i8 signext 46)
%31 = call i32 @sleep(i32 1)
%32 = call i32 @putchar(i8 signext 46)
%33 = call i32 @sleep(i32 1)
%34 = call i32 @putchar(i8 signext 46)
%35 = call i32 @sleep(i32 1)
%36 = call i32 @putchar(i8 signext 46)
%37 = call i32 @sleep(i32 1)
%38 = call i32 @putchar(i8 signext 46)
%39 = call i32 @sleep(i32 1)
%40 = call i32 @putchar(i8 signext 46)
%41 = call i32 @sleep(i32 1)
%42 = call i32 @putchar(i8 signext 46)
%43 = call i32 @sleep(i32 1)
%44 = call i32 @putchar(i8 signext 46)
%45 = call i32 @sleep(i32 1)
%46 = call i32 @putchar(i8 signext 46)
%47 = call i32 @sleep(i32 1)
%48 = call i32 @putchar(i8 signext 46)
%49 = call i32 @sleep(i32 1)
%50 = call i32 @putchar(i8 signext 46)
%51 = call i32 @sleep(i32 1)
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}