#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 */
scalar_t__ malloc(int);
double *west_bound(const double *data, int nx, int ny) {
  int i;
  double *bnd;
  bnd = (double *)malloc(ny * sizeof(double));
  for (i = 0; i < ny; i++)
    bnd[i] = data[i * nx];
  return bnd;
}


x86 assembly (clang, -O0):
<west_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0x10(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1176 <west_bound+0x66>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113c <west_bound+0x2c>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<west_bound>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0x0(,%rbx,8),%edi
call   1030 <malloc@plt>
test   %ebx,%ebx
jle    132c <west_bound+0x21c>
movslq %r14d,%r8
mov    %ebx,%r11d
xor    %edx,%edx
cmp    $0x4,%ebx
jb     1265 <west_bound+0x155>
cmp    $0x1,%r14d
jne    1265 <west_bound+0x155>
lea    0x0(,%r11,8),%rcx
add    %rbp,%rcx
cmp    %rcx,%rax
jae    116e <west_bound+0x5e>
lea    (%rax,%r11,8),%rcx
cmp    %rbp,%rcx
jbe    116e <west_bound+0x5e>
xor    %edx,%edx
jmp    1265 <west_bound+0x155>
mov    %r11d,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rcx
mov    %rcx,%r14
shr    $0x2,%r14
add    $0x1,%r14
mov    %r14d,%r9d
and    $0x3,%r9d
cmp    $0xc,%rcx
jae    1194 <west_bound+0x84>
xor    %esi,%esi
jmp    1210 <west_bound+0x100>
and    $0xfffffffffffffffc,%r14
mov    %r8,%r10
shl    $0x7,%r10
mov    %r8,%rcx
shl    $0x5,%rcx
xor    %esi,%esi
mov    %rbp,%rbx
nopl   0x0(%rax,%rax,1)
movups (%rbx),%xmm0
movups 0x10(%rbx),%xmm1
movups %xmm0,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
lea    (%rbx,%rcx,1),%rdi
movups (%rbx,%rcx,1),%xmm0
movups 0x10(%rbx,%rcx,1),%xmm1
movups %xmm0,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
lea    (%rdi,%rcx,1),%r15
movups (%rcx,%rdi,1),%xmm0
movups 0x10(%rcx,%rdi,1),%xmm1
movups %xmm0,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups (%rcx,%r15,1),%xmm0
movups 0x10(%rcx,%r15,1),%xmm1
movups %xmm0,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
add    $0x10,%rsi
add    %r10,%rbx
add    $0xfffffffffffffffc,%r14
jne    11b0 <west_bound+0xa0>
test   %r9,%r9
je     125c <west_bound+0x14c>
lea    (%rax,%rsi,8),%rcx
add    $0x10,%rcx
imul   %r8,%rsi
lea    0x10(,%rsi,8),%rsi
add    %rbp,%rsi
mov    %r8,%rdi
shl    $0x5,%rdi
shl    $0x5,%r9
xor    %ebx,%ebx
nopl   0x0(%rax)
movups -0x10(%rsi),%xmm0
movups (%rsi),%xmm1
movups %xmm0,-0x10(%rcx,%rbx,1)
movups %xmm1,(%rcx,%rbx,1)
add    $0x20,%rbx
add    %rdi,%rsi
cmp    %rbx,%r9
jne    1240 <west_bound+0x130>
cmp    %r11,%rdx
je     132c <west_bound+0x21c>
mov    %rdx,%rsi
not    %rsi
add    %r11,%rsi
mov    %r11,%rcx
and    $0x3,%rcx
je     12b6 <west_bound+0x1a6>
mov    %rdx,%rdi
imul   %r8,%rdi
lea    0x0(,%rdi,8),%rdi
add    %rbp,%rdi
lea    0x0(,%r8,8),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
add    %rbx,%rdi
add    $0xffffffffffffffff,%rcx
jne    12a0 <west_bound+0x190>
cmp    $0x3,%rsi
jb     132c <west_bound+0x21c>
lea    0x3(%rdx),%r9
imul   %r8,%r9
mov    %r8,%rsi
shl    $0x5,%rsi
lea    0x2(%rdx),%rdi
imul   %r8,%rdi
mov    %rdx,%rbx
imul   %r8,%rbx
lea    0x1(%rdx),%rcx
imul   %r8,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%rbp,%rbx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
movsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,0x8(%rax,%rdx,8)
movsd  0x0(%rbp,%rdi,8),%xmm0
movsd  %xmm0,0x10(%rax,%rdx,8)
movsd  0x0(%rbp,%r9,8),%xmm0
movsd  %xmm0,0x18(%rax,%rdx,8)
add    $0x4,%rdx
add    %rsi,%rbp
cmp    %rdx,%r11
jne    12f0 <west_bound+0x1e0>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double* @west_bound(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = mul i64 %10, 8
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to double*
store double* %14, double** %8
store i32 0, i32* %7
br label %15
15: ; preds = %31, %3
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %34
19: ; preds = %15
%20 = load double*, double** %4
%21 = load i32, i32* %7
%22 = load i32, i32* %5
%23 = mul nsw i32 %21, %22
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %20, i64 %24
%26 = load double, double* %25
%27 = load double*, double** %8
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
store double %26, double* %30
br label %31
31: ; preds = %19
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %15
34: ; preds = %15
%35 = load double*, double** %8
ret double* %35
}

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