#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_broadcom(int which, int part, char *model_string) {
  switch (part) {
  case 0x0f:
    string_append(which, "Brahma B15", model_string);
    break;
  case 0x100:
    string_append(which, "Brahma B53", model_string);
    break;
  case 0x516:
    string_append(which, "ThunderX2", model_string);
    break;
  default:
    string_append(which, "Unknown", model_string);
    break;
  }
}


x86 assembly (clang, -O0):
<handle_broadcom>:
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     115c <handle_broadcom+0x4c>
jmp    1136 <handle_broadcom+0x26>
mov    -0x14(%rbp),%eax
sub    $0x100,%eax
je     1174 <handle_broadcom+0x64>
jmp    1149 <handle_broadcom+0x39>
mov    -0x14(%rbp),%eax
sub    $0x516,%eax
je     118c <handle_broadcom+0x7c>
jmp    11a4 <handle_broadcom+0x94>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rsi
call   1030 <string_append@plt>
jmp    11b7 <handle_broadcom+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1030 <string_append@plt>
jmp    11b7 <handle_broadcom+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe7c(%rip),%rsi
call   1030 <string_append@plt>
jmp    11b7 <handle_broadcom+0xa7>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe6e(%rip),%rsi
call   1030 <string_append@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_broadcom>:
cmp    $0xf,%esi
je     1131 <handle_broadcom+0x21>
cmp    $0x516,%esi
je     113d <handle_broadcom+0x2d>
cmp    $0x100,%esi
jne    1149 <handle_broadcom+0x39>
lea    0xedf(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xec8(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xed2(%rip),%rsi
jmp    1030 <string_append@plt>
lea    0xed0(%rip),%rsi
jmp    1030 <string_append@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Brahma B15\00"
@.str.1 = [11 x i8] c"Brahma B53\00"
@.str.2 = [10 x i8] c"ThunderX2\00"
@.str.3 = [8 x i8] c"Unknown\00"
define void @handle_broadcom(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 %20 [
i32 15, label %8
i32 256, label %12
i32 1302, label %16
]
8: ; preds = %3
%9 = load i32, i32* %4
%10 = load i8*, i8** %6
%11 = call i32 @string_append(i32 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %24
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i8*, i8** %6
%15 = call i32 @string_append(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %24
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i8*, i8** %6
%19 = call i32 @string_append(i32 %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %24
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i8*, i8** %6
%23 = call i32 @string_append(i32 %21, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %20, %16, %12, %8
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Brahma B15\00"
@.str.1 = [11 x i8] c"Brahma B53\00"
@.str.2 = [10 x i8] c"ThunderX2\00"
@.str.3 = [8 x i8] c"Unknown\00"
define void @handle_broadcom(i32 %0, i32 %1, i8* %2) {
switch i32 %1, label %6 [
i32 15, label %7
i32 256, label %4
i32 1302, label %5
]
4: ; preds = %3
br label %7
5: ; preds = %3
br label %7
6: ; preds = %3
br label %7
7: ; preds = %3, %6, %5, %4
%8 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %3 ]
%9 = tail call i32 @string_append(i32 %0, i8* %8, i8* %2)
ret void
}