#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*/ printf(char *, ...);
float tasa_de_transferencia(float);
int /*<<< orphan*/ todos_transmiten(int *, int);
float fitness(float *sinr_pu, int *evaluacion_pu, float *aptitud_pu,
              int total_pu, float *sinr_su, int *evaluacion_su,
              float *aptitud_su, int total_su) {
  float fitness = 0.0;
  if (!todos_transmiten(evaluacion_pu, total_pu) ||
      !todos_transmiten(evaluacion_su, total_su)) {
    printf("Hay dispositivos sin transmitir.\n");
    return 0.0;
  }
  int i;
  printf("\nfitness: ");
  for (i = 0; i < total_pu; i++) {
    aptitud_pu[i] = tasa_de_transferencia(sinr_pu[i]);
    printf(" %f + ", aptitud_pu[i]);
    fitness += aptitud_pu[i];
  }
  printf("= %f", fitness);
  printf("\nfitness: ");
  for (i = 0; i < total_su; i++) {
    aptitud_su[i] = tasa_de_transferencia(sinr_su[i]);
    printf(" %f + ", aptitud_pu[i]);
    fitness += aptitud_su[i];
  }
  printf("= %f", fitness);
  printf("\nfitness corrida: %f\n", fitness);
  return fitness;
}


x86 assembly (clang, -O0):
<fitness>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <todos_transmiten@plt>
cmp    $0x0,%eax
je     1188 <fitness+0x58>
mov    -0x38(%rbp),%rdi
mov    0x18(%rbp),%esi
call   1050 <todos_transmiten@plt>
cmp    $0x0,%eax
jne    11a3 <fitness+0x73>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    12fa <fitness+0x1ca>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1227 <fitness+0xf7>
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <tasa_de_transferencia@plt>
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe32(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11b8 <fitness+0x88>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    12c2 <fitness+0x192>
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1040 <tasa_de_transferencia@plt>
mov    0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
addss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1253 <fitness+0x123>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd50(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fitness>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%r13
mov    %r8,%r14
mov    %ecx,%r12d
mov    %rdx,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %ecx,%esi
call   1060 <todos_transmiten@plt>
test   %eax,%eax
je     11da <fitness+0x9a>
mov    0x58(%rsp),%esi
mov    %r13,%rdi
call   1060 <todos_transmiten@plt>
test   %eax,%eax
je     11da <fitness+0x9a>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    11ee <fitness+0xae>
mov    %r12d,%r13d
xorps  %xmm0,%xmm0
xor    %ebp,%ebp
lea    0xe6e(%rip),%r12
nopl   (%rax)
movss  %xmm0,0xc(%rsp)
movss  (%r15,%rbp,4),%xmm0
call   1050 <tasa_de_transferencia@plt>
movss  %xmm0,(%rbx,%rbp,4)
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
addss  (%rbx,%rbp,4),%xmm0
add    $0x1,%rbp
cmp    %rbp,%r13
jne    11a0 <fitness+0x60>
jmp    11f1 <fitness+0xb1>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
jmp    12bf <fitness+0x17f>
xorps  %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe10(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdea(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x58(%rsp),%eax
test   %eax,%eax
jle    128b <fitness+0x14b>
mov    0x50(%rsp),%r12
mov    %eax,%r13d
xor    %ebp,%ebp
lea    0xdd5(%rip),%r15
movss  0xc(%rsp),%xmm0
nopl   0x0(%rax)
movss  %xmm0,0xc(%rsp)
movss  (%r14,%rbp,4),%xmm0
call   1050 <tasa_de_transferencia@plt>
movss  %xmm0,(%r12,%rbp,4)
movss  (%rbx,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
addss  (%r12,%rbp,4),%xmm0
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1240 <fitness+0x100>
movss  %xmm0,0xc(%rsp)
cvtss2sd %xmm0,%xmm0
jmp    1291 <fitness+0x151>
movsd  0x10(%rsp),%xmm0
lea    0xd7a(%rip),%rdi
movsd  %xmm0,0x10(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xd6b(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Hay dispositivos sin transmitir.\0A\00"
@.str.1 = [11 x i8] c"\0Afitness: \00"
@.str.2 = [7 x i8] c" %f + \00"
@.str.3 = [5 x i8] c"= %f\00"
@.str.4 = [22 x i8] c"\0Afitness corrida: %f\0A\00"
define float @fitness(float* %0, i32* %1, float* %2, i32 %3, float* %4, i32* %5, float* %6, i32 %7) {
%9 = alloca float
%10 = alloca float*
%11 = alloca i32*
%12 = alloca float*
%13 = alloca i32
%14 = alloca float*
%15 = alloca i32*
%16 = alloca float*
%17 = alloca i32
%18 = alloca float
%19 = alloca i32
store float* %0, float** %10
store i32* %1, i32** %11
store float* %2, float** %12
store i32 %3, i32* %13
store float* %4, float** %14
store i32* %5, i32** %15
store float* %6, float** %16
store i32 %7, i32* %17
store float 0.000000e+00, float* %18
%20 = load i32*, i32** %11
%21 = load i32, i32* %13
%22 = call i32 @todos_transmiten(i32* %20, i32 %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %8
%25 = load i32*, i32** %15
%26 = load i32, i32* %17
%27 = call i32 @todos_transmiten(i32* %25, i32 %26)
%28 = icmp ne i32 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %24, %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store float 0.000000e+00, float* %9
br label %110
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %19
br label %33
33: ; preds = %62, %31
%34 = load i32, i32* %19
%35 = load i32, i32* %13
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %65
37: ; preds = %33
%38 = load float*, float** %10
%39 = load i32, i32* %19
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %38, i64 %40
%42 = load float, float* %41
%43 = call float @tasa_de_transferencia(float %42)
%44 = load float*, float** %12
%45 = load i32, i32* %19
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
store float %43, float* %47
%48 = load float*, float** %12
%49 = load i32, i32* %19
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %48, i64 %50
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %53)
%55 = load float*, float** %12
%56 = load i32, i32* %19
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds float, float* %55, i64 %57
%59 = load float, float* %58
%60 = load float, float* %18
%61 = fadd float %60, %59
store float %61, float* %18
br label %62
62: ; preds = %37
%63 = load i32, i32* %19
%64 = add nsw i32 %63, 1
store i32 %64, i32* %19
br label %33
65: ; preds = %33
%66 = load float, float* %18
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %67)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %19
br label %70
70: ; preds = %99, %65
%71 = load i32, i32* %19
%72 = load i32, i32* %17
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %102
74: ; preds = %70
%75 = load float*, float** %14
%76 = load i32, i32* %19
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds float, float* %75, i64 %77
%79 = load float, float* %78
%80 = call float @tasa_de_transferencia(float %79)
%81 = load float*, float** %16
%82 = load i32, i32* %19
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds float, float* %81, i64 %83
store float %80, float* %84
%85 = load float*, float** %12
%86 = load i32, i32* %19
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds float, float* %85, i64 %87
%89 = load float, float* %88
%90 = fpext float %89 to double
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %90)
%92 = load float*, float** %16
%93 = load i32, i32* %19
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds float, float* %92, i64 %94
%96 = load float, float* %95
%97 = load float, float* %18
%98 = fadd float %97, %96
store float %98, float* %18
br label %99
99: ; preds = %74
%100 = load i32, i32* %19
%101 = add nsw i32 %100, 1
store i32 %101, i32* %19
br label %70
102: ; preds = %70
%103 = load float, float* %18
%104 = fpext float %103 to double
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %104)
%106 = load float, float* %18
%107 = fpext float %106 to double
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %107)
%109 = load float, float* %18
store float %109, float* %9
br label %110
110: ; preds = %102, %29
%111 = load float, float* %9
ret float %111
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"\0Afitness: \00"
@.str.2 = [7 x i8] c" %f + \00"
@.str.3 = [5 x i8] c"= %f\00"
@.str.4 = [22 x i8] c"\0Afitness corrida: %f\0A\00"
@str = [33 x i8] c"Hay dispositivos sin transmitir.\00"
define float @fitness(float* nocapture %0, i32* %1, float* nocapture %2, i32 %3, float* nocapture %4, i32* %5, float* nocapture %6, i32 %7) {
%9 = tail call i32 @todos_transmiten(i32* %1, i32 %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i32 @todos_transmiten(i32* %5, i32 %7)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11, %8
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %64
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp sgt i32 %3, 0
br i1 %18, label %19, label %34
19: ; preds = %16
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %32, %21 ]
%23 = phi float [ 0.000000e+00, %19 ], [ %31, %21 ]
%24 = getelementptr inbounds float, float* %0, i64 %22
%25 = load float, float* %24
%26 = tail call float @tasa_de_transferencia(float %25)
%27 = getelementptr inbounds float, float* %2, i64 %22
store float %26, float* %27
%28 = fpext float %26 to double
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = load float, float* %27
%31 = fadd float %23, %30
%32 = add nuw nsw i64 %22, 1
%33 = icmp eq i64 %32, %20
br i1 %33, label %34, label %21
34: ; preds = %21, %16
%35 = phi float [ 0.000000e+00, %16 ], [ %31, %21 ]
%36 = fpext float %35 to double
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %36)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp sgt i32 %7, 0
br i1 %39, label %40, label %59
40: ; preds = %34
%41 = zext i32 %7 to i64
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %55, %42 ]
%44 = phi float [ %35, %40 ], [ %54, %42 ]
%45 = getelementptr inbounds float, float* %4, i64 %43
%46 = load float, float* %45
%47 = tail call float @tasa_de_transferencia(float %46)
%48 = getelementptr inbounds float, float* %6, i64 %43
store float %47, float* %48
%49 = getelementptr inbounds float, float* %2, i64 %43
%50 = load float, float* %49
%51 = fpext float %50 to double
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %51)
%53 = load float, float* %48
%54 = fadd float %44, %53
%55 = add nuw nsw i64 %43, 1
%56 = icmp eq i64 %55, %41
br i1 %56, label %57, label %42
57: ; preds = %42
%58 = fpext float %54 to double
br label %59
59: ; preds = %57, %34
%60 = phi double [ %58, %57 ], [ %36, %34 ]
%61 = phi float [ %54, %57 ], [ %35, %34 ]
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %60)
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), double %60)
br label %64
64: ; preds = %59, %14
%65 = phi float [ %61, %59 ], [ 0.000000e+00, %14 ]
ret float %65
}