#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 *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  char correct_pass[] = "test";
  char typed_pass[10];
  do {
    printf("\nTo unlock your last tip, enter the correct password: ");
    scanf("%s", typed_pass);
  } while (strcmp(typed_pass, correct_pass));
  printf("\nOK!");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x5(%rbp)
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    -0x13(%rbp),%rsi
lea    0xed4(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x13(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1151 <main+0x21>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x74736574,0x8(%rsp)
74
lea    0xeb6(%rip),%r14
lea    0xee6(%rip),%r15
lea    0xe(%rsp),%rbx
lea    0x8(%rsp),%r12
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1160 <main+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.correct_pass = [5 x i8] c"test\00"
@.str = [55 x i8] c"\0ATo unlock your last tip, enter the correct password: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"\0AOK!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = bitcast [5 x i8]* %2 to i8*
br label %5
5: ; preds = %9, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i8], [10 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)
br label %9
9: ; preds = %5
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%12 = call i64 @strcmp(i8* %10, i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %5, label %14
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@__const.main.correct_pass = [5 x i8] c"test\00"
@.str = [55 x i8] c"\0ATo unlock your last tip, enter the correct password: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"\0AOK!\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %5, %0
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%8 = call i64 @strcmp(i8* %4, i8* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}