#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 DBL_EPSILON;
double HUGE_VAL;
double fabs(double);
void setConstraints(int n, double x[], int pivot[], double xscale[],
                    double xoffset[], double low[], double up[]) {
  int i;
  for (i = 0; i < n; i++) {
    if (xscale[i] == 0.0) {
      pivot[i] = 2;
    } else if (low[i] != -HUGE_VAL &&
               (x[i] * xscale[i] + xoffset[i] - low[i] <=
                DBL_EPSILON * 10.0 * (fabs(low[i]) + 1.0))) {
      pivot[i] = -1;
    } else if (up[i] != HUGE_VAL &&
               (x[i] * xscale[i] + xoffset[i] - up[i] >=
                DBL_EPSILON * 10.0 * (fabs(up[i]) + 1.0))) {
      pivot[i] = 1;
    } else {
      pivot[i] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<setConstraints>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1329 <setConstraints+0x229>
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1166 <setConstraints+0x66>
jp     1166 <setConstraints+0x66>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x2,(%rax,%rcx,4)
jmp    1316 <setConstraints+0x216>
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2e66(%rip),%rax
movsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
ucomisd %xmm1,%xmm0
jne    11aa <setConstraints+0xaa>
jp     11aa <setConstraints+0xaa>
jmp    123f <setConstraints+0x13f>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xe1a(%rip),%xmm0
mov    0x2df3(%rip),%rax
mulsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movaps 0xe03(%rip),%xmm3
pand   %xmm3,%xmm2
movsd  0xde7(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     123f <setConstraints+0x13f>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
jmp    1311 <setConstraints+0x211>
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2d8d(%rip),%rax
ucomisd (%rax),%xmm0
jne    1268 <setConstraints+0x168>
jp     1268 <setConstraints+0x168>
jmp    12fd <setConstraints+0x1fd>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xd5c(%rip),%xmm1
mov    0x2d35(%rip),%rax
mulsd  (%rax),%xmm1
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movaps 0xd45(%rip),%xmm3
pand   %xmm3,%xmm2
movsd  0xd29(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     12fd <setConstraints+0x1fd>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    130c <setConstraints+0x20c>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    1311 <setConstraints+0x211>
jmp    1316 <setConstraints+0x216>
jmp    131b <setConstraints+0x21b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1126 <setConstraints+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setConstraints>:
test   %edi,%edi
jle    11f9 <setConstraints+0xf9>
mov    0x8(%rsp),%r10
mov    0x2ecc(%rip),%rax
movsd  (%rax),%xmm0
movapd 0xee0(%rip),%xmm1
xorpd  %xmm0,%xmm1
mov    0x2ebd(%rip),%rax
movsd  (%rax),%xmm2
mulsd  0xee9(%rip),%xmm2
mov    %edi,%r11d
xor    %eax,%eax
xorpd  %xmm3,%xmm3
movapd 0xec7(%rip),%xmm8
movsd  0xed7(%rip),%xmm5
jmp    1170 <setConstraints+0x70>
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nop
mov    %edi,(%rdx,%rax,4)
add    $0x1,%rax
cmp    %rax,%r11
je     11f9 <setConstraints+0xf9>
movsd  (%rcx,%rax,8),%xmm6
mov    $0x2,%edi
ucomisd %xmm3,%xmm6
jne    1182 <setConstraints+0x82>
jnp    1160 <setConstraints+0x60>
movsd  (%r9,%rax,8),%xmm7
ucomisd %xmm1,%xmm7
jne    1190 <setConstraints+0x90>
jnp    11bb <setConstraints+0xbb>
movsd  (%rsi,%rax,8),%xmm4
mulsd  %xmm6,%xmm4
addsd  (%r8,%rax,8),%xmm4
subsd  %xmm7,%xmm4
andpd  %xmm8,%xmm7
addsd  %xmm5,%xmm7
mulsd  %xmm2,%xmm7
mov    $0xffffffff,%edi
ucomisd %xmm4,%xmm7
jae    1160 <setConstraints+0x60>
movsd  (%r10,%rax,8),%xmm7
ucomisd %xmm0,%xmm7
jne    11c9 <setConstraints+0xc9>
jnp    1153 <setConstraints+0x53>
mulsd  (%rsi,%rax,8),%xmm6
addsd  (%r8,%rax,8),%xmm6
subsd  %xmm7,%xmm6
andpd  %xmm8,%xmm7
addsd  %xmm5,%xmm7
mulsd  %xmm2,%xmm7
mov    $0x1,%edi
ucomisd %xmm7,%xmm6
jb     1153 <setConstraints+0x53>
jmp    1160 <setConstraints+0x60>
ret

LLVM IR (-O0):
@HUGE_VAL = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define void @setConstraints(i32 %0, double* %1, i32* %2, double* %3, double* %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca double*
%10 = alloca i32*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
store i32 %0, i32* %8
store double* %1, double** %9
store i32* %2, i32** %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store double* %6, double** %14
store i32 0, i32* %15
br label %16
16: ; preds = %135, %7
%17 = load i32, i32* %15
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %138
20: ; preds = %16
%21 = load double*, double** %11
%22 = load i32, i32* %15
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %32
27: ; preds = %20
%28 = load i32*, i32** %10
%29 = load i32, i32* %15
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 2, i32* %31
br label %134
32: ; preds = %20
%33 = load double*, double** %13
%34 = load i32, i32* %15
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double, double* @HUGE_VAL
%39 = fneg double %38
%40 = fcmp une double %37, %39
br i1 %40, label %41, label %80
41: ; preds = %32
%42 = load double*, double** %9
%43 = load i32, i32* %15
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = load double*, double** %11
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %12
%53 = load i32, i32* %15
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = call double @llvm.fmuladd.f64(double %46, double %51, double %56)
%58 = load double*, double** %13
%59 = load i32, i32* %15
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = fsub double %57, %62
%64 = load double, double* @DBL_EPSILON
%65 = fmul double %64, 1.000000e+01
%66 = load double*, double** %13
%67 = load i32, i32* %15
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
%70 = load double, double* %69
%71 = call double @llvm.fabs.f64(double %70)
%72 = fadd double %71, 1.000000e+00
%73 = fmul double %65, %72
%74 = fcmp ole double %63, %73
br i1 %74, label %75, label %80
75: ; preds = %41
%76 = load i32*, i32** %10
%77 = load i32, i32* %15
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i32, i32* %76, i64 %78
store i32 -1, i32* %79
br label %133
80: ; preds = %41, %32
%81 = load double*, double** %14
%82 = load i32, i32* %15
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %81, i64 %83
%85 = load double, double* %84
%86 = load double, double* @HUGE_VAL
%87 = fcmp une double %85, %86
br i1 %87, label %88, label %127
88: ; preds = %80
%89 = load double*, double** %9
%90 = load i32, i32* %15
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
%93 = load double, double* %92
%94 = load double*, double** %11
%95 = load i32, i32* %15
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
%98 = load double, double* %97
%99 = load double*, double** %12
%100 = load i32, i32* %15
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
%104 = call double @llvm.fmuladd.f64(double %93, double %98, double %103)
%105 = load double*, double** %14
%106 = load i32, i32* %15
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds double, double* %105, i64 %107
%109 = load double, double* %108
%110 = fsub double %104, %109
%111 = load double, double* @DBL_EPSILON
%112 = fmul double %111, 1.000000e+01
%113 = load double*, double** %14
%114 = load i32, i32* %15
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
%117 = load double, double* %116
%118 = call double @llvm.fabs.f64(double %117)
%119 = fadd double %118, 1.000000e+00
%120 = fmul double %112, %119
%121 = fcmp oge double %110, %120
br i1 %121, label %122, label %127
122: ; preds = %88
%123 = load i32*, i32** %10
%124 = load i32, i32* %15
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %123, i64 %125
store i32 1, i32* %126
br label %132
127: ; preds = %88, %80
%128 = load i32*, i32** %10
%129 = load i32, i32* %15
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32, i32* %128, i64 %130
store i32 0, i32* %131
br label %132
132: ; preds = %127, %122
br label %133
133: ; preds = %132, %75
br label %134
134: ; preds = %133, %27
br label %135
135: ; preds = %134
%136 = load i32, i32* %15
%137 = add nsw i32 %136, 1
store i32 %137, i32* %15
br label %16
138: ; preds = %16
ret void
}

LLVM IR (-O2):
@HUGE_VAL = global double 0.000000e+00
@DBL_EPSILON = global double 0.000000e+00
define void @setConstraints(i32 %0, double* nocapture %1, i32* nocapture writeonly %2, double* nocapture %3, double* nocapture %4, double* nocapture %5, double* nocapture %6) {
%8 = icmp sgt i32 %0, 0
br i1 %8, label %9, label %56
9: ; preds = %7
%10 = load double, double* @HUGE_VAL
%11 = fneg double %10
%12 = load double, double* @DBL_EPSILON
%13 = fmul double %12, 1.000000e+01
%14 = zext i32 %0 to i64
br label %15
15: ; preds = %9, %51
%16 = phi i64 [ 0, %9 ], [ %54, %51 ]
%17 = getelementptr inbounds double, double* %3, i64 %16
%18 = load double, double* %17
%19 = fcmp oeq double %18, 0.000000e+00
br i1 %19, label %51, label %20
20: ; preds = %15
%21 = getelementptr inbounds double, double* %5, i64 %16
%22 = load double, double* %21
%23 = fcmp une double %22, %11
br i1 %23, label %24, label %35
24: ; preds = %20
%25 = getelementptr inbounds double, double* %1, i64 %16
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %4, i64 %16
%28 = load double, double* %27
%29 = tail call double @llvm.fmuladd.f64(double %26, double %18, double %28)
%30 = fsub double %29, %22
%31 = tail call double @llvm.fabs.f64(double %22)
%32 = fadd double %31, 1.000000e+00
%33 = fmul double %32, %13
%34 = fcmp ugt double %30, %33
br i1 %34, label %35, label %51
35: ; preds = %24, %20
%36 = getelementptr inbounds double, double* %6, i64 %16
%37 = load double, double* %36
%38 = fcmp une double %37, %10
br i1 %38, label %39, label %50
39: ; preds = %35
%40 = getelementptr inbounds double, double* %1, i64 %16
%41 = load double, double* %40
%42 = getelementptr inbounds double, double* %4, i64 %16
%43 = load double, double* %42
%44 = tail call double @llvm.fmuladd.f64(double %41, double %18, double %43)
%45 = fsub double %44, %37
%46 = tail call double @llvm.fabs.f64(double %37)
%47 = fadd double %46, 1.000000e+00
%48 = fmul double %47, %13
%49 = fcmp ult double %45, %48
br i1 %49, label %50, label %51
50: ; preds = %39, %35
br label %51
51: ; preds = %39, %24, %15, %50
%52 = phi i32 [ 0, %50 ], [ 2, %15 ], [ -1, %24 ], [ 1, %39 ]
%53 = getelementptr inbounds i32, i32* %2, i64 %16
store i32 %52, i32* %53
%54 = add nuw nsw i64 %16, 1
%55 = icmp eq i64 %54, %14
br i1 %55, label %56, label %15
56: ; preds = %51, %7
ret void
}