#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 matExtract1D(char const *, int, double *);
int matExtract1Df(const char *string, int dim, float *res) {
  int i;
  double v1[16];
  if (matExtract1D(string, dim, v1) == -1)
    return -1;
  else
    for (i = 0; i < dim; i++)
      res[i] = (float)v1[i];
  return 0;
}


x86 assembly (clang, -O0):
<matExtract1Df>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0xb0(%rbp),%rdx
call   1030 <matExtract1D@plt>
cmp    $0xffffffff,%eax
jne    114e <matExtract1Df+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1199 <matExtract1Df+0x89>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118d <matExtract1Df+0x7d>
movslq -0x24(%rbp),%rax
movsd  -0xb0(%rbp,%rax,8),%xmm0
ff ff
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1155 <matExtract1Df+0x45>
jmp    1192 <matExtract1Df+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matExtract1Df>:
push   %rbp
push   %rbx
sub    $0x88,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rsp,%rdx
call   1030 <matExtract1D@plt>
cmp    $0xffffffff,%eax
je     1141 <matExtract1Df+0x31>
test   %ebp,%ebp
jle    11f7 <matExtract1Df+0xe7>
mov    %ebp,%ecx
cmp    $0x4,%ebp
jae    114b <matExtract1Df+0x3b>
xor    %edx,%edx
jmp    11e0 <matExtract1Df+0xd0>
mov    $0xffffffff,%eax
jmp    11f9 <matExtract1Df+0xe9>
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rsi
mov    %rsi,%rax
shr    $0x2,%rax
add    $0x1,%rax
test   %rsi,%rsi
je     1203 <matExtract1Df+0xf3>
mov    %rax,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cvtpd2ps (%rsp,%rsi,8),%xmm0
cvtpd2ps 0x10(%rsp,%rsi,8),%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,(%rbx,%rsi,4)
cvtpd2ps 0x20(%rsp,%rsi,8),%xmm0
cvtpd2ps 0x30(%rsp,%rsi,8),%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,0x10(%rbx,%rsi,4)
add    $0x8,%rsi
add    $0xfffffffffffffffe,%rdi
jne    1180 <matExtract1Df+0x70>
test   $0x1,%al
je     11cc <matExtract1Df+0xbc>
cvtpd2ps (%rsp,%rsi,8),%xmm0
cvtpd2ps 0x10(%rsp,%rsi,8),%xmm1
unpcklpd %xmm1,%xmm0
movupd %xmm0,(%rbx,%rsi,4)
xor    %eax,%eax
cmp    %rcx,%rdx
je     11f9 <matExtract1Df+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rsp,%rdx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rbx,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    11e0 <matExtract1Df+0xd0>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %rbp
ret
xor    %esi,%esi
test   $0x1,%al
jne    11b8 <matExtract1Df+0xa8>
jmp    11cc <matExtract1Df+0xbc>

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

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