#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[30], float acum[30]) {
  int i, x;
  float lista_aleatorios[30];
  printf("Aleatorios generados: ");
  for (i = 0; i < 30; i++) {
    lista_aleatorios[i] = drand48() * 1;
  }
  printf("\n");
  for (x = 0; x < 30; x++) {
    i = 30;
    do {
      i--;
    } while (acum[i] <= lista_aleatorios[x]);
    padres[x] = (30 - i);
  }
  return padres[30];
}


x86 assembly (clang, -O0):
<SeleccionPadres>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x1e,-0x14(%rbp)
jge    1179 <SeleccionPadres+0x59>
mov    $0x0,%al
call   1040 <drand48@plt>
shl    $0x0,%eax
cvtsi2ss %eax,%xmm0
movslq -0x14(%rbp),%rax
movss  %xmm0,-0x90(%rbp,%rax,4)
ff ff
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <SeleccionPadres+0x26>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x1e,-0x18(%rbp)
jge    11ea <SeleccionPadres+0xca>
movl   $0x1e,-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  -0x90(%rbp,%rax,4),%xmm0
ff ff
ucomiss %xmm1,%xmm0
jae    119d <SeleccionPadres+0x7d>
mov    $0x1e,%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    118c <SeleccionPadres+0x6c>
mov    -0x8(%rbp),%rax
mov    0x78(%rax),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeleccionPadres>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <drand48@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x1e,%rbx
jne    1150 <SeleccionPadres+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x74,%r15
xor    %eax,%eax
nopl   (%rax)
movss  (%rsp,%rax,4),%xmm0
mov    %r15,%rdx
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
ucomiss (%rdx),%xmm0
lea    -0x4(%rdx),%rdx
jae    1190 <SeleccionPadres+0x60>
mov    %ecx,(%r14,%rax,4)
mov    %rax,%rcx
or     $0x1,%rcx
movss  (%rsp,%rcx,4),%xmm0
xor    %edx,%edx
mov    %r15,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%edx
ucomiss (%rsi),%xmm0
lea    -0x4(%rsi),%rsi
jae    11c0 <SeleccionPadres+0x90>
mov    %edx,(%r14,%rcx,4)
add    $0x2,%rax
cmp    $0x1e,%rax
jne    1180 <SeleccionPadres+0x50>
mov    0x78(%r14),%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Aleatorios generados: \00"
@.str.1 = [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 [30 x float]
store i32* %0, i32** %3
store float* %1, float** %4
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 30
br i1 %11, label %12, label %22
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 [30 x float], [30 x float]* %7, i64 0, i64 %17
store float %15, float* %18
br label %19
19: ; preds = %12
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %9
22: ; preds = %9
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %24
24: ; preds = %49, %22
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 30
br i1 %26, label %27, label %52
27: ; preds = %24
store i32 30, i32* %5
br label %28
28: ; preds = %31, %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, -1
store i32 %30, i32* %5
br label %31
31: ; preds = %28
%32 = load float*, float** %4
%33 = load i32, i32* %5
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds float, float* %32, i64 %34
%36 = load float, float* %35
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [30 x float], [30 x float]* %7, i64 0, i64 %38
%40 = load float, float* %39
%41 = fcmp ole float %36, %40
br i1 %41, label %28, label %42
42: ; preds = %31
%43 = load i32, i32* %5
%44 = sub nsw i32 30, %43
%45 = load i32*, i32** %3
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
store i32 %44, i32* %48
br label %49
49: ; preds = %42
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %24
52: ; preds = %24
%53 = load i32*, i32** %3
%54 = getelementptr inbounds i32, i32* %53, i64 30
%55 = load i32, i32* %54
ret i32 %55
}

LLVM IR (-O2):
@.str = [23 x i8] c"Aleatorios generados: \00"
define i32 @SeleccionPadres(i32* nocapture %0, float* nocapture %1) {
%3 = alloca [30 x float]
%4 = bitcast [30 x float]* %3 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 0, %2 ], [ %11, %6 ]
%8 = tail call i32 (...) @drand48()
%9 = sitofp i32 %8 to float
%10 = getelementptr inbounds [30 x float], [30 x float]* %3, i64 0, i64 %7
store float %9, float* %10
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, 30
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = tail call i32 @putchar(i32 10)
br label %15
15: ; preds = %38, %13
%16 = phi i64 [ 0, %13 ], [ %42, %38 ]
%17 = getelementptr inbounds [30 x float], [30 x float]* %3, i64 0, i64 %16
%18 = load float, float* %17
br label %19
19: ; preds = %15, %19
%20 = phi i64 [ 30, %15 ], [ %21, %19 ]
%21 = add nsw i64 %20, -1
%22 = getelementptr inbounds float, float* %1, i64 %21
%23 = load float, float* %22
%24 = fcmp ugt float %23, %18
br i1 %24, label %25, label %19
25: ; preds = %19
%26 = trunc i64 %20 to i32
%27 = sub i32 31, %26
%28 = getelementptr inbounds i32, i32* %0, i64 %16
store i32 %27, i32* %28
%29 = or i64 %16, 1
%30 = getelementptr inbounds [30 x float], [30 x float]* %3, i64 0, i64 %29
%31 = load float, float* %30
br label %32
32: ; preds = %32, %25
%33 = phi i64 [ 30, %25 ], [ %34, %32 ]
%34 = add nsw i64 %33, -1
%35 = getelementptr inbounds float, float* %1, i64 %34
%36 = load float, float* %35
%37 = fcmp ugt float %36, %31
br i1 %37, label %38, label %32
38: ; preds = %32
%39 = trunc i64 %33 to i32
%40 = sub i32 31, %39
%41 = getelementptr inbounds i32, i32* %0, i64 %29
store i32 %40, i32* %41
%42 = add nuw nsw i64 %16, 2
%43 = icmp eq i64 %42, 30
br i1 %43, label %44, label %15
44: ; preds = %38
%45 = getelementptr inbounds i32, i32* %0, i64 30
%46 = load i32, i32* %45
ret i32 %46
}