#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*/ printf(char *, char *);
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++;
  }
  password[i] = '\0';
  printf("%s", password);
  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    0xdc7(%rip),%rax
mov    %rax,-0x218(%rbp)
movl   $0x0,-0x21c(%rbp)
mov    $0x0,%al
call   1080 <initscr@plt>
mov    $0x5,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xd9f(%rip),%rdi
lea    0xd9b(%rip),%rsi
call   10b0 <printw@plt>
mov    $0x7,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xd7d(%rip),%rdi
lea    0xd87(%rip),%rsi
call   10b0 <printw@plt>
lea    -0x110(%rbp),%rdi
call   10a0 <getstr@plt>
mov    $0x8,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xd4f(%rip),%rdi
lea    0xd65(%rip),%rsi
call   10b0 <printw@plt>
mov    $0x0,%al
call   10d0 <refresh@plt>
mov    $0x0,%al
call   1050 <cbreak@plt>
mov    $0x0,%al
call   1110 <noecho@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
cmpl   $0x100,-0x21c(%rbp)
jge    1367 <main+0x147>
mov    $0x0,%al
call   10e0 <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    132f <main+0x10f>
jmp    1367 <main+0x147>
mov    -0x21c(%rbp),%esi
add    $0x14,%esi
mov    $0x8,%edi
call   1140 <move@plt>
mov    $0x2a,%edi
call   10c0 <addch@plt>
mov    $0x0,%al
call   10d0 <refresh@plt>
mov    -0x21c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x21c(%rbp)
jmp    12eb <main+0xcb>
movslq -0x21c(%rbp),%rax
movb   $0x0,-0x210(%rbp,%rax,1)
lea    -0x210(%rbp),%rsi
lea    0xc82(%rip),%rdi
call   1070 <printf@plt>
mov    $0x0,%al
call   1030 <echo@plt>
mov    $0x0,%al
call   1100 <nocbreak@plt>
mov    $0xb,%edi
mov    $0xa,%esi
call   1140 <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    1405 <main+0x1e5>
lea    0xc12(%rip),%rdi
lea    0xc33(%rip),%rsi
call   10b0 <printw@plt>
jmp    1418 <main+0x1f8>
lea    0xbfa(%rip),%rdi
lea    0xc23(%rip),%rsi
call   10b0 <printw@plt>
lea    0xbe7(%rip),%rdi
lea    0xc16(%rip),%rsi
call   10b0 <printw@plt>
mov    $0x0,%al
call   10d0 <refresh@plt>
mov    $0x2,%edi
call   1130 <sleep@plt>
mov    $0x0,%al
call   10f0 <endwin@plt>
mov    0x2b96(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x200,%rsp
xor    %eax,%eax
call   1080 <initscr@plt>
mov    $0x5,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xdbd(%rip),%rbx
lea    0xdb9(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <printw@plt>
mov    $0x7,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xda9(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <printw@plt>
lea    0x100(%rsp),%rdi
call   10a0 <getstr@plt>
mov    $0x8,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xd8a(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <printw@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
xor    %eax,%eax
call   1050 <cbreak@plt>
xor    %eax,%eax
call   1110 <noecho@plt>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <getch@plt>
mov    %al,(%rsp,%rbx,1)
cmp    $0xa,%al
je     130e <main+0xee>
lea    0x14(%rbx),%esi
mov    $0x8,%edi
call   1140 <move@plt>
mov    $0x2a,%edi
call   10c0 <addch@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    12d0 <main+0xb0>
mov    $0x100,%ebx
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xceb(%rip),%r15
mov    %rsp,%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <printf@plt>
xor    %eax,%eax
call   1030 <echo@plt>
xor    %eax,%eax
call   1100 <nocbreak@plt>
mov    $0xb,%edi
mov    $0xa,%esi
call   1140 <move@plt>
lea    0xcb3(%rip),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
lea    0xcc2(%rip),%rax
lea    0xcc3(%rip),%rsi
cmove  %rax,%rsi
mov    %r15,%rdi
call   10b0 <printw@plt>
lea    0xcb6(%rip),%rsi
mov    %r15,%rdi
call   10b0 <printw@plt>
xor    %eax,%eax
call   10d0 <refresh@plt>
mov    $0x2,%edi
call   1130 <sleep@plt>
xor    %eax,%eax
call   10f0 <endwin@plt>
mov    0x2c33(%rip),%rax
mov    (%rax),%edi
call   1120 <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 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %45
store i8 0, i8* %46
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %47)
%49 = call i32 (...) @echo()
%50 = call i32 (...) @nocbreak()
%51 = call i32 @move(i32 11, i32 10)
%52 = load i8*, i8** %4
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%54 = load i8*, i8** %4
%55 = call i32 @strlen(i8* %54)
%56 = call i64 @strncmp(i8* %52, i8* %53, i32 %55)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %43
%59 = 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 %62
60: ; preds = %43
%61 = 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 %62
62: ; preds = %60, %58
%63 = 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))
%64 = call i32 (...) @refresh()
%65 = call i32 @sleep(i32 2)
%66 = call i32 (...) @endwin()
%67 = load i32, i32* @EXIT_SUCCESS
%68 = call i32 @exit(i32 %67)
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 = phi i64 [ %18, %17 ], [ 256, %22 ]
%32 = and i64 %31, 4294967295
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %32
store i8 0, i8* %33
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%35 = call i32 (...) @echo()
%36 = call i32 (...) @nocbreak()
%37 = call i32 @move(i32 11, i32 10)
%38 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%39 = call i64 @strncmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %38)
%40 = icmp eq i64 %39, 0
%41 = select i1 %40, 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)
%42 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %41)
%43 = 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))
%44 = call i32 (...) @refresh()
%45 = call i32 @sleep(i32 2)
%46 = call i32 (...) @endwin()
%47 = load i32, i32* @EXIT_SUCCESS
%48 = call i32 @exit(i32 %47)
unreachable
}