#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*/ geraInstrucao(int /*<<< orphan*/, int, int,
                                 int /*<<< orphan*/, char *);
int /*<<< orphan*/ incrementaStack(int);
void geraRead(int tipo, int pos) {
  incrementaStack(3);
  geraInstrucao(0, 2026, 0, 0, "");
  geraInstrucao(0, 2025, 0, 0, "");
  geraInstrucao(0, 2027, 0, 0, "");
  geraInstrucao(0, 2028, 0, 0, "");
  if (tipo == 1000) {
    geraInstrucao(0, 2029, 0, 0, "");
    geraInstrucao(0, 2012, pos, 0, "");
  } else if (tipo == 1001) {
    geraInstrucao(0, 2033, 0, 0, "");
    geraInstrucao(0, 2031, pos, 0, "");
  }
  decrementaStack(3);
}


x86 assembly (clang, -O0):
<geraRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x3,%edi
call   1040 <incrementaStack@plt>
xor    %ecx,%ecx
mov    $0x7ea,%esi
lea    0xeaa(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
xor    %ecx,%ecx
mov    $0x7e9,%esi
lea    0xe93(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
xor    %ecx,%ecx
mov    $0x7eb,%esi
lea    0xe7c(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
xor    %ecx,%ecx
mov    $0x7ec,%esi
lea    0xe65(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
cmpl   $0x3e8,-0x4(%rbp)
jne    11e5 <geraRead+0xb5>
xor    %ecx,%ecx
mov    $0x7ed,%esi
lea    0xe41(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
mov    $0x7dc,%esi
lea    0xe27(%rip),%r8
mov    %ecx,%edi
call   1050 <geraInstrucao@plt>
jmp    1226 <geraRead+0xf6>
cmpl   $0x3e9,-0x4(%rbp)
jne    1221 <geraRead+0xf1>
xor    %ecx,%ecx
mov    $0x7f1,%esi
lea    0xe00(%rip),%r8
mov    %ecx,%edi
mov    %ecx,%edx
call   1050 <geraInstrucao@plt>
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
mov    $0x7ef,%esi
lea    0xde6(%rip),%r8
mov    %ecx,%edi
call   1050 <geraInstrucao@plt>
jmp    1226 <geraRead+0xf6>
mov    $0x3,%edi
call   1030 <decrementaStack@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraRead>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0x3,%edi
call   1040 <incrementaStack@plt>
lea    0xeb6(%rip),%rbx
xor    %edi,%edi
mov    $0x7ea,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1050 <geraInstrucao@plt>
xor    %edi,%edi
mov    $0x7e9,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1050 <geraInstrucao@plt>
xor    %edi,%edi
mov    $0x7eb,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1050 <geraInstrucao@plt>
xor    %edi,%edi
mov    $0x7ec,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbx,%r8
call   1050 <geraInstrucao@plt>
cmp    $0x3e8,%ebp
je     11b2 <geraRead+0x82>
cmp    $0x3e9,%ebp
jne    11e2 <geraRead+0xb2>
mov    $0x7ef,%ebx
mov    $0x7f1,%esi
jmp    11bc <geraRead+0x8c>
mov    $0x7dc,%ebx
mov    $0x7ed,%esi
lea    0xe3d(%rip),%rbp
xor    %edi,%edi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
call   1050 <geraInstrucao@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    %r14d,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
call   1050 <geraInstrucao@plt>
mov    $0x3,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <decrementaStack@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @geraRead(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @incrementaStack(i32 3)
%6 = call i32 @geraInstrucao(i32 0, i32 2026, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @geraInstrucao(i32 0, i32 2025, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @geraInstrucao(i32 0, i32 2027, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @geraInstrucao(i32 0, i32 2028, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1000
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = call i32 @geraInstrucao(i32 0, i32 2029, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = call i32 @geraInstrucao(i32 0, i32 2012, i32 %14, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %24
16: ; preds = %2
%17 = load i32, i32* %3
%18 = icmp eq i32 %17, 1001
br i1 %18, label %19, label %23
19: ; preds = %16
%20 = call i32 @geraInstrucao(i32 0, i32 2033, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%21 = load i32, i32* %4
%22 = call i32 @geraInstrucao(i32 0, i32 2031, i32 %21, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %19, %16
br label %24
24: ; preds = %23, %12
%25 = call i32 @decrementaStack(i32 3)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @geraRead(i32 %0, i32 %1) {
%3 = tail call i32 @incrementaStack(i32 3)
%4 = tail call i32 @geraInstrucao(i32 0, i32 2026, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @geraInstrucao(i32 0, i32 2025, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @geraInstrucao(i32 0, i32 2027, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @geraInstrucao(i32 0, i32 2028, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %14 [
i32 1000, label %9
i32 1001, label %8
]
8: ; preds = %2
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ 2033, %8 ], [ 2029, %2 ]
%11 = phi i32 [ 2031, %8 ], [ 2012, %2 ]
%12 = tail call i32 @geraInstrucao(i32 0, i32 %10, i32 0, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @geraInstrucao(i32 0, i32 %11, i32 %1, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %9, %2
%15 = tail call i32 @decrementaStack(i32 3)
ret void
}