#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__ isalpha(char);
scalar_t__ isdigit(char);
scalar_t__ islower(char);
scalar_t__ ispunct(char);
scalar_t__ isupper(char);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char upasswd[30];
  int flag = 0, low = 0;
  printf("Enter a password you want to check \n");
  scanf("%s", upasswd);
  for (int i = 0; upasswd[i] != '\0'; i++) {
    if (isalpha(upasswd[i])) {
      if (isupper(upasswd[i])) {
        flag++;
      }
      if (islower(upasswd[i])) {
        low++;
      }
    }
    if (isdigit(upasswd[i])) {
      flag++;
    }
    if (ispunct(upasswd[i])) {
      flag++;
    }
  }
  if (flag >= 3 && low >= 1) {
    printf("\nYou've made a nice passwd");
  } else {
    printf("\n You've made a CRAP passwd");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe81(%rip),%rdi
call   1090 <scanf@plt>
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1276 <main+0x106>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1070 <isalpha@plt>
cmp    $0x0,%rax
je     1221 <main+0xb1>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1080 <isupper@plt>
cmp    $0x0,%rax
je     11fb <main+0x8b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1040 <islower@plt>
cmp    $0x0,%rax
je     121c <main+0xac>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1221 <main+0xb1>
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1242 <main+0xd2>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%edi
call   1060 <ispunct@plt>
cmp    $0x0,%rax
je     1263 <main+0xf3>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1268 <main+0xf8>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11b0 <main+0x40>
cmpl   $0x3,-0x34(%rbp)
jl     129b <main+0x12b>
cmpl   $0x1,-0x38(%rbp)
jl     129b <main+0x12b>
lea    0xd97(%rip),%rdi
call   1050 <printf@plt>
jmp    12a7 <main+0x137>
lea    0xda1(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xeab(%rip),%rdi
call   1050 <puts@plt>
lea    0xe65(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   10a0 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     122b <main+0xab>
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    11ea <main+0x6a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
movsbl (%rbx),%edi
call   1070 <ispunct@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1218 <main+0x98>
movsbl %al,%edi
call   1080 <isalpha@plt>
test   %rax,%rax
je     11c0 <main+0x40>
movsbl (%rbx),%edi
call   1090 <isupper@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
movsbl (%rbx),%edi
call   1040 <islower@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
jmp    11c0 <main+0x40>
cmp    $0x3,%ebp
jl     122b <main+0xab>
test   %r14d,%r14d
jle    122b <main+0xab>
lea    0xdda(%rip),%rdi
jmp    1232 <main+0xb2>
lea    0xdec(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter a password you want to check \0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [27 x i8] c"\0AYou've made a nice passwd\00"
@.str.3 = [28 x i8] c"\0A You've made a CRAP passwd\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
store i32 0, i32* %5
br label %9
9: ; preds = %65, %0
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %68
16: ; preds = %9
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i64 @isalpha(i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %44
23: ; preds = %16
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i64 @isupper(i8 signext %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %23
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %33
33: ; preds = %30, %23
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i64 @islower(i8 signext %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = load i32, i32* %4
%42 = add nsw i32 %41, 1
store i32 %42, i32* %4
br label %43
43: ; preds = %40, %33
br label %44
44: ; preds = %43, %16
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = call i64 @isdigit(i8 signext %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %44
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %54
54: ; preds = %51, %44
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = call i64 @ispunct(i8 signext %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = load i32, i32* %3
%63 = add nsw i32 %62, 1
store i32 %63, i32* %3
br label %64
64: ; preds = %61, %54
br label %65
65: ; preds = %64
%66 = load i32, i32* %5
%67 = add nsw i32 %66, 1
store i32 %67, i32* %5
br label %9
68: ; preds = %9
%69 = load i32, i32* %3
%70 = icmp sge i32 %69, 3
br i1 %70, label %71, label %76
71: ; preds = %68
%72 = load i32, i32* %4
%73 = icmp sge i32 %72, 1
br i1 %73, label %74, label %76
74: ; preds = %71
%75 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
br label %78
76: ; preds = %71, %68
%77 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
br label %78
78: ; preds = %76, %74
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [27 x i8] c"\0AYou've made a nice passwd\00"
@.str.3 = [28 x i8] c"\0A You've made a CRAP passwd\00"
@str = [36 x i8] c"Enter a password you want to check \00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %47, label %11
7: ; preds = %30
%8 = icmp sgt i32 %42, 2
%9 = icmp sgt i32 %32, 0
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %48, label %47
11: ; preds = %0, %30
%12 = phi i64 [ %43, %30 ], [ 0, %0 ]
%13 = phi i8 [ %45, %30 ], [ %5, %0 ]
%14 = phi i8* [ %44, %30 ], [ %2, %0 ]
%15 = phi i32 [ %32, %30 ], [ 0, %0 ]
%16 = phi i32 [ %42, %30 ], [ 0, %0 ]
%17 = call i64 @isalpha(i8 signext %13)
%18 = icmp eq i64 %17, 0
br i1 %18, label %30, label %19
19: ; preds = %11
%20 = load i8, i8* %14
%21 = call i64 @isupper(i8 signext %20)
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i32
%24 = add nsw i32 %16, %23
%25 = load i8, i8* %14
%26 = call i64 @islower(i8 signext %25)
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i32
%29 = add nsw i32 %15, %28
br label %30
30: ; preds = %19, %11
%31 = phi i32 [ %16, %11 ], [ %24, %19 ]
%32 = phi i32 [ %15, %11 ], [ %29, %19 ]
%33 = load i8, i8* %14
%34 = call i64 @isdigit(i8 signext %33)
%35 = icmp ne i64 %34, 0
%36 = zext i1 %35 to i32
%37 = add nsw i32 %31, %36
%38 = load i8, i8* %14
%39 = call i64 @ispunct(i8 signext %38)
%40 = icmp ne i64 %39, 0
%41 = zext i1 %40 to i32
%42 = add nsw i32 %37, %41
%43 = add nuw i64 %12, 1
%44 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %7, label %11
47: ; preds = %0, %7
br label %48
48: ; preds = %7, %47
%49 = phi i8* [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), %47 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), %7 ]
%50 = call i32 @printf(i8* dereferenceable(1) %49)
ret i32 0
}