#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 */
double fabs(double);
int /*<<< orphan*/ printf(char *, double);
int DiagUpdate(double *dii, int mode) {
  int id = 1;
  if (mode) {
    if (*dii < 1.0e-13)
      return 0;
  } else {
    if (fabs(*dii) < 1.0e-35) {
      printf(" diagonal nearly zero: %5.1e.\n", (*dii));
      return 0;
    }
  }
  return id;
}


x86 assembly (clang, -O0):
<DiagUpdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1157 <DiagUpdate+0x47>
mov    -0x10(%rbp),%rax
movsd  0xecc(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    1152 <DiagUpdate+0x42>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <DiagUpdate+0x97>
jmp    11a1 <DiagUpdate+0x91>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
movaps 0xeaa(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe8e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    119c <DiagUpdate+0x8c>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <DiagUpdate+0x97>
jmp    11a1 <DiagUpdate+0x91>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DiagUpdate>:
push   %rax
movsd  (%rdi),%xmm0
test   %esi,%esi
je     112b <DiagUpdate+0x1b>
xor    %eax,%eax
movsd  0xedd(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1155 <DiagUpdate+0x45>
pop    %rcx
ret
movapd 0xedd(%rip),%xmm1
andpd  %xmm0,%xmm1
movsd  0xec9(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1155 <DiagUpdate+0x45>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c" diagonal nearly zero: %5.1e.\0A\00"
define i32 @DiagUpdate(double* %0, i32 %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 1, i32* %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load double*, double** %4
%11 = load double, double* %10
%12 = fcmp olt double %11, 1.000000e-13
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 0, i32* %3
br label %27
14: ; preds = %9
br label %25
15: ; preds = %2
%16 = load double*, double** %4
%17 = load double, double* %16
%18 = call double @llvm.fabs.f64(double %17)
%19 = fcmp olt double %18, 1.000000e-35
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load double*, double** %4
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %22)
store i32 0, i32* %3
br label %27
24: ; preds = %15
br label %25
25: ; preds = %24, %14
%26 = load i32, i32* %6
store i32 %26, i32* %3
br label %27
27: ; preds = %25, %20, %13
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [31 x i8] c" diagonal nearly zero: %5.1e.\0A\00"
define i32 @DiagUpdate(double* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = load double, double* %0
br i1 %3, label %7, label %5
5: ; preds = %2
%6 = fcmp olt double %4, 1.000000e-13
br i1 %6, label %13, label %12
7: ; preds = %2
%8 = tail call double @llvm.fabs.f64(double %4)
%9 = fcmp olt double %8, 1.000000e-35
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %4)
br label %13
12: ; preds = %7, %5
br label %13
13: ; preds = %5, %12, %10
%14 = phi i32 [ 1, %12 ], [ 0, %10 ], [ 0, %5 ]
ret i32 %14
}