#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*/ createpass(char *);
char getch();
scalar_t__ passwd();
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ slowprint(char *, int);
scalar_t__ strcmp(char *, char *);
int changepasswd(void) {
  char a[20], b;
  int i;
  char a1[20];
  if (passwd()) {
  enterpasswd:
    slowprint("Enter new password: ", 30);
    i = 0;
    while (((b = getch()) != 13) && (i < 20)) {
      if (b != 127) {
        putchar('*');
        a[i] = b;
        i++;
      } else {
        if (i > 0) {
          i--;
          putchar('\b');
          putchar(' ');
          putchar('\b');
        }
      }
    }
    a[i] = '\0';
    putchar('\n');
    slowprint("Corfirm           : ", 30);
    i = 0;
    while (((b = getch()) != 13) && (i < 20)) {
      if (b != 127) {
        putchar('*');
        a1[i] = b;
        i++;
      } else {
        if (i > 0) {
          i--;
          putchar('\b');
          putchar(' ');
          putchar('\b');
        }
      }
    }
    a1[i] = '\0';
    putchar('\n');
    if (strcmp(a, a1) == 0) {
      createpass(a);
      slowprint("\e[31mChange password successfully!\e[39m\n", 30);
      return 1;
    } else {
      slowprint("\e[31mPassword not Match, Enter again.\e[39m\n", 30);
      goto enterpasswd;
    }
  } else {
    slowprint("\e[31mPassword incorrect. Try again.\e[0m\n", 30);
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<changepasswd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0x0,%al
call   1040 <passwd@plt>
cmp    $0x0,%rax
je     1367 <changepasswd+0x207>
jmp    117e <changepasswd+0x1e>
lea    0xe7b(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
movl   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1070 <getch@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x41(%rbp)
je     11bb <changepasswd+0x5b>
cmpl   $0x14,-0x28(%rbp)
setl   %al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11cb <changepasswd+0x6b>
jmp    1236 <changepasswd+0xd6>
movsbl -0x21(%rbp),%eax
cmp    $0x7f,%eax
je     11fb <changepasswd+0x9b>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x21(%rbp),%cl
movslq -0x28(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1231 <changepasswd+0xd1>
cmpl   $0x0,-0x28(%rbp)
jle    122c <changepasswd+0xcc>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
jmp    1231 <changepasswd+0xd1>
jmp    1196 <changepasswd+0x36>
movslq -0x28(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc5(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
movl   $0x0,-0x28(%rbp)
mov    $0x0,%al
call   1070 <getch@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xd,%ecx
mov    %al,-0x42(%rbp)
je     1286 <changepasswd+0x126>
cmpl   $0x14,-0x28(%rbp)
setl   %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
test   $0x1,%al
jne    1296 <changepasswd+0x136>
jmp    1301 <changepasswd+0x1a1>
movsbl -0x21(%rbp),%eax
cmp    $0x7f,%eax
je     12c6 <changepasswd+0x166>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x21(%rbp),%cl
movslq -0x28(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12fc <changepasswd+0x19c>
cmpl   $0x0,-0x28(%rbp)
jle    12f7 <changepasswd+0x197>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
jmp    12fc <changepasswd+0x19c>
jmp    1261 <changepasswd+0x101>
movslq -0x28(%rbp),%rax
movb   $0x0,-0x40(%rbp,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1351 <changepasswd+0x1f1>
lea    -0x20(%rbp),%rdi
call   1050 <createpass@plt>
lea    0xcef(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
movl   $0x1,-0x4(%rbp)
jmp    137f <changepasswd+0x21f>
lea    0xcfb(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
jmp    117e <changepasswd+0x1e>
lea    0xd11(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changepasswd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <passwd@plt>
test   %rax,%rax
je     1301 <changepasswd+0x1a1>
lea    0xe8e(%rip),%r15
mov    %rsp,%r12
lea    0x20(%rsp),%r14
nop
lea    0xe69(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
xor    %eax,%eax
call   1070 <getch@plt>
mov    $0x0,%ebp
cmp    $0xd,%al
je     1215 <changepasswd+0xb5>
mov    %eax,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x7f,%bl
jne    11f0 <changepasswd+0x90>
test   %ebp,%ebp
jle    1203 <changepasswd+0xa3>
add    $0xffffffff,%ebp
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
jmp    1203 <changepasswd+0xa3>
nopl   0x0(%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
movslq %ebp,%rbp
mov    %bl,(%rsp,%rbp,1)
add    $0x1,%ebp
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0xd,%al
je     1215 <changepasswd+0xb5>
mov    %eax,%ebx
cmp    $0x14,%ebp
jl     11c0 <changepasswd+0x60>
movslq %ebp,%rax
movb   $0x0,(%rsp,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r15,%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
xor    %r13d,%r13d
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0xd,%al
je     12a9 <changepasswd+0x149>
mov    %eax,%ebx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
cmp    $0x7f,%bl
jne    1280 <changepasswd+0x120>
test   %r13d,%r13d
jle    1296 <changepasswd+0x136>
add    $0xffffffff,%r13d
mov    $0x8,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x8,%edi
call   1030 <putchar@plt>
jmp    1296 <changepasswd+0x136>
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
movslq %r13d,%r13
mov    %bl,0x20(%rsp,%r13,1)
add    $0x1,%r13d
xor    %eax,%eax
call   1070 <getch@plt>
cmp    $0xd,%al
je     12a9 <changepasswd+0x149>
mov    %eax,%ebx
cmp    $0x14,%r13d
jl     1250 <changepasswd+0xf0>
movslq %r13d,%rax
movb   $0x0,0x20(%rsp,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     12e1 <changepasswd+0x181>
lea    0xd81(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
jmp    1190 <changepasswd+0x30>
mov    %rsp,%rdi
call   1050 <createpass@plt>
lea    0xd3a(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
mov    $0x1,%ebx
jmp    1312 <changepasswd+0x1b2>
lea    0xd77(%rip),%rdi
mov    $0x1e,%esi
call   1080 <slowprint@plt>
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter new password: \00"
@.str.1 = [21 x i8] c"Corfirm : \00"
@.str.2 = [41 x i8] c"\1B[31mChange password successfully!\1B[39m\0A\00"
@.str.3 = [44 x i8] c"\1B[31mPassword not Match, Enter again.\1B[39m\0A\00"
@.str.4 = [41 x i8] c"\1B[31mPassword incorrect. Try again.\1B[0m\0A\00"
define i32 @changepasswd() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca i8
%4 = alloca i32
%5 = alloca [20 x i8]
%6 = call i64 (...) @passwd()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %96
8: ; preds = %0
br label %9
9: ; preds = %94, %8
%10 = call i32 @slowprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 30)
store i32 0, i32* %4
br label %11
11: ; preds = %42, %9
%12 = call signext i8 (...) @getch()
store i8 %12, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 20
br label %18
18: ; preds = %15, %11
%19 = phi i1 [ false, %11 ], [ %17, %15 ]
br i1 %19, label %20, label %43
20: ; preds = %18
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 127
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = call i32 @putchar(i8 signext 42)
%26 = load i8, i8* %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %28
store i8 %26, i8* %29
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %42
32: ; preds = %20
%33 = load i32, i32* %4
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %32
%36 = load i32, i32* %4
%37 = add nsw i32 %36, -1
store i32 %37, i32* %4
%38 = call i32 @putchar(i8 signext 8)
%39 = call i32 @putchar(i8 signext 32)
%40 = call i32 @putchar(i8 signext 8)
br label %41
41: ; preds = %35, %32
br label %42
42: ; preds = %41, %24
br label %11
43: ; preds = %18
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %45
store i8 0, i8* %46
%47 = call i32 @putchar(i8 signext 10)
%48 = call i32 @slowprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 30)
store i32 0, i32* %4
br label %49
49: ; preds = %80, %43
%50 = call signext i8 (...) @getch()
store i8 %50, i8* %3
%51 = sext i8 %50 to i32
%52 = icmp ne i32 %51, 13
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load i32, i32* %4
%55 = icmp slt i32 %54, 20
br label %56
56: ; preds = %53, %49
%57 = phi i1 [ false, %49 ], [ %55, %53 ]
br i1 %57, label %58, label %81
58: ; preds = %56
%59 = load i8, i8* %3
%60 = sext i8 %59 to i32
%61 = icmp ne i32 %60, 127
br i1 %61, label %62, label %70
62: ; preds = %58
%63 = call i32 @putchar(i8 signext 42)
%64 = load i8, i8* %3
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %66
store i8 %64, i8* %67
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
store i32 %69, i32* %4
br label %80
70: ; preds = %58
%71 = load i32, i32* %4
%72 = icmp sgt i32 %71, 0
br i1 %72, label %73, label %79
73: ; preds = %70
%74 = load i32, i32* %4
%75 = add nsw i32 %74, -1
store i32 %75, i32* %4
%76 = call i32 @putchar(i8 signext 8)
%77 = call i32 @putchar(i8 signext 32)
%78 = call i32 @putchar(i8 signext 8)
br label %79
79: ; preds = %73, %70
br label %80
80: ; preds = %79, %62
br label %49
81: ; preds = %56
%82 = load i32, i32* %4
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %83
store i8 0, i8* %84
%85 = call i32 @putchar(i8 signext 10)
%86 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%87 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%88 = call i64 @strcmp(i8* %86, i8* %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %81
%91 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%92 = call i32 @createpass(i8* %91)
%93 = call i32 @slowprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 30)
store i32 1, i32* %1
br label %98
94: ; preds = %81
%95 = call i32 @slowprint(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 30)
br label %9
96: ; preds = %0
%97 = call i32 @slowprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 30)
store i32 0, i32* %1
br label %98
98: ; preds = %96, %90
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter new password: \00"
@.str.1 = [21 x i8] c"Corfirm : \00"
@.str.2 = [41 x i8] c"\1B[31mChange password successfully!\1B[39m\0A\00"
@.str.3 = [44 x i8] c"\1B[31mPassword not Match, Enter again.\1B[39m\0A\00"
@.str.4 = [41 x i8] c"\1B[31mPassword incorrect. Try again.\1B[0m\0A\00"
define i32 @changepasswd() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i64 (...) @passwd()
%6 = icmp eq i64 %5, 0
br i1 %6, label %75, label %7
7: ; preds = %0, %73
%8 = call i32 @slowprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 30)
%9 = call signext i8 (...) @getch()
%10 = icmp eq i8 %9, 13
br i1 %10, label %33, label %11
11: ; preds = %7, %27
%12 = phi i8 [ %29, %27 ], [ %9, %7 ]
%13 = phi i32 [ %28, %27 ], [ 0, %7 ]
%14 = icmp eq i8 %12, 127
br i1 %14, label %20, label %15
15: ; preds = %11
%16 = call i32 @putchar(i8 signext 42)
%17 = sext i32 %13 to i64
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %17
store i8 %12, i8* %18
%19 = add nsw i32 %13, 1
br label %27
20: ; preds = %11
%21 = icmp sgt i32 %13, 0
br i1 %21, label %22, label %27
22: ; preds = %20
%23 = add nsw i32 %13, -1
%24 = call i32 @putchar(i8 signext 8)
%25 = call i32 @putchar(i8 signext 32)
%26 = call i32 @putchar(i8 signext 8)
br label %27
27: ; preds = %20, %22, %15
%28 = phi i32 [ %19, %15 ], [ %23, %22 ], [ %13, %20 ]
%29 = call signext i8 (...) @getch()
%30 = icmp ne i8 %29, 13
%31 = icmp slt i32 %28, 20
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %11, label %33
33: ; preds = %27, %7
%34 = phi i32 [ 0, %7 ], [ %28, %27 ]
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %35
store i8 0, i8* %36
%37 = call i32 @putchar(i8 signext 10)
%38 = call i32 @slowprint(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 30)
%39 = call signext i8 (...) @getch()
%40 = icmp eq i8 %39, 13
br i1 %40, label %63, label %41
41: ; preds = %33, %57
%42 = phi i8 [ %59, %57 ], [ %39, %33 ]
%43 = phi i32 [ %58, %57 ], [ 0, %33 ]
%44 = icmp eq i8 %42, 127
br i1 %44, label %50, label %45
45: ; preds = %41
%46 = call i32 @putchar(i8 signext 42)
%47 = sext i32 %43 to i64
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %47
store i8 %42, i8* %48
%49 = add nsw i32 %43, 1
br label %57
50: ; preds = %41
%51 = icmp sgt i32 %43, 0
br i1 %51, label %52, label %57
52: ; preds = %50
%53 = add nsw i32 %43, -1
%54 = call i32 @putchar(i8 signext 8)
%55 = call i32 @putchar(i8 signext 32)
%56 = call i32 @putchar(i8 signext 8)
br label %57
57: ; preds = %50, %52, %45
%58 = phi i32 [ %49, %45 ], [ %53, %52 ], [ %43, %50 ]
%59 = call signext i8 (...) @getch()
%60 = icmp ne i8 %59, 13
%61 = icmp slt i32 %58, 20
%62 = select i1 %60, i1 %61, i1 false
br i1 %62, label %41, label %63
63: ; preds = %57, %33
%64 = phi i32 [ 0, %33 ], [ %58, %57 ]
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %65
store i8 0, i8* %66
%67 = call i32 @putchar(i8 signext 10)
%68 = call i64 @strcmp(i8* %3, i8* %4)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %63
%71 = call i32 @createpass(i8* %3)
%72 = call i32 @slowprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 30)
br label %77
73: ; preds = %63
%74 = call i32 @slowprint(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 30)
br label %7
75: ; preds = %0
%76 = tail call i32 @slowprint(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i32 30)
br label %77
77: ; preds = %75, %70
%78 = phi i32 [ 1, %70 ], [ 0, %75 ]
ret i32 %78
}