#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*/ edge_sparse_csr_reader_double(char const *, unsigned int **,
                                                 unsigned int **, double **,
                                                 unsigned int *, unsigned int *,
                                                 unsigned int *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(unsigned int);
void edge_sparse_csr_reader_float(const char *i_csr_file_in,
                                  unsigned int **o_row_idx,
                                  unsigned int **o_column_idx, float **o_values,
                                  unsigned int *o_row_count,
                                  unsigned int *o_column_count,
                                  unsigned int *o_element_count) {
  double *l_values;
  unsigned int i;
  edge_sparse_csr_reader_double(i_csr_file_in, o_row_idx, o_column_idx,
                                &l_values, o_row_count, o_column_count,
                                o_element_count);
  *o_values = (float *)malloc((*o_element_count) * sizeof(float));
  for (i = 0; i < (*o_element_count); ++i) {
    (*o_values)[i] = (float)l_values[i];
  }
  free(l_values);
}


x86 assembly (clang, -O0):
<edge_sparse_csr_reader_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
lea    -0x38(%rbp),%rcx
mov    %rax,(%rsp)
call   1040 <edge_sparse_csr_reader_double@plt>
mov    0x10(%rbp),%rax
mov    (%rax),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    0x10(%rbp),%rcx
cmp    (%rcx),%eax
jae    11d7 <edge_sparse_csr_reader_float+0xa7>
mov    -0x38(%rbp),%rax
mov    -0x3c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x3c(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    119b <edge_sparse_csr_reader_float+0x6b>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edge_sparse_csr_reader_float>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    0x30(%rsp),%rbx
mov    %rbx,(%rsp)
lea    0x10(%rsp),%rcx
call   1040 <edge_sparse_csr_reader_double@plt>
mov    (%rbx),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,(%r14)
mov    (%rbx),%ecx
mov    0x10(%rsp),%rdi
test   %rcx,%rcx
je     1227 <edge_sparse_csr_reader_float+0xf7>
cmp    $0x4,%ecx
jae    1176 <edge_sparse_csr_reader_float+0x46>
xor    %edx,%edx
jmp    1210 <edge_sparse_csr_reader_float+0xe0>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rsi
mov    %rsi,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rsi,%rsi
je     1234 <edge_sparse_csr_reader_float+0x104>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ebx,%ebx
nopl   0x0(%rax)
movupd (%rdi,%rbx,8),%xmm0
movupd 0x10(%rdi,%rbx,8),%xmm1
cvtpd2ps %xmm0,%xmm0
cvtpd2ps %xmm1,%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,(%rax,%rbx,4)
movupd 0x20(%rdi,%rbx,8),%xmm0
movupd 0x30(%rdi,%rbx,8),%xmm1
cvtpd2ps %xmm0,%xmm0
cvtpd2ps %xmm1,%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,0x10(%rax,%rbx,4)
add    $0x8,%rbx
add    $0xfffffffffffffffe,%rsi
jne    11a0 <edge_sparse_csr_reader_float+0x70>
test   $0x1,%r8b
je     1206 <edge_sparse_csr_reader_float+0xd6>
movupd (%rdi,%rbx,8),%xmm0
movupd 0x10(%rdi,%rbx,8),%xmm1
cvtpd2ps %xmm0,%xmm0
cvtpd2ps %xmm1,%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,(%rax,%rbx,4)
cmp    %rcx,%rdx
je     1227 <edge_sparse_csr_reader_float+0xf7>
nopl   0x0(%rax,%rax,1)
movsd  (%rdi,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rax,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1210 <edge_sparse_csr_reader_float+0xe0>
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
test   $0x1,%r8b
jne    11ea <edge_sparse_csr_reader_float+0xba>
jmp    1206 <edge_sparse_csr_reader_float+0xd6>

LLVM IR (-O0):
define void @edge_sparse_csr_reader_float(i8* %0, i32** %1, i32** %2, float** %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32**
%10 = alloca i32**
%11 = alloca float**
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca double*
%16 = alloca i32
store i8* %0, i8** %8
store i32** %1, i32*** %9
store i32** %2, i32*** %10
store float** %3, float*** %11
store i32* %4, i32** %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%17 = load i8*, i8** %8
%18 = load i32**, i32*** %9
%19 = load i32**, i32*** %10
%20 = load i32*, i32** %12
%21 = load i32*, i32** %13
%22 = load i32*, i32** %14
%23 = call i32 @edge_sparse_csr_reader_double(i8* %17, i32** %18, i32** %19, double** %15, i32* %20, i32* %21, i32* %22)
%24 = load i32*, i32** %14
%25 = load i32, i32* %24
%26 = zext i32 %25 to i64
%27 = mul i64 %26, 4
%28 = trunc i64 %27 to i32
%29 = call i64 @malloc(i32 %28)
%30 = inttoptr i64 %29 to float*
%31 = load float**, float*** %11
store float* %30, float** %31
store i32 0, i32* %16
br label %32
32: ; preds = %49, %7
%33 = load i32, i32* %16
%34 = load i32*, i32** %14
%35 = load i32, i32* %34
%36 = icmp ult i32 %33, %35
br i1 %36, label %37, label %52
37: ; preds = %32
%38 = load double*, double** %15
%39 = load i32, i32* %16
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fptrunc double %42 to float
%44 = load float**, float*** %11
%45 = load float*, float** %44
%46 = load i32, i32* %16
%47 = zext i32 %46 to i64
%48 = getelementptr inbounds float, float* %45, i64 %47
store float %43, float* %48
br label %49
49: ; preds = %37
%50 = load i32, i32* %16
%51 = add i32 %50, 1
store i32 %51, i32* %16
br label %32
52: ; preds = %32
%53 = load double*, double** %15
%54 = call i32 @free(double* %53)
ret void
}

LLVM IR (-O2):
define void @edge_sparse_csr_reader_float(i8* %0, i32** %1, i32** %2, float** nocapture %3, i32* %4, i32* %5, i32* %6) {
%8 = alloca double*
%9 = bitcast double** %8 to i8*
%10 = call i32 @edge_sparse_csr_reader_double(i8* %0, i32** %1, i32** %2, double** %8, i32* %4, i32* %5, i32* %6)
%11 = load i32, i32* %6
%12 = shl i32 %11, 2
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to float*
store float* %14, float** %3
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 0
%17 = load double*, double** %8
br i1 %16, label %89, label %18
18: ; preds = %7
%19 = zext i32 %15 to i64
%20 = icmp ult i32 %15, 4
br i1 %20, label %79, label %21
21: ; preds = %18
%22 = and i64 %19, 4294967292
%23 = add nsw i64 %22, -4
%24 = lshr exact i64 %23, 2
%25 = add nuw nsw i64 %24, 1
%26 = and i64 %25, 1
%27 = icmp eq i64 %23, 0
br i1 %27, label %61, label %28
28: ; preds = %21
%29 = and i64 %25, 9223372036854775806
br label %30
30: ; preds = %30, %28
%31 = phi i64 [ 0, %28 ], [ %58, %30 ]
%32 = phi i64 [ 0, %28 ], [ %59, %30 ]
%33 = getelementptr inbounds double, double* %17, i64 %31
%34 = bitcast double* %33 to <2 x double>*
%35 = load <2 x double>, <2 x double>* %34
%36 = getelementptr inbounds double, double* %33, i64 2
%37 = bitcast double* %36 to <2 x double>*
%38 = load <2 x double>, <2 x double>* %37
%39 = fptrunc <2 x double> %35 to <2 x float>
%40 = fptrunc <2 x double> %38 to <2 x float>
%41 = getelementptr inbounds float, float* %14, i64 %31
%42 = bitcast float* %41 to <2 x float>*
store <2 x float> %39, <2 x float>* %42
%43 = getelementptr inbounds float, float* %41, i64 2
%44 = bitcast float* %43 to <2 x float>*
store <2 x float> %40, <2 x float>* %44
%45 = or i64 %31, 4
%46 = getelementptr inbounds double, double* %17, i64 %45
%47 = bitcast double* %46 to <2 x double>*
%48 = load <2 x double>, <2 x double>* %47
%49 = getelementptr inbounds double, double* %46, i64 2
%50 = bitcast double* %49 to <2 x double>*
%51 = load <2 x double>, <2 x double>* %50
%52 = fptrunc <2 x double> %48 to <2 x float>
%53 = fptrunc <2 x double> %51 to <2 x float>
%54 = getelementptr inbounds float, float* %14, i64 %45
%55 = bitcast float* %54 to <2 x float>*
store <2 x float> %52, <2 x float>* %55
%56 = getelementptr inbounds float, float* %54, i64 2
%57 = bitcast float* %56 to <2 x float>*
store <2 x float> %53, <2 x float>* %57
%58 = add nuw i64 %31, 8
%59 = add i64 %32, 2
%60 = icmp eq i64 %59, %29
br i1 %60, label %61, label %30
61: ; preds = %30, %21
%62 = phi i64 [ 0, %21 ], [ %58, %30 ]
%63 = icmp eq i64 %26, 0
br i1 %63, label %77, label %64
64: ; preds = %61
%65 = getelementptr inbounds double, double* %17, i64 %62
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = getelementptr inbounds double, double* %65, i64 2
%69 = bitcast double* %68 to <2 x double>*
%70 = load <2 x double>, <2 x double>* %69
%71 = fptrunc <2 x double> %67 to <2 x float>
%72 = fptrunc <2 x double> %70 to <2 x float>
%73 = getelementptr inbounds float, float* %14, i64 %62
%74 = bitcast float* %73 to <2 x float>*
store <2 x float> %71, <2 x float>* %74
%75 = getelementptr inbounds float, float* %73, i64 2
%76 = bitcast float* %75 to <2 x float>*
store <2 x float> %72, <2 x float>* %76
br label %77
77: ; preds = %61, %64
%78 = icmp eq i64 %22, %19
br i1 %78, label %89, label %79
79: ; preds = %18, %77
%80 = phi i64 [ 0, %18 ], [ %22, %77 ]
br label %81
81: ; preds = %79, %81
%82 = phi i64 [ %87, %81 ], [ %80, %79 ]
%83 = getelementptr inbounds double, double* %17, i64 %82
%84 = load double, double* %83
%85 = fptrunc double %84 to float
%86 = getelementptr inbounds float, float* %14, i64 %82
store float %85, float* %86
%87 = add nuw nsw i64 %82, 1
%88 = icmp eq i64 %87, %19
br i1 %88, label %89, label %81
89: ; preds = %81, %77, %7
%90 = call i32 @free(double* %17)
ret void
}