#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 */
scalar_t__ isinff(float);
void arr_float_mark_inf_as_zero(float *pSrc, unsigned long int num) {
  unsigned long int i;
  for (i = 0; i < num; i++) {
    if (isinff(pSrc[i]))
      pSrc[i] = 0;
  }
}


x86 assembly (clang, -O0):
<arr_float_mark_inf_as_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1178 <arr_float_mark_inf_as_zero+0x68>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <isinff@plt>
cmp    $0x0,%rax
je     1162 <arr_float_mark_inf_as_zero+0x52>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1167 <arr_float_mark_inf_as_zero+0x57>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <arr_float_mark_inf_as_zero+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_float_mark_inf_as_zero>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1153 <arr_float_mark_inf_as_zero+0x43>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    1139 <arr_float_mark_inf_as_zero+0x29>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%r14
je     1153 <arr_float_mark_inf_as_zero+0x43>
movss  (%r15,%rbx,4),%xmm0
call   1030 <isinff@plt>
test   %rax,%rax
je     1130 <arr_float_mark_inf_as_zero+0x20>
movl   $0x0,(%r15,%rbx,4)
jmp    1130 <arr_float_mark_inf_as_zero+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @arr_float_mark_inf_as_zero(float* %0, i64 %1) {
%3 = alloca float*
%4 = alloca i64
%5 = alloca i64
store float* %0, float** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %22, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load float*, float** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds float, float* %11, i64 %12
%14 = load float, float* %13
%15 = call i64 @isinff(float %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load float*, float** %3
%19 = load i64, i64* %5
%20 = getelementptr inbounds float, float* %18, i64 %19
store float 0.000000e+00, float* %20
br label %21
21: ; preds = %17, %10
br label %22
22: ; preds = %21
%23 = load i64, i64* %5
%24 = add i64 %23, 1
store i64 %24, i64* %5
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @arr_float_mark_inf_as_zero(float* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %11
%5 = phi i64 [ %12, %11 ], [ 0, %2 ]
%6 = getelementptr inbounds float, float* %0, i64 %5
%7 = load float, float* %6
%8 = tail call i64 @isinff(float %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %4
store float 0.000000e+00, float* %6
br label %11
11: ; preds = %4, %10
%12 = add nuw i64 %5, 1
%13 = icmp eq i64 %12, %1
br i1 %13, label %14, label %4
14: ; preds = %11, %2
ret void
}