#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  int match = 1, p = 0;
  char password[] = "secret";
  char buffer[50];
  scanf("%s", buffer);
  while (password[p] != '\0') {
    if (password[p] != buffer[p])
      match = 0;
    p++;
  }
  if (match == 1)
    printf("Success\n");
  else
    printf("Incorrect password\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x13(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0xf(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0xd(%rbp)
lea    -0x50(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1040 <scanf@plt>
movslq -0xc(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ab <main+0x8b>
movslq -0xc(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x50(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     119d <main+0x7d>
movl   $0x0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116a <main+0x4a>
cmpl   $0x1,-0x8(%rbp)
jne    11c6 <main+0xa6>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
jmp    11d2 <main+0xb2>
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xed5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%al
mov    0x1(%rsp),%cl
xor    $0x73,%al
xor    $0x65,%cl
movd   0x2(%rsp),%xmm0
lea    0xeca(%rip),%rdi
lea    0xeb0(%rip),%rdx
or     %al,%cl
cmovne %rdx,%rdi
movd   %xmm0,%eax
cmp    $0x74657263,%eax
cmovne %rdx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.password = [7 x i8] c"secret\00"
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"Success\0A\00"
@.str.2 = [20 x i8] c"Incorrect password\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i8]
%5 = alloca [50 x i8]
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
%6 = bitcast [7 x i8]* %4 to i8*
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %29, %0
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %4, 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 %32
16: ; preds = %9
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %21, %26
br i1 %27, label %28, label %29
28: ; preds = %16
store i32 0, i32* %2
br label %29
29: ; preds = %28, %16
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %9
32: ; preds = %9
%33 = load i32, i32* %2
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %39
37: ; preds = %32
%38 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %37, %35
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [19 x i8] c"Incorrect password\00"
@str.3 = [8 x i8] c"Success\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 115
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 101
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 2
%10 = bitcast i8* %9 to <4 x i8>*
%11 = load <4 x i8>, <4 x i8>* %10
%12 = freeze <4 x i8> %11
%13 = bitcast <4 x i8> %12 to i32
%14 = icmp eq i32 %13, 1952805475
%15 = select i1 %14, i1 %8, i1 false
%16 = select i1 %15, i1 %5, i1 false
%17 = select i1 %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0)
%18 = call i32 @puts(i8* dereferenceable(1) %17)
ret i32 0
}