#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 short 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)
movw   $0x0,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
cmp    -0x10(%rbp),%rax
jae    1176 <arr_float_mark_inf_as_zero+0x66>
mov    -0x8(%rbp),%rax
movzwl -0x12(%rbp),%ecx
movss  (%rax,%rcx,4),%xmm0
call   1030 <isinff@plt>
cmp    $0x0,%rax
je     1160 <arr_float_mark_inf_as_zero+0x50>
mov    -0x8(%rbp),%rax
movzwl -0x12(%rbp),%ecx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
jmp    1165 <arr_float_mark_inf_as_zero+0x55>
mov    -0x12(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x12(%rbp)
jmp    1126 <arr_float_mark_inf_as_zero+0x16>
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     1155 <arr_float_mark_inf_as_zero+0x45>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
jmp    113b <arr_float_mark_inf_as_zero+0x2b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
movzwl %bx,%ebx
cmp    %r14,%rbx
jae    1155 <arr_float_mark_inf_as_zero+0x45>
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 i16
store float* %0, float** %3
store i64 %1, i64* %4
store i16 0, i16* %5
br label %6
6: ; preds = %25, %2
%7 = load i16, i16* %5
%8 = zext i16 %7 to i64
%9 = load i64, i64* %4
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %6
%12 = load float*, float** %3
%13 = load i16, i16* %5
%14 = zext i16 %13 to i64
%15 = getelementptr inbounds float, float* %12, i64 %14
%16 = load float, float* %15
%17 = call i64 @isinff(float %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %11
%20 = load float*, float** %3
%21 = load i16, i16* %5
%22 = zext i16 %21 to i64
%23 = getelementptr inbounds float, float* %20, i64 %22
store float 0.000000e+00, float* %23
br label %24
24: ; preds = %19, %11
br label %25
25: ; preds = %24
%26 = load i16, i16* %5
%27 = add i16 %26, 1
store i16 %27, i16* %5
br label %6
28: ; 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 %15, label %4
4: ; preds = %2, %11
%5 = phi i64 [ %13, %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 nsw i64 %5, 1
%13 = and i64 %12, 65535
%14 = icmp ult i64 %13, %1
br i1 %14, label %4, label %15
15: ; preds = %11, %2
ret void
}