#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*/ buscaPos(char *);
int /*<<< orphan*/ decrementaStack(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ geraInstrucao(int /*<<< orphan*/, int, int /*<<< orphan*/,
                                 int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *);
void geraAtribuicao(char var[32], unsigned tipo1, unsigned tipo2) {
  decrementaStack(1);
  if (tipo1 == tipo2) {
    if (tipo1 == 1000)
      geraInstrucao(0, 2012, buscaPos(var), 0, "");
    else
      geraInstrucao(0, 2031, buscaPos(var), 0, "");
  } else {
    printf("Atribuicao na variavel %s com tipos diferentes!\n", var);
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<geraAtribuicao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <decrementaStack@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11cf <geraAtribuicao+0x7f>
cmpl   $0x3e8,-0xc(%rbp)
jne    11aa <geraAtribuicao+0x5a>
mov    -0x8(%rbp),%rdi
call   1050 <buscaPos@plt>
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x7dc,%esi
lea    0xe92(%rip),%r8
mov    %ecx,%edi
call   1060 <geraInstrucao@plt>
jmp    11ca <geraAtribuicao+0x7a>
mov    -0x8(%rbp),%rdi
call   1050 <buscaPos@plt>
mov    %eax,%edx
xor    %ecx,%ecx
mov    $0x7ef,%esi
lea    0xe6d(%rip),%r8
mov    %ecx,%edi
call   1060 <geraInstrucao@plt>
jmp    11e9 <geraAtribuicao+0x99>
mov    -0x8(%rbp),%rsi
lea    0xe26(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraAtribuicao>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r14
mov    $0x1,%edi
call   1040 <decrementaStack@plt>
cmp    %ebp,%ebx
jne    119a <geraAtribuicao+0x4a>
mov    %r14,%rdi
call   1050 <buscaPos@plt>
cmp    $0x3e8,%ebx
mov    $0x7dc,%ecx
mov    $0x7ef,%esi
cmove  %ecx,%esi
lea    0xea5(%rip),%r8
xor    %edi,%edi
mov    %eax,%edx
xor    %ecx,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <geraInstrucao@plt>
lea    0xe5f(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [49 x i8] c"Atribuicao na variavel %s com tipos diferentes!\0A\00"
define void @geraAtribuicao(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @decrementaStack(i32 1)
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %23
11: ; preds = %3
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 1000
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i8*, i8** %4
%16 = call i32 @buscaPos(i8* %15)
%17 = call i32 @geraInstrucao(i32 0, i32 2012, i32 %16, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %22
18: ; preds = %11
%19 = load i8*, i8** %4
%20 = call i32 @buscaPos(i8* %19)
%21 = call i32 @geraInstrucao(i32 0, i32 2031, i32 %20, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %18, %14
br label %27
23: ; preds = %3
%24 = load i8*, i8** %4
%25 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [49 x i8] c"Atribuicao na variavel %s com tipos diferentes!\0A\00"
define void @geraAtribuicao(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @decrementaStack(i32 1)
%5 = icmp eq i32 %1, %2
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = icmp eq i32 %1, 1000
%8 = tail call i32 @buscaPos(i8* %0)
%9 = select i1 %7, i32 2012, i32 2031
%10 = tail call i32 @geraInstrucao(i32 0, i32 %9, i32 %8, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
11: ; preds = %3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%13 = tail call i32 @exit(i32 -1)
unreachable
}