#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__ isfinite(float);
int /*<<< orphan*/ printf(char *, ...);
void checkDivide(float denom) {
  if (denom == 0.0)
    printf("denom = 0.0\n");
  float result = 1.0 / denom;
  printf("1 / %11g = %11g  -->", denom, result);
  if (isfinite(result))
    printf("division successful\n");
  else
    printf("result is not finite!\n");
}


x86 assembly (clang, -O0):
<checkDivide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1157 <checkDivide+0x37>
jp     1157 <checkDivide+0x37>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe87(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
call   1040 <isfinite@plt>
cmp    $0x0,%rax
je     11bc <checkDivide+0x9c>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ca <checkDivide+0xaa>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkDivide>:
push   %rax
movaps %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    1156 <checkDivide+0x26>
jp     1156 <checkDivide+0x26>
lea    0xefe(%rip),%rdi
movss  %xmm1,0x4(%rsp)
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movss  0xe9b(%rip),%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
lea    0xe87(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
call   1050 <isfinite@plt>
test   %rax,%rax
lea    0xe80(%rip),%rax
lea    0xe8f(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"denom = 0.0\0A\00"
@.str.1 = [21 x i8] c"1 / %11g = %11g -->\00"
@.str.2 = [21 x i8] c"division successful\0A\00"
@.str.3 = [23 x i8] c"result is not finite!\0A\00"
define void @checkDivide(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = fdiv double 1.000000e+00, %11
%13 = fptrunc double %12 to float
store float %13, float* %3
%14 = load float, float* %2
%15 = fpext float %14 to double
%16 = load float, float* %3
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %15, double %17)
%19 = load float, float* %3
%20 = call i64 @isfinite(float %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %9
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
br label %26
24: ; preds = %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
ret void
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"1 / %11g = %11g -->\00"
@str = [22 x i8] c"result is not finite!\00"
@str.4 = [20 x i8] c"division successful\00"
@str.5 = [12 x i8] c"denom = 0.0\00"
define void @checkDivide(float %0) {
%2 = fcmp oeq float %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = fpext float %0 to double
%7 = fdiv float 1.000000e+00, %0
%8 = fpext float %7 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %6, double %8)
%10 = tail call i64 @isfinite(float %7)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0)
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret void
}