#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 */
void bbob2009_copy_rotation_matrix(double **rot, double *M, double *b,
                                   const size_t dimension) {
  size_t row, column;
  double *current_row;
  for (row = 0; row < dimension; ++row) {
    current_row = M + row * dimension;
    for (column = 0; column < dimension; ++column) {
      current_row[column] = rot[row][column];
    }
    b[row] = 0.0;
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11ac <bbob2009_copy_rotation_matrix+0xac>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    118b <bbob2009_copy_rotation_matrix+0x8b>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    114a <bbob2009_copy_rotation_matrix+0x4a>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <bbob2009_copy_rotation_matrix+0x1c>
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rcx,%rcx
je     131e <bbob2009_copy_rotation_matrix+0x21e>
mov    %rsi,%r10
lea    -0x4(%rcx),%rax
mov    %rax,-0x8(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %rcx,%r8
and    $0xfffffffffffffffc,%r8
mov    %eax,%r12d
and    $0x3,%r12d
and    $0xfffffffffffffffc,%rax
mov    %rax,-0x18(%rsp)
mov    %ecx,%r14d
and    $0x3,%r14d
lea    0x70(%rsi),%r9
lea    0x0(,%rcx,8),%r15
mov    %r12,-0x10(%rsp)
shl    $0x5,%r12
xor    %r13d,%r13d
jmp    117b <bbob2009_copy_rotation_matrix+0x7b>
nop
movq   $0x0,(%rdx,%r13,8)
add    $0x1,%r13
add    %r15,%r9
add    %r15,%rsi
cmp    %rcx,%r13
je     131e <bbob2009_copy_rotation_matrix+0x21e>
mov    (%rdi,%r13,8),%rbp
cmp    $0x4,%rcx
jb     11b4 <bbob2009_copy_rotation_matrix+0xb4>
mov    %r13,%rax
imul   %rcx,%rax
lea    (%r10,%rax,8),%r11
lea    0x0(,%rcx,8),%rbx
add    %rbp,%rbx
cmp    %rbx,%r11
jae    1250 <bbob2009_copy_rotation_matrix+0x150>
add    %rcx,%rax
lea    (%r10,%rax,8),%rax
cmp    %rax,%rbp
jae    1250 <bbob2009_copy_rotation_matrix+0x150>
xor    %r11d,%r11d
mov    %r11,%rax
not    %rax
add    %rcx,%rax
test   %r14,%r14
je     11e7 <bbob2009_copy_rotation_matrix+0xe7>
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r11,8),%xmm0
movsd  %xmm0,(%rsi,%r11,8)
add    $0x1,%r11
add    $0xffffffffffffffff,%rbx
jne    11d0 <bbob2009_copy_rotation_matrix+0xd0>
cmp    $0x3,%rax
jb     1160 <bbob2009_copy_rotation_matrix+0x60>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%r11,8),%xmm0
movsd  %xmm0,(%rsi,%r11,8)
movsd  0x8(%rbp,%r11,8),%xmm0
movsd  %xmm0,0x8(%rsi,%r11,8)
movsd  0x10(%rbp,%r11,8),%xmm0
movsd  %xmm0,0x10(%rsi,%r11,8)
movsd  0x18(%rbp,%r11,8),%xmm0
movsd  %xmm0,0x18(%rsi,%r11,8)
add    $0x4,%r11
cmp    %r11,%rcx
jne    1200 <bbob2009_copy_rotation_matrix+0x100>
jmp    1160 <bbob2009_copy_rotation_matrix+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
cmpq   $0xc,-0x8(%rsp)
jae    125c <bbob2009_copy_rotation_matrix+0x15c>
xor    %ebx,%ebx
jmp    12d1 <bbob2009_copy_rotation_matrix+0x1d1>
mov    -0x18(%rsp),%rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups 0x0(%rbp,%rbx,8),%xmm0
movups 0x10(%rbp,%rbx,8),%xmm1
movups %xmm0,-0x70(%r9,%rbx,8)
movups %xmm1,-0x60(%r9,%rbx,8)
movups 0x20(%rbp,%rbx,8),%xmm0
movups 0x30(%rbp,%rbx,8),%xmm1
movups %xmm0,-0x50(%r9,%rbx,8)
movups %xmm1,-0x40(%r9,%rbx,8)
movups 0x40(%rbp,%rbx,8),%xmm0
movups 0x50(%rbp,%rbx,8),%xmm1
movups %xmm0,-0x30(%r9,%rbx,8)
movups %xmm1,-0x20(%r9,%rbx,8)
movups 0x60(%rbp,%rbx,8),%xmm0
movups 0x70(%rbp,%rbx,8),%xmm1
movups %xmm0,-0x10(%r9,%rbx,8)
movups %xmm1,(%r9,%rbx,8)
add    $0x10,%rbx
add    $0xfffffffffffffffc,%rax
jne    1270 <bbob2009_copy_rotation_matrix+0x170>
cmpq   $0x0,-0x10(%rsp)
je     130d <bbob2009_copy_rotation_matrix+0x20d>
lea    (%rsi,%rbx,8),%r11
lea    0x10(,%rbx,8),%rbx
add    %rbp,%rbx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movups -0x10(%rbx,%rax,1),%xmm0
movups (%rbx,%rax,1),%xmm1
movups %xmm0,(%r11,%rax,1)
movups %xmm1,0x10(%r11,%rax,1)
add    $0x20,%rax
cmp    %rax,%r12
jne    12f0 <bbob2009_copy_rotation_matrix+0x1f0>
mov    %r8,%r11
cmp    %rcx,%r8
je     1160 <bbob2009_copy_rotation_matrix+0x60>
jmp    11b7 <bbob2009_copy_rotation_matrix+0xb7>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @bbob2009_copy_rotation_matrix(double** %0, double* %1, double* %2, i64 %3) {
%5 = alloca double**
%6 = alloca double*
%7 = alloca double*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca double*
store double** %0, double*** %5
store double* %1, double** %6
store double* %2, double** %7
store i64 %3, i64* %8
store i64 0, i64* %9
br label %12
12: ; preds = %44, %4
%13 = load i64, i64* %9
%14 = load i64, i64* %8
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %47
16: ; preds = %12
%17 = load double*, double** %6
%18 = load i64, i64* %9
%19 = load i64, i64* %8
%20 = mul i64 %18, %19
%21 = getelementptr inbounds double, double* %17, i64 %20
store double* %21, double** %11
store i64 0, i64* %10
br label %22
22: ; preds = %37, %16
%23 = load i64, i64* %10
%24 = load i64, i64* %8
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %40
26: ; preds = %22
%27 = load double**, double*** %5
%28 = load i64, i64* %9
%29 = getelementptr inbounds double*, double** %27, i64 %28
%30 = load double*, double** %29
%31 = load i64, i64* %10
%32 = getelementptr inbounds double, double* %30, i64 %31
%33 = load double, double* %32
%34 = load double*, double** %11
%35 = load i64, i64* %10
%36 = getelementptr inbounds double, double* %34, i64 %35
store double %33, double* %36
br label %37
37: ; preds = %26
%38 = load i64, i64* %10
%39 = add i64 %38, 1
store i64 %39, i64* %10
br label %22
40: ; preds = %22
%41 = load double*, double** %7
%42 = load i64, i64* %9
%43 = getelementptr inbounds double, double* %41, i64 %42
store double 0.000000e+00, double* %43
br label %44
44: ; preds = %40
%45 = load i64, i64* %9
%46 = add i64 %45, 1
store i64 %46, i64* %9
br label %12
47: ; preds = %12
ret void
}

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