#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 SHRT_MAX;
int SHRT_MIN;
int brand();
int /*<<< orphan*/ out_warning(char *);
void rparam(short *pv, float dv) {
  int v, istep;
  istep = brand();
  istep += brand();
  v = *pv;
  if (v > 0) {
    dv -= (float)(0.2 / (double)32);
  } else if (v < 0) {
    dv += (float)(0.2 / (double)32);
  }
  if (dv >= 0.0 && v <= SHRT_MAX - istep) {
    v += istep;
  } else if (dv <= 0.0 && v >= SHRT_MIN + istep) {
    v -= istep;
  } else {
    out_warning("A fvcoef parameter is out of bounce.\n");
  }
  *pv = (short)v;
}


x86 assembly (clang, -O0):
<rparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <brand@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <brand@plt>
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1177 <rparam+0x57>
movss  -0xc(%rbp),%xmm0
movss  0xe97(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1198 <rparam+0x78>
cmpl   $0x0,-0x10(%rbp)
jge    1193 <rparam+0x73>
movss  0xe77(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1198 <rparam+0x78>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11d3 <rparam+0xb3>
mov    -0x10(%rbp),%eax
mov    0x2e20(%rip),%rcx
mov    (%rcx),%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jg     11d3 <rparam+0xb3>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1221 <rparam+0x101>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1210 <rparam+0xf0>
mov    -0x10(%rbp),%eax
mov    0x2ded(%rip),%rcx
mov    (%rcx),%ecx
add    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jl     1210 <rparam+0xf0>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    121c <rparam+0xfc>
lea    0xded(%rip),%rdi
call   1040 <out_warning@plt>
jmp    1221 <rparam+0x101>
mov    -0x10(%rbp),%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rparam>:
push   %rbp
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <brand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <brand@plt>
add    %ebp,%eax
movswl (%rbx),%ebp
test   %ebp,%ebp
js     1152 <rparam+0x32>
movss  0x4(%rsp),%xmm1
movaps %xmm1,%xmm0
jg     1166 <rparam+0x46>
jmp    1171 <rparam+0x51>
movss  0xeaa(%rip),%xmm0
movss  0x4(%rsp),%xmm1
addss  %xmm1,%xmm0
jle    1171 <rparam+0x51>
addss  0xe92(%rip),%xmm1
movaps %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1188 <rparam+0x68>
mov    0x2e58(%rip),%rcx
mov    (%rcx),%ecx
sub    %eax,%ecx
cmp    %ebp,%ecx
jge    11aa <rparam+0x8a>
ucomiss %xmm0,%xmm1
jb     119c <rparam+0x7c>
mov    0x2e4c(%rip),%rcx
mov    (%rcx),%ecx
add    %eax,%ecx
cmp    %ebp,%ecx
jle    11ae <rparam+0x8e>
lea    0xe65(%rip),%rdi
call   1040 <out_warning@plt>
jmp    11b0 <rparam+0x90>
add    %eax,%ebp
jmp    11b0 <rparam+0x90>
sub    %eax,%ebp
mov    %bp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SHRT_MAX = global i32 0
@SHRT_MIN = global i32 0
@.str = [38 x i8] c"A fvcoef parameter is out of bounce.\0A\00"
define void @rparam(i16* %0, float %1) {
%3 = alloca i16*
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store i16* %0, i16** %3
store float %1, float* %4
%7 = call i32 (...) @brand()
store i32 %7, i32* %6
%8 = call i32 (...) @brand()
%9 = load i32, i32* %6
%10 = add nsw i32 %9, %8
store i32 %10, i32* %6
%11 = load i16*, i16** %3
%12 = load i16, i16* %11
%13 = sext i16 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = load float, float* %4
%18 = fsub float %17, 0x3F799999A0000000
store float %18, float* %4
br label %26
19: ; preds = %2
%20 = load i32, i32* %5
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load float, float* %4
%24 = fadd float %23, 0x3F799999A0000000
store float %24, float* %4
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %16
%27 = load float, float* %4
%28 = fpext float %27 to double
%29 = fcmp oge double %28, 0.000000e+00
br i1 %29, label %30, label %40
30: ; preds = %26
%31 = load i32, i32* %5
%32 = load i32, i32* @SHRT_MAX
%33 = load i32, i32* %6
%34 = sub nsw i32 %32, %33
%35 = icmp sle i32 %31, %34
br i1 %35, label %36, label %40
36: ; preds = %30
%37 = load i32, i32* %6
%38 = load i32, i32* %5
%39 = add nsw i32 %38, %37
store i32 %39, i32* %5
br label %57
40: ; preds = %30, %26
%41 = load float, float* %4
%42 = fpext float %41 to double
%43 = fcmp ole double %42, 0.000000e+00
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = load i32, i32* %5
%46 = load i32, i32* @SHRT_MIN
%47 = load i32, i32* %6
%48 = add nsw i32 %46, %47
%49 = icmp sge i32 %45, %48
br i1 %49, label %50, label %54
50: ; preds = %44
%51 = load i32, i32* %6
%52 = load i32, i32* %5
%53 = sub nsw i32 %52, %51
store i32 %53, i32* %5
br label %56
54: ; preds = %44, %40
%55 = call i32 @out_warning(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
br label %57
57: ; preds = %56, %36
%58 = load i32, i32* %5
%59 = trunc i32 %58 to i16
%60 = load i16*, i16** %3
store i16 %59, i16* %60
ret void
}

LLVM IR (-O2):
@SHRT_MAX = global i32 0
@SHRT_MIN = global i32 0
@.str = [38 x i8] c"A fvcoef parameter is out of bounce.\0A\00"
define void @rparam(i16* nocapture %0, float %1) {
%3 = tail call i32 (...) @brand()
%4 = tail call i32 (...) @brand()
%5 = add nsw i32 %4, %3
%6 = load i16, i16* %0
%7 = sext i16 %6 to i32
%8 = icmp sgt i16 %6, 0
%9 = fadd float %1, 0xBF799999A0000000
%10 = icmp slt i16 %6, 0
%11 = fadd float %1, 0x3F799999A0000000
%12 = select i1 %10, float %11, float %1
%13 = select i1 %8, float %9, float %12
%14 = fcmp ult float %13, 0.000000e+00
br i1 %14, label %21, label %15
15: ; preds = %2
%16 = load i32, i32* @SHRT_MAX
%17 = sub nsw i32 %16, %5
%18 = icmp slt i32 %17, %7
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = add nsw i32 %5, %7
br label %31
21: ; preds = %15, %2
%22 = fcmp ugt float %13, 0.000000e+00
br i1 %22, label %29, label %23
23: ; preds = %21
%24 = load i32, i32* @SHRT_MIN
%25 = add nsw i32 %24, %5
%26 = icmp sgt i32 %25, %7
br i1 %26, label %29, label %27
27: ; preds = %23
%28 = sub nsw i32 %7, %5
br label %31
29: ; preds = %23, %21
%30 = tail call i32 @out_warning(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %27, %29, %19
%32 = phi i32 [ %20, %19 ], [ %28, %27 ], [ %7, %29 ]
%33 = trunc i32 %32 to i16
store i16 %33, i16* %0
ret void
}