#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*/ sprintf(char *, char *, ...);
void format_val(char *buf, const float val) {
  if (val > 99) {
    sprintf(buf, "+++++");
  } else if (val > -99.9) {
    sprintf(buf, "%+5.1f", val);
  } else {
    sprintf(buf, " -\u221E  ");
  }
}


x86 assembly (clang, -O0):
<format_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xed2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    114e <format_val+0x3e>
mov    -0x8(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11a0 <format_val+0x90>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1189 <format_val+0x79>
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe99(%rip),%rsi
mov    $0x1,%al
call   1030 <sprintf@plt>
jmp    119b <format_val+0x8b>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11a0 <format_val+0x90>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_val>:
ucomiss 0xee9(%rip),%xmm0
jbe    1126 <format_val+0x16>
movw   $0x2b,0x4(%rdi)
movl   $0x2b2b2b2b,(%rdi)
ret
cvtss2sd %xmm0,%xmm0
ucomisd 0xed6(%rip),%xmm0
jbe    1142 <format_val+0x32>
lea    0xedb(%rip),%rsi
mov    $0x1,%al
jmp    1030 <sprintf@plt>
movabs $0x20209e88e22d20,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
@.str = [6 x i8] c"+++++\00"
@.str.1 = [7 x i8] c"%+5.1f\00"
@.str.2 = [8 x i8] c" -\E2\88\9E \00"
define void @format_val(i8* %0, float %1) {
%3 = alloca i8*
%4 = alloca float
store i8* %0, i8** %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fcmp ogt float %5, 9.900000e+01
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %23
10: ; preds = %2
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = fcmp ogt double %12, -9.990000e+01
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load float, float* %4
%17 = fpext float %16 to double
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %22
19: ; preds = %10
%20 = load i8*, i8** %3
%21 = call i32 (i8*, i8*, ...) @sprintf(i8* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %14
br label %23
23: ; preds = %22, %7
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"+++++\00"
@.str.1 = [7 x i8] c"%+5.1f\00"
define void @format_val(i8* nocapture writeonly %0, float %1) {
%3 = fcmp ogt float %1, 9.900000e+01
br i1 %3, label %4, label %5
4: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 6, i1 false)
br label %12
5: ; preds = %2
%6 = fpext float %1 to double
%7 = fcmp ogt double %6, -9.990000e+01
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %6)
br label %12
10: ; preds = %5
%11 = bitcast i8* %0 to i64*
store i64 9043064528186656, i64* %11
br label %12
12: ; preds = %8, %10, %4
ret void
}