#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 *);
int main(void) {
  int i, a;
  for (i = 1; i <= 99; i++) {
    scanf("%d", &a);
    if (a != 2002) {
      printf("Senha Invalida\n");
    } else {
      printf("Acesso Permitido\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x63,-0x8(%rbp)
jg     1192 <main+0x72>
lea    0xeb9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x7d2,-0xc(%rbp)
je     116e <main+0x4e>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    117f <main+0x5f>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    1192 <main+0x72>
jmp    1184 <main+0x64>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x63,%ebp
lea    0xecd(%rip),%r14
lea    0x4(%rsp),%rbx
lea    0xed5(%rip),%r15
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x7d2,0x4(%rsp)
je     1164 <main+0x44>
mov    %r15,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebp
jne    1140 <main+0x20>
jmp    1170 <main+0x50>
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [16 x i8] c"Senha Invalida\0A\00"
@.str.2 = [18 x i8] c"Acesso Permitido\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 99
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 2002
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %7
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %19
15: ; preds = %11
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %13, %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [17 x i8] c"Acesso Permitido\00"
@str.3 = [15 x i8] c"Senha Invalida\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %8
%4 = phi i32 [ 1, %0 ], [ %10, %8 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 2002
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
%10 = add nuw nsw i32 %4, 1
%11 = icmp eq i32 %10, 100
br i1 %11, label %14, label %3
12: ; preds = %3
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %14
14: ; preds = %8, %12
ret i32 0
}