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


x86 assembly (clang, -O0):
<south_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%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    -0xc(%rbp),%eax
jge    1170 <south_bound+0x60>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%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 <south_bound+0x2c>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<south_bound>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
lea    0x0(,%r14,8),%edi
call   1030 <malloc@plt>
test   %r14d,%r14d
jle    1294 <south_bound+0x184>
mov    %r14d,%r9d
cmp    $0x4,%r14d
jb     114b <south_bound+0x3b>
lea    (%rbx,%r9,8),%rcx
cmp    %rcx,%rax
jae    11bc <south_bound+0xac>
lea    (%rax,%r9,8),%rcx
cmp    %rbx,%rcx
jbe    11bc <south_bound+0xac>
xor    %edx,%edx
mov    %rdx,%rsi
not    %rsi
add    %r9,%rsi
mov    %r9,%rdi
and    $0x3,%rdi
je     1174 <south_bound+0x64>
nop
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rdi
jne    1160 <south_bound+0x50>
cmp    $0x3,%rsi
jb     1294 <south_bound+0x184>
xchg   %ax,%ax
movsd  (%rbx,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
movsd  0x8(%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x8(%rax,%rdx,8)
movsd  0x10(%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x10(%rax,%rdx,8)
movsd  0x18(%rbx,%rdx,8),%xmm0
movsd  %xmm0,0x18(%rax,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%r9
jne    1180 <south_bound+0x70>
jmp    1294 <south_bound+0x184>
mov    %r9d,%edx
and    $0xfffffffc,%edx
lea    -0x4(%rdx),%rcx
mov    %rcx,%rdi
shr    $0x2,%rdi
add    $0x1,%rdi
mov    %edi,%r8d
and    $0x3,%r8d
cmp    $0xc,%rcx
jae    11e2 <south_bound+0xd2>
xor    %esi,%esi
jmp    1248 <south_bound+0x138>
and    $0xfffffffffffffffc,%rdi
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
movups %xmm0,(%rax,%rsi,8)
movups %xmm1,0x10(%rax,%rsi,8)
movups 0x20(%rbx,%rsi,8),%xmm0
movups 0x30(%rbx,%rsi,8),%xmm1
movups %xmm0,0x20(%rax,%rsi,8)
movups %xmm1,0x30(%rax,%rsi,8)
movups 0x40(%rbx,%rsi,8),%xmm0
movups 0x50(%rbx,%rsi,8),%xmm1
movups %xmm0,0x40(%rax,%rsi,8)
movups %xmm1,0x50(%rax,%rsi,8)
movups 0x60(%rbx,%rsi,8),%xmm0
movups 0x70(%rbx,%rsi,8),%xmm1
movups %xmm0,0x60(%rax,%rsi,8)
movups %xmm1,0x70(%rax,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rdi
jne    11f0 <south_bound+0xe0>
test   %r8,%r8
je     128b <south_bound+0x17b>
lea    (%rax,%rsi,8),%rdi
add    $0x10,%rdi
lea    (%rbx,%rsi,8),%rsi
add    $0x10,%rsi
shl    $0x5,%r8
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups -0x10(%rsi,%rcx,1),%xmm0
movups (%rsi,%rcx,1),%xmm1
movups %xmm0,-0x10(%rdi,%rcx,1)
movups %xmm1,(%rdi,%rcx,1)
add    $0x20,%rcx
cmp    %rcx,%r8
jne    1270 <south_bound+0x160>
cmp    %r9,%rdx
jne    114d <south_bound+0x3d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @south_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* %5
%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 = %29, %3
%16 = load i32, i32* %7
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = load double*, double** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %20, i64 %22
%24 = load double, double* %23
%25 = load double*, double** %8
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %25, i64 %27
store double %24, double* %28
br label %29
29: ; preds = %19
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %15
32: ; preds = %15
%33 = load double*, double** %8
ret double* %33
}

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