#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 */
typedef int int32_t;

/* Variables and functions */
int __builtin_fmaxf32(float, int);
void __attribute__((noipa))
test_float_one(float *__restrict x, float *__restrict y,
               int32_t *__restrict pred, int n) {
  for (int i = 0; i < n; ++i)
    x[i] = pred[i] != 1 ? __builtin_fmaxf32(y[i], 1) : 4;
}


x86 assembly (clang, -O0):
<test_float_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119a <test_float_one+0x8a>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
je     116b <test_float_one+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    $0x1,%edi
call   1030 <__builtin_fmaxf32@plt>
mov    %eax,-0x24(%rbp)
jmp    1178 <test_float_one+0x68>
mov    $0x4,%eax
mov    %eax,-0x24(%rbp)
jmp    1178 <test_float_one+0x68>
mov    -0x24(%rbp),%eax
cvtsi2ss %eax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112e <test_float_one+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_float_one>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %ecx,%ecx
jle    1164 <test_float_one+0x54>
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
mov    %ecx,%r13d
xor    %ebx,%ebx
jmp    1146 <test_float_one+0x36>
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r13
je     1164 <test_float_one+0x54>
mov    $0x4,%eax
cmpl   $0x1,(%r15,%rbx,4)
je     1130 <test_float_one+0x20>
movss  (%r14,%rbx,4),%xmm0
mov    $0x1,%edi
call   1030 <__builtin_fmaxf32@plt>
jmp    1130 <test_float_one+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @test_float_one(float* noalias nocapture writeonly %0, float* noalias nocapture %1, i32* noalias nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %3 to i64
br label %9
8: ; preds = %18, %4
ret void
9: ; preds = %6, %18
%10 = phi i64 [ 0, %6 ], [ %22, %18 ]
%11 = getelementptr inbounds i32, i32* %2, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 1
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = getelementptr inbounds float, float* %1, i64 %10
%16 = load float, float* %15
%17 = tail call i32 @__builtin_fmaxf32(float %16, i32 1)
br label %18
18: ; preds = %9, %14
%19 = phi i32 [ %17, %14 ], [ 4, %9 ]
%20 = sitofp i32 %19 to float
%21 = getelementptr inbounds float, float* %0, i64 %10
store float %20, float* %21
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, %7
br i1 %23, label %8, label %9
}