#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 */
double fmax(int /*<<< orphan*/, double);
void prox_lp(double *x, const int n, const double rho, const double *c) {
  int i;
#pragma omp parallel for
  for (i = 0; i < n; i++) {
    x[i] = fmax(0, x[i] - c[i] / rho);
  }
}


x86 assembly (clang, -O0):
<prox_lp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1180 <prox_lp+0x70>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
divsd  -0x18(%rbp),%xmm1
subsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <prox_lp+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prox_lp>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    11d3 <prox_lp+0xc3>
mov    %rdx,%r14
mov    %rdi,%r15
mov    %esi,%r12d
cmp    $0x1,%esi
movsd  %xmm0,0x8(%rsp)
jne    113d <prox_lp+0x2d>
xor    %ebx,%ebx
jmp    11a2 <prox_lp+0x92>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
movsd  (%r14,%rbx,8),%xmm1
divsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
movsd  %xmm0,(%r15,%rbx,8)
movsd  0x8(%r15,%rbx,8),%xmm0
movsd  0x8(%r14,%rbx,8),%xmm1
divsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
movsd  %xmm0,0x8(%r15,%rbx,8)
add    $0x2,%rbx
cmp    %rbx,%r13
jne    1150 <prox_lp+0x40>
test   $0x1,%r12b
movsd  0x8(%rsp),%xmm0
je     11d3 <prox_lp+0xc3>
movapd %xmm0,%xmm2
movsd  (%r15,%rbx,8),%xmm0
movsd  (%r14,%rbx,8),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
xor    %edi,%edi
call   1030 <fmax@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @prox_lp(double* nocapture %0, i32 %1, double %2, double* nocapture %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %44
6: ; preds = %4
%7 = zext i32 %1 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %1, 1
br i1 %9, label %33, label %10
10: ; preds = %6
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %30, %12 ]
%14 = phi i64 [ 0, %10 ], [ %31, %12 ]
%15 = getelementptr inbounds double, double* %0, i64 %13
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %3, i64 %13
%18 = load double, double* %17
%19 = fdiv double %18, %2
%20 = fsub double %16, %19
%21 = tail call double @fmax(i32 0, double %20)
store double %21, double* %15
%22 = or i64 %13, 1
%23 = getelementptr inbounds double, double* %0, i64 %22
%24 = load double, double* %23
%25 = getelementptr inbounds double, double* %3, i64 %22
%26 = load double, double* %25
%27 = fdiv double %26, %2
%28 = fsub double %24, %27
%29 = tail call double @fmax(i32 0, double %28)
store double %29, double* %23
%30 = add nuw nsw i64 %13, 2
%31 = add i64 %14, 2
%32 = icmp eq i64 %31, %11
br i1 %32, label %33, label %12
33: ; preds = %12, %6
%34 = phi i64 [ 0, %6 ], [ %30, %12 ]
%35 = icmp eq i64 %8, 0
br i1 %35, label %44, label %36
36: ; preds = %33
%37 = getelementptr inbounds double, double* %0, i64 %34
%38 = load double, double* %37
%39 = getelementptr inbounds double, double* %3, i64 %34
%40 = load double, double* %39
%41 = fdiv double %40, %2
%42 = fsub double %38, %41
%43 = tail call double @fmax(i32 0, double %42)
store double %43, double* %37
br label %44
44: ; preds = %36, %33, %4
ret void
}