#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*/ string_append(int, char *, char *);
void handle_qualcomm(int which, int part, char *model_string) {
  switch (part) {
  case 0x00f:
    string_append(which, "Scorpion", model_string);
    break;
  case 0x02d:
    string_append(which, "Scorpion", model_string);
    break;
  case 0x04d:
    string_append(which, "Krait", model_string);
    break;
  case 0x06f:
    string_append(which, "Krait", model_string);
    break;
  case 0x201:
    string_append(which, "Kryo", model_string);
    break;
  case 0x205:
    string_append(which, "Kryo", model_string);
    break;
  case 0x211:
    string_append(which, "Kryo", model_string);
    break;
  case 0x800:
    string_append(which, "Falkor V1/Kryo", model_string);
    break;
  case 0x801:
    string_append(which, "Kryo V2", model_string);
    break;
  case 0xc00:
    string_append(which, "Falkor", model_string);
    break;
  case 0xc01:
    string_append(which, "Saphira", model_string);
    break;
  default:
    string_append(which, "Unknown", model_string);
    break;
  }
}


x86 assembly (clang, -O0):
<handle_qualcomm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0xf,%eax
je     11ee <handle_qualcomm+0xde>
jmp    1136 <handle_qualcomm+0x26>
mov    -0x14(%rbp),%eax
sub    $0x2d,%eax
je     1206 <handle_qualcomm+0xf6>
jmp    1147 <handle_qualcomm+0x37>
mov    -0x14(%rbp),%eax
sub    $0x4d,%eax
je     121e <handle_qualcomm+0x10e>
jmp    1158 <handle_qualcomm+0x48>
mov    -0x14(%rbp),%eax
sub    $0x6f,%eax
je     1236 <handle_qualcomm+0x126>
jmp    1169 <handle_qualcomm+0x59>
mov    -0x14(%rbp),%eax
sub    $0x201,%eax
je     124e <handle_qualcomm+0x13e>
jmp    117c <handle_qualcomm+0x6c>
mov    -0x14(%rbp),%eax
sub    $0x205,%eax
je     1266 <handle_qualcomm+0x156>
jmp    118f <handle_qualcomm+0x7f>
mov    -0x14(%rbp),%eax
sub    $0x211,%eax
je     127e <handle_qualcomm+0x16e>
jmp    11a2 <handle_qualcomm+0x92>
mov    -0x14(%rbp),%eax
sub    $0x800,%eax
je     1296 <handle_qualcomm+0x186>
jmp    11b5 <handle_qualcomm+0xa5>
mov    -0x14(%rbp),%eax
sub    $0x801,%eax
je     12ae <handle_qualcomm+0x19e>
jmp    11c8 <handle_qualcomm+0xb8>
mov    -0x14(%rbp),%eax
sub    $0xc00,%eax
je     12c6 <handle_qualcomm+0x1b6>
jmp    11db <handle_qualcomm+0xcb>
mov    -0x14(%rbp),%eax
sub    $0xc01,%eax
je     12de <handle_qualcomm+0x1ce>
jmp    12f6 <handle_qualcomm+0x1e6>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe04(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdec(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xddd(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdc5(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xdbd(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xda5(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd8d(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd6b(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd62(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd52(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd41(%rip),%rsi
call   1030 <string_append@plt>
jmp    1309 <handle_qualcomm+0x1f9>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xd31(%rip),%rsi
call   1030 <string_append@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_qualcomm>:
cmp    $0x204,%esi
jle    1148 <handle_qualcomm+0x38>
cmp    $0x800,%esi
jg     116b <handle_qualcomm+0x5b>
cmp    $0x205,%esi
je     115f <handle_qualcomm+0x4f>
cmp    $0x211,%esi
je     115f <handle_qualcomm+0x4f>
cmp    $0x800,%esi
jne    11cf <handle_qualcomm+0xbf>
lea    0xecc(%rip),%rsi
jmp    1030 <string_append@plt>
cmp    $0x4c,%esi
jle    118f <handle_qualcomm+0x7f>
cmp    $0x4d,%esi
je     11a8 <handle_qualcomm+0x98>
cmp    $0x6f,%esi
je     11a8 <handle_qualcomm+0x98>
cmp    $0x201,%esi
jne    11cf <handle_qualcomm+0xbf>
lea    0xeb3(%rip),%rsi
jmp    1030 <string_append@plt>
cmp    $0x801,%esi
je     11b4 <handle_qualcomm+0xa4>
cmp    $0xc00,%esi
je     11c0 <handle_qualcomm+0xb0>
cmp    $0xc01,%esi
jne    11cf <handle_qualcomm+0xbf>
lea    0xea3(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xe6a(%rip),%rax
cmp    $0xf,%esi
je     11a0 <handle_qualcomm+0x90>
cmp    $0x2d,%esi
jne    11cf <handle_qualcomm+0xbf>
mov    %rax,%rsi
jmp    1030 <string_append@plt>
lea    0xe5a(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xe63(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xe5f(%rip),%rax
mov    %rax,%rsi
jmp    1030 <string_append@plt>
lea    0xe5f(%rip),%rsi
jmp    1030 <string_append@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Scorpion\00"
@.str.1 = [6 x i8] c"Krait\00"
@.str.2 = [5 x i8] c"Kryo\00"
@.str.3 = [15 x i8] c"Falkor V1/Kryo\00"
@.str.4 = [8 x i8] c"Kryo V2\00"
@.str.5 = [7 x i8] c"Falkor\00"
@.str.6 = [8 x i8] c"Saphira\00"
@.str.7 = [8 x i8] c"Unknown\00"
define void @handle_qualcomm(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
switch i32 %7, label %52 [
i32 15, label %8
i32 45, label %12
i32 77, label %16
i32 111, label %20
i32 513, label %24
i32 517, label %28
i32 529, label %32
i32 2048, label %36
i32 2049, label %40
i32 3072, label %44
i32 3073, label %48
]
8: ; preds = %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %6
%11 = call i32 @string_append(i32 %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %56
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i8*, i8** %6
%15 = call i32 @string_append(i32 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %56
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i8*, i8** %6
%19 = call i32 @string_append(i32 %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %56
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i8*, i8** %6
%23 = call i32 @string_append(i32 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %56
24: ; preds = %3
%25 = load i32, i32* %4
%26 = load i8*, i8** %6
%27 = call i32 @string_append(i32 %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %56
28: ; preds = %3
%29 = load i32, i32* %4
%30 = load i8*, i8** %6
%31 = call i32 @string_append(i32 %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %30)
br label %56
32: ; preds = %3
%33 = load i32, i32* %4
%34 = load i8*, i8** %6
%35 = call i32 @string_append(i32 %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %56
36: ; preds = %3
%37 = load i32, i32* %4
%38 = load i8*, i8** %6
%39 = call i32 @string_append(i32 %37, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8* %38)
br label %56
40: ; preds = %3
%41 = load i32, i32* %4
%42 = load i8*, i8** %6
%43 = call i32 @string_append(i32 %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %42)
br label %56
44: ; preds = %3
%45 = load i32, i32* %4
%46 = load i8*, i8** %6
%47 = call i32 @string_append(i32 %45, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %46)
br label %56
48: ; preds = %3
%49 = load i32, i32* %4
%50 = load i8*, i8** %6
%51 = call i32 @string_append(i32 %49, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %50)
br label %56
52: ; preds = %3
%53 = load i32, i32* %4
%54 = load i8*, i8** %6
%55 = call i32 @string_append(i32 %53, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8* %54)
br label %56
56: ; preds = %52, %48, %44, %40, %36, %32, %28, %24, %20, %16, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Scorpion\00"
@.str.1 = [6 x i8] c"Krait\00"
@.str.2 = [5 x i8] c"Kryo\00"
@.str.3 = [15 x i8] c"Falkor V1/Kryo\00"
@.str.4 = [8 x i8] c"Kryo V2\00"
@.str.5 = [7 x i8] c"Falkor\00"
@.str.6 = [8 x i8] c"Saphira\00"
@.str.7 = [8 x i8] c"Unknown\00"
define void @handle_qualcomm(i32 %0, i32 %1, i8* %2) {
switch i32 %1, label %13 [
i32 15, label %14
i32 45, label %14
i32 77, label %4
i32 111, label %5
i32 513, label %6
i32 517, label %7
i32 529, label %8
i32 2048, label %9
i32 2049, label %10
i32 3072, label %11
i32 3073, label %12
]
4: ; preds = %3
br label %14
5: ; preds = %3
br label %14
6: ; preds = %3
br label %14
7: ; preds = %3
br label %14
8: ; preds = %3
br label %14
9: ; preds = %3
br label %14
10: ; preds = %3
br label %14
11: ; preds = %3
br label %14
12: ; preds = %3
br label %14
13: ; preds = %3
br label %14
14: ; preds = %3, %3, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4
%15 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), %13 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), %12 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %10 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %3 ]
%16 = tail call i32 @string_append(i32 %0, i8* %15, i8* %2)
ret void
}