#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 fabs(double);
void my_constraints(double x[], int n) {
  int i;
  for (i = 0; i < n; i++) {
    if (x[i] < 0) {
      x[i] = fabs(x[i]);
    }
  }
}


x86 assembly (clang, -O0):
<my_constraints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116c <my_constraints+0x6c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    1159 <my_constraints+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xeb8(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    115e <my_constraints+0x5e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <my_constraints+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_constraints>:
test   %esi,%esi
jle    112e <my_constraints+0x2e>
mov    %esi,%ecx
cmp    $0x1,%esi
jne    112f <my_constraints+0x2f>
xor    %eax,%eax
test   $0x1,%cl
je     112e <my_constraints+0x2e>
movsd  (%rdi,%rax,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    112e <my_constraints+0x2e>
andpd  0xed7(%rip),%xmm0
movlpd %xmm0,(%rdi,%rax,8)
ret
mov    %ecx,%edx
and    $0xfffffffe,%edx
xor    %eax,%eax
xorpd  %xmm0,%xmm0
movapd 0xebe(%rip),%xmm1
jmp    1159 <my_constraints+0x59>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x2,%rax
cmp    %rax,%rdx
je     110d <my_constraints+0xd>
movsd  (%rdi,%rax,8),%xmm2
ucomisd %xmm2,%xmm0
jbe    116d <my_constraints+0x6d>
andpd  %xmm1,%xmm2
movlpd %xmm2,(%rdi,%rax,8)
movsd  0x8(%rdi,%rax,8),%xmm2
ucomisd %xmm2,%xmm0
jbe    1150 <my_constraints+0x50>
andpd  %xmm1,%xmm2
movlpd %xmm2,0x8(%rdi,%rax,8)
jmp    1150 <my_constraints+0x50>

LLVM IR (-O0):
define void @my_constraints(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %29, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %32
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
%15 = load double, double* %14
%16 = fcmp olt double %15, 0.000000e+00
br i1 %16, label %17, label %28
17: ; preds = %10
%18 = load double*, double** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = load double, double* %21
%23 = call double @llvm.fabs.f64(double %22)
%24 = load double*, double** %3
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
store double %23, double* %27
br label %28
28: ; preds = %17, %10
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %6
32: ; preds = %6
ret void
}

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