#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*/ MN_DrTextAYellow(char *, int, int);
int MN_TextAWidth(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void DrNumberBold(int val, int x, int y, int wrapThresh) {
  char buff[8] = "XX";
  if (!(val < -9 && wrapThresh < 1000)) {
    sprintf(buff, "%d", val >= wrapThresh ? val % wrapThresh : val);
  }
  MN_DrTextAYellow(buff, x - MN_TextAWidth(buff) / 2, y);
}


x86 assembly (clang, -O0):
<DrNumberBold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    0xeb5(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0xfffffff7,-0x4(%rbp)
jge    1166 <DrNumberBold+0x36>
cmpl   $0x3e8,-0x10(%rbp)
jl     11a2 <DrNumberBold+0x72>
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1189 <DrNumberBold+0x59>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x24(%rbp)
jmp    118f <DrNumberBold+0x5f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe6b(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    -0x18(%rbp),%rdi
call   1040 <MN_TextAWidth@plt>
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rdi
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    %eax,%esi
mov    -0xc(%rbp),%edx
call   1030 <MN_DrTextAYellow@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DrNumberBold>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%edx
movq   $0x5858,0x8(%rsp)
cmp    $0xfffffff6,%edi
jg     1155 <DrNumberBold+0x25>
cmp    $0x3e8,%ecx
jl     116f <DrNumberBold+0x3f>
cmp    %ecx,%edx
jl     115e <DrNumberBold+0x2e>
mov    %edx,%eax
cltd
idiv   %ecx
lea    0xe9b(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1050 <sprintf@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <MN_TextAWidth@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
sub    %ecx,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <MN_DrTextAYellow@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.DrNumberBold.buff = [8 x i8] c"XX\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
define void @DrNumberBold(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [8 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = bitcast [8 x i8]* %9 to i8*
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, -9
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i32, i32* %8
%15 = icmp slt i32 %14, 1000
br i1 %15, label %30, label %16
16: ; preds = %13, %4
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%18 = load i32, i32* %5
%19 = load i32, i32* %8
%20 = icmp sge i32 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %16
%22 = load i32, i32* %5
%23 = load i32, i32* %8
%24 = srem i32 %22, %23
br label %27
25: ; preds = %16
%26 = load i32, i32* %5
br label %27
27: ; preds = %25, %21
%28 = phi i32 [ %24, %21 ], [ %26, %25 ]
%29 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %13
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%32 = load i32, i32* %6
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%34 = call i32 @MN_TextAWidth(i8* %33)
%35 = sdiv i32 %34, 2
%36 = sub nsw i32 %32, %35
%37 = load i32, i32* %7
%38 = call i32 @MN_DrTextAYellow(i8* %31, i32 %36, i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @DrNumberBold(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
store i64 22616, i64* %5
%7 = icmp slt i32 %0, -9
%8 = icmp slt i32 %3, 1000
%9 = and i1 %7, %8
br i1 %9, label %17, label %10
10: ; preds = %4
%11 = icmp slt i32 %0, %3
br i1 %11, label %14, label %12
12: ; preds = %10
%13 = srem i32 %0, %3
br label %14
14: ; preds = %10, %12
%15 = phi i32 [ %13, %12 ], [ %0, %10 ]
%16 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %4, %14
%18 = call i32 @MN_TextAWidth(i8* %6)
%19 = sdiv i32 %18, -2
%20 = add i32 %19, %1
%21 = call i32 @MN_DrTextAYellow(i8* %6, i32 %20, i32 %2)
ret void
}