#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 drand48();
int /*<<< orphan*/ printf(char *, ...);
int SeleccionPadres(int padres[5], float acumulado[5]) {
  int i, x;
  float Aleatorio[5];
  printf("aleatorios");
  for (i = 0; i < 5; i++) {
    Aleatorio[i] = drand48() * 1;
    printf("%f ", Aleatorio[i]);
  }
  printf("\n");
  for (x = 0; x < 5; x++) {
    i = 5;
    do {
      i--;
    } while (acumulado[i] <= Aleatorio[x]);
    padres[x] = (5 - i);
  }
  return padres[5];
}


x86 assembly (clang, -O0):
<SeleccionPadres>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1191 <SeleccionPadres+0x71>
mov    $0x0,%al
call   1040 <drand48@plt>
shl    $0x0,%eax
cvtsi2ss %eax,%xmm0
movslq -0x14(%rbp),%rax
movss  %xmm0,-0x30(%rbp,%rax,4)
movslq -0x14(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <SeleccionPadres+0x25>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    1201 <SeleccionPadres+0xe1>
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
movslq -0x18(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
ucomiss %xmm1,%xmm0
jae    11b7 <SeleccionPadres+0x97>
mov    $0x5,%edx
sub    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a6 <SeleccionPadres+0x86>
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeleccionPadres>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xeb9(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <drand48@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe9f(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <drand48@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <drand48@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <drand48@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <drand48@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x14(%rsp)
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0x4(%rsp),%xmm0
lea    0x10(%rbx),%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
ucomiss (%rax),%xmm0
lea    -0x4(%rax),%rax
jae    1220 <SeleccionPadres+0xf0>
mov    %ebp,(%r14)
lea    0x10(%rbx),%rcx
xor    %eax,%eax
movss  0x8(%rsp),%xmm0
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
ucomiss (%rcx),%xmm0
lea    -0x4(%rcx),%rcx
jae    1240 <SeleccionPadres+0x110>
mov    %eax,0x4(%r14)
lea    0x10(%rbx),%rcx
xor    %eax,%eax
movss  0x14(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
ucomiss (%rcx),%xmm2
lea    -0x4(%rcx),%rcx
jae    1270 <SeleccionPadres+0x140>
mov    %eax,0x8(%r14)
lea    0x10(%rbx),%rcx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
ucomiss (%rcx),%xmm1
lea    -0x4(%rcx),%rcx
jae    1290 <SeleccionPadres+0x160>
mov    %eax,0xc(%r14)
add    $0x10,%rbx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
ucomiss (%rbx),%xmm0
lea    -0x4(%rbx),%rbx
jae    12b0 <SeleccionPadres+0x180>
mov    %eax,0x10(%r14)
mov    0x14(%r14),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"aleatorios\00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @SeleccionPadres(i32* %0, float* %1) {
%3 = alloca i32*
%4 = alloca float*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [5 x float]
store i32* %0, i32** %3
store float* %1, float** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %9
9: ; preds = %25, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 5
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = call i32 (...) @drand48()
%14 = mul nsw i32 %13, 1
%15 = sitofp i32 %14 to float
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x float], [5 x float]* %7, i64 0, i64 %17
store float %15, float* %18
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x float], [5 x float]* %7, i64 0, i64 %20
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %23)
br label %25
25: ; preds = %12
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %9
28: ; preds = %9
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %30
30: ; preds = %55, %28
%31 = load i32, i32* %6
%32 = icmp slt i32 %31, 5
br i1 %32, label %33, label %58
33: ; preds = %30
store i32 5, i32* %5
br label %34
34: ; preds = %37, %33
%35 = load i32, i32* %5
%36 = add nsw i32 %35, -1
store i32 %36, i32* %5
br label %37
37: ; preds = %34
%38 = load float*, float** %4
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %38, i64 %40
%42 = load float, float* %41
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [5 x float], [5 x float]* %7, i64 0, i64 %44
%46 = load float, float* %45
%47 = fcmp ole float %42, %46
br i1 %47, label %34, label %48
48: ; preds = %37
%49 = load i32, i32* %5
%50 = sub nsw i32 5, %49
%51 = load i32*, i32** %3
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %51, i64 %53
store i32 %50, i32* %54
br label %55
55: ; preds = %48
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %30
58: ; preds = %30
%59 = load i32*, i32** %3
%60 = getelementptr inbounds i32, i32* %59, i64 5
%61 = load i32, i32* %60
ret i32 %61
}

LLVM IR (-O2):
@.str = [11 x i8] c"aleatorios\00"
@.str.1 = [4 x i8] c"%f \00"
define i32 @SeleccionPadres(i32* nocapture %0, float* nocapture %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @drand48()
%5 = sitofp i32 %4 to float
%6 = fpext float %5 to double
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = tail call i32 (...) @drand48()
%9 = sitofp i32 %8 to float
%10 = fpext float %9 to double
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = tail call i32 (...) @drand48()
%13 = sitofp i32 %12 to float
%14 = fpext float %13 to double
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %14)
%16 = tail call i32 (...) @drand48()
%17 = sitofp i32 %16 to float
%18 = fpext float %17 to double
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = tail call i32 (...) @drand48()
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = tail call i32 @putchar(i32 10)
br label %25
25: ; preds = %2, %25
%26 = phi i64 [ 5, %2 ], [ %27, %25 ]
%27 = add nsw i64 %26, -1
%28 = getelementptr inbounds float, float* %1, i64 %27
%29 = load float, float* %28
%30 = fcmp ugt float %29, %5
br i1 %30, label %31, label %25
31: ; preds = %25
%32 = trunc i64 %26 to i32
%33 = sub i32 6, %32
store i32 %33, i32* %0
br label %34
34: ; preds = %34, %31
%35 = phi i64 [ 5, %31 ], [ %36, %34 ]
%36 = add nsw i64 %35, -1
%37 = getelementptr inbounds float, float* %1, i64 %36
%38 = load float, float* %37
%39 = fcmp ugt float %38, %9
br i1 %39, label %40, label %34
40: ; preds = %34
%41 = trunc i64 %35 to i32
%42 = sub i32 6, %41
%43 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %42, i32* %43
br label %44
44: ; preds = %44, %40
%45 = phi i64 [ 5, %40 ], [ %46, %44 ]
%46 = add nsw i64 %45, -1
%47 = getelementptr inbounds float, float* %1, i64 %46
%48 = load float, float* %47
%49 = fcmp ugt float %48, %13
br i1 %49, label %50, label %44
50: ; preds = %44
%51 = trunc i64 %45 to i32
%52 = sub i32 6, %51
%53 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %52, i32* %53
br label %54
54: ; preds = %54, %50
%55 = phi i64 [ 5, %50 ], [ %56, %54 ]
%56 = add nsw i64 %55, -1
%57 = getelementptr inbounds float, float* %1, i64 %56
%58 = load float, float* %57
%59 = fcmp ugt float %58, %17
br i1 %59, label %60, label %54
60: ; preds = %54
%61 = trunc i64 %55 to i32
%62 = sub i32 6, %61
%63 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %62, i32* %63
br label %64
64: ; preds = %64, %60
%65 = phi i64 [ 5, %60 ], [ %66, %64 ]
%66 = add nsw i64 %65, -1
%67 = getelementptr inbounds float, float* %1, i64 %66
%68 = load float, float* %67
%69 = fcmp ugt float %68, %21
br i1 %69, label %70, label %64
70: ; preds = %64
%71 = trunc i64 %65 to i32
%72 = sub i32 6, %71
%73 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %72, i32* %73
%74 = getelementptr inbounds i32, i32* %0, i64 5
%75 = load i32, i32* %74
ret i32 %75
}