#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*/ abort();
int half_word_swap(int);
int multiply_and_accumulate(int, int, int);
int rxround(double);
int saturate_add(int, int);
int main(void) {
  if (half_word_swap(0x12345678) != 0x34127856)
    abort();
  ;
  if (saturate_add(0x80000000, 0x80000000) != 0x80000000)
    abort();
  ;
  if (multiply_and_accumulate(0x111, 0x222, 0x333) != 0x70007)
    abort();
  ;
  if (rxround(0.5) != 1)
    abort();
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x12345678,%edi
call   1060 <half_word_swap@plt>
cmp    $0x34127856,%eax
je     117b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x80000000,%esi
mov    %esi,%edi
call   1050 <saturate_add@plt>
cmp    $0x80000000,%eax
je     1199 <main+0x49>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x111,%edi
mov    $0x222,%esi
mov    $0x333,%edx
call   1040 <multiply_and_accumulate@plt>
cmp    $0x70007,%eax
je     11bf <main+0x6f>
mov    $0x0,%al
call   1030 <abort@plt>
movsd  0xe39(%rip),%xmm0
call   1070 <rxround@plt>
cmp    $0x1,%eax
je     11dc <main+0x8c>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x12345678,%edi
call   1060 <half_word_swap@plt>
cmp    $0x34127856,%eax
jne    11a9 <main+0x59>
mov    $0x80000000,%edi
mov    $0x80000000,%esi
call   1050 <saturate_add@plt>
cmp    $0x80000000,%eax
jne    11a9 <main+0x59>
mov    $0x111,%edi
mov    $0x222,%esi
mov    $0x333,%edx
call   1040 <multiply_and_accumulate@plt>
cmp    $0x70007,%eax
jne    11a9 <main+0x59>
movsd  0xe65(%rip),%xmm0
call   1070 <rxround@plt>
cmp    $0x1,%eax
jne    11a9 <main+0x59>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @half_word_swap(i32 305419896)
%3 = icmp ne i32 %2, 873625686
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @saturate_add(i32 -2147483648, i32 -2147483648)
%8 = icmp ne i32 %7, -2147483648
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @multiply_and_accumulate(i32 273, i32 546, i32 819)
%13 = icmp ne i32 %12, 458759
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call i32 @rxround(double 5.000000e-01)
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @half_word_swap(i32 305419896)
%2 = icmp eq i32 %1, 873625686
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @saturate_add(i32 -2147483648, i32 -2147483648)
%7 = icmp eq i32 %6, -2147483648
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @multiply_and_accumulate(i32 273, i32 546, i32 819)
%12 = icmp eq i32 %11, 458759
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @rxround(double 5.000000e-01)
%17 = icmp eq i32 %16, 1
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %15
ret i32 0
}