#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 + 320) / 2)
      density = 240;
    else if (density < (320 + 480) / 2)
      density = 320;
    else if (density < (480 + 640) / 2)
      density = 480;
    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     11d5 <hwLcd_setBootProperty+0xb5>
cmpl   $0x8c,-0x4(%rbp)
jge    1151 <hwLcd_setBootProperty+0x31>
movl   $0x78,-0x4(%rbp)
jmp    11d0 <hwLcd_setBootProperty+0xb0>
cmpl   $0xc8,-0x4(%rbp)
jge    116a <hwLcd_setBootProperty+0x4a>
movl   $0xa0,-0x4(%rbp)
jmp    11cb <hwLcd_setBootProperty+0xab>
cmpl   $0x118,-0x4(%rbp)
jge    1183 <hwLcd_setBootProperty+0x63>
movl   $0xf0,-0x4(%rbp)
jmp    11c6 <hwLcd_setBootProperty+0xa6>
cmpl   $0x190,-0x4(%rbp)
jge    119c <hwLcd_setBootProperty+0x7c>
movl   $0x140,-0x4(%rbp)
jmp    11c1 <hwLcd_setBootProperty+0xa1>
cmpl   $0x230,-0x4(%rbp)
jge    11b5 <hwLcd_setBootProperty+0x95>
movl   $0x1e0,-0x4(%rbp)
jmp    11bc <hwLcd_setBootProperty+0x9c>
movl   $0x280,-0x4(%rbp)
jmp    11c1 <hwLcd_setBootProperty+0xa1>
jmp    11c6 <hwLcd_setBootProperty+0xa6>
jmp    11cb <hwLcd_setBootProperty+0xab>
jmp    11d0 <hwLcd_setBootProperty+0xb0>
jmp    11d5 <hwLcd_setBootProperty+0xb5>
lea    -0xc(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x8,%esi
lea    0xe18(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0xc(%rbp),%rsi
lea    0xe0b(%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     1174 <hwLcd_setBootProperty+0x54>
mov    $0x78,%ecx
cmp    $0x8c,%edi
jl     1174 <hwLcd_setBootProperty+0x54>
mov    $0xa0,%ecx
cmp    $0xc8,%edi
jb     1174 <hwLcd_setBootProperty+0x54>
mov    $0xf0,%ecx
cmp    $0x118,%edi
jb     1174 <hwLcd_setBootProperty+0x54>
mov    $0x140,%ecx
cmp    $0x190,%edi
jb     1174 <hwLcd_setBootProperty+0x54>
cmp    $0x230,%edi
mov    $0x1e0,%eax
mov    $0x280,%ecx
cmovb  %eax,%ecx
push   %rbx
sub    $0x10,%rsp
lea    0xe80(%rip),%rdx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <snprintf@plt>
lea    0xe6a(%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 %32
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 %31
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 %30
14: ; preds = %10
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 280
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 240, i32* %2
br label %29
18: ; preds = %14
%19 = load i32, i32* %2
%20 = icmp slt i32 %19, 400
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 320, i32* %2
br label %28
22: ; preds = %18
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 560
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 480, i32* %2
br label %27
26: ; preds = %22
store i32 640, i32* %2
br label %27
27: ; preds = %26, %25
br label %28
28: ; preds = %27, %21
br label %29
29: ; preds = %28, %17
br label %30
30: ; preds = %29, %13
br label %31
31: ; preds = %30, %9
br label %32
32: ; preds = %31, %1
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%34 = load i32, i32* %2
%35 = call i32 @snprintf(i8* %33, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%37 = call i32 @boot_property_add(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %36)
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 %16, label %5
5: ; preds = %1
%6 = icmp slt i32 %0, 140
br i1 %6, label %16, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 200
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 280
br i1 %10, label %16, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 400
br i1 %12, label %16, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 560
%15 = select i1 %14, i32 480, i32 640
br label %16
16: ; preds = %13, %11, %9, %7, %5, %1
%17 = phi i32 [ 213, %1 ], [ 120, %5 ], [ 160, %7 ], [ 240, %9 ], [ 320, %11 ], [ %15, %13 ]
%18 = call i32 @snprintf(i8* %3, i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = call i32 @boot_property_add(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}