#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_trans_block(double **dest, double **source, int istart, int ni,
                      int jstart, int nj) {
  int ii, jj;
  memset(dest[0], 0, sizeof(double) * 32 * 32);
  for (jj = 0; jj < nj; jj++) {
    double *sj = &source[jstart + jj][istart];
    for (ii = 0; ii < ni; ii++)
      dest[ii][jj] = sj[ii];
  }
}


x86 assembly (clang, -O0):
<copy_trans_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1030 <memset@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    11ca <copy_trans_block+0xba>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    -0x28(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11b7 <copy_trans_block+0xa7>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    117b <copy_trans_block+0x6b>
jmp    11bc <copy_trans_block+0xac>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1148 <copy_trans_block+0x38>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_trans_block>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%ebp
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1030 <memset@plt>
test   %r15d,%r15d
jle    124c <copy_trans_block+0x13c>
movslq %r13d,%r8
movslq %ebp,%r10
mov    %r15d,%r15d
mov    %r12d,%r9d
lea    -0x1(%r9),%r11
mov    %r9d,%esi
and    $0x3,%esi
and    $0xfffffffc,%r9d
lea    0x3(%r8),%rax
mov    %rax,(%rsp)
xor    %ecx,%ecx
jmp    117d <copy_trans_block+0x6d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    %r15,%rcx
je     124c <copy_trans_block+0x13c>
test   %r12d,%r12d
jle    1170 <copy_trans_block+0x60>
lea    (%rcx,%r10,1),%rdx
mov    (%r14,%rdx,8),%r13
cmp    $0x3,%r11
jae    11a0 <copy_trans_block+0x90>
xor    %ebp,%ebp
jmp    1207 <copy_trans_block+0xf7>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp),%rax
lea    0x0(,%rax,8),%rdx
add    %r13,%rdx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  -0x18(%rdx,%rbp,8),%xmm0
mov    (%rbx,%rbp,8),%rdi
movsd  %xmm0,(%rdi,%rcx,8)
movsd  -0x10(%rdx,%rbp,8),%xmm0
mov    0x8(%rbx,%rbp,8),%rdi
movsd  %xmm0,(%rdi,%rcx,8)
movsd  -0x8(%rdx,%rbp,8),%xmm0
mov    0x10(%rbx,%rbp,8),%rdi
movsd  %xmm0,(%rdi,%rcx,8)
movsd  (%rdx,%rbp,8),%xmm0
mov    0x18(%rbx,%rbp,8),%rdi
movsd  %xmm0,(%rdi,%rcx,8)
add    $0x4,%rbp
cmp    %rbp,%r9
jne    11c0 <copy_trans_block+0xb0>
test   %rsi,%rsi
je     1170 <copy_trans_block+0x60>
lea    (%rbx,%rbp,8),%rdx
lea    0x0(,%r8,8),%rdi
add    %r13,%rdi
lea    (%rdi,%rbp,8),%rdi
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rdi,%rbp,8),%xmm0
mov    (%rdx,%rbp,8),%rax
movsd  %xmm0,(%rax,%rcx,8)
add    $0x1,%rbp
cmp    %rbp,%rsi
jne    1230 <copy_trans_block+0x120>
jmp    1170 <copy_trans_block+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @copy_trans_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*
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
%16 = load double**, double*** %7
%17 = getelementptr inbounds double*, double** %16, i64 0
%18 = load double*, double** %17
%19 = call i32 @memset(double* %18, i32 0, i32 8192)
store i32 0, i32* %14
br label %20
20: ; preds = %57, %6
%21 = load i32, i32* %14
%22 = load i32, i32* %12
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %60
24: ; preds = %20
%25 = load double**, double*** %8
%26 = load i32, i32* %11
%27 = load i32, i32* %14
%28 = add nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double*, double** %25, i64 %29
%31 = load double*, double** %30
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
store double* %34, double** %15
store i32 0, i32* %13
br label %35
35: ; preds = %53, %24
%36 = load i32, i32* %13
%37 = load i32, i32* %10
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %56
39: ; preds = %35
%40 = load double*, double** %15
%41 = load i32, i32* %13
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = load double**, double*** %7
%46 = load i32, i32* %13
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double*, double** %45, i64 %47
%49 = load double*, double** %48
%50 = load i32, i32* %14
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %49, i64 %51
store double %44, double* %52
br label %53
53: ; preds = %39
%54 = load i32, i32* %13
%55 = add nsw i32 %54, 1
store i32 %55, i32* %13
br label %35
56: ; preds = %35
br label %57
57: ; preds = %56
%58 = load i32, i32* %14
%59 = add nsw i32 %58, 1
store i32 %59, i32* %14
br label %20
60: ; preds = %20
ret void
}

LLVM IR (-O2):
define void @copy_trans_block(double** nocapture %0, double** nocapture %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = load double*, double** %0
%8 = tail call i32 @memset(double* %7, i32 0, i32 8192)
%9 = icmp sgt i32 %5, 0
br i1 %9, label %10, label %73
10: ; preds = %6
%11 = sext i32 %2 to i64
%12 = icmp sgt i32 %3, 0
%13 = sext i32 %4 to i64
%14 = zext i32 %5 to i64
%15 = zext i32 %3 to i64
%16 = add nsw i64 %15, -1
%17 = and i64 %15, 3
%18 = icmp ult i64 %16, 3
%19 = and i64 %15, 4294967292
%20 = icmp eq i64 %17, 0
br label %21
21: ; preds = %10, %70
%22 = phi i64 [ 0, %10 ], [ %71, %70 ]
%23 = add nsw i64 %22, %13
%24 = getelementptr inbounds double*, double** %1, i64 %23
%25 = load double*, double** %24
%26 = getelementptr inbounds double, double* %25, i64 %11
br i1 %12, label %27, label %70
27: ; preds = %21
br i1 %18, label %57, label %28
28: ; preds = %27, %28
%29 = phi i64 [ %54, %28 ], [ 0, %27 ]
%30 = phi i64 [ %55, %28 ], [ 0, %27 ]
%31 = getelementptr inbounds double, double* %26, i64 %29
%32 = load double, double* %31
%33 = getelementptr inbounds double*, double** %0, i64 %29
%34 = load double*, double** %33
%35 = getelementptr inbounds double, double* %34, i64 %22
store double %32, double* %35
%36 = or i64 %29, 1
%37 = getelementptr inbounds double, double* %26, i64 %36
%38 = load double, double* %37
%39 = getelementptr inbounds double*, double** %0, i64 %36
%40 = load double*, double** %39
%41 = getelementptr inbounds double, double* %40, i64 %22
store double %38, double* %41
%42 = or i64 %29, 2
%43 = getelementptr inbounds double, double* %26, i64 %42
%44 = load double, double* %43
%45 = getelementptr inbounds double*, double** %0, i64 %42
%46 = load double*, double** %45
%47 = getelementptr inbounds double, double* %46, i64 %22
store double %44, double* %47
%48 = or i64 %29, 3
%49 = getelementptr inbounds double, double* %26, i64 %48
%50 = load double, double* %49
%51 = getelementptr inbounds double*, double** %0, i64 %48
%52 = load double*, double** %51
%53 = getelementptr inbounds double, double* %52, i64 %22
store double %50, double* %53
%54 = add nuw nsw i64 %29, 4
%55 = add i64 %30, 4
%56 = icmp eq i64 %55, %19
br i1 %56, label %57, label %28
57: ; preds = %28, %27
%58 = phi i64 [ 0, %27 ], [ %54, %28 ]
br i1 %20, label %70, label %59
59: ; preds = %57, %59
%60 = phi i64 [ %67, %59 ], [ %58, %57 ]
%61 = phi i64 [ %68, %59 ], [ 0, %57 ]
%62 = getelementptr inbounds double, double* %26, i64 %60
%63 = load double, double* %62
%64 = getelementptr inbounds double*, double** %0, i64 %60
%65 = load double*, double** %64
%66 = getelementptr inbounds double, double* %65, i64 %22
store double %63, double* %66
%67 = add nuw nsw i64 %60, 1
%68 = add i64 %61, 1
%69 = icmp eq i64 %68, %17
br i1 %69, label %70, label %59
70: ; preds = %57, %59, %21
%71 = add nuw nsw i64 %22, 1
%72 = icmp eq i64 %71, %14
br i1 %72, label %73, label %21
73: ; preds = %70, %6
ret void
}