#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 */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ baz();
__attribute__((noipa)) void foo(int n, double *p, double *x) {
  if (n < 10 && p != 0)
    for (int i = 0; i < 10; i++)
      if (x[0] < p[i])
        x[i] = 0;
  if (p != 0)
    bar();
  else
    baz();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    11a0 <foo+0x80>
cmpq   $0x0,-0x10(%rbp)
je     11a0 <foo+0x80>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jge    119b <foo+0x7b>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1188 <foo+0x68>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    118d <foo+0x6d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114f <foo+0x2f>
jmp    11a0 <foo+0x80>
cmpq   $0x0,-0x10(%rbp)
je     11b7 <foo+0x97>
mov    $0x0,%al
call   1040 <bar@plt>
jmp    11be <foo+0x9e>
mov    $0x0,%al
call   1030 <baz@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x9,%edi
jg     11f6 <foo+0xd6>
test   %rsi,%rsi
je     11f6 <foo+0xd6>
movsd  (%rdx),%xmm0
movsd  (%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    114b <foo+0x2b>
movq   $0x0,(%rdx)
xorpd  %xmm0,%xmm0
movsd  0x8(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    115e <foo+0x3e>
movq   $0x0,0x8(%rdx)
movsd  0x10(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    1171 <foo+0x51>
movq   $0x0,0x10(%rdx)
movsd  0x18(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    1184 <foo+0x64>
movq   $0x0,0x18(%rdx)
movsd  0x20(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    1197 <foo+0x77>
movq   $0x0,0x20(%rdx)
movsd  0x28(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    11aa <foo+0x8a>
movq   $0x0,0x28(%rdx)
movsd  0x30(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    11bd <foo+0x9d>
movq   $0x0,0x30(%rdx)
movsd  0x38(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    11d0 <foo+0xb0>
movq   $0x0,0x38(%rdx)
movsd  0x40(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    11e3 <foo+0xc3>
movq   $0x0,0x40(%rdx)
movsd  0x48(%rsi),%xmm1
ucomisd %xmm0,%xmm1
jbe    11f6 <foo+0xd6>
movq   $0x0,0x48(%rdx)
xor    %eax,%eax
test   %rsi,%rsi
je     1202 <foo+0xe2>
jmp    1040 <bar@plt>
jmp    1030 <baz@plt>

LLVM IR (-O0):
define void @foo(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %37
10: ; preds = %3
%11 = load double*, double** %5
%12 = icmp ne double* %11, null
br i1 %12, label %13, label %37
13: ; preds = %10
store i32 0, i32* %7
br label %14
14: ; preds = %33, %13
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double*, double** %5
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fcmp olt double %20, %25
br i1 %26, label %27, label %32
27: ; preds = %17
%28 = load double*, double** %6
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
store double 0.000000e+00, double* %31
br label %32
32: ; preds = %27, %17
br label %33
33: ; preds = %32
%34 = load i32, i32* %7
%35 = add nsw i32 %34, 1
store i32 %35, i32* %7
br label %14
36: ; preds = %14
br label %37
37: ; preds = %36, %10, %3
%38 = load double*, double** %5
%39 = icmp ne double* %38, null
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (...) @bar()
br label %44
42: ; preds = %37
%43 = call i32 (...) @baz()
br label %44
44: ; preds = %42, %40
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, double* %1, double* nocapture %2) {
%4 = icmp slt i32 %0, 10
%5 = icmp ne double* %1, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %67
7: ; preds = %3
%8 = load double, double* %2
%9 = load double, double* %1
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %12
11: ; preds = %7
store double 0.000000e+00, double* %2
br label %12
12: ; preds = %7, %11
%13 = phi double [ %8, %7 ], [ 0.000000e+00, %11 ]
%14 = getelementptr inbounds double, double* %1, i64 1
%15 = load double, double* %14
%16 = fcmp olt double %13, %15
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = getelementptr inbounds double, double* %2, i64 1
store double 0.000000e+00, double* %18
br label %19
19: ; preds = %17, %12
%20 = getelementptr inbounds double, double* %1, i64 2
%21 = load double, double* %20
%22 = fcmp olt double %13, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = getelementptr inbounds double, double* %2, i64 2
store double 0.000000e+00, double* %24
br label %25
25: ; preds = %23, %19
%26 = getelementptr inbounds double, double* %1, i64 3
%27 = load double, double* %26
%28 = fcmp olt double %13, %27
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = getelementptr inbounds double, double* %2, i64 3
store double 0.000000e+00, double* %30
br label %31
31: ; preds = %29, %25
%32 = getelementptr inbounds double, double* %1, i64 4
%33 = load double, double* %32
%34 = fcmp olt double %13, %33
br i1 %34, label %35, label %37
35: ; preds = %31
%36 = getelementptr inbounds double, double* %2, i64 4
store double 0.000000e+00, double* %36
br label %37
37: ; preds = %35, %31
%38 = getelementptr inbounds double, double* %1, i64 5
%39 = load double, double* %38
%40 = fcmp olt double %13, %39
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = getelementptr inbounds double, double* %2, i64 5
store double 0.000000e+00, double* %42
br label %43
43: ; preds = %41, %37
%44 = getelementptr inbounds double, double* %1, i64 6
%45 = load double, double* %44
%46 = fcmp olt double %13, %45
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = getelementptr inbounds double, double* %2, i64 6
store double 0.000000e+00, double* %48
br label %49
49: ; preds = %47, %43
%50 = getelementptr inbounds double, double* %1, i64 7
%51 = load double, double* %50
%52 = fcmp olt double %13, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = getelementptr inbounds double, double* %2, i64 7
store double 0.000000e+00, double* %54
br label %55
55: ; preds = %53, %49
%56 = getelementptr inbounds double, double* %1, i64 8
%57 = load double, double* %56
%58 = fcmp olt double %13, %57
br i1 %58, label %59, label %61
59: ; preds = %55
%60 = getelementptr inbounds double, double* %2, i64 8
store double 0.000000e+00, double* %60
br label %61
61: ; preds = %59, %55
%62 = getelementptr inbounds double, double* %1, i64 9
%63 = load double, double* %62
%64 = fcmp olt double %13, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = getelementptr inbounds double, double* %2, i64 9
store double 0.000000e+00, double* %66
br label %67
67: ; preds = %61, %65, %3
br i1 %5, label %68, label %70
68: ; preds = %67
%69 = tail call i32 (...) @bar()
br label %72
70: ; preds = %67
%71 = tail call i32 (...) @baz()
br label %72
72: ; preds = %70, %68
ret void
}