#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*/ V_DrawPatchDirect(int, int, int /*<<< orphan*/,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ W_CacheLumpName(char *, int);
void M_DrawThermo(int x, int y, int thermWidth, int thermDot) {
  int xx;
  int i;
  xx = x;
  V_DrawPatchDirect(xx, y, 0, W_CacheLumpName("M_THERML", 101));
  xx += 8;
  for (i = 0; i < thermWidth; i++) {
    V_DrawPatchDirect(xx, y, 0, W_CacheLumpName("M_THERMM", 101));
    xx += 8;
  }
  V_DrawPatchDirect(xx, y, 0, W_CacheLumpName("M_THERMR", 101));
  if (thermDot <= 30)
    V_DrawPatchDirect((x + 8) + thermDot * 8, y, 0,
                      W_CacheLumpName("M_THERMO", 101));
}


x86 assembly (clang, -O0):
<M_DrawThermo>:
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    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c5 <M_DrawThermo+0xa5>
mov    -0x14(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
lea    0xe74(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
mov    -0x14(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1176 <M_DrawThermo+0x56>
mov    -0x14(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    0xe3a(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
cmpl   $0x1e,-0x10(%rbp)
jg     1232 <M_DrawThermo+0x112>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    -0x10(%rbp),%ecx
shl    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    0xe02(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    -0x38(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    %eax,%ecx
xor    %edx,%edx
call   1030 <V_DrawPatchDirect@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M_DrawThermo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r12d
mov    %edi,%r15d
lea    0xec3(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    %r15d,%edi
mov    %r12d,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <V_DrawPatchDirect@plt>
add    $0x8,%r15d
mov    %r15d,%ebx
test   %ebp,%ebp
jle    1193 <M_DrawThermo+0x73>
lea    0xea1(%rip),%r13
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    %ebx,%edi
mov    %r12d,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <V_DrawPatchDirect@plt>
add    $0x8,%ebx
add    $0xffffffff,%ebp
jne    1170 <M_DrawThermo+0x50>
lea    0xe78(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    %ebx,%edi
mov    %r12d,%esi
xor    %edx,%edx
mov    %eax,%ecx
call   1030 <V_DrawPatchDirect@plt>
cmp    $0x1e,%r14d
jg     11e9 <M_DrawThermo+0xc9>
lea    (%r15,%r14,8),%ebx
lea    0xe58(%rip),%rdi
mov    $0x65,%esi
call   1040 <W_CacheLumpName@plt>
mov    %ebx,%edi
mov    %r12d,%esi
xor    %edx,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <V_DrawPatchDirect@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"M_THERML\00"
@.str.1 = [9 x i8] c"M_THERMM\00"
@.str.2 = [9 x i8] c"M_THERMR\00"
@.str.3 = [9 x i8] c"M_THERMO\00"
define void @M_DrawThermo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = load i32, i32* %6
%14 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 101)
%15 = call i32 @V_DrawPatchDirect(i32 %12, i32 %13, i32 0, i32 %14)
%16 = load i32, i32* %9
%17 = add nsw i32 %16, 8
store i32 %17, i32* %9
store i32 0, i32* %10
br label %18
18: ; preds = %29, %4
%19 = load i32, i32* %10
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32, i32* %9
%24 = load i32, i32* %6
%25 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 101)
%26 = call i32 @V_DrawPatchDirect(i32 %23, i32 %24, i32 0, i32 %25)
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 8
store i32 %28, i32* %9
br label %29
29: ; preds = %22
%30 = load i32, i32* %10
%31 = add nsw i32 %30, 1
store i32 %31, i32* %10
br label %18
32: ; preds = %18
%33 = load i32, i32* %9
%34 = load i32, i32* %6
%35 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 101)
%36 = call i32 @V_DrawPatchDirect(i32 %33, i32 %34, i32 0, i32 %35)
%37 = load i32, i32* %8
%38 = icmp sle i32 %37, 30
br i1 %38, label %39, label %48
39: ; preds = %32
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 8
%42 = load i32, i32* %8
%43 = mul nsw i32 %42, 8
%44 = add nsw i32 %41, %43
%45 = load i32, i32* %6
%46 = call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 101)
%47 = call i32 @V_DrawPatchDirect(i32 %44, i32 %45, i32 0, i32 %46)
br label %48
48: ; preds = %39, %32
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"M_THERML\00"
@.str.1 = [9 x i8] c"M_THERMM\00"
@.str.2 = [9 x i8] c"M_THERMR\00"
@.str.3 = [9 x i8] c"M_THERMO\00"
define void @M_DrawThermo(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 101)
%6 = tail call i32 @V_DrawPatchDirect(i32 %0, i32 %1, i32 0, i32 %5)
%7 = add nsw i32 %0, 8
%8 = icmp sgt i32 %2, 0
br i1 %8, label %9, label %17
9: ; preds = %4, %9
%10 = phi i32 [ %15, %9 ], [ 0, %4 ]
%11 = phi i32 [ %14, %9 ], [ %7, %4 ]
%12 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 101)
%13 = tail call i32 @V_DrawPatchDirect(i32 %11, i32 %1, i32 0, i32 %12)
%14 = add nsw i32 %11, 8
%15 = add nuw nsw i32 %10, 1
%16 = icmp eq i32 %15, %2
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = phi i32 [ %7, %4 ], [ %14, %9 ]
%19 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 101)
%20 = tail call i32 @V_DrawPatchDirect(i32 %18, i32 %1, i32 0, i32 %19)
%21 = icmp slt i32 %3, 31
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = shl nsw i32 %3, 3
%24 = add nsw i32 %23, %7
%25 = tail call i32 @W_CacheLumpName(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 101)
%26 = tail call i32 @V_DrawPatchDirect(i32 %24, i32 %1, i32 0, i32 %25)
br label %27
27: ; preds = %22, %17
ret void
}