#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__ boitho_authenticat(char *, char *);
char getchar();
char *getpass(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char username[64];
  char *password;
  int i = 0;
  printf("username: ");
  while ((username[i] = getchar()) != '\n') {
    i++;
  }
  username[i] = '\0';
  password = getpass("Password: ");
  if (boitho_authenticat(username, password)) {
    printf("Main: ok\n");
  } else {
    printf("Main: sorry\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x5c(%rbp)
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movslq -0x5c(%rbp),%rcx
mov    %al,-0x50(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     118b <main+0x4b>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1162 <main+0x22>
movslq -0x5c(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    0xe70(%rip),%rdi
call   1060 <getpass@plt>
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1030 <boitho_authenticat@plt>
cmp    $0x0,%rax
je     11cc <main+0x8c>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
jmp    11d8 <main+0x98>
lea    0xe4d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xea4(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1170 <main+0x20>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xe7b(%rip),%rdi
call   1070 <getpass@plt>
mov    %rsp,%rdi
mov    %rax,%rsi
call   1030 <boitho_authenticat@plt>
test   %rax,%rax
lea    0xe6c(%rip),%rax
lea    0xe71(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"username: \00"
@.str.1 = [11 x i8] c"Password: \00"
@.str.2 = [10 x i8] c"Main: ok\0A\00"
@.str.3 = [13 x i8] c"Main: sorry\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %13, %0
%7 = call signext i8 (...) @getchar()
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 %9
store i8 %7, i8* %10
%11 = sext i8 %7 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %16
13: ; preds = %6
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 %18
store i8 0, i8* %19
%20 = call i8* @getpass(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i8* %20, i8** %3
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%22 = load i8*, i8** %3
%23 = call i64 @boitho_authenticat(i8* %21, i8* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %29
27: ; preds = %16
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [11 x i8] c"username: \00"
@.str.1 = [11 x i8] c"Password: \00"
@str = [12 x i8] c"Main: sorry\00"
@str.4 = [9 x i8] c"Main: ok\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %9, %4 ], [ 0, %0 ]
%6 = tail call signext i8 (...) @getchar()
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 %5
store i8 %6, i8* %7
%8 = icmp eq i8 %6, 10
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = and i64 %5, 4294967295
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 %11
store i8 0, i8* %12
%13 = tail call i8* @getpass(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%14 = call i64 @boitho_authenticat(i8* %2, i8* %13)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
ret i32 0
}