#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 */
typedef int /*<<< orphan*/ password;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ echo();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char getch();
int /*<<< orphan*/ getstr(char *);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ nocbreak();
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char *, int /*<<< orphan*/);
int main() {
  char name[256];
  char password[256];
  const char *real_password = "xyzzy";
  int i = 0;
  initscr();
  move(5, 10);
  printw("%s", "Please login:");
  move(7, 10);
  printw("%s", "User name: ");
  getstr(name);
  move(8, 10);
  printw("%s", "Password: ");
  refresh();
  cbreak();
  noecho();
  memset(password, '\0', sizeof(password));
  while (i < 256) {
    password[i] = getch();
    if (password[i] == '\n')
      break;
    move(8, 20 + i);
    addch('*');
    refresh();
    i++;
  }
  echo();
  nocbreak();
  move(11, 10);
  if (strncmp(real_password, password, strlen(real_password)) == 0)
    printw("%s", "Correct");
  else
    printw("%s", "Wrong");
  printw("%s", " password");
  refresh();
  sleep(2);
  endwin();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xdd7(%rip),%rax
mov    %rax,-0x218(%rbp)
movl   $0x0,-0x21c(%rbp)
mov    $0x0,%al
call   1070 <initscr@plt>
mov    $0x5,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xdaf(%rip),%rdi
lea    0xdab(%rip),%rsi
call   10a0 <printw@plt>
mov    $0x7,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xd8d(%rip),%rdi
lea    0xd97(%rip),%rsi
call   10a0 <printw@plt>
lea    -0x110(%rbp),%rdi
call   1090 <getstr@plt>
mov    $0x8,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xd5f(%rip),%rdi
lea    0xd75(%rip),%rsi
call   10a0 <printw@plt>
mov    $0x0,%al
call   10c0 <refresh@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    $0x0,%al
call   1100 <noecho@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
cmpl   $0x100,-0x21c(%rbp)
jge    1357 <main+0x147>
mov    $0x0,%al
call   10d0 <getch@plt>
mov    %al,%cl
movslq -0x21c(%rbp),%rax
mov    %cl,-0x210(%rbp,%rax,1)
movslq -0x21c(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0xa,%eax
jne    131f <main+0x10f>
jmp    1357 <main+0x147>
mov    -0x21c(%rbp),%esi
add    $0x14,%esi
mov    $0x8,%edi
call   1130 <move@plt>
mov    $0x2a,%edi
call   10b0 <addch@plt>
mov    $0x0,%al
call   10c0 <refresh@plt>
mov    -0x21c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21c(%rbp)
jmp    12db <main+0xcb>
mov    $0x0,%al
call   1030 <echo@plt>
mov    $0x0,%al
call   10f0 <nocbreak@plt>
mov    $0xb,%edi
mov    $0xa,%esi
call   1130 <move@plt>
mov    -0x218(%rbp),%rax
mov    %rax,-0x230(%rbp)
lea    -0x210(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x218(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x230(%rbp),%rdi
mov    -0x228(%rbp),%rsi
mov    %eax,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13d3 <main+0x1c3>
lea    0xc44(%rip),%rdi
lea    0xc65(%rip),%rsi
call   10a0 <printw@plt>
jmp    13e6 <main+0x1d6>
lea    0xc2c(%rip),%rdi
lea    0xc55(%rip),%rsi
call   10a0 <printw@plt>
lea    0xc19(%rip),%rdi
lea    0xc48(%rip),%rsi
call   10a0 <printw@plt>
mov    $0x0,%al
call   10c0 <refresh@plt>
mov    $0x2,%edi
call   1120 <sleep@plt>
mov    $0x0,%al
call   10e0 <endwin@plt>
mov    0x2bc8(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x200,%rsp
xor    %eax,%eax
call   1070 <initscr@plt>
mov    $0x5,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xdd1(%rip),%rbx
lea    0xdcd(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <printw@plt>
mov    $0x7,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xdbd(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <printw@plt>
lea    0x100(%rsp),%rdi
call   1090 <getstr@plt>
mov    $0x8,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xd9e(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <printw@plt>
xor    %eax,%eax
call   10c0 <refresh@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
xor    %eax,%eax
call   1100 <noecho@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   10d0 <getch@plt>
mov    %al,(%rsp,%rbx,1)
cmp    $0xa,%al
je     12f9 <main+0xe9>
lea    0x14(%rbx),%esi
mov    $0x8,%edi
call   1130 <move@plt>
mov    $0x2a,%edi
call   10b0 <addch@plt>
xor    %eax,%eax
call   10c0 <refresh@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    12c0 <main+0xb0>
xor    %eax,%eax
call   1030 <echo@plt>
xor    %eax,%eax
call   10f0 <nocbreak@plt>
mov    $0xb,%edi
mov    $0xa,%esi
call   1130 <move@plt>
lea    0xce3(%rip),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %eax,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
lea    0xcf2(%rip),%rax
lea    0xcf3(%rip),%rsi
cmove  %rax,%rsi
lea    0xcb8(%rip),%rbx
mov    %rbx,%rdi
call   10a0 <printw@plt>
lea    0xcdf(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <printw@plt>
xor    %eax,%eax
call   10c0 <refresh@plt>
mov    $0x2,%edi
call   1120 <sleep@plt>
xor    %eax,%eax
call   10e0 <endwin@plt>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"xyzzy\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"Please login:\00"
@.str.3 = [12 x i8] c"User name: \00"
@.str.4 = [11 x i8] c"Password: \00"
@.str.5 = [8 x i8] c"Correct\00"
@.str.6 = [6 x i8] c"Wrong\00"
@.str.7 = [10 x i8] c" password\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca i8*
%5 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
store i32 0, i32* %5
%6 = call i32 (...) @initscr()
%7 = call i32 @move(i32 5, i32 10)
%8 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @move(i32 7, i32 10)
%10 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%12 = call i32 @getstr(i8* %11)
%13 = call i32 @move(i32 8, i32 10)
%14 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (...) @refresh()
%16 = call i32 (...) @cbreak()
%17 = call i32 (...) @noecho()
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%19 = call i32 @memset(i8* %18, i8 signext 0, i32 256)
br label %20
20: ; preds = %35, %0
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 256
br i1 %22, label %23, label %43
23: ; preds = %20
%24 = call signext i8 (...) @getch()
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %26
store i8 %24, i8* %27
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %35
34: ; preds = %23
br label %43
35: ; preds = %23
%36 = load i32, i32* %5
%37 = add nsw i32 20, %36
%38 = call i32 @move(i32 8, i32 %37)
%39 = call i32 @addch(i8 signext 42)
%40 = call i32 (...) @refresh()
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %20
43: ; preds = %34, %20
%44 = call i32 (...) @echo()
%45 = call i32 (...) @nocbreak()
%46 = call i32 @move(i32 11, i32 10)
%47 = load i8*, i8** %4
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%49 = load i8*, i8** %4
%50 = call i32 @strlen(i8* %49)
%51 = call i64 @strncmp(i8* %47, i8* %48, i32 %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %43
%54 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %57
55: ; preds = %43
%56 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %57
57: ; preds = %55, %53
%58 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%59 = call i32 (...) @refresh()
%60 = call i32 @sleep(i32 2)
%61 = call i32 (...) @endwin()
%62 = load i32, i32* @EXIT_SUCCESS
%63 = call i32 @exit(i32 %62)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"xyzzy\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [14 x i8] c"Please login:\00"
@.str.3 = [12 x i8] c"User name: \00"
@.str.4 = [11 x i8] c"Password: \00"
@.str.5 = [8 x i8] c"Correct\00"
@.str.6 = [6 x i8] c"Wrong\00"
@.str.7 = [10 x i8] c" password\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (...) @initscr()
%6 = tail call i32 @move(i32 5, i32 10)
%7 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @move(i32 7, i32 10)
%9 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @getstr(i8* %3)
%11 = call i32 @move(i32 8, i32 10)
%12 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (...) @refresh()
%14 = call i32 (...) @cbreak()
%15 = call i32 (...) @noecho()
%16 = call i32 @memset(i8* %4, i8 signext 0, i32 256)
br label %17
17: ; preds = %0, %22
%18 = phi i64 [ 0, %0 ], [ %28, %22 ]
%19 = call signext i8 (...) @getch()
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %18
store i8 %19, i8* %20
%21 = icmp eq i8 %19, 10
br i1 %21, label %30, label %22
22: ; preds = %17
%23 = trunc i64 %18 to i32
%24 = add i32 %23, 20
%25 = call i32 @move(i32 8, i32 %24)
%26 = call i32 @addch(i8 signext 42)
%27 = call i32 (...) @refresh()
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, 256
br i1 %29, label %30, label %17
30: ; preds = %17, %22
%31 = call i32 (...) @echo()
%32 = call i32 (...) @nocbreak()
%33 = call i32 @move(i32 11, i32 10)
%34 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%35 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %34)
%36 = icmp eq i64 %35, 0
%37 = select i1 %36, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0)
%38 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%40 = call i32 (...) @refresh()
%41 = call i32 @sleep(i32 2)
%42 = call i32 (...) @endwin()
%43 = load i32, i32* @EXIT_SUCCESS
%44 = call i32 @exit(i32 %43)
unreachable
}