#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*/ aD2H(float *, float *const, long);
void download_n(int na, long n, float *const dev[], float *hst[]) {
  for (int i = 0; i < na; ++i)
    aD2H(hst[i], dev[i], n);
}


x86 assembly (clang, -O0):
<download_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1169 <download_n+0x59>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <aD2H@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112e <download_n+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<download_n>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edi,%edi
jle    1149 <download_n+0x39>
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,%r13d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
mov    (%r15,%rbx,8),%rsi
mov    %r12,%rdx
call   1030 <aD2H@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1130 <download_n+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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