#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*/ var;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ trap_Cvar_Set(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ trap_Cvar_VariableStringBuffer(char const *, char *, int);
int /*<<< orphan*/ va(char *, int);
void CG_ForceCvar(const char *cvar, int value) {
  char var[128];
  trap_Cvar_VariableStringBuffer(cvar, var, sizeof(var));
  if (atoi(var) != value) {
    trap_Cvar_Set(cvar, va("%i", value));
  }
}


x86 assembly (clang, -O0):
<CG_ForceCvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
lea    -0x90(%rbp),%rdi
call   1050 <atoi@plt>
cmp    -0xc(%rbp),%eax
je     11a4 <CG_ForceCvar+0x64>
mov    -0x8(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe6f(%rip),%rdi
call   1040 <va@plt>
mov    -0x98(%rbp),%rdi
mov    %eax,%esi
call   1060 <trap_Cvar_Set@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_ForceCvar>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rsi
mov    $0x80,%edx
call   1030 <trap_Cvar_VariableStringBuffer@plt>
mov    %r14,%rdi
call   1050 <atoi@plt>
cmp    %ebp,%eax
je     1184 <CG_ForceCvar+0x44>
lea    0xe8d(%rip),%rdi
mov    %ebp,%esi
call   1040 <va@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <trap_Cvar_Set@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define void @CG_ForceCvar(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [128 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = call i32 @trap_Cvar_VariableStringBuffer(i8* %6, i8* %7, i32 128)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%10 = call i32 @atoi(i8* %9)
%11 = load i32, i32* %4
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = call i32 @va(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @trap_Cvar_Set(i8* %14, i32 %16)
br label %18
18: ; preds = %13, %2
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define void @CG_ForceCvar(i8* %0, i32 %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = call i32 @trap_Cvar_VariableStringBuffer(i8* %0, i8* %4, i32 128)
%6 = call i32 @atoi(i8* %4)
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = call i32 @va(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%10 = call i32 @trap_Cvar_Set(i8* %0, i32 %9)
br label %11
11: ; preds = %8, %2
ret void
}