#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 *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *vism_to_VV(char *target, double V) {
  if (V < 100.0) {
    strcpy(target, "00");
  } else if (V <= 5000.0) {
    sprintf(target, "%02d", (int)(V + 0.1) / 100);
  } else if (V < 6000.0) {
    sprintf(target, "50");
  } else if (V <= 30000.0) {
    sprintf(target, "%02d", (int)(V + 0.1) / 1000 + 50);
  } else if (V <= 70000.0) {
    sprintf(target, "%02d", (int)(V - 30000.0) / 5000 + 80);
  } else {
    strcpy(target, "89");
  }
  return target;
}


x86 assembly (clang, -O0):
<vism_to_VV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xec7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1159 <vism_to_VV+0x39>
mov    -0x8(%rbp),%rdi
lea    0xee1(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1280 <vism_to_VV+0x160>
movsd  0xea7(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     119e <vism_to_VV+0x7e>
mov    -0x8(%rbp),%rdi
movsd  0xeb0(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    127b <vism_to_VV+0x15b>
movsd  0xe6a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c8 <vism_to_VV+0xa8>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1276 <vism_to_VV+0x156>
movsd  0xe48(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1210 <vism_to_VV+0xf0>
mov    -0x8(%rbp),%rdi
movsd  0xe41(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
add    $0x32,%edx
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1271 <vism_to_VV+0x151>
movsd  0xe08(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     125c <vism_to_VV+0x13c>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    $0x1388,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
add    $0x50,%edx
lea    0xde3(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    126c <vism_to_VV+0x14c>
mov    -0x8(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1271 <vism_to_VV+0x151>
jmp    1276 <vism_to_VV+0x156>
jmp    127b <vism_to_VV+0x15b>
jmp    1280 <vism_to_VV+0x160>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vism_to_VV>:
push   %rbx
mov    %rdi,%rbx
movsd  0xed4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1146 <vism_to_VV+0x26>
lea    0xeff(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
jmp    1228 <vism_to_VV+0x108>
movsd  0xeba(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1170 <vism_to_VV+0x50>
movsd  0xebc(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a1 <vism_to_VV+0x81>
movb   $0x0,0x2(%rbx)
movw   $0x3035,(%rbx)
jmp    1228 <vism_to_VV+0x108>
addsd  0xe98(%rip),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0x51eb851f,%rax,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x25,%rdx
add    %eax,%edx
lea    0xea2(%rip),%rsi
mov    %rbx,%rdi
jmp    1221 <vism_to_VV+0x101>
movsd  0xe77(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11c9 <vism_to_VV+0xa9>
movsd  0xe71(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11f1 <vism_to_VV+0xd1>
lea    0xe7f(%rip),%rsi
jmp    1139 <vism_to_VV+0x19>
addsd  0xe3f(%rip),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
sar    $0x26,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%edx
add    $0x32,%edx
jmp    1217 <vism_to_VV+0xf7>
addsd  0xe37(%rip),%xmm0
cvttsd2si %xmm0,%eax
cltq
imul   $0x68db8bad,%rax,%rax
mov    %rax,%rcx
sar    $0x2b,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%edx
add    $0x50,%edx
lea    0xe1d(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"00\00"
@.str.1 = [5 x i8] c"%02d\00"
@.str.2 = [3 x i8] c"50\00"
@.str.3 = [3 x i8] c"89\00"
define i8* @vism_to_VV(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp olt double %5, 1.000000e+02
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %55
10: ; preds = %2
%11 = load double, double* %4
%12 = fcmp ole double %11, 5.000000e+03
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = load double, double* %4
%16 = fadd double %15, 1.000000e-01
%17 = fptosi double %16 to i32
%18 = sdiv i32 %17, 100
%19 = call i32 (i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %54
20: ; preds = %10
%21 = load double, double* %4
%22 = fcmp olt double %21, 6.000000e+03
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i8*, i8** %3
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %53
26: ; preds = %20
%27 = load double, double* %4
%28 = fcmp ole double %27, 3.000000e+04
br i1 %28, label %29, label %37
29: ; preds = %26
%30 = load i8*, i8** %3
%31 = load double, double* %4
%32 = fadd double %31, 1.000000e-01
%33 = fptosi double %32 to i32
%34 = sdiv i32 %33, 1000
%35 = add nsw i32 %34, 50
%36 = call i32 (i8*, i8*, ...) @sprintf(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %35)
br label %52
37: ; preds = %26
%38 = load double, double* %4
%39 = fcmp ole double %38, 7.000000e+04
br i1 %39, label %40, label %48
40: ; preds = %37
%41 = load i8*, i8** %3
%42 = load double, double* %4
%43 = fsub double %42, 3.000000e+04
%44 = fptosi double %43 to i32
%45 = sdiv i32 %44, 5000
%46 = add nsw i32 %45, 80
%47 = call i32 (i8*, i8*, ...) @sprintf(i8* %41, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %46)
br label %51
48: ; preds = %37
%49 = load i8*, i8** %3
%50 = call i32 @strcpy(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %51
51: ; preds = %48, %40
br label %52
52: ; preds = %51, %29
br label %53
53: ; preds = %52, %23
br label %54
54: ; preds = %53, %13
br label %55
55: ; preds = %54, %7
%56 = load i8*, i8** %3
ret i8* %56
}

LLVM IR (-O2):
@.str = [3 x i8] c"00\00"
@.str.1 = [5 x i8] c"%02d\00"
@.str.2 = [3 x i8] c"50\00"
@.str.3 = [3 x i8] c"89\00"
define i8* @vism_to_VV(i8* returned %0, double %1) {
%3 = fcmp olt double %1, 1.000000e+02
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %34
6: ; preds = %2
%7 = fcmp ugt double %1, 5.000000e+03
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = fadd double %1, 1.000000e-01
%10 = fptosi double %9 to i32
%11 = sdiv i32 %10, 100
%12 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %34
13: ; preds = %6
%14 = fcmp olt double %1, 6.000000e+03
br i1 %14, label %15, label %16
15: ; preds = %13
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %0, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 3, i1 false)
br label %34
16: ; preds = %13
%17 = fcmp ugt double %1, 3.000000e+04
br i1 %17, label %24, label %18
18: ; preds = %16
%19 = fadd double %1, 1.000000e-01
%20 = fptosi double %19 to i32
%21 = sdiv i32 %20, 1000
%22 = add nsw i32 %21, 50
%23 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %34
24: ; preds = %16
%25 = fcmp ugt double %1, 7.000000e+04
br i1 %25, label %32, label %26
26: ; preds = %24
%27 = fadd double %1, -3.000000e+04
%28 = fptosi double %27 to i32
%29 = sdiv i32 %28, 5000
%30 = add nsw i32 %29, 80
%31 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %34
32: ; preds = %24
%33 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %34
34: ; preds = %8, %18, %32, %26, %15, %4
ret i8* %0
}