#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*/ decrementaStack(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ geraInstrucao(int /*<<< orphan*/, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
void geraComparacao(int comp, unsigned t1, unsigned t2) {
  if (t1 != 1000 || t2 != 1000) {
    printf("Comparacao de variaveis com tipos incosistentes!\n");
    exit(-1);
  }
  decrementaStack(2);
  switch (comp) {
  case 3000:
    geraInstrucao(0, 2016, 0, 0, "");
    break;
  case 3001:
    geraInstrucao(0, 2017, 0, 0, "");
    break;
  case 3002:
    geraInstrucao(0, 2018, 0, 0, "");
    break;
  case 3003:
    geraInstrucao(0, 2019, 0, 0, "");
    break;
  case 3004:
    geraInstrucao(0, 2020, 0, 0, "");
    break;
  case 3005:
    geraInstrucao(0, 2021, 0, 0, "");
    break;
  default:
    printf("Comparacao nao existente!\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<geraComparacao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jne    116b <geraComparacao+0x2b>
cmpl   $0x3e8,-0xc(%rbp)
je     1181 <geraComparacao+0x41>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    $0x2,%edi
call   1040 <decrementaStack@plt>
mov    -0x4(%rbp),%eax
add    $0xfffff448,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     125e <geraComparacao+0x11e>
mov    -0x18(%rbp),%rax
lea    0xe53(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %ecx,%ecx
mov    $0x7e0,%esi
lea    0xea0(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
xor    %ecx,%ecx
mov    $0x7e1,%esi
lea    0xe84(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
xor    %ecx,%ecx
mov    $0x7e2,%esi
lea    0xe68(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
xor    %ecx,%ecx
mov    $0x7e3,%esi
lea    0xe4c(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
xor    %ecx,%ecx
mov    $0x7e4,%esi
lea    0xe30(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
xor    %ecx,%ecx
mov    $0x7e5,%esi
lea    0xe14(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
jmp    1274 <geraComparacao+0x134>
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraComparacao>:
push   %rbx
cmp    $0x3e8,%esi
jne    1183 <geraComparacao+0x43>
cmp    $0x3e8,%edx
jne    1183 <geraComparacao+0x43>
mov    %edi,%ebx
mov    $0x2,%edi
call   1040 <decrementaStack@plt>
lea    -0xbb8(%rbx),%eax
cmp    $0x6,%eax
jae    118c <geraComparacao+0x4c>
add    $0xfffffc28,%ebx
lea    0xea4(%rip),%r8
xor    %edi,%edi
mov    %ebx,%esi
xor    %edx,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1050 <geraInstrucao@plt>
lea    0xe90(%rip),%rdi
jmp    1193 <geraComparacao+0x53>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Comparacao de variaveis com tipos incosistentes!\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [27 x i8] c"Comparacao nao existente!\0A\00"
define void @geraComparacao(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 1000
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 1000
br i1 %11, label %12, label %15
12: ; preds = %9, %3
%13 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %9
%16 = call i32 @decrementaStack(i32 2)
%17 = load i32, i32* %4
switch i32 %17, label %30 [
i32 3000, label %18
i32 3001, label %20
i32 3002, label %22
i32 3003, label %24
i32 3004, label %26
i32 3005, label %28
]
18: ; preds = %15
%19 = call i32 @geraInstrucao(i32 0, i32 2016, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
20: ; preds = %15
%21 = call i32 @geraInstrucao(i32 0, i32 2017, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
22: ; preds = %15
%23 = call i32 @geraInstrucao(i32 0, i32 2018, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
24: ; preds = %15
%25 = call i32 @geraInstrucao(i32 0, i32 2019, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
26: ; preds = %15
%27 = call i32 @geraInstrucao(i32 0, i32 2020, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
28: ; preds = %15
%29 = call i32 @geraInstrucao(i32 0, i32 2021, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %33
30: ; preds = %15
%31 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %28, %26, %24, %22, %20, %18
ret void
}

LLVM IR (-O2):
@.str.1 = [1 x i8] zeroinitializer
@str = [26 x i8] c"Comparacao nao existente!\00"
@str.3 = [49 x i8] c"Comparacao de variaveis com tipos incosistentes!\00"
define void @geraComparacao(i32 %0, i32 %1, i32 %2) {
%4 = icmp ne i32 %1, 1000
%5 = icmp ne i32 %2, 1000
%6 = or i1 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.3, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -1)
unreachable
10: ; preds = %3
%11 = tail call i32 @decrementaStack(i32 2)
%12 = add i32 %0, -3000
%13 = icmp ult i32 %12, 6
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%16 = tail call i32 @exit(i32 -1)
unreachable
17: ; preds = %10
%18 = add i32 %0, -984
%19 = tail call i32 @geraInstrucao(i32 0, i32 %18, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}