#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 */
typedef double uint8_t;

/* Variables and functions */
int pixel_convert_8u_gray_to_64f_gray(double *dest, int dstride, int dwidth,
                                      int dheight, const uint8_t *src,
                                      int sstride) {
  int i, j;
  for (i = 0; i < dheight; i++) {
    double *drow = (double *)((uint8_t *)dest + i * dstride);
    const uint8_t *srow = src + i * sstride;
    for (j = 0; j < dwidth; j++) {
      drow[j] = srow[j];
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<pixel_convert_8u_gray_to_64f_gray>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ac <pixel_convert_8u_gray_to_64f_gray+0xac>
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
imul   -0x24(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1199 <pixel_convert_8u_gray_to_64f_gray+0x99>
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1165 <pixel_convert_8u_gray_to_64f_gray+0x65>
jmp    119e <pixel_convert_8u_gray_to_64f_gray+0x9e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1120 <pixel_convert_8u_gray_to_64f_gray+0x20>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pixel_convert_8u_gray_to_64f_gray>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,-0x40(%rsp)
test   %ecx,%ecx
jle    1384 <pixel_convert_8u_gray_to_64f_gray+0x284>
movslq %esi,%rax
movslq %r9d,%rbp
mov    %ecx,%r13d
mov    %edx,%r10d
mov    %r10d,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,-0x20(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x28(%rsp)
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %ecx,%r14d
and    $0x3,%r14d
and    $0xfffffffffffffffc,%rcx
mov    %rcx,-0x38(%rsp)
mov    %r10d,%r11d
and    $0x3,%r11d
mov    -0x40(%rsp),%r8
lea    0x70(%r8),%rsi
mov    %rbp,-0x18(%rsp)
lea    0x0(,%rbp,8),%rcx
lea    0x70(%rdi),%rbp
mov    %rax,-0x10(%rsp)
lea    0x0(,%rax,8),%rax
mov    %rax,-0x8(%rsp)
mov    %rcx,%rax
mov    %r14,-0x30(%rsp)
shl    $0x5,%r14
xor    %r15d,%r15d
mov    %rdi,%r12
mov    %r11,-0x50(%rsp)
mov    %rcx,-0x48(%rsp)
jmp    11be <pixel_convert_8u_gray_to_64f_gray+0xbe>
add    $0x1,%r15
add    %rax,%rsi
mov    -0x8(%rsp),%rcx
add    %rcx,%rbp
add    %rcx,%r12
add    %rax,%r8
cmp    %r13,%r15
je     1384 <pixel_convert_8u_gray_to_64f_gray+0x284>
test   %edx,%edx
jle    11a0 <pixel_convert_8u_gray_to_64f_gray+0xa0>
cmp    $0x4,%edx
jae    11d0 <pixel_convert_8u_gray_to_64f_gray+0xd0>
xor    %r9d,%r9d
jmp    1300 <pixel_convert_8u_gray_to_64f_gray+0x200>
nop
mov    %r13,%r11
mov    %r15,%rcx
imul   -0x10(%rsp),%rcx
mov    %r15,%rax
imul   -0x18(%rsp),%rax
lea    (%rax,%r10,1),%rbx
lea    (%rdi,%rcx,8),%r9
mov    -0x40(%rsp),%r13
lea    0x0(,%rbx,8),%rbx
add    %r13,%rbx
cmp    %rbx,%r9
jae    122e <pixel_convert_8u_gray_to_64f_gray+0x12e>
add    %r10,%rcx
lea    (%rdi,%rcx,8),%rcx
lea    0x0(,%rax,8),%rax
add    %r13,%rax
cmp    %rcx,%rax
jae    122e <pixel_convert_8u_gray_to_64f_gray+0x12e>
xor    %r9d,%r9d
mov    %r11,%r13
mov    -0x50(%rsp),%r11
mov    -0x48(%rsp),%rax
jmp    1300 <pixel_convert_8u_gray_to_64f_gray+0x200>
cmpq   $0xc,-0x28(%rsp)
mov    %r11,%r13
jae    1242 <pixel_convert_8u_gray_to_64f_gray+0x142>
xor    %ebx,%ebx
mov    -0x50(%rsp),%r11
jmp    12a9 <pixel_convert_8u_gray_to_64f_gray+0x1a9>
mov    -0x38(%rsp),%rcx
xor    %ebx,%ebx
mov    -0x50(%rsp),%r11
xchg   %ax,%ax
movups -0x70(%rsi,%rbx,8),%xmm0
movups -0x60(%rsi,%rbx,8),%xmm1
movups %xmm0,-0x70(%rbp,%rbx,8)
movups %xmm1,-0x60(%rbp,%rbx,8)
movups -0x50(%rsi,%rbx,8),%xmm0
movups -0x40(%rsi,%rbx,8),%xmm1
movups %xmm0,-0x50(%rbp,%rbx,8)
movups %xmm1,-0x40(%rbp,%rbx,8)
movups -0x30(%rsi,%rbx,8),%xmm0
movups -0x20(%rsi,%rbx,8),%xmm1
movups %xmm0,-0x30(%rbp,%rbx,8)
movups %xmm1,-0x20(%rbp,%rbx,8)
movups -0x10(%rsi,%rbx,8),%xmm0
movups (%rsi,%rbx,8),%xmm1
movups %xmm0,-0x10(%rbp,%rbx,8)
movups %xmm1,0x0(%rbp,%rbx,8)
add    $0x10,%rbx
add    $0xfffffffffffffffc,%rcx
jne    1250 <pixel_convert_8u_gray_to_64f_gray+0x150>
cmpq   $0x0,-0x30(%rsp)
je     12db <pixel_convert_8u_gray_to_64f_gray+0x1db>
lea    (%r12,%rbx,8),%rcx
lea    (%r8,%rbx,8),%rbx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
movups (%rbx,%rax,1),%xmm0
movups 0x10(%rbx,%rax,1),%xmm1
movups %xmm0,(%rcx,%rax,1)
movups %xmm1,0x10(%rcx,%rax,1)
add    $0x20,%rax
cmp    %rax,%r14
jne    12c0 <pixel_convert_8u_gray_to_64f_gray+0x1c0>
mov    -0x20(%rsp),%rax
mov    %rax,%r9
cmp    %r10,%rax
mov    -0x48(%rsp),%rax
je     11a0 <pixel_convert_8u_gray_to_64f_gray+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r9,%rcx
not    %rcx
add    %r10,%rcx
test   %r11,%r11
je     1336 <pixel_convert_8u_gray_to_64f_gray+0x236>
mov    %r11,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r8,%r9,8),%xmm0
movsd  %xmm0,(%r12,%r9,8)
add    $0x1,%r9
add    $0xffffffffffffffff,%rbx
jne    1320 <pixel_convert_8u_gray_to_64f_gray+0x220>
cmp    $0x3,%rcx
jb     11a0 <pixel_convert_8u_gray_to_64f_gray+0xa0>
movsd  (%r8,%r9,8),%xmm0
movsd  %xmm0,(%r12,%r9,8)
movsd  0x8(%r8,%r9,8),%xmm0
movsd  %xmm0,0x8(%r12,%r9,8)
movsd  0x10(%r8,%r9,8),%xmm0
movsd  %xmm0,0x10(%r12,%r9,8)
movsd  0x18(%r8,%r9,8),%xmm0
movsd  %xmm0,0x18(%r12,%r9,8)
add    $0x4,%r9
cmp    %r9,%r10
jne    1340 <pixel_convert_8u_gray_to_64f_gray+0x240>
jmp    11a0 <pixel_convert_8u_gray_to_64f_gray+0xa0>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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