#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 */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
int /*<<< orphan*/ Com_sprintf(char *, int, char *, float);
int /*<<< orphan*/ Cvar_SetEx(char const *, char *, int);
void Cvar_SetValue(const char *var_name, float value) {
  char val[32];
  if (value == (int)value)
    Com_sprintf(val, sizeof(val), "%i", (int)value);
  else
    Com_sprintf(val, sizeof(val), "%g", value);
  Cvar_SetEx(var_name, val, 1);
}


x86 assembly (clang, -O0):
<Cvar_SetValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvttss2si -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm1
ucomiss %xmm1,%xmm0
jne    1171 <Cvar_SetValue+0x51>
jp     1171 <Cvar_SetValue+0x51>
lea    -0x30(%rbp),%rdi
cvttss2si -0xc(%rbp),%eax
cvtsi2ss %eax,%xmm0
mov    $0x20,%esi
lea    0xe99(%rip),%rdx
call   1040 <Com_sprintf@plt>
jmp    118b <Cvar_SetValue+0x6b>
lea    -0x30(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
mov    $0x20,%esi
lea    0xe7d(%rip),%rdx
call   1040 <Com_sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x1,%edx
call   1030 <Cvar_SetEx@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cvar_SetValue>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jne    114a <Cvar_SetValue+0x2a>
jp     114a <Cvar_SetValue+0x2a>
lea    0xec3(%rip),%rdx
mov    %rsp,%rdi
mov    $0x20,%esi
movaps %xmm1,%xmm0
jmp    1159 <Cvar_SetValue+0x39>
lea    0xeb2(%rip),%rdx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1040 <Com_sprintf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <Cvar_SetEx@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@.str.1 = [3 x i8] c"%g\00"
define void @Cvar_SetValue(i8* %0, float %1) {
%3 = alloca i8*
%4 = alloca float
%5 = alloca [32 x i8]
store i8* %0, i8** %3
store float %1, float* %4
%6 = load float, float* %4
%7 = load float, float* %4
%8 = fptosi float %7 to i32
%9 = sitofp i32 %8 to float
%10 = fcmp oeq float %6, %9
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%13 = load float, float* %4
%14 = fptosi float %13 to i32
%15 = sitofp i32 %14 to float
%16 = call i32 @Com_sprintf(i8* %12, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %15)
br label %21
17: ; preds = %2
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%19 = load float, float* %4
%20 = call i32 @Com_sprintf(i8* %18, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %19)
br label %21
21: ; preds = %17, %11
%22 = load i8*, i8** %3
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%24 = call i32 @Cvar_SetEx(i8* %22, i8* %23, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [3 x i8] c"%g\00"
define void @Cvar_SetValue(i8* %0, float %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = fptosi float %1 to i32
%6 = sitofp i32 %5 to float
%7 = fcmp oeq float %6, %1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @Com_sprintf(i8* %4, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %6)
br label %12
10: ; preds = %2
%11 = call i32 @Com_sprintf(i8* %4, i32 32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float %1)
br label %12
12: ; preds = %10, %8
%13 = call i32 @Cvar_SetEx(i8* %0, i8* %4, i32 1)
ret void
}