#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*/ fscanf(int /*<<< orphan*/ *, char *, int *);
scalar_t__ malloc(int);
void ler_arquivo_entrada(FILE *arquivo, int **tamanhos_array, int *n) {
  int i;
  fscanf(arquivo, "%d", n);
  *tamanhos_array = (int *)malloc(sizeof(int) * (*n));
  for (i = 0; i < (*n); i++) {
    fscanf(arquivo, "%d", (*tamanhos_array) + i);
  }
}


x86 assembly (clang, -O0):
<ler_arquivo_entrada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    11aa <ler_arquivo_entrada+0x8a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe69(%rip),%rsi
call   1030 <fscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    116b <ler_arquivo_entrada+0x4b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ler_arquivo_entrada>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xec5(%rip),%rsi
call   1030 <fscanf@plt>
mov    0x0(%r13),%edi
shl    $0x2,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14)
cmpl   $0x0,0x0(%r13)
jle    11a2 <ler_arquivo_entrada+0x82>
lea    0xea3(%rip),%rsi
mov    %r15,%rdi
mov    %rax,%rdx
call   1030 <fscanf@plt>
cmpl   $0x2,0x0(%r13)
jl     11a2 <ler_arquivo_entrada+0x82>
mov    $0x1,%ebx
mov    $0x4,%ebp
lea    0xe80(%rip),%r12
mov    (%r14),%rdx
add    %rbp,%rdx
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <fscanf@plt>
add    $0x1,%rbx
movslq 0x0(%r13),%rax
add    $0x4,%rbp
cmp    %rax,%rbx
jl     1180 <ler_arquivo_entrada+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @ler_arquivo_entrada(i32* %0, i32** %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32**
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32** %1, i32*** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = load i32*, i32** %6
%10 = call i32 @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
%14 = mul i64 4, %13
%15 = trunc i64 %14 to i32
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
%18 = load i32**, i32*** %5
store i32* %17, i32** %18
store i32 0, i32* %7
br label %19
19: ; preds = %32, %3
%20 = load i32, i32* %7
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = icmp slt i32 %20, %22
br i1 %23, label %24, label %35
24: ; preds = %19
%25 = load i32*, i32** %4
%26 = load i32**, i32*** %5
%27 = load i32*, i32** %26
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = call i32 @fscanf(i32* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %24
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %19
35: ; preds = %19
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @ler_arquivo_entrada(i32* nocapture %0, i32** nocapture %1, i32* %2) {
%4 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = shl i32 %5, 2
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %1
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %24
15: ; preds = %11, %15
%16 = phi i64 [ %20, %15 ], [ 1, %11 ]
%17 = load i32*, i32** %1
%18 = getelementptr inbounds i32, i32* %17, i64 %16
%19 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %18)
%20 = add nuw nsw i64 %16, 1
%21 = load i32, i32* %2
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %15, label %24
24: ; preds = %15, %11, %3
ret void
}