#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 FLT_ROUNDS;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, double,
                           double);
int /*<<< orphan*/ stderr;
void test_flt_rounds(int expected_round) {
  do {
    double x = FLT_ROUNDS;
    double y = expected_round;
    if (x != y) {
      fprintf(stderr, "file %s, line %d, %f != %f\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/"
              "master/native_client/tests/math/float_rounding_mode.c",
              41, x, y);
      abort();
    }
  } while (0);
}


x86 assembly (clang, -O0):
<test_flt_rounds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1160 <test_flt_rounds+0x40>
jp     1160 <test_flt_rounds+0x40>
jmp    1192 <test_flt_rounds+0x72>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe86(%rip),%rsi
lea    0xe9b(%rip),%rdx
mov    $0x29,%ecx
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1197 <test_flt_rounds+0x77>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_flt_rounds>:
push   %rax
mov    0x2ec0(%rip),%rax
movsd  (%rax),%xmm0
cvtsi2sd %edi,%xmm1
ucomisd %xmm1,%xmm0
jne    113a <test_flt_rounds+0x1a>
jp     113a <test_flt_rounds+0x1a>
pop    %rax
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
lea    0xecb(%rip),%rdx
mov    $0x29,%ecx
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@FLT_ROUNDS = global double 0.000000e+00
@stderr = global i32 0
@.str = [28 x i8] c"file %s, line %d, %f != %f\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/master/native_client/tests/math/float_rounding_mode.c\00"
define void @test_flt_rounds(i32 %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 %0, i32* %2
br label %5
5: ; preds = %1
%6 = load double, double* @FLT_ROUNDS
store double %6, double* %3
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
store double %8, double* %4
%9 = load double, double* %3
%10 = load double, double* %4
%11 = fcmp une double %9, %10
br i1 %11, label %12, label %18
12: ; preds = %5
%13 = load i32, i32* @stderr
%14 = load double, double* %3
%15 = load double, double* %4
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0), i32 41, double %14, double %15)
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %5
br label %19
19: ; preds = %18
ret void
}

LLVM IR (-O2):
@FLT_ROUNDS = global double 0.000000e+00
@stderr = global i32 0
@.str = [28 x i8] c"file %s, line %d, %f != %f\0A\00"
@.str.1 = [181 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/endlessm/chromium-browser/refs/heads/master/native_client/tests/math/float_rounding_mode.c\00"
define void @test_flt_rounds(i32 %0) {
%2 = load double, double* @FLT_ROUNDS
%3 = sitofp i32 %0 to double
%4 = fcmp une double %2, %3
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([181 x i8], [181 x i8]* @.str.1, i64 0, i64 0), i32 41, double %2, double %3)
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %1
ret void
}