#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 *, int *);
void password() {
  int clave_usuario, clave_secreta = 246;
  do {
    printf("Para ingresar al sistema, \n");
    printf("por favor ingresa la clave secreta: ");
    scanf("%d", &clave_usuario);
  } while (clave_usuario != clave_secreta);
  printf("Has accedido..\n");
}


x86 assembly (clang, -O0):
<password>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xf6,-0x8(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    112f <password+0xf>
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<password>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xee9(%rip),%r14
lea    0xeba(%rip),%r15
lea    0xed8(%rip),%r12
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0xf6,0x4(%rsp)
jne    1160 <password+0x30>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Para ingresar al sistema, \0A\00"
@.str.1 = [37 x i8] c"por favor ingresa la clave secreta: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"Has accedido..\0A\00"
define void @password() {
%1 = alloca i32
%2 = alloca i32
store i32 246, i32* %2
br label %3
3: ; preds = %7, %0
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
br label %7
7: ; preds = %3
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = icmp ne i32 %8, %9
br i1 %10, label %3, label %11
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [37 x i8] c"por favor ingresa la clave secreta: \00"
@.str.2 = [3 x i8] c"%d\00"
@str = [27 x i8] c"Para ingresar al sistema, \00"
@str.4 = [15 x i8] c"Has accedido..\00"
define void @password() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 246
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
ret void
}