#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 */
int /*<<< orphan*/ __ESBMC_assume(int);
int abs(int);
int /*<<< orphan*/ assert(int);
double fabs(double);
int /*<<< orphan*/ isnan(double);
int main() {
  int my_i, iabs;
  double my_d, dabs;
  assert(abs(-1) == 1);
  assert(abs(1) == 1);
  assert(fabs(1.0) == 1);
  assert(fabs(-1.0) == 1);
  iabs = (my_i < 0) ? -my_i : my_i;
  assert(abs(my_i) == iabs);
  __ESBMC_assume(!isnan(my_d));
  dabs = (my_d < 0) ? -my_d : my_d;
  assert(fabs(my_d) == dabs);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1030 <abs@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1030 <abs@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsd  0xe75(%rip),%xmm0
movsd  0xe6d(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsd  0xe4f(%rip),%xmm0
movsd  0xe47(%rip),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11e6 <main+0xa6>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11ec <main+0xac>
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movsd  -0x18(%rbp),%xmm0
call   1060 <isnan@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__ESBMC_assume@plt>
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    125a <main+0x11a>
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1264 <main+0x124>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xd96(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x20(%rbp),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
call   1040 <assert@plt>
call   1050 <isnan@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <__ESBMC_assume@plt>
xor    %edi,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 @abs(i32 -1)
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 @abs(i32 1)
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call double @llvm.fabs.f64(double 1.000000e+00)
%15 = fcmp oeq double %14, 1.000000e+00
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call double @llvm.fabs.f64(double -1.000000e+00)
%19 = fcmp oeq double %18, 1.000000e+00
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %0
%25 = load i32, i32* %2
%26 = sub nsw i32 0, %25
br label %29
27: ; preds = %0
%28 = load i32, i32* %2
br label %29
29: ; preds = %27, %24
%30 = phi i32 [ %26, %24 ], [ %28, %27 ]
store i32 %30, i32* %3
%31 = load i32, i32* %2
%32 = call i32 @abs(i32 %31)
%33 = load i32, i32* %3
%34 = icmp eq i32 %32, %33
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = load double, double* %4
%38 = call i32 @isnan(double %37)
%39 = icmp ne i32 %38, 0
%40 = xor i1 %39, true
%41 = zext i1 %40 to i32
%42 = call i32 @__ESBMC_assume(i32 %41)
%43 = load double, double* %4
%44 = fcmp olt double %43, 0.000000e+00
br i1 %44, label %45, label %48
45: ; preds = %29
%46 = load double, double* %4
%47 = fneg double %46
br label %50
48: ; preds = %29
%49 = load double, double* %4
br label %50
50: ; preds = %48, %45
%51 = phi double [ %47, %45 ], [ %49, %48 ]
store double %51, double* %5
%52 = load double, double* %4
%53 = call double @llvm.fabs.f64(double %52)
%54 = load double, double* %5
%55 = fcmp oeq double %53, %54
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 @assert(i32 0)
%6 = tail call i32 @isnan(double undef)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @__ESBMC_assume(i32 %8)
%10 = tail call i32 @assert(i32 0)
ret i32 0
}