#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*/ avaliacao(char *, int);
int /*<<< orphan*/ free(float *);
int /*<<< orphan*/ inicializacao();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ rand();
int /*<<< orphan*/ srand(int);
int main() {
  int i;
  float *a, *b;
  a = (float *)malloc(sizeof(float) * 50000000);
  b = (float *)malloc(sizeof(float) * 50000000);
  srand(424242);
  for (i = 0; i < 50000000; i++) {
    a[i] = (float)rand() / 10000000.0;
    b[i] = (float)rand() / 10000000.0;
  }
  inicializacao();
  for (i = 1; i < 50000000; i++) {
    a[i] = a[i - 1] + b[i];
  }
  avaliacao("Exercicio F - Padrão", 50000000);
  for (i = 50000000 - 10; i < 50000000; i++) {
    printf("%.2f ", a[i]);
    ;
  }
  printf("\n");
  ;
  free(a);
  free(b);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xbebc200,%edi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0xbebc200,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x67932,%edi
call   1060 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2faf080,-0x8(%rbp)
jge    1221 <main+0xb1>
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe02(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ac <main+0x3c>
mov    $0x0,%al
call   1080 <inicializacao@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x2faf080,-0x8(%rbp)
jge    1276 <main+0x106>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
addss  (%rax,%rcx,4),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    122f <main+0xbf>
lea    0xd8b(%rip),%rdi
mov    $0x2faf080,%esi
call   1030 <avaliacao@plt>
movl   $0x2faf076,-0x8(%rbp)
cmpl   $0x2faf080,-0x8(%rbp)
jge    12c8 <main+0x158>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd6b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    128e <main+0x11e>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0xbebc200,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    $0xbebc200,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    $0x67932,%edi
call   1070 <srand@plt>
xor    %ebx,%ebx
xchg   %ax,%ax
xor    %eax,%eax
call   10a0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  0xe39(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,(%r12,%rbx,4)
xor    %eax,%eax
call   10a0 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
divss  0xe18(%rip),%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    $0x2faf080,%rbx
jne    11b0 <main+0x30>
xor    %eax,%eax
call   1090 <inicializacao@plt>
movss  (%r12),%xmm0
mov    $0x4,%eax
nopl   (%rax)
addss  -0xc(%r14,%rax,4),%xmm0
movss  %xmm0,-0xc(%r12,%rax,4)
addss  -0x8(%r14,%rax,4),%xmm0
movss  %xmm0,-0x8(%r12,%rax,4)
addss  -0x4(%r14,%rax,4),%xmm0
movss  %xmm0,-0x4(%r12,%rax,4)
cmp    $0x2faf080,%rax
je     1254 <main+0xd4>
addss  (%r14,%rax,4),%xmm0
movss  %xmm0,(%r12,%rax,4)
add    $0x4,%rax
jmp    1210 <main+0x90>
lea    0xda9(%rip),%rdi
mov    $0x2faf080,%esi
call   1030 <avaliacao@plt>
movss  0xbebc1d8(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
lea    0xda0(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1dc(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1e0(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1e4(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1e8(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1ec(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1f0(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1f4(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1f8(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xbebc1fc(%r12),%xmm0
c1 eb 0b
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1050 <putchar@plt>
mov    %r12,%rdi
call   1040 <free@plt>
mov    %r14,%rdi
call   1040 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Exercicio F - Padr\C3\A3o\00"
@.str.1 = [6 x i8] c"%.2f \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float*
%4 = alloca float*
store i32 0, i32* %1
%5 = call i64 @malloc(i32 200000000)
%6 = inttoptr i64 %5 to float*
store float* %6, float** %3
%7 = call i64 @malloc(i32 200000000)
%8 = inttoptr i64 %7 to float*
store float* %8, float** %4
%9 = call i32 @srand(i32 424242)
store i32 0, i32* %2
br label %10
10: ; preds = %32, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 50000000
br i1 %12, label %13, label %35
13: ; preds = %10
%14 = call i64 (...) @rand()
%15 = sitofp i64 %14 to float
%16 = fpext float %15 to double
%17 = fdiv double %16, 1.000000e+07
%18 = fptrunc double %17 to float
%19 = load float*, float** %3
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %19, i64 %21
store float %18, float* %22
%23 = call i64 (...) @rand()
%24 = sitofp i64 %23 to float
%25 = fpext float %24 to double
%26 = fdiv double %25, 1.000000e+07
%27 = fptrunc double %26 to float
%28 = load float*, float** %4
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %28, i64 %30
store float %27, float* %31
br label %32
32: ; preds = %13
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %10
35: ; preds = %10
%36 = call i32 (...) @inicializacao()
store i32 1, i32* %2
br label %37
37: ; preds = %57, %35
%38 = load i32, i32* %2
%39 = icmp slt i32 %38, 50000000
br i1 %39, label %40, label %60
40: ; preds = %37
%41 = load float*, float** %3
%42 = load i32, i32* %2
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %41, i64 %44
%46 = load float, float* %45
%47 = load float*, float** %4
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %47, i64 %49
%51 = load float, float* %50
%52 = fadd float %46, %51
%53 = load float*, float** %3
%54 = load i32, i32* %2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds float, float* %53, i64 %55
store float %52, float* %56
br label %57
57: ; preds = %40
%58 = load i32, i32* %2
%59 = add nsw i32 %58, 1
store i32 %59, i32* %2
br label %37
60: ; preds = %37
%61 = call i32 @avaliacao(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 50000000)
store i32 49999990, i32* %2
br label %62
62: ; preds = %73, %60
%63 = load i32, i32* %2
%64 = icmp slt i32 %63, 50000000
br i1 %64, label %65, label %76
65: ; preds = %62
%66 = load float*, float** %3
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds float, float* %66, i64 %68
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %71)
br label %73
73: ; preds = %65
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %62
76: ; preds = %62
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%78 = load float*, float** %3
%79 = call i32 @free(float* %78)
%80 = load float*, float** %4
%81 = call i32 @free(float* %80)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Exercicio F - Padr\C3\A3o\00"
@.str.1 = [6 x i8] c"%.2f \00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 200000000)
%2 = inttoptr i64 %1 to float*
%3 = tail call i64 @malloc(i32 200000000)
%4 = inttoptr i64 %3 to float*
%5 = tail call i32 @srand(i32 424242)
br label %6
6: ; preds = %0, %6
%7 = phi i64 [ 0, %0 ], [ %16, %6 ]
%8 = tail call i64 (...) @rand()
%9 = sitofp i64 %8 to float
%10 = fdiv float %9, 1.000000e+07
%11 = getelementptr inbounds float, float* %2, i64 %7
store float %10, float* %11
%12 = tail call i64 (...) @rand()
%13 = sitofp i64 %12 to float
%14 = fdiv float %13, 1.000000e+07
%15 = getelementptr inbounds float, float* %4, i64 %7
store float %14, float* %15
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, 50000000
br i1 %17, label %18, label %6
18: ; preds = %6
%19 = tail call i32 (...) @inicializacao()
%20 = load float, float* %2
br label %21
21: ; preds = %40, %18
%22 = phi float [ %20, %18 ], [ %43, %40 ]
%23 = phi i64 [ 1, %18 ], [ %45, %40 ]
%24 = getelementptr inbounds float, float* %4, i64 %23
%25 = load float, float* %24
%26 = fadd float %22, %25
%27 = getelementptr inbounds float, float* %2, i64 %23
store float %26, float* %27
%28 = add nuw nsw i64 %23, 1
%29 = getelementptr inbounds float, float* %4, i64 %28
%30 = load float, float* %29
%31 = fadd float %26, %30
%32 = getelementptr inbounds float, float* %2, i64 %28
store float %31, float* %32
%33 = add nuw nsw i64 %23, 2
%34 = getelementptr inbounds float, float* %4, i64 %33
%35 = load float, float* %34
%36 = fadd float %31, %35
%37 = getelementptr inbounds float, float* %2, i64 %33
store float %36, float* %37
%38 = add nuw nsw i64 %23, 3
%39 = icmp eq i64 %38, 50000000
br i1 %39, label %46, label %40
40: ; preds = %21
%41 = getelementptr inbounds float, float* %4, i64 %38
%42 = load float, float* %41
%43 = fadd float %36, %42
%44 = getelementptr inbounds float, float* %2, i64 %38
store float %43, float* %44
%45 = add nuw nsw i64 %23, 4
br label %21
46: ; preds = %21
%47 = tail call i32 @avaliacao(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 50000000)
%48 = getelementptr inbounds float, float* %2, i64 49999990
%49 = load float, float* %48
%50 = fpext float %49 to double
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %50)
%52 = getelementptr inbounds float, float* %2, i64 49999991
%53 = load float, float* %52
%54 = fpext float %53 to double
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %54)
%56 = getelementptr inbounds float, float* %2, i64 49999992
%57 = load float, float* %56
%58 = fpext float %57 to double
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %58)
%60 = getelementptr inbounds float, float* %2, i64 49999993
%61 = load float, float* %60
%62 = fpext float %61 to double
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %62)
%64 = getelementptr inbounds float, float* %2, i64 49999994
%65 = load float, float* %64
%66 = fpext float %65 to double
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %66)
%68 = getelementptr inbounds float, float* %2, i64 49999995
%69 = load float, float* %68
%70 = fpext float %69 to double
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %70)
%72 = getelementptr inbounds float, float* %2, i64 49999996
%73 = load float, float* %72
%74 = fpext float %73 to double
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %74)
%76 = getelementptr inbounds float, float* %2, i64 49999997
%77 = load float, float* %76
%78 = fpext float %77 to double
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %78)
%80 = getelementptr inbounds float, float* %2, i64 49999998
%81 = load float, float* %80
%82 = fpext float %81 to double
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %82)
%84 = getelementptr inbounds float, float* %2, i64 49999999
%85 = load float, float* %84
%86 = fpext float %85 to double
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %86)
%88 = tail call i32 @putchar(i32 10)
%89 = tail call i32 @free(float* %2)
%90 = tail call i32 @free(float* %4)
ret i32 0
}