#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 */
struct chromosome {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ myfree(struct chromosome *, int);
void deletepreviousgeneration(struct chromosome **initialpop,
                              struct chromosome **nextgen, int POPSIZE,
                              int timeslots) {
  int i = 0;
  for (i = 0; i < POPSIZE; i++) {
    struct chromosome *temp = initialpop[i];
    initialpop[i] = nextgen[i];
    myfree(temp, timeslots);
  }
}


x86 assembly (clang, -O0):
<deletepreviousgeneration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1182 <deletepreviousgeneration+0x72>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <myfree@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <deletepreviousgeneration+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deletepreviousgeneration>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    114f <deletepreviousgeneration+0x3f>
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rbx,8),%rdi
mov    (%r15,%rbx,8),%rax
mov    %rax,0x0(%rbp,%rbx,8)
mov    %r14d,%esi
call   1030 <myfree@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <deletepreviousgeneration+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.chromosome = type { i32 }
define void @deletepreviousgeneration(%struct.chromosome** %0, %struct.chromosome** %1, i32 %2, i32 %3) {
%5 = alloca %struct.chromosome**
%6 = alloca %struct.chromosome**
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.chromosome*
store %struct.chromosome** %0, %struct.chromosome*** %5
store %struct.chromosome** %1, %struct.chromosome*** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
store i32 0, i32* %9
br label %11
11: ; preds = %33, %4
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %11
%16 = load %struct.chromosome**, %struct.chromosome*** %5
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds %struct.chromosome*, %struct.chromosome** %16, i64 %18
%20 = load %struct.chromosome*, %struct.chromosome** %19
store %struct.chromosome* %20, %struct.chromosome** %10
%21 = load %struct.chromosome**, %struct.chromosome*** %6
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds %struct.chromosome*, %struct.chromosome** %21, i64 %23
%25 = load %struct.chromosome*, %struct.chromosome** %24
%26 = load %struct.chromosome**, %struct.chromosome*** %5
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds %struct.chromosome*, %struct.chromosome** %26, i64 %28
store %struct.chromosome* %25, %struct.chromosome** %29
%30 = load %struct.chromosome*, %struct.chromosome** %10
%31 = load i32, i32* %8
%32 = call i32 @myfree(%struct.chromosome* %30, i32 %31)
br label %33
33: ; preds = %15
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %11
36: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.chromosome = type { i32 }
define void @deletepreviousgeneration(%struct.chromosome** nocapture %0, %struct.chromosome** nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %17
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %15, %8 ]
%10 = getelementptr inbounds %struct.chromosome*, %struct.chromosome** %0, i64 %9
%11 = load %struct.chromosome*, %struct.chromosome** %10
%12 = getelementptr inbounds %struct.chromosome*, %struct.chromosome** %1, i64 %9
%13 = load %struct.chromosome*, %struct.chromosome** %12
store %struct.chromosome* %13, %struct.chromosome** %10
%14 = tail call i32 @myfree(%struct.chromosome* %11, i32 %3)
%15 = add nuw nsw i64 %9, 1
%16 = icmp eq i64 %15, %7
br i1 %16, label %17, label %8
17: ; preds = %8, %4
ret void
}