#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int buscaIdEspecie(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ removeKey(int);
int removeRegEspecie(FILE *arquivo, int id) {
  int offset = buscaIdEspecie(arquivo, id);
  if (offset != -1) {
    fseek(arquivo, offset, SEEK_SET);
    char c[2];
    c[0] = '$';
    c[1] = " ";
    fputs(c, arquivo);
    removeKey(id);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<removeRegEspecie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <buscaIdEspecie@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     11ac <removeRegEspecie+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
movb   $0x24,-0x1a(%rbp)
lea    0xe78(%rip),%rax
mov    %al,-0x19(%rbp)
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x14(%rbp),%edi
call   1050 <removeKey@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b3 <removeRegEspecie+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeRegEspecie>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1060 <buscaIdEspecie@plt>
cmp    $0xffffffff,%eax
je     1190 <removeRegEspecie+0x50>
mov    0x2e87(%rip),%rcx
mov    (%rcx),%edx
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <fseek@plt>
movb   $0x24,0x6(%rsp)
lea    0xe8f(%rip),%rax
mov    %al,0x7(%rsp)
lea    0x6(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    %ebp,%edi
call   1050 <removeKey@plt>
mov    $0x1,%eax
jmp    1192 <removeRegEspecie+0x52>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [2 x i8] c" \00"
define i32 @removeRegEspecie(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i8]
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = call i32 @buscaIdEspecie(i32* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load i32*, i32** %4
%15 = load i32, i32* %6
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %14, i32 %15, i32 %16)
%18 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
store i8 36, i8* %18
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
store i8 ptrtoint ([2 x i8]* @.str to i8), i8* %19
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 0
%21 = load i32*, i32** %4
%22 = call i32 @fputs(i8* %20, i32* %21)
%23 = load i32, i32* %5
%24 = call i32 @removeKey(i32 %23)
store i32 1, i32* %3
br label %26
25: ; preds = %2
store i32 0, i32* %3
br label %26
26: ; preds = %25, %13
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [2 x i8] c" \00"
define i32 @removeRegEspecie(i32* %0, i32 %1) {
%3 = alloca [2 x i8]
%4 = tail call i32 @buscaIdEspecie(i32* %0, i32 %1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @fseek(i32* %0, i32 %4, i32 %7)
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
store i8 36, i8* %9
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 ptrtoint ([2 x i8]* @.str to i8), i8* %10
%11 = call i32 @fputs(i8* %9, i32* %0)
%12 = tail call i32 @removeKey(i32 %1)
br label %13
13: ; preds = %2, %6
%14 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %14
}