#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_jpeg(int width, int height, char *profile,
                                char *mimeType) {
  if (width <= 0 && height <= 0) {
    return -1;
  }
  strcpy(mimeType, "image/jpeg");
  if (width <= 48 && height <= 48) {
    strcpy(profile, "JPEG_SM_ICO");
    return 0;
  } else if (width <= 120 && height <= 120) {
    strcpy(profile, "JPEG_LRG_ICO");
    return 0;
  } else if (width <= 160 && height <= 160) {
    strcpy(profile, "JPEG_TN");
    return 0;
  } else if (width <= 640 && height <= 480) {
    strcpy(profile, "JPEG_SM");
    return 0;
  } else if (width <= 1024 && height <= 768) {
    strcpy(profile, "JPEG_MED");
    return 0;
  } else if (width <= 4096 && height <= 4096) {
    strcpy(profile, "JPEG_LRG");
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<dlna_get_image_profile_jpeg>:
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_jpeg+0x36>
cmpl   $0x0,-0xc(%rbp)
jg     1146 <dlna_get_image_profile_jpeg+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
mov    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
cmpl   $0x30,-0x8(%rbp)
jg     1186 <dlna_get_image_profile_jpeg+0x76>
cmpl   $0x30,-0xc(%rbp)
jg     1186 <dlna_get_image_profile_jpeg+0x76>
mov    -0x18(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
cmpl   $0x78,-0x8(%rbp)
jg     11b6 <dlna_get_image_profile_jpeg+0xa6>
cmpl   $0x78,-0xc(%rbp)
jg     11b6 <dlna_get_image_profile_jpeg+0xa6>
mov    -0x18(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
cmpl   $0xa0,-0x8(%rbp)
jg     11ec <dlna_get_image_profile_jpeg+0xdc>
cmpl   $0xa0,-0xc(%rbp)
jg     11ec <dlna_get_image_profile_jpeg+0xdc>
mov    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
cmpl   $0x280,-0x8(%rbp)
jg     1222 <dlna_get_image_profile_jpeg+0x112>
cmpl   $0x1e0,-0xc(%rbp)
jg     1222 <dlna_get_image_profile_jpeg+0x112>
mov    -0x18(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
cmpl   $0x400,-0x8(%rbp)
jg     1258 <dlna_get_image_profile_jpeg+0x148>
cmpl   $0x300,-0xc(%rbp)
jg     1258 <dlna_get_image_profile_jpeg+0x148>
mov    -0x18(%rbp),%rdi
lea    0xded(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
cmpl   $0x1000,-0x8(%rbp)
jg     128e <dlna_get_image_profile_jpeg+0x17e>
cmpl   $0x1000,-0xc(%rbp)
jg     128e <dlna_get_image_profile_jpeg+0x17e>
mov    -0x18(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x4(%rbp)
jmp    12ae <dlna_get_image_profile_jpeg+0x19e>
jmp    1293 <dlna_get_image_profile_jpeg+0x183>
jmp    1298 <dlna_get_image_profile_jpeg+0x188>
jmp    129d <dlna_get_image_profile_jpeg+0x18d>
jmp    12a2 <dlna_get_image_profile_jpeg+0x192>
jmp    12a7 <dlna_get_image_profile_jpeg+0x197>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlna_get_image_profile_jpeg>:
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     1130 <dlna_get_image_profile_jpeg+0x20>
test   %ebx,%ebx
jle    11d2 <dlna_get_image_profile_jpeg+0xc2>
lea    0xec9(%rip),%rsi
mov    %rcx,%rdi
call   1030 <strcpy@plt>
cmp    $0x30,%ebp
jg     1152 <dlna_get_image_profile_jpeg+0x42>
cmp    $0x31,%ebx
jge    1152 <dlna_get_image_profile_jpeg+0x42>
lea    0xebb(%rip),%rsi
jmp    11c7 <dlna_get_image_profile_jpeg+0xb7>
cmp    $0x78,%ebp
jg     1165 <dlna_get_image_profile_jpeg+0x55>
cmp    $0x79,%ebx
jge    1165 <dlna_get_image_profile_jpeg+0x55>
lea    0xeb4(%rip),%rsi
jmp    11c7 <dlna_get_image_profile_jpeg+0xb7>
cmp    $0xa0,%ebp
jg     117e <dlna_get_image_profile_jpeg+0x6e>
cmp    $0xa1,%ebx
jge    117e <dlna_get_image_profile_jpeg+0x6e>
lea    0xea8(%rip),%rsi
jmp    11c7 <dlna_get_image_profile_jpeg+0xb7>
cmp    $0x280,%ebp
jg     1197 <dlna_get_image_profile_jpeg+0x87>
cmp    $0x1e1,%ebx
jge    1197 <dlna_get_image_profile_jpeg+0x87>
lea    0xe97(%rip),%rsi
jmp    11c7 <dlna_get_image_profile_jpeg+0xb7>
cmp    $0x400,%ebp
jg     11b0 <dlna_get_image_profile_jpeg+0xa0>
cmp    $0x301,%ebx
jge    11b0 <dlna_get_image_profile_jpeg+0xa0>
lea    0xe86(%rip),%rsi
jmp    11c7 <dlna_get_image_profile_jpeg+0xb7>
cmp    $0x1000,%ebp
jg     11d2 <dlna_get_image_profile_jpeg+0xc2>
cmp    $0x1000,%ebx
jg     11d2 <dlna_get_image_profile_jpeg+0xc2>
lea    0xe76(%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 = [11 x i8] c"image/jpeg\00"
@.str.1 = [12 x i8] c"JPEG_SM_ICO\00"
@.str.2 = [13 x i8] c"JPEG_LRG_ICO\00"
@.str.3 = [8 x i8] c"JPEG_TN\00"
@.str.4 = [8 x i8] c"JPEG_SM\00"
@.str.5 = [9 x i8] c"JPEG_MED\00"
@.str.6 = [9 x i8] c"JPEG_LRG\00"
define i32 @dlna_get_image_profile_jpeg(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 %78
16: ; preds = %12, %4
%17 = load i8*, i8** %9
%18 = call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 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 ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %78
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 ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %78
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 ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %78
45: ; preds = %39, %36
%46 = load i32, i32* %6
%47 = icmp sle i32 %46, 640
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load i32, i32* %7
%50 = icmp sle i32 %49, 480
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 %78
54: ; preds = %48, %45
%55 = load i32, i32* %6
%56 = icmp sle i32 %55, 1024
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i32, i32* %7
%59 = icmp sle i32 %58, 768
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8*, i8** %8
%62 = call i32 @strcpy(i8* %61, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %5
br label %78
63: ; preds = %57, %54
%64 = load i32, i32* %6
%65 = icmp sle i32 %64, 4096
br i1 %65, label %66, label %72
66: ; preds = %63
%67 = load i32, i32* %7
%68 = icmp sle i32 %67, 4096
br i1 %68, label %69, label %72
69: ; preds = %66
%70 = load i8*, i8** %8
%71 = call i32 @strcpy(i8* %70, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %5
br label %78
72: ; preds = %66, %63
br label %73
73: ; preds = %72
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74
br label %76
76: ; preds = %75
br label %77
77: ; preds = %76
store i32 -1, i32* %5
br label %78
78: ; preds = %77, %69, %60, %51, %42, %33, %24, %15
%79 = load i32, i32* %5
ret i32 %79
}

LLVM IR (-O2):
@.str = [11 x i8] c"image/jpeg\00"
@.str.1 = [12 x i8] c"JPEG_SM_ICO\00"
@.str.2 = [13 x i8] c"JPEG_LRG_ICO\00"
@.str.3 = [8 x i8] c"JPEG_TN\00"
@.str.4 = [8 x i8] c"JPEG_SM\00"
@.str.5 = [9 x i8] c"JPEG_MED\00"
@.str.6 = [9 x i8] c"JPEG_LRG\00"
define i32 @dlna_get_image_profile_jpeg(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 %36, label %8
8: ; preds = %4
%9 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 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 %33, 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 %33, 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 %33, label %21
21: ; preds = %17
%22 = icmp slt i32 %0, 641
%23 = icmp slt i32 %1, 481
%24 = and i1 %22, %23
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = icmp slt i32 %0, 1025
%27 = icmp slt i32 %1, 769
%28 = and i1 %26, %27
br i1 %28, label %33, label %29
29: ; preds = %25
%30 = icmp slt i32 %0, 4097
%31 = icmp slt i32 %1, 4097
%32 = and i1 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %29, %25, %21, %17, %13, %8
%34 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %21 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), %25 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), %29 ]
%35 = tail call i32 @strcpy(i8* %2, i8* %34)
br label %36
36: ; preds = %33, %29, %4
%37 = phi i32 [ -1, %4 ], [ -1, %29 ], [ 0, %33 ]
ret i32 %37
}