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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
scalar_t__ ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
bool trebleft_meu_index(FILE *arquivo) {
  if (arquivo) {
    int16_t indexador = 0;
    int16_t tamanho_arquivo = 0;
    char *absorcao = NULL;
    fseek(arquivo, 0L, SEEK_END);
    tamanho_arquivo = (int16_t)ftell(arquivo);
    rewind(arquivo);
    absorcao = (char *)calloc(tamanho_arquivo, sizeof(char));
    memset(absorcao, '0', sizeof(char) * tamanho_arquivo);
    fread(absorcao, tamanho_arquivo, 1, arquivo);
    while (absorcao != NULL) {
      if (*(absorcao + indexador) == '0') {
        printf(absorcao + indexador);
        break;
      }
      indexador += 1;
    }
    fclose(arquivo);
    free(absorcao);
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<trebleft_meu_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1287 <trebleft_meu_index+0xf7>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   10b0 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   10a0 <ftell@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <rewind@plt>
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
movslq -0x18(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
mov    $0x30,%esi
call   1080 <memset@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1040 <fread@plt>
cmpq   $0x0,-0x20(%rbp)
je     1269 <trebleft_meu_index+0xd9>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jne    125b <trebleft_meu_index+0xcb>
mov    -0x20(%rbp),%rdi
movslq -0x14(%rbp),%rax
add    %rax,%rdi
call   1060 <printf@plt>
jmp    1269 <trebleft_meu_index+0xd9>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1226 <trebleft_meu_index+0x96>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    128e <trebleft_meu_index+0xfe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trebleft_meu_index>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     123a <trebleft_meu_index+0xaa>
mov    %rdi,%rbx
mov    0x2e3e(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %rbx,%rdi
call   10a0 <ftell@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1070 <rewind@plt>
mov    $0x1,%r14d
mov    %r15d,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0x30,%esi
mov    %r15d,%edx
call   1080 <memset@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fread@plt>
test   %rbp,%rbp
je     1228 <trebleft_meu_index+0x98>
mov    $0xffffffffffffffff,%rax
nopl   0x0(%rax,%rax,1)
cmpb   $0x30,0x1(%rbp,%rax,1)
lea    0x1(%rax),%rax
jne    1210 <trebleft_meu_index+0x80>
mov    %eax,%eax
mov    %rbp,%rdi
add    %rax,%rdi
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
jmp    123d <trebleft_meu_index+0xad>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @trebleft_meu_index(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %3
%7 = load i32*, i32** %3
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %56
9: ; preds = %1
store i32 0, i32* %4
store i32 0, i32* %5
store i8* null, i8** %6
%10 = load i32*, i32** %3
%11 = load i32, i32* @SEEK_END
%12 = call i32 @fseek(i32* %10, i64 0, i32 %11)
%13 = load i32*, i32** %3
%14 = call i64 @ftell(i32* %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = load i32*, i32** %3
%17 = call i32 @rewind(i32* %16)
%18 = load i32, i32* %5
%19 = call i64 @calloc(i32 %18, i32 1)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = mul i64 1, %23
%25 = trunc i64 %24 to i32
%26 = call i32 @memset(i8* %21, i32 48, i32 %25)
%27 = load i8*, i8** %6
%28 = load i32, i32* %5
%29 = load i32*, i32** %3
%30 = call i32 @fread(i8* %27, i32 %28, i32 1, i32* %29)
br label %31
31: ; preds = %48, %9
%32 = load i8*, i8** %6
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %51
34: ; preds = %31
%35 = load i8*, i8** %6
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 48
br i1 %41, label %42, label %48
42: ; preds = %34
%43 = load i8*, i8** %6
%44 = load i32, i32* %4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = call i32 @printf(i8* %46)
br label %51
48: ; preds = %34
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %31
51: ; preds = %42, %31
%52 = load i32*, i32** %3
%53 = call i32 @fclose(i32* %52)
%54 = load i8*, i8** %6
%55 = call i32 @free(i8* %54)
store i32 1, i32* %2
br label %57
56: ; preds = %1
store i32 0, i32* %2
br label %57
57: ; preds = %56, %51
%58 = load i32, i32* %2
ret i32 %58
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @trebleft_meu_index(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %27, label %3
3: ; preds = %1
%4 = load i32, i32* @SEEK_END
%5 = tail call i32 @fseek(i32* %0, i64 0, i32 %4)
%6 = tail call i64 @ftell(i32* %0)
%7 = trunc i64 %6 to i32
%8 = tail call i32 @rewind(i32* %0)
%9 = tail call i64 @calloc(i32 %7, i32 1)
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @memset(i8* %10, i32 48, i32 %7)
%12 = tail call i32 @fread(i8* %10, i32 %7, i32 1, i32* %0)
%13 = icmp eq i64 %9, 0
br i1 %13, label %24, label %14
14: ; preds = %3, %14
%15 = phi i64 [ %19, %14 ], [ 0, %3 ]
%16 = getelementptr inbounds i8, i8* %10, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 48
%19 = add nuw i64 %15, 1
br i1 %18, label %20, label %14
20: ; preds = %14
%21 = and i64 %15, 4294967295
%22 = getelementptr inbounds i8, i8* %10, i64 %21
%23 = tail call i32 @printf(i8* %22)
br label %24
24: ; preds = %3, %20
%25 = tail call i32 @fclose(i32* %0)
%26 = tail call i32 @free(i8* %10)
br label %27
27: ; preds = %1, %24
%28 = phi i32 [ 1, %24 ], [ 0, %1 ]
ret i32 %28
}