#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char password[15] = "\x62\x60\x73\x75\x6c\x60\x6f\x63\x73\x60";
  char enter[15];
  int i;
  printf("Please enter the password: ");
  scanf("%s", enter);
  if (strlen(enter) > 10)
    goto fail;
  for (i = 0; i < 10; i++) {
    if ((password[i] ^ 1) != enter[i])
      goto fail;
  }
correct:
  printf("Correct. You did it.\n");
  return 0;
fail:
  printf("Sorry, it's wrong.\n");
  exit(155);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xea2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xe9a(%rip),%al
mov    %al,-0x5(%rbp)
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
lea    -0x22(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x22(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xa,%eax
jle    11aa <main+0x6a>
jmp    1209 <main+0xc9>
movl   $0x0,-0x28(%rbp)
cmpl   $0xa,-0x28(%rbp)
jge    11f0 <main+0xb0>
movslq -0x28(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
xor    $0x1,%eax
movslq -0x28(%rbp),%rcx
movsbl -0x22(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     11dd <main+0x9d>
jmp    1209 <main+0xc9>
jmp    11e2 <main+0xa2>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b1 <main+0x71>
jmp    11f5 <main+0xb5>
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
mov    $0x9b,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
lea    0xec4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0xa,%eax
jg     11f7 <main+0xa7>
movq   (%rsp),%xmm0
pcmpeqb 0xe73(%rip),%xmm0
pmovmskb %xmm0,%eax
test   $0x1,%al
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x2,%cl
shr    %cl
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x4,%cl
shr    $0x2,%cl
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x8,%cl
shr    $0x3,%cl
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x10,%cl
shr    $0x4,%cl
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x20,%cl
shr    $0x5,%cl
je     11f7 <main+0xa7>
mov    %eax,%ecx
and    $0x40,%cl
shr    $0x6,%cl
je     11f7 <main+0xa7>
shr    $0x7,%al
je     11f7 <main+0xa7>
cmpb   $0x72,0x8(%rsp)
jne    11f7 <main+0xa7>
cmpb   $0x61,0x9(%rsp)
jne    11f7 <main+0xa7>
lea    0xe45(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
mov    $0x9b,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@__const.main.password = [15 x i8] c"b`sul`ocs`\00\00\00\00\00"
@.str = [28 x i8] c"Please enter the password: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c"Correct. You did it.\0A\00"
@.str.3 = [20 x i8] c"Sorry, it's wrong.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [15 x i8]* %2 to i8*
%6 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %3, 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)
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = icmp sgt i32 %10, 10
br i1 %11, label %12, label %13
12: ; preds = %0
br label %38
13: ; preds = %0
store i32 0, i32* %4
br label %14
14: ; preds = %32, %13
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %35
17: ; preds = %14
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = xor i32 %22, 1
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %23, %28
br i1 %29, label %30, label %31
30: ; preds = %17
br label %38
31: ; preds = %17
br label %32
32: ; preds = %31
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %14
35: ; preds = %14
br label %36
36: ; preds = %35
%37 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
38: ; preds = %30, %12
%39 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 @exit(i32 155)
unreachable
}

LLVM IR (-O2):
@.str = [28 x i8] c"Please enter the password: \00"
@.str.1 = [3 x i8] c"%s\00"
@str = [21 x i8] c"Correct. You did it.\00"
@str.4 = [19 x i8] c"Sorry, it's wrong.\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 = call i32 @strlen(i8* %2)
%6 = icmp slt i32 %5, 11
%7 = bitcast [15 x i8]* %1 to <8 x i8>*
%8 = load <8 x i8>, <8 x i8>* %7
%9 = icmp eq <8 x i8> %8, <i8 99, i8 97, i8 114, i8 116, i8 109, i8 97, i8 110, i8 98>
%10 = extractelement <8 x i1> %9, i64 0
%11 = select i1 %6, i1 %10, i1 false
%12 = extractelement <8 x i1> %9, i64 1
%13 = select i1 %11, i1 %12, i1 false
%14 = extractelement <8 x i1> %9, i64 2
%15 = select i1 %13, i1 %14, i1 false
%16 = extractelement <8 x i1> %9, i64 3
%17 = select i1 %15, i1 %16, i1 false
%18 = extractelement <8 x i1> %9, i64 4
%19 = select i1 %17, i1 %18, i1 false
%20 = extractelement <8 x i1> %9, i64 5
%21 = select i1 %19, i1 %20, i1 false
%22 = extractelement <8 x i1> %9, i64 6
%23 = select i1 %21, i1 %22, i1 false
%24 = extractelement <8 x i1> %9, i64 7
%25 = select i1 %23, i1 %24, i1 false
%26 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 8
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 114
%29 = select i1 %25, i1 %28, i1 false
%30 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 9
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 97
%33 = select i1 %29, i1 %32, i1 false
br i1 %33, label %34, label %36
34: ; preds = %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
36: ; preds = %0
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
%38 = call i32 @exit(i32 155)
unreachable
}