#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*/ boot_property_add(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
void hwLcd_setBootProperty(int density) {
  char temp[8];
  if (density != 213) {
    if (density < (120 + 160) / 2)
      density = 120;
    else if (density < (160 + 240) / 2)
      density = 160;
    else if (density < (240 + 280) / 2)
      density = 240;
    else if (density < (280 + 320) / 2)
      density = 280;
    else if (density < (320 + 360) / 2)
      density = 320;
    else if (density < (360 + 400) / 2)
      density = 360;
    else if (density < (400 + 480) / 2)
      density = 400;
    else if (density < (480 + 560) / 2)
      density = 480;
    else if (density < (560 + 640) / 2)
      density = 560;
    else
      density = 640;
  }
  snprintf(temp, sizeof temp, "%d", density);
  boot_property_add("qemu.sf.lcd_density", temp);
}


x86 assembly (clang, -O0):
<hwLcd_setBootProperty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xd5,-0x4(%rbp)
je     124d <hwLcd_setBootProperty+0x12d>
cmpl   $0x8c,-0x4(%rbp)
jge    1151 <hwLcd_setBootProperty+0x31>
movl   $0x78,-0x4(%rbp)
jmp    1248 <hwLcd_setBootProperty+0x128>
cmpl   $0xc8,-0x4(%rbp)
jge    116a <hwLcd_setBootProperty+0x4a>
movl   $0xa0,-0x4(%rbp)
jmp    1243 <hwLcd_setBootProperty+0x123>
cmpl   $0x104,-0x4(%rbp)
jge    1183 <hwLcd_setBootProperty+0x63>
movl   $0xf0,-0x4(%rbp)
jmp    123e <hwLcd_setBootProperty+0x11e>
cmpl   $0x12c,-0x4(%rbp)
jge    119c <hwLcd_setBootProperty+0x7c>
movl   $0x118,-0x4(%rbp)
jmp    1239 <hwLcd_setBootProperty+0x119>
cmpl   $0x154,-0x4(%rbp)
jge    11b5 <hwLcd_setBootProperty+0x95>
movl   $0x140,-0x4(%rbp)
jmp    1234 <hwLcd_setBootProperty+0x114>
cmpl   $0x17c,-0x4(%rbp)
jge    11ce <hwLcd_setBootProperty+0xae>
movl   $0x168,-0x4(%rbp)
jmp    122f <hwLcd_setBootProperty+0x10f>
cmpl   $0x1b8,-0x4(%rbp)
jge    11e7 <hwLcd_setBootProperty+0xc7>
movl   $0x190,-0x4(%rbp)
jmp    122a <hwLcd_setBootProperty+0x10a>
cmpl   $0x208,-0x4(%rbp)
jge    1200 <hwLcd_setBootProperty+0xe0>
movl   $0x1e0,-0x4(%rbp)
jmp    1225 <hwLcd_setBootProperty+0x105>
cmpl   $0x258,-0x4(%rbp)
jge    1219 <hwLcd_setBootProperty+0xf9>
movl   $0x230,-0x4(%rbp)
jmp    1220 <hwLcd_setBootProperty+0x100>
movl   $0x280,-0x4(%rbp)
jmp    1225 <hwLcd_setBootProperty+0x105>
jmp    122a <hwLcd_setBootProperty+0x10a>
jmp    122f <hwLcd_setBootProperty+0x10f>
jmp    1234 <hwLcd_setBootProperty+0x114>
jmp    1239 <hwLcd_setBootProperty+0x119>
jmp    123e <hwLcd_setBootProperty+0x11e>
jmp    1243 <hwLcd_setBootProperty+0x123>
jmp    1248 <hwLcd_setBootProperty+0x128>
jmp    124d <hwLcd_setBootProperty+0x12d>
lea    -0xc(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x8,%esi
lea    0xda0(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0xc(%rbp),%rsi
lea    0xd93(%rip),%rdi
call   1040 <boot_property_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hwLcd_setBootProperty>:
mov    $0xd5,%ecx
cmp    $0xd5,%edi
je     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x78,%ecx
cmp    $0x8c,%edi
jl     11a8 <hwLcd_setBootProperty+0x88>
mov    $0xa0,%ecx
cmp    $0xc8,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0xf0,%ecx
cmp    $0x104,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x118,%ecx
cmp    $0x12c,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x140,%ecx
cmp    $0x154,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x168,%ecx
cmp    $0x17c,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x190,%ecx
cmp    $0x1b8,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
mov    $0x1e0,%ecx
cmp    $0x208,%edi
jb     11a8 <hwLcd_setBootProperty+0x88>
cmp    $0x258,%edi
mov    $0x230,%eax
mov    $0x280,%ecx
cmovb  %eax,%ecx
push   %rbx
sub    $0x10,%rsp
lea    0xe4c(%rip),%rdx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <snprintf@plt>
lea    0xe36(%rip),%rdi
mov    %rbx,%rsi
call   1040 <boot_property_add@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"qemu.sf.lcd_density\00"
define void @hwLcd_setBootProperty(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 213
br i1 %5, label %6, label %52
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 140
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 120, i32* %2
br label %51
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 200
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 160, i32* %2
br label %50
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 260
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 240, i32* %2
br label %49
18: ; preds = %14
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 300
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 280, i32* %2
br label %48
22: ; preds = %18
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 340
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 320, i32* %2
br label %47
26: ; preds = %22
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 380
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 360, i32* %2
br label %46
30: ; preds = %26
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 440
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 400, i32* %2
br label %45
34: ; preds = %30
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 520
br i1 %36, label %37, label %38
37: ; preds = %34
store i32 480, i32* %2
br label %44
38: ; preds = %34
%39 = load i32, i32* %2
%40 = icmp slt i32 %39, 600
br i1 %40, label %41, label %42
41: ; preds = %38
store i32 560, i32* %2
br label %43
42: ; preds = %38
store i32 640, i32* %2
br label %43
43: ; preds = %42, %41
br label %44
44: ; preds = %43, %37
br label %45
45: ; preds = %44, %33
br label %46
46: ; preds = %45, %29
br label %47
47: ; preds = %46, %25
br label %48
48: ; preds = %47, %21
br label %49
49: ; preds = %48, %17
br label %50
50: ; preds = %49, %13
br label %51
51: ; preds = %50, %9
br label %52
52: ; preds = %51, %1
%53 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%54 = load i32, i32* %2
%55 = call i32 @snprintf(i8* %53, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %54)
%56 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%57 = call i32 @boot_property_add(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %56)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [20 x i8] c"qemu.sf.lcd_density\00"
define void @hwLcd_setBootProperty(i32 %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 213
br i1 %4, label %24, label %5
5: ; preds = %1
%6 = icmp slt i32 %0, 140
br i1 %6, label %24, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 200
br i1 %8, label %24, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 260
br i1 %10, label %24, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 300
br i1 %12, label %24, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 340
br i1 %14, label %24, label %15
15: ; preds = %13
%16 = icmp ult i32 %0, 380
br i1 %16, label %24, label %17
17: ; preds = %15
%18 = icmp ult i32 %0, 440
br i1 %18, label %24, label %19
19: ; preds = %17
%20 = icmp ult i32 %0, 520
br i1 %20, label %24, label %21
21: ; preds = %19
%22 = icmp ult i32 %0, 600
%23 = select i1 %22, i32 560, i32 640
br label %24
24: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5, %1
%25 = phi i32 [ 213, %1 ], [ 120, %5 ], [ 160, %7 ], [ 240, %9 ], [ 280, %11 ], [ 320, %13 ], [ 360, %15 ], [ 400, %17 ], [ 480, %19 ], [ %23, %21 ]
%26 = call i32 @snprintf(i8* %3, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 @boot_property_add(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}