#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 */
struct termios {
  int *c_cc;
  int /*<<< orphan*/ c_lflag;
};
struct passwd {
  int *pw_passwd;
  char *pw_name;
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ pwd;

/* Variables and functions */
int /*<<< orphan*/ ECHO;
int EOF;
int /*<<< orphan*/ ICANON;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
char *crypt(char *, int *);
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ freepw(struct passwd *);
scalar_t__ get_passwd(struct passwd *);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int sh();
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, int *);
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int main(void) {
  struct termios old, raw;
  struct passwd pw = {0};
  int rc = 1, ch;
  if (get_passwd(&pw))
    err(1, "reading credentials for UID 0");
  switch (pw.pw_passwd[0]) {
  case '*':
  case '!':
    printf("The %s account is locked, allowing entry.\n", pw.pw_name);
  case 0:
    printf("Press enter for maintenance (Ctrl-D to continue) ");
    fflush(stdout);
    ch = getchar();
    if (ch == 4 || ch == EOF) {
      rc = 0;
      goto done;
    }
    goto nopass;
  case '$':
    break;
  default:
    break;
  }
  if (tcgetattr(1, &old) < 0)
    goto done;
  raw = old;
  raw.c_lflag &= ~ICANON;
  raw.c_lflag &= ~ECHO;
  raw.c_cc[VMIN] = 1;
  raw.c_cc[VTIME] = 0;
  if (tcsetattr(1, TCSANOW, &raw) < 0) {
    tcsetattr(1, TCSANOW, &old);
    goto done;
  }
  while (1) {
    char pwd[256];
    size_t i = 0;
    char *passwd;
    printf("Give %s password for maintenance (Ctrl-D to continue): ",
           pw.pw_name);
    fflush(stdout);
    do {
      ch = getchar();
      if (ch == '\n' || ch == '\r')
        break;
      if (ch == 4 || ch == EOF) {
        rc = 0;
        goto exit;
      }
      pwd[i++] = ch;
    } while (i + 1 < sizeof(pwd));
    pwd[i] = 0;
    puts("");
    passwd = crypt(pwd, pw.pw_passwd);
    if (passwd && !strcmp(passwd, pw.pw_passwd)) {
      tcsetattr(1, TCSANOW, &old);
    nopass:
      freepw(&pw);
      return sh();
    }
  }
exit:
  tcsetattr(1, TCSANOW, &old);
  puts("");
done:
  freepw(&pw);
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
movl   $0x1,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <get_passwd@plt>
cmp    $0x0,%rax
je     121d <main+0x4d>
mov    $0x1,%edi
lea    0xde8(%rip),%rsi
call   10b0 <err@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x164(%rbp)
test   %eax,%eax
je     1284 <main+0xb4>
jmp    1236 <main+0x66>
mov    -0x164(%rbp),%eax
sub    $0x21,%eax
je     1272 <main+0xa2>
jmp    124a <main+0x7a>
mov    -0x164(%rbp),%eax
sub    $0x24,%eax
je     12d7 <main+0x107>
jmp    125e <main+0x8e>
mov    -0x164(%rbp),%eax
sub    $0x2a,%eax
jne    12dc <main+0x10c>
jmp    1272 <main+0xa2>
mov    -0x38(%rbp),%rsi
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x4,-0x48(%rbp)
je     12c6 <main+0xf6>
mov    -0x48(%rbp),%eax
mov    0x2d1a(%rip),%rcx
cmp    (%rcx),%eax
jne    12d2 <main+0x102>
movl   $0x0,-0x44(%rbp)
jmp    14fc <main+0x32c>
jmp    14bc <main+0x2ec>
jmp    12e1 <main+0x111>
jmp    12e1 <main+0x111>
mov    $0x1,%edi
lea    -0x18(%rbp),%rsi
call   10e0 <tcgetattr@plt>
cmp    $0x0,%rax
jge    12fe <main+0x12e>
jmp    14fc <main+0x32c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cb9(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2c93(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    0x2c66(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2c85(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    -0x28(%rbp),%rdx
call   10f0 <tcsetattr@plt>
cmp    $0x0,%rax
jge    1399 <main+0x1c9>
mov    0x2c64(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    -0x18(%rbp),%rdx
call   10f0 <tcsetattr@plt>
jmp    14fc <main+0x32c>
jmp    139e <main+0x1ce>
movq   $0x0,-0x158(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2bfe(%rip),%rax
mov    (%rax),%edi
call   10c0 <fflush@plt>
mov    $0x0,%al
call   10a0 <getchar@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0xa,-0x48(%rbp)
je     13e7 <main+0x217>
cmpl   $0xd,-0x48(%rbp)
jne    13ec <main+0x21c>
jmp    144c <main+0x27c>
cmpl   $0x4,-0x48(%rbp)
je     1408 <main+0x238>
mov    -0x48(%rbp),%eax
mov    0x2bd8(%rip),%rcx
cmp    (%rcx),%eax
jne    1414 <main+0x244>
movl   $0x0,-0x44(%rbp)
jmp    14d9 <main+0x309>
mov    -0x48(%rbp),%eax
mov    %al,%cl
mov    -0x158(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x158(%rbp)
mov    %cl,-0x150(%rbp,%rax,1)
mov    -0x158(%rbp),%rax
add    $0x1,%rax
cmp    $0x100,%rax
jb     13c9 <main+0x1f9>
mov    -0x158(%rbp),%rax
movb   $0x0,-0x150(%rbp,%rax,1)
lea    0xbe6(%rip),%rdi
call   1040 <puts@plt>
lea    -0x150(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <crypt@plt>
mov    %rax,-0x160(%rbp)
cmpq   $0x0,-0x160(%rbp)
je     14d4 <main+0x304>
mov    -0x160(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    14d4 <main+0x304>
mov    0x2b3c(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    -0x18(%rbp),%rdx
call   10f0 <tcsetattr@plt>
lea    -0x40(%rbp),%rdi
call   10d0 <freepw@plt>
mov    $0x0,%al
call   1060 <sh@plt>
mov    %eax,-0x4(%rbp)
jmp    150b <main+0x33b>
jmp    139e <main+0x1ce>
mov    0x2b08(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
lea    -0x18(%rbp),%rdx
call   10f0 <tcsetattr@plt>
lea    0xb51(%rip),%rdi
call   1040 <puts@plt>
lea    -0x40(%rbp),%rdi
call   10d0 <freepw@plt>
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rdi
call   1040 <get_passwd@plt>
test   %rax,%rax
je     11ff <main+0x3f>
lea    0xe0b(%rip),%rsi
mov    $0x1,%edi
call   10a0 <err@plt>
mov    (%rsp),%rax
mov    (%rax),%eax
test   %eax,%eax
je     1226 <main+0x66>
cmp    $0x2a,%eax
je     1213 <main+0x53>
cmp    $0x21,%eax
jne    1279 <main+0xb9>
mov    0x8(%rsp),%rsi
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe1c(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%edi
call   10b0 <fflush@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0x4,%eax
je     13ed <main+0x22d>
mov    0x2d7d(%rip),%rcx
cmp    (%rcx),%eax
je     13ed <main+0x22d>
mov    %rsp,%rdi
call   10c0 <freepw@plt>
xor    %eax,%eax
call   1060 <sh@plt>
mov    %eax,%ebx
jmp    13f5 <main+0x235>
mov    $0x1,%ebx
lea    0x20(%rsp),%rsi
mov    $0x1,%edi
call   10d0 <tcgetattr@plt>
test   %rax,%rax
js     13ed <main+0x22d>
movups 0x20(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0x2d09(%rip),%rax
mov    (%rax),%eax
mov    0x2d30(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    %eax,0x38(%rsp)
mov    0x30(%rsp),%rax
mov    0x2d0c(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2ce3(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2d02(%rip),%r15
mov    (%r15),%esi
mov    $0x1,%ebx
lea    0x30(%rsp),%rdx
mov    $0x1,%edi
call   10e0 <tcsetattr@plt>
test   %rax,%rax
js     13db <main+0x21b>
lea    0xd6e(%rip),%r12
mov    0x2cac(%rip),%r13
lea    0x40(%rsp),%r14
mov    0x2cb8(%rip),%rbx
mov    0x8(%rsp),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edi
call   10b0 <fflush@plt>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <getchar@plt>
cmp    $0x4,%eax
je     13bb <main+0x1fb>
cmp    $0xa,%eax
je     1370 <main+0x1b0>
cmp    $0xd,%eax
je     1370 <main+0x1b0>
cmp    (%rbx),%eax
je     13bb <main+0x1fb>
mov    %al,0x40(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    $0xff,%rbp
jne    1340 <main+0x180>
mov    $0xff,%ebp
movb   $0x0,0x40(%rsp,%rbp,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rsp),%rsi
mov    %r14,%rdi
call   1050 <crypt@plt>
test   %rax,%rax
je     1320 <main+0x160>
mov    (%rsp),%rsi
mov    %rax,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1320 <main+0x160>
mov    (%r15),%esi
lea    0x20(%rsp),%rdx
mov    $0x1,%edi
call   10e0 <tcsetattr@plt>
jmp    1263 <main+0xa3>
mov    (%r15),%esi
lea    0x20(%rsp),%rdx
mov    $0x1,%edi
call   10e0 <tcsetattr@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
jmp    13ed <main+0x22d>
mov    (%r15),%esi
lea    0x20(%rsp),%rdx
mov    $0x1,%edi
call   10e0 <tcsetattr@plt>
mov    %rsp,%rdi
call   10c0 <freepw@plt>
mov    %ebx,%eax
add    $0x148,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32*, i32 }
%struct.passwd = type { i32*, i8*, i32 }
@.str = [30 x i8] c"reading credentials for UID 0\00"
@.str.1 = [43 x i8] c"The %s account is locked, allowing entry.\0A\00"
@.str.2 = [50 x i8] c"Press enter for maintenance (Ctrl-D to continue) \00"
@stdout = global i32 0
@EOF = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.3 = [56 x i8] c"Give %s password for maintenance (Ctrl-D to continue): \00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.termios
%3 = alloca %struct.termios
%4 = alloca %struct.passwd
%5 = alloca i32
%6 = alloca i32
%7 = alloca [256 x i8]
%8 = alloca i64
%9 = alloca i8*
store i32 0, i32* %1
%10 = bitcast %struct.passwd* %4 to i8*
store i32 1, i32* %5
%11 = call i64 @get_passwd(%struct.passwd* %4)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @err(i32 1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %0
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 0
%17 = load i32*, i32** %16
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
switch i32 %19, label %38 [
i32 42, label %20
i32 33, label %20
i32 0, label %24
i32 36, label %37
]
20: ; preds = %15, %15
%21 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 1
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %15, %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%26 = load i32, i32* @stdout
%27 = call i32 @fflush(i32 %26)
%28 = call i32 (...) @getchar()
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 4
br i1 %30, label %35, label %31
31: ; preds = %24
%32 = load i32, i32* %6
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %31, %24
store i32 0, i32* %5
br label %130
36: ; preds = %31
br label %122
37: ; preds = %15
br label %39
38: ; preds = %15
br label %39
39: ; preds = %38, %37
%40 = call i64 @tcgetattr(i32 1, %struct.termios* %2)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %39
br label %130
43: ; preds = %39
%44 = bitcast %struct.termios* %3 to i8*
%45 = bitcast %struct.termios* %2 to i8*
%46 = load i32, i32* @ICANON
%47 = xor i32 %46, -1
%48 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
%49 = load i32, i32* %48
%50 = and i32 %49, %47
store i32 %50, i32* %48
%51 = load i32, i32* @ECHO
%52 = xor i32 %51, -1
%53 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
%54 = load i32, i32* %53
%55 = and i32 %54, %52
store i32 %55, i32* %53
%56 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%57 = load i32*, i32** %56
%58 = load i64, i64* @VMIN
%59 = getelementptr inbounds i32, i32* %57, i64 %58
store i32 1, i32* %59
%60 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%61 = load i32*, i32** %60
%62 = load i64, i64* @VTIME
%63 = getelementptr inbounds i32, i32* %61, i64 %62
store i32 0, i32* %63
%64 = load i32, i32* @TCSANOW
%65 = call i64 @tcsetattr(i32 1, i32 %64, %struct.termios* %3)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %70
67: ; preds = %43
%68 = load i32, i32* @TCSANOW
%69 = call i64 @tcsetattr(i32 1, i32 %68, %struct.termios* %2)
br label %130
70: ; preds = %43
br label %71
71: ; preds = %70, %125
store i64 0, i64* %8
%72 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 1
%73 = load i8*, i8** %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i8* %73)
%75 = load i32, i32* @stdout
%76 = call i32 @fflush(i32 %75)
br label %77
77: ; preds = %99, %71
%78 = call i32 (...) @getchar()
store i32 %78, i32* %6
%79 = load i32, i32* %6
%80 = icmp eq i32 %79, 10
br i1 %80, label %84, label %81
81: ; preds = %77
%82 = load i32, i32* %6
%83 = icmp eq i32 %82, 13
br i1 %83, label %84, label %85
84: ; preds = %81, %77
br label %103
85: ; preds = %81
%86 = load i32, i32* %6
%87 = icmp eq i32 %86, 4
br i1 %87, label %92, label %88
88: ; preds = %85
%89 = load i32, i32* %6
%90 = load i32, i32* @EOF
%91 = icmp eq i32 %89, %90
br i1 %91, label %92, label %93
92: ; preds = %88, %85
store i32 0, i32* %5
br label %126
93: ; preds = %88
%94 = load i32, i32* %6
%95 = trunc i32 %94 to i8
%96 = load i64, i64* %8
%97 = add i64 %96, 1
store i64 %97, i64* %8
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %96
store i8 %95, i8* %98
br label %99
99: ; preds = %93
%100 = load i64, i64* %8
%101 = add i64 %100, 1
%102 = icmp ult i64 %101, 256
br i1 %102, label %77, label %103
103: ; preds = %99, %84
%104 = load i64, i64* %8
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 %104
store i8 0, i8* %105
%106 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%107 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%108 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 0
%109 = load i32*, i32** %108
%110 = call i8* @crypt(i8* %107, i32* %109)
store i8* %110, i8** %9
%111 = load i8*, i8** %9
%112 = icmp ne i8* %111, null
br i1 %112, label %113, label %125
113: ; preds = %103
%114 = load i8*, i8** %9
%115 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 0
%116 = load i32*, i32** %115
%117 = call i32 @strcmp(i8* %114, i32* %116)
%118 = icmp ne i32 %117, 0
br i1 %118, label %125, label %119
119: ; preds = %113
%120 = load i32, i32* @TCSANOW
%121 = call i64 @tcsetattr(i32 1, i32 %120, %struct.termios* %2)
br label %122
122: ; preds = %119, %36
%123 = call i32 @freepw(%struct.passwd* %4)
%124 = call i32 (...) @sh()
store i32 %124, i32* %1
br label %133
125: ; preds = %113, %103
br label %71
126: ; preds = %92
%127 = load i32, i32* @TCSANOW
%128 = call i64 @tcsetattr(i32 1, i32 %127, %struct.termios* %2)
%129 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %130
130: ; preds = %126, %67, %42, %35
%131 = call i32 @freepw(%struct.passwd* %4)
%132 = load i32, i32* %5
store i32 %132, i32* %1
br label %133
133: ; preds = %130, %122
%134 = load i32, i32* %1
ret i32 %134
}

LLVM IR (-O2):
%struct.termios = type { i32*, i32 }
%struct.passwd = type { i32*, i8*, i32 }
@.str = [30 x i8] c"reading credentials for UID 0\00"
@.str.1 = [43 x i8] c"The %s account is locked, allowing entry.\0A\00"
@.str.2 = [50 x i8] c"Press enter for maintenance (Ctrl-D to continue) \00"
@stdout = global i32 0
@EOF = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.3 = [56 x i8] c"Give %s password for maintenance (Ctrl-D to continue): \00"
define i32 @main() {
%1 = alloca %struct.termios
%2 = alloca %struct.termios
%3 = alloca %struct.passwd
%4 = alloca [256 x i8]
%5 = bitcast %struct.termios* %1 to i8*
%6 = bitcast %struct.termios* %2 to i8*
%7 = bitcast %struct.passwd* %3 to i8*
%8 = call i64 @get_passwd(%struct.passwd* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %0
%11 = call i32 @err(i32 1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %0
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %3, i64 0, i32 0
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
switch i32 %15, label %29 [
i32 42, label %16
i32 33, label %16
i32 0, label %20
]
16: ; preds = %12, %12
%17 = getelementptr inbounds %struct.passwd, %struct.passwd* %3, i64 0, i32 1
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %12, %16
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = call i32 @fflush(i32 %22)
%24 = call i32 (...) @getchar()
%25 = icmp eq i32 %24, 4
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %24, %26
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %93, label %90
29: ; preds = %12
%30 = call i64 @tcgetattr(i32 1, %struct.termios* %1)
%31 = icmp slt i64 %30, 0
br i1 %31, label %93, label %32
32: ; preds = %29
%33 = load i32, i32* @ICANON
%34 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 1
%35 = load i32, i32* %34
%36 = load i32, i32* @ECHO
%37 = or i32 %33, %36
%38 = xor i32 %37, -1
%39 = and i32 %35, %38
store i32 %39, i32* %34
%40 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 0
%41 = load i32*, i32** %40
%42 = load i64, i64* @VMIN
%43 = getelementptr inbounds i32, i32* %41, i64 %42
store i32 1, i32* %43
%44 = load i64, i64* @VTIME
%45 = getelementptr inbounds i32, i32* %41, i64 %44
store i32 0, i32* %45
%46 = load i32, i32* @TCSANOW
%47 = call i64 @tcsetattr(i32 1, i32 %46, %struct.termios* %2)
%48 = icmp slt i64 %47, 0
br i1 %48, label %52, label %49
49: ; preds = %32
%50 = getelementptr inbounds %struct.passwd, %struct.passwd* %3, i64 0, i32 1
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
br label %55
52: ; preds = %32
%53 = load i32, i32* @TCSANOW
%54 = call i64 @tcsetattr(i32 1, i32 %53, %struct.termios* %1)
br label %93
55: ; preds = %86, %49
%56 = load i8*, i8** %50
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.3, i64 0, i64 0), i8* %56)
%58 = load i32, i32* @stdout
%59 = call i32 @fflush(i32 %58)
br label %60
60: ; preds = %70, %55
%61 = phi i64 [ 0, %55 ], [ %72, %70 ]
%62 = call i32 (...) @getchar()
switch i32 %62, label %63 [
i32 13, label %75
i32 10, label %75
i32 4, label %66
]
63: ; preds = %60
%64 = load i32, i32* @EOF
%65 = icmp eq i32 %62, %64
br i1 %65, label %66, label %70
66: ; preds = %60, %63
%67 = load i32, i32* @TCSANOW
%68 = call i64 @tcsetattr(i32 1, i32 %67, %struct.termios* %1)
%69 = call i32 @putchar(i32 10)
br label %93
70: ; preds = %63
%71 = trunc i32 %62 to i8
%72 = add nuw nsw i64 %61, 1
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %61
store i8 %71, i8* %73
%74 = icmp eq i64 %72, 255
br i1 %74, label %75, label %60
75: ; preds = %60, %60, %70
%76 = phi i64 [ %61, %60 ], [ 255, %70 ], [ %61, %60 ]
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %76
store i8 0, i8* %77
%78 = call i32 @putchar(i32 10)
%79 = load i32*, i32** %13
%80 = call i8* @crypt(i8* %51, i32* %79)
%81 = icmp eq i8* %80, null
br i1 %81, label %86, label %82
82: ; preds = %75
%83 = load i32*, i32** %13
%84 = call i32 @strcmp(i8* %80, i32* %83)
%85 = icmp eq i32 %84, 0
br i1 %85, label %87, label %86
86: ; preds = %82, %75
br label %55
87: ; preds = %82
%88 = load i32, i32* @TCSANOW
%89 = call i64 @tcsetattr(i32 1, i32 %88, %struct.termios* %1)
br label %90
90: ; preds = %20, %87
%91 = call i32 @freepw(%struct.passwd* %3)
%92 = call i32 (...) @sh()
br label %96
93: ; preds = %20, %29, %66, %52
%94 = phi i32 [ 1, %29 ], [ 1, %52 ], [ 0, %66 ], [ 0, %20 ]
%95 = call i32 @freepw(%struct.passwd* %3)
br label %96
96: ; preds = %93, %90
%97 = phi i32 [ %94, %93 ], [ %92, %90 ]
ret i32 %97
}