#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_nvidia(int which, int part, char *model_string) {
  switch (part) {
  case 0x000:
    string_append(which, "Denver", model_string);
    break;
  case 0x003:
    string_append(which, "Denver 2", model_string);
    break;
  default:
    string_append(which, "Unknown", model_string);
    break;
  }
}


x86 assembly (clang, -O0):
<handle_nvidia>:
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)
test   %eax,%eax
je     1146 <handle_nvidia+0x36>
jmp    1135 <handle_nvidia+0x25>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     115e <handle_nvidia+0x4e>
jmp    1176 <handle_nvidia+0x66>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xeac(%rip),%rsi
call   1030 <string_append@plt>
jmp    1189 <handle_nvidia+0x79>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe9b(%rip),%rsi
call   1030 <string_append@plt>
jmp    1189 <handle_nvidia+0x79>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1030 <string_append@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_nvidia>:
cmp    $0x3,%esi
lea    0xeed(%rip),%rax
lea    0xeef(%rip),%rcx
cmove  %rax,%rcx
test   %esi,%esi
lea    0xed2(%rip),%rsi
cmovne %rcx,%rsi
jmp    1030 <string_append@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"Denver\00"
@.str.1 = [9 x i8] c"Denver 2\00"
@.str.2 = [8 x i8] c"Unknown\00"
define void @handle_nvidia(i32 %0, i32 %1, i8* %2) {
%4 = icmp eq i32 %1, 3
%5 = select i1 %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5
%8 = tail call i32 @string_append(i32 %0, i8* %7, i8* %2)
ret void
}