#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 */
double **get_double_matrix(int, int);
double **copy_byte_matrix(char **a, int m, int n) {
  double **b = get_double_matrix(m + 1, n + 1);
  int i, j;
  for (i = 1; i <= m; i++)
    for (j = 1; j <= n; j++)
      b[i][j] = (double)a[i - 1][j - 1];
  return b;
}


x86 assembly (clang, -O0):
<copy_byte_matrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1030 <get_double_matrix@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b5 <copy_byte_matrix+0xa5>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11a2 <copy_byte_matrix+0x92>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0xffffffff,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
add    $0xffffffff,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1151 <copy_byte_matrix+0x41>
jmp    11a7 <copy_byte_matrix+0x97>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <copy_byte_matrix+0x2e>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_byte_matrix>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %edx,%r13d
mov    %esi,%ebp
mov    %rdi,%r14
lea    0x1(%rbp),%r12d
lea    0x1(%r13),%r15d
mov    %r12d,%edi
mov    %r15d,%esi
call   1030 <get_double_matrix@plt>
test   %ebp,%ebp
jle    1384 <copy_byte_matrix+0x274>
mov    %r12d,%r12d
mov    %r15d,%r8d
lea    -0x1(%r8),%r11
lea    -0x5(%r8),%r15
mov    %r15,0x20(%rsp)
shr    $0x2,%r15
add    $0x1,%r15
mov    %r11,%rcx
and    $0xfffffffffffffffc,%rcx
mov    %rcx,0x18(%rsp)
add    $0x1,%rcx
mov    %rcx,0x10(%rsp)
mov    %r15,%rcx
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x8(%rsp)
mov    $0x1,%r9d
jmp    119d <copy_byte_matrix+0x8d>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r9
cmp    %r12,%r9
je     1384 <copy_byte_matrix+0x274>
test   %r13d,%r13d
jle    1190 <copy_byte_matrix+0x80>
mov    -0x8(%r14,%r9,8),%rdi
mov    (%rax,%r9,8),%rbx
mov    $0x1,%ecx
cmp    $0x4,%r11
jb     12e0 <copy_byte_matrix+0x1d0>
lea    0x8(%rbx),%rdx
lea    (%rdi,%r11,1),%rsi
cmp    %rdx,%rsi
jbe    11d4 <copy_byte_matrix+0xc4>
lea    (%rbx,%r8,8),%rdx
cmp    %rdx,%rdi
jb     12e0 <copy_byte_matrix+0x1d0>
cmpq   $0x4,0x20(%rsp)
jae    11e3 <copy_byte_matrix+0xd3>
xor    %ecx,%ecx
jmp    127e <copy_byte_matrix+0x16e>
mov    0x8(%rsp),%r10
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movzwl (%rdi,%rcx,1),%edx
movd   %edx,%xmm0
punpcklbw %xmm0,%xmm0
movzwl 0x2(%rdi,%rcx,1),%edx
movd   %edx,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x60,%xmm0,%xmm0
psrad  $0x18,%xmm0
cvtdq2pd %xmm0,%xmm0
pshuflw $0x60,%xmm1,%xmm1
psrad  $0x18,%xmm1
cvtdq2pd %xmm1,%xmm1
movups %xmm0,0x8(%rbx,%rcx,8)
movups %xmm1,0x18(%rbx,%rcx,8)
movzwl 0x4(%rdi,%rcx,1),%edx
movd   %edx,%xmm0
punpcklbw %xmm0,%xmm0
movzwl 0x6(%rdi,%rcx,1),%edx
movd   %edx,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x60,%xmm0,%xmm0
psrad  $0x18,%xmm0
cvtdq2pd %xmm0,%xmm0
pshuflw $0x60,%xmm1,%xmm1
psrad  $0x18,%xmm1
cvtdq2pd %xmm1,%xmm1
movupd %xmm0,0x28(%rbx,%rcx,8)
movups %xmm1,0x38(%rbx,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%r10
jne    11f0 <copy_byte_matrix+0xe0>
test   $0x1,%r15b
je     12cf <copy_byte_matrix+0x1bf>
movzwl (%rdi,%rcx,1),%edx
movd   %edx,%xmm0
punpcklbw %xmm0,%xmm0
movzwl 0x2(%rdi,%rcx,1),%edx
movd   %edx,%xmm1
punpcklbw %xmm1,%xmm1
pshuflw $0x60,%xmm0,%xmm0
psrad  $0x18,%xmm0
cvtdq2pd %xmm0,%xmm0
pshuflw $0x60,%xmm1,%xmm1
psrad  $0x18,%xmm1
cvtdq2pd %xmm1,%xmm1
lea    0x0(,%rcx,8),%rcx
or     $0x8,%rcx
movupd %xmm0,(%rbx,%rcx,1)
movups %xmm1,0x10(%rbx,%rcx,1)
mov    0x10(%rsp),%rcx
cmp    0x18(%rsp),%r11
je     1190 <copy_byte_matrix+0x80>
nop
mov    %r8d,%edx
sub    %ecx,%edx
mov    %rcx,%rsi
not    %rsi
add    %r8,%rsi
and    $0x3,%rdx
je     131b <copy_byte_matrix+0x20b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl -0x1(%rdi,%rcx,1),%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
jne    1300 <copy_byte_matrix+0x1f0>
cmp    $0x3,%rsi
jb     1190 <copy_byte_matrix+0x80>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl -0x1(%rdi,%rcx,1),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsbl (%rdi,%rcx,1),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsbl 0x1(%rdi,%rcx,1),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
movsbl 0x2(%rdi,%rcx,1),%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x18(%rbx,%rcx,8)
add    $0x4,%rcx
cmp    %rcx,%r8
jne    1330 <copy_byte_matrix+0x220>
jmp    1190 <copy_byte_matrix+0x80>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double** @copy_byte_matrix(i8** nocapture %0, i32 %1, i32 %2) {
%4 = add i32 %1, 1
%5 = add i32 %2, 1
%6 = tail call double** @get_double_matrix(i32 %4, i32 %5)
%7 = icmp slt i32 %1, 1
br i1 %7, label %141, label %8
8: ; preds = %3
%9 = icmp slt i32 %2, 1
%10 = zext i32 %4 to i64
%11 = zext i32 %5 to i64
%12 = add nsw i64 %11, -1
%13 = add nsw i64 %11, -1
%14 = add nsw i64 %11, -5
%15 = lshr i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = icmp ult i64 %13, 4
%18 = and i64 %13, -4
%19 = or i64 %18, 1
%20 = and i64 %16, 1
%21 = icmp ult i64 %14, 4
%22 = and i64 %16, 9223372036854775806
%23 = icmp eq i64 %20, 0
%24 = icmp eq i64 %13, %18
br label %25
25: ; preds = %8, %138
%26 = phi i64 [ 1, %8 ], [ %139, %138 ]
br i1 %9, label %138, label %27
27: ; preds = %25
%28 = add nsw i64 %26, -1
%29 = getelementptr inbounds i8*, i8** %0, i64 %28
%30 = load i8*, i8** %29
%31 = getelementptr inbounds double*, double** %6, i64 %26
%32 = load double*, double** %31
br i1 %17, label %93, label %33
33: ; preds = %27
%34 = getelementptr double, double* %32, i64 1
%35 = bitcast double* %34 to i8*
%36 = getelementptr double, double* %32, i64 %11
%37 = bitcast double* %36 to i8*
%38 = getelementptr i8, i8* %30, i64 %12
%39 = icmp ugt i8* %38, %35
%40 = icmp ult i8* %30, %37
%41 = and i1 %39, %40
br i1 %41, label %93, label %42
42: ; preds = %33
br i1 %21, label %76, label %43
43: ; preds = %42, %43
%44 = phi i64 [ %73, %43 ], [ 0, %42 ]
%45 = phi i64 [ %74, %43 ], [ 0, %42 ]
%46 = or i64 %44, 1
%47 = getelementptr inbounds i8, i8* %30, i64 %44
%48 = bitcast i8* %47 to <2 x i8>*
%49 = load <2 x i8>, <2 x i8>* %48
%50 = getelementptr inbounds i8, i8* %47, i64 2
%51 = bitcast i8* %50 to <2 x i8>*
%52 = load <2 x i8>, <2 x i8>* %51
%53 = sitofp <2 x i8> %49 to <2 x double>
%54 = sitofp <2 x i8> %52 to <2 x double>
%55 = getelementptr inbounds double, double* %32, i64 %46
%56 = bitcast double* %55 to <2 x double>*
store <2 x double> %53, <2 x double>* %56
%57 = getelementptr inbounds double, double* %55, i64 2
%58 = bitcast double* %57 to <2 x double>*
store <2 x double> %54, <2 x double>* %58
%59 = or i64 %44, 4
%60 = or i64 %44, 5
%61 = getelementptr inbounds i8, i8* %30, i64 %59
%62 = bitcast i8* %61 to <2 x i8>*
%63 = load <2 x i8>, <2 x i8>* %62
%64 = getelementptr inbounds i8, i8* %61, i64 2
%65 = bitcast i8* %64 to <2 x i8>*
%66 = load <2 x i8>, <2 x i8>* %65
%67 = sitofp <2 x i8> %63 to <2 x double>
%68 = sitofp <2 x i8> %66 to <2 x double>
%69 = getelementptr inbounds double, double* %32, i64 %60
%70 = bitcast double* %69 to <2 x double>*
store <2 x double> %67, <2 x double>* %70
%71 = getelementptr inbounds double, double* %69, i64 2
%72 = bitcast double* %71 to <2 x double>*
store <2 x double> %68, <2 x double>* %72
%73 = add nuw i64 %44, 8
%74 = add i64 %45, 2
%75 = icmp eq i64 %74, %22
br i1 %75, label %76, label %43
76: ; preds = %43, %42
%77 = phi i64 [ 0, %42 ], [ %73, %43 ]
br i1 %23, label %92, label %78
78: ; preds = %76
%79 = or i64 %77, 1
%80 = getelementptr inbounds i8, i8* %30, i64 %77
%81 = bitcast i8* %80 to <2 x i8>*
%82 = load <2 x i8>, <2 x i8>* %81
%83 = getelementptr inbounds i8, i8* %80, i64 2
%84 = bitcast i8* %83 to <2 x i8>*
%85 = load <2 x i8>, <2 x i8>* %84
%86 = sitofp <2 x i8> %82 to <2 x double>
%87 = sitofp <2 x i8> %85 to <2 x double>
%88 = getelementptr inbounds double, double* %32, i64 %79
%89 = bitcast double* %88 to <2 x double>*
store <2 x double> %86, <2 x double>* %89
%90 = getelementptr inbounds double, double* %88, i64 2
%91 = bitcast double* %90 to <2 x double>*
store <2 x double> %87, <2 x double>* %91
br label %92
92: ; preds = %76, %78
br i1 %24, label %138, label %93
93: ; preds = %33, %27, %92
%94 = phi i64 [ 1, %33 ], [ 1, %27 ], [ %19, %92 ]
%95 = sub nsw i64 %11, %94
%96 = xor i64 %94, -1
%97 = add nsw i64 %96, %11
%98 = and i64 %95, 3
%99 = icmp eq i64 %98, 0
br i1 %99, label %111, label %100
100: ; preds = %93, %100
%101 = phi i64 [ %108, %100 ], [ %94, %93 ]
%102 = phi i64 [ %109, %100 ], [ 0, %93 ]
%103 = add nsw i64 %101, -1
%104 = getelementptr inbounds i8, i8* %30, i64 %103
%105 = load i8, i8* %104
%106 = sitofp i8 %105 to double
%107 = getelementptr inbounds double, double* %32, i64 %101
store double %106, double* %107
%108 = add nuw nsw i64 %101, 1
%109 = add i64 %102, 1
%110 = icmp eq i64 %109, %98
br i1 %110, label %111, label %100
111: ; preds = %100, %93
%112 = phi i64 [ %94, %93 ], [ %108, %100 ]
%113 = icmp ult i64 %97, 3
br i1 %113, label %138, label %114
114: ; preds = %111, %114
%115 = phi i64 [ %136, %114 ], [ %112, %111 ]
%116 = add nsw i64 %115, -1
%117 = getelementptr inbounds i8, i8* %30, i64 %116
%118 = load i8, i8* %117
%119 = sitofp i8 %118 to double
%120 = getelementptr inbounds double, double* %32, i64 %115
store double %119, double* %120
%121 = add nuw nsw i64 %115, 1
%122 = getelementptr inbounds i8, i8* %30, i64 %115
%123 = load i8, i8* %122
%124 = sitofp i8 %123 to double
%125 = getelementptr inbounds double, double* %32, i64 %121
store double %124, double* %125
%126 = add nuw nsw i64 %115, 2
%127 = getelementptr inbounds i8, i8* %30, i64 %121
%128 = load i8, i8* %127
%129 = sitofp i8 %128 to double
%130 = getelementptr inbounds double, double* %32, i64 %126
store double %129, double* %130
%131 = add nuw nsw i64 %115, 3
%132 = getelementptr inbounds i8, i8* %30, i64 %126
%133 = load i8, i8* %132
%134 = sitofp i8 %133 to double
%135 = getelementptr inbounds double, double* %32, i64 %131
store double %134, double* %135
%136 = add nuw nsw i64 %115, 4
%137 = icmp eq i64 %136, %11
br i1 %137, label %138, label %114
138: ; preds = %111, %114, %92, %25
%139 = add nuw nsw i64 %26, 1
%140 = icmp eq i64 %139, %10
br i1 %140, label %141, label %25
141: ; preds = %138, %3
ret double** %6
}