#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*/ strcpy(char *, char *);
int dlna_get_image_profile_png(int width, int height, char *profile,
                               char *mimeType) {
  if (width <= 0 && height <= 0) {
    return -1;
  }
  strcpy(mimeType, "image/png");
  if (width <= 48 && height <= 48) {
    strcpy(profile, "PNG_SM_ICO");
    return 0;
  } else if (width <= 120 && height <= 120) {
    strcpy(profile, "PNG_LRG_ICO");
    return 0;
  } else if (width <= 160 && height <= 160) {
    strcpy(profile, "PNG_TN");
    return 0;
  } else if (width <= 4096 && height <= 4096) {
    strcpy(profile, "PNG_LRG");
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<dlna_get_image_profile_png>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1146 <dlna_get_image_profile_png+0x36>
cmpl   $0x0,-0xc(%rbp)
jg     1146 <dlna_get_image_profile_png+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1238 <dlna_get_image_profile_png+0x128>
mov    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x30,-0x8(%rbp)
jg     1186 <dlna_get_image_profile_png+0x76>
cmpl   $0x30,-0xc(%rbp)
jg     1186 <dlna_get_image_profile_png+0x76>
mov    -0x18(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1238 <dlna_get_image_profile_png+0x128>
cmpl   $0x78,-0x8(%rbp)
jg     11b6 <dlna_get_image_profile_png+0xa6>
cmpl   $0x78,-0xc(%rbp)
jg     11b6 <dlna_get_image_profile_png+0xa6>
mov    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1238 <dlna_get_image_profile_png+0x128>
cmpl   $0xa0,-0x8(%rbp)
jg     11ec <dlna_get_image_profile_png+0xdc>
cmpl   $0xa0,-0xc(%rbp)
jg     11ec <dlna_get_image_profile_png+0xdc>
mov    -0x18(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1238 <dlna_get_image_profile_png+0x128>
cmpl   $0x1000,-0x8(%rbp)
jg     1222 <dlna_get_image_profile_png+0x112>
cmpl   $0x1000,-0xc(%rbp)
jg     1222 <dlna_get_image_profile_png+0x112>
mov    -0x18(%rbp),%rdi
lea    0xe17(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    1238 <dlna_get_image_profile_png+0x128>
jmp    1227 <dlna_get_image_profile_png+0x117>
jmp    122c <dlna_get_image_profile_png+0x11c>
jmp    1231 <dlna_get_image_profile_png+0x121>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlna_get_image_profile_png>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xffffffff,%r15d
test   %edi,%edi
jg     112c <dlna_get_image_profile_png+0x1c>
test   %ebx,%ebx
jle    119c <dlna_get_image_profile_png+0x8c>
lea    0xecd(%rip),%rsi
mov    %rcx,%rdi
call   1030 <strcpy@plt>
cmp    $0x30,%ebp
jg     114e <dlna_get_image_profile_png+0x3e>
cmp    $0x31,%ebx
jge    114e <dlna_get_image_profile_png+0x3e>
lea    0xebe(%rip),%rsi
jmp    1191 <dlna_get_image_profile_png+0x81>
cmp    $0x78,%ebp
jg     1161 <dlna_get_image_profile_png+0x51>
cmp    $0x79,%ebx
jge    1161 <dlna_get_image_profile_png+0x51>
lea    0xeb6(%rip),%rsi
jmp    1191 <dlna_get_image_profile_png+0x81>
cmp    $0xa0,%ebp
jg     117a <dlna_get_image_profile_png+0x6a>
cmp    $0xa1,%ebx
jge    117a <dlna_get_image_profile_png+0x6a>
lea    0xea9(%rip),%rsi
jmp    1191 <dlna_get_image_profile_png+0x81>
cmp    $0x1000,%ebp
jg     119c <dlna_get_image_profile_png+0x8c>
cmp    $0x1000,%ebx
jg     119c <dlna_get_image_profile_png+0x8c>
lea    0xe97(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"image/png\00"
@.str.1 = [11 x i8] c"PNG_SM_ICO\00"
@.str.2 = [12 x i8] c"PNG_LRG_ICO\00"
@.str.3 = [7 x i8] c"PNG_TN\00"
@.str.4 = [8 x i8] c"PNG_LRG\00"
define i32 @dlna_get_image_profile_png(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32, i32* %7
%14 = icmp sle i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 -1, i32* %5
br label %58
16: ; preds = %12, %4
%17 = load i8*, i8** %9
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %6
%20 = icmp sle i32 %19, 48
br i1 %20, label %21, label %27
21: ; preds = %16
%22 = load i32, i32* %7
%23 = icmp sle i32 %22, 48
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8*, i8** %8
%26 = call i32 @strcpy(i8* %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %58
27: ; preds = %21, %16
%28 = load i32, i32* %6
%29 = icmp sle i32 %28, 120
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load i32, i32* %7
%32 = icmp sle i32 %31, 120
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i8*, i8** %8
%35 = call i32 @strcpy(i8* %34, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %58
36: ; preds = %30, %27
%37 = load i32, i32* %6
%38 = icmp sle i32 %37, 160
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = load i32, i32* %7
%41 = icmp sle i32 %40, 160
br i1 %41, label %42, label %45
42: ; preds = %39
%43 = load i8*, i8** %8
%44 = call i32 @strcpy(i8* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %58
45: ; preds = %39, %36
%46 = load i32, i32* %6
%47 = icmp sle i32 %46, 4096
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load i32, i32* %7
%50 = icmp sle i32 %49, 4096
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i8*, i8** %8
%53 = call i32 @strcpy(i8* %52, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %5
br label %58
54: ; preds = %48, %45
br label %55
55: ; preds = %54
br label %56
56: ; preds = %55
br label %57
57: ; preds = %56
store i32 -1, i32* %5
br label %58
58: ; preds = %57, %51, %42, %33, %24, %15
%59 = load i32, i32* %5
ret i32 %59
}

LLVM IR (-O2):
@.str = [10 x i8] c"image/png\00"
@.str.1 = [11 x i8] c"PNG_SM_ICO\00"
@.str.2 = [12 x i8] c"PNG_LRG_ICO\00"
@.str.3 = [7 x i8] c"PNG_TN\00"
@.str.4 = [8 x i8] c"PNG_LRG\00"
define i32 @dlna_get_image_profile_png(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = icmp slt i32 %0, 1
%6 = icmp slt i32 %1, 1
%7 = and i1 %5, %6
br i1 %7, label %28, label %8
8: ; preds = %4
%9 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = icmp slt i32 %0, 49
%11 = icmp slt i32 %1, 49
%12 = and i1 %10, %11
br i1 %12, label %25, label %13
13: ; preds = %8
%14 = icmp slt i32 %0, 121
%15 = icmp slt i32 %1, 121
%16 = and i1 %14, %15
br i1 %16, label %25, label %17
17: ; preds = %13
%18 = icmp slt i32 %0, 161
%19 = icmp slt i32 %1, 161
%20 = and i1 %18, %19
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = icmp slt i32 %0, 4097
%23 = icmp slt i32 %1, 4097
%24 = and i1 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21, %17, %13, %8
%26 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %13 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %21 ]
%27 = tail call i32 @strcpy(i8* %2, i8* %26)
br label %28
28: ; preds = %25, %21, %4
%29 = phi i32 [ -1, %4 ], [ -1, %21 ], [ 0, %25 ]
ret i32 %29
}