#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 */
typedef double int32_t;

/* Variables and functions */
void fmt_convert_s20_to_float(void *dest_v, void *src_v, int n) {
  float *dest = dest_v;
  int32_t *src = src_v;
  int i;
  for (i = 0; i < n; i++)
    dest[i] = src[i] / 524288.0;
}


x86 assembly (clang, -O0):
<fmt_convert_s20_to_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116a <fmt_convert_s20_to_float+0x6a>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xeb9(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1126 <fmt_convert_s20_to_float+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_convert_s20_to_float>:
test   %edx,%edx
jle    120b <fmt_convert_s20_to_float+0x10b>
mov    %edx,%r9d
cmp    $0x4,%edx
jae    1117 <fmt_convert_s20_to_float+0x17>
xor    %ecx,%ecx
jmp    11db <fmt_convert_s20_to_float+0xdb>
mov    %r9d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rax
mov    %rax,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rax,%rax
je     120c <fmt_convert_s20_to_float+0x10c>
mov    %r8,%rax
and    $0xfffffffffffffffe,%rax
xor    %edx,%edx
movapd 0xeba(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
movupd (%rsi,%rdx,8),%xmm1
movupd 0x10(%rsi,%rdx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
cvtpd2ps %xmm1,%xmm1
cvtpd2ps %xmm2,%xmm2
unpcklpd %xmm2,%xmm1
movupd %xmm1,(%rdi,%rdx,4)
movupd 0x20(%rsi,%rdx,8),%xmm1
movupd 0x30(%rsi,%rdx,8),%xmm2
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
cvtpd2ps %xmm1,%xmm1
cvtpd2ps %xmm2,%xmm2
unpcklpd %xmm2,%xmm1
movupd %xmm1,0x10(%rdi,%rdx,4)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rax
jne    1150 <fmt_convert_s20_to_float+0x50>
test   $0x1,%r8b
je     11d6 <fmt_convert_s20_to_float+0xd6>
movupd (%rsi,%rdx,8),%xmm0
movupd 0x10(%rsi,%rdx,8),%xmm1
movapd 0xe43(%rip),%xmm2
mulpd  %xmm2,%xmm0
mulpd  %xmm2,%xmm1
cvtpd2ps %xmm0,%xmm0
cvtpd2ps %xmm1,%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,(%rdi,%rdx,4)
cmp    %r9,%rcx
je     120b <fmt_convert_s20_to_float+0x10b>
movsd  0xe2d(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rsi,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,(%rdi,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%r9
jne    11f0 <fmt_convert_s20_to_float+0xf0>
ret
xor    %edx,%edx
test   $0x1,%r8b
jne    11aa <fmt_convert_s20_to_float+0xaa>
jmp    11d6 <fmt_convert_s20_to_float+0xd6>

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

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