#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*/ memset(double *, int /*<<< orphan*/, int);
void copy_block(double **dest, double **source, int istart, int ni, int jstart,
                int nj) {
  int ii, jj;
  for (ii = 0; ii < ni; ii++) {
    double *di = dest[ii];
    double *si = &source[istart + ii][jstart];
    for (jj = 0; jj < nj; jj++)
      di[jj] = si[jj];
    for (; jj < 32; jj++)
      di[jj] = 0;
  }
  int left = 32 - ii;
  if (left)
    memset(dest[ii], 0, sizeof(double) * left * 32);
}


x86 assembly (clang, -O0):
<copy_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11ec <copy_block+0xdc>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x1c(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11ac <copy_block+0x9c>
mov    -0x38(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1178 <copy_block+0x68>
jmp    11b1 <copy_block+0xa1>
cmpl   $0x20,-0x28(%rbp)
jge    11d9 <copy_block+0xc9>
mov    -0x30(%rbp),%rax
movslq -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b1 <copy_block+0xa1>
jmp    11de <copy_block+0xce>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1135 <copy_block+0x25>
mov    $0x20,%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1222 <copy_block+0x112>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
shl    $0x5,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,0x68(%rsp)
mov    %rdi,0x10(%rsp)
test   %ecx,%ecx
jle    13ba <copy_block+0x2aa>
mov    %r9d,%r14d
movslq %r8d,%rsi
movslq %edx,%rax
mov    %rax,0x58(%rsp)
mov    %ecx,0xc(%rsp)
mov    %ecx,%eax
mov    %rax,0x70(%rsp)
mov    %r9d,%r13d
lea    (%rsi,%r13,1),%rax
mov    %rax,0x50(%rsp)
mov    %r13d,%eax
and    $0xfffffffc,%eax
mov    %rax,0x40(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x38(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r12d
and    $0x3,%r12d
and    $0xfffffffffffffffc,%rax
mov    %rax,0x20(%rsp)
mov    %r13d,%r15d
and    $0x3,%r15d
lea    0xe(%rsi),%rax
mov    %rax,0x18(%rsp)
lea    0x2(%rsi),%rax
mov    %rax,0x28(%rsp)
mov    %r12,0x30(%rsp)
shl    $0x5,%r12
mov    %rsi,%rax
mov    %rsi,0x60(%rsp)
lea    0x3(%rsi),%rax
mov    %rax,0x48(%rsp)
xor    %ebx,%ebx
jmp    11eb <copy_block+0xdb>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
lea    (%rax,%rdx,8),%rdi
mov    $0x1f,%eax
sub    %ecx,%eax
lea    0x8(,%rax,8),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x1,%rbx
cmp    0x70(%rsp),%rbx
je     13a2 <copy_block+0x292>
mov    0x10(%rsp),%rax
mov    (%rax,%rbx,8),%rax
mov    $0x0,%ecx
test   %r14d,%r14d
jle    11c0 <copy_block+0xb0>
mov    0x58(%rsp),%rcx
add    %rbx,%rcx
mov    0x68(%rsp),%rdx
mov    (%rdx,%rcx,8),%rcx
mov    0x60(%rsp),%rdx
lea    (%rcx,%rdx,8),%rdx
cmp    $0x4,%r14d
jb     123d <copy_block+0x12d>
mov    0x50(%rsp),%rsi
lea    (%rcx,%rsi,8),%rsi
cmp    %rsi,%rax
jae    12bc <copy_block+0x1ac>
lea    (%rax,%r13,8),%rsi
cmp    %rsi,%rdx
jae    12bc <copy_block+0x1ac>
xor    %esi,%esi
mov    %rsi,%rdi
not    %rdi
add    %r13,%rdi
test   %r15,%r15
je     1264 <copy_block+0x154>
mov    %r15,%rbp
movsd  (%rdx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rbp
jne    1250 <copy_block+0x140>
cmp    $0x3,%rdi
jb     1390 <copy_block+0x280>
mov    0x48(%rsp),%rdx
lea    (%rcx,%rdx,8),%rcx
nopw   0x0(%rax,%rax,1)
movsd  -0x18(%rcx,%rsi,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
movsd  -0x10(%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rax,%rsi,8)
movsd  -0x8(%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x10(%rax,%rsi,8)
movsd  (%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rax,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%r13
jne    1280 <copy_block+0x170>
jmp    1390 <copy_block+0x280>
cmpq   $0xc,0x38(%rsp)
jae    12c8 <copy_block+0x1b8>
xor    %esi,%esi
jmp    1338 <copy_block+0x228>
mov    0x18(%rsp),%rsi
lea    (%rcx,%rsi,8),%rdi
mov    0x20(%rsp),%rbp
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movups -0x70(%rdi,%rsi,8),%xmm0
movups -0x60(%rdi,%rsi,8),%xmm1
movups %xmm0,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
movups -0x50(%rdi,%rsi,8),%xmm0
movups -0x40(%rdi,%rsi,8),%xmm1
movups %xmm0,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
movups -0x30(%rdi,%rsi,8),%xmm0
movups -0x20(%rdi,%rsi,8),%xmm1
movups %xmm0,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups -0x10(%rdi,%rsi,8),%xmm0
movups (%rdi,%rsi,8),%xmm1
movups %xmm0,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rbp
jne    12e0 <copy_block+0x1d0>
cmpq   $0x0,0x30(%rsp)
je     137b <copy_block+0x26b>
lea    (%rax,%rsi,8),%rdi
add    $0x10,%rdi
mov    0x28(%rsp),%rbp
lea    (%rcx,%rbp,8),%rbp
lea    0x0(,%rsi,8),%rsi
add    %rbp,%rsi
xor    %ebp,%ebp
xchg   %ax,%ax
movups -0x10(%rsi,%rbp,1),%xmm0
movups (%rsi,%rbp,1),%xmm1
movups %xmm0,-0x10(%rdi,%rbp,1)
movups %xmm1,(%rdi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r12
jne    1360 <copy_block+0x250>
mov    0x40(%rsp),%rdi
mov    %rdi,%rsi
cmp    %r13,%rdi
jne    123f <copy_block+0x12f>
nopl   0x0(%rax)
mov    %r14d,%ecx
cmp    $0x1f,%r14d
jbe    11c0 <copy_block+0xb0>
jmp    11dc <copy_block+0xcc>
mov    0xc(%rsp),%ecx
cmp    $0x20,%ecx
jne    13bc <copy_block+0x2ac>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ecx,%ecx
mov    %ecx,%eax
mov    0x10(%rsp),%rdx
mov    (%rdx,%rax,8),%rdi
shl    $0x8,%ecx
mov    $0x2000,%edx
sub    %ecx,%edx
xor    %esi,%esi
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @copy_block(double** %0, double** %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca double**
%8 = alloca double**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
store double** %0, double*** %7
store double** %1, double*** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
br label %18
18: ; preds = %68, %6
%19 = load i32, i32* %13
%20 = load i32, i32* %10
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %71
22: ; preds = %18
%23 = load double**, double*** %7
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double*, double** %23, i64 %25
%27 = load double*, double** %26
store double* %27, double** %15
%28 = load double**, double*** %8
%29 = load i32, i32* %9
%30 = load i32, i32* %13
%31 = add nsw i32 %29, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double*, double** %28, i64 %32
%34 = load double*, double** %33
%35 = load i32, i32* %11
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
store double* %37, double** %16
store i32 0, i32* %14
br label %38
38: ; preds = %52, %22
%39 = load i32, i32* %14
%40 = load i32, i32* %12
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = load double*, double** %16
%44 = load i32, i32* %14
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %15
%49 = load i32, i32* %14
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
store double %47, double* %51
br label %52
52: ; preds = %42
%53 = load i32, i32* %14
%54 = add nsw i32 %53, 1
store i32 %54, i32* %14
br label %38
55: ; preds = %38
br label %56
56: ; preds = %64, %55
%57 = load i32, i32* %14
%58 = icmp slt i32 %57, 32
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load double*, double** %15
%61 = load i32, i32* %14
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double 0.000000e+00, double* %63
br label %64
64: ; preds = %59
%65 = load i32, i32* %14
%66 = add nsw i32 %65, 1
store i32 %66, i32* %14
br label %56
67: ; preds = %56
br label %68
68: ; preds = %67
%69 = load i32, i32* %13
%70 = add nsw i32 %69, 1
store i32 %70, i32* %13
br label %18
71: ; preds = %18
%72 = load i32, i32* %13
%73 = sub nsw i32 32, %72
store i32 %73, i32* %17
%74 = load i32, i32* %17
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %88
76: ; preds = %71
%77 = load double**, double*** %7
%78 = load i32, i32* %13
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds double*, double** %77, i64 %79
%81 = load double*, double** %80
%82 = load i32, i32* %17
%83 = sext i32 %82 to i64
%84 = mul i64 8, %83
%85 = mul i64 %84, 32
%86 = trunc i64 %85 to i32
%87 = call i32 @memset(double* %81, i32 0, i32 %86)
br label %88
88: ; preds = %76, %71
ret void
}

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