#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 */
typedef int /*<<< orphan*/ s2;
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int /*<<< orphan*/ def_buslist(char *, char const *);
int /*<<< orphan*/ def_fuzzlist(char *, char *);
int /*<<< orphan*/ getFuzzlist(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char const *,
                            ...);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void addPCIFuzzEntry(const char *vendor, const char *device,
                     const char *subvendor, const char *subdevice,
                     const char *bt) {
  char s[256], s2[256];
  char fuzz[256];
  snprintf(s, sizeof(s), "%s:%s", vendor, device);
  strcpy(fuzz, s);
  getFuzzlist(fuzz);
  if (subvendor[0] == '\0' || !strcmp(fuzz, s)) {
    strcpy(s2, s);
    if (subvendor[0] != '\0')
      snprintf(s2, sizeof(s2), "%s:%s:%s", s, subdevice, subvendor);
    def_fuzzlist(s, s2);
    def_buslist(s, bt);
  }
}


x86 assembly (clang, -O0):
<addPCIFuzzEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    $0x100,%esi
lea    0xe69(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x330(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x330(%rbp),%rdi
call   1050 <getFuzzlist@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ec <addPCIFuzzEntry+0x8c>
lea    -0x330(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    125b <addPCIFuzzEntry+0xfb>
lea    -0x230(%rbp),%rdi
lea    -0x130(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1238 <addPCIFuzzEntry+0xd8>
lea    -0x230(%rbp),%rdi
lea    -0x130(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    $0x100,%esi
lea    0xdcf(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    -0x130(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   1030 <def_fuzzlist@plt>
lea    -0x130(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <def_buslist@plt>
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addPCIFuzzEntry>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x300,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0xe7d(%rip),%rdx
mov    %rsp,%r13
mov    %r13,%rdi
mov    $0x100,%esi
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    0x200(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <getFuzzlist@plt>
cmpb   $0x0,(%r12)
je     11ce <addPCIFuzzEntry+0x6e>
lea    0x200(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
jne    1227 <addPCIFuzzEntry+0xc7>
lea    0x100(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <strcpy@plt>
cmpb   $0x0,(%r12)
je     1209 <addPCIFuzzEntry+0xa9>
lea    0xe14(%rip),%rdx
lea    0x100(%rsp),%rdi
mov    %rsp,%rcx
mov    $0x100,%esi
mov    %r15,%r8
mov    %r12,%r9
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %rsp,%rbx
lea    0x100(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <def_fuzzlist@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <def_buslist@plt>
add    $0x300,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s:%s\00"
@.str.1 = [9 x i8] c"%s:%s:%s\00"
define void @addPCIFuzzEntry(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca [256 x i8]
%13 = alloca [256 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %14, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%22 = call i32 @getFuzzlist(i8* %21)
%23 = load i8*, i8** %8
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 0
br i1 %27, label %33, label %28
28: ; preds = %5
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %13, i64 0, i64 0
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%31 = call i32 @strcmp(i8* %29, i8* %30)
%32 = icmp ne i32 %31, 0
br i1 %32, label %55, label %33
33: ; preds = %28, %5
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%35 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%36 = call i32 @strcpy(i8* %34, i8* %35)
%37 = load i8*, i8** %8
%38 = getelementptr inbounds i8, i8* %37, i64 0
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %33
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%45 = load i8*, i8** %9
%46 = load i8*, i8** %8
%47 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %43, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %44, i8* %45, i8* %46)
br label %48
48: ; preds = %42, %33
%49 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %12, i64 0, i64 0
%51 = call i32 @def_fuzzlist(i8* %49, i8* %50)
%52 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%53 = load i8*, i8** %10
%54 = call i32 @def_buslist(i8* %52, i8* %53)
br label %55
55: ; preds = %48, %28
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s:%s\00"
@.str.1 = [9 x i8] c"%s:%s:%s\00"
define void @addPCIFuzzEntry(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = alloca [256 x i8]
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%12 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %9, i32 256, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%13 = call i32 @strcpy(i8* %11, i8* %9)
%14 = call i32 @getFuzzlist(i8* %11)
%15 = load i8, i8* %2
%16 = icmp eq i8 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %5
%18 = call i32 @strcmp(i8* %11, i8* %9)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %17, %5
%21 = call i32 @strcpy(i8* %10, i8* %9)
%22 = load i8, i8* %2
%23 = icmp eq i8 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %20
%25 = call i32 (i8*, i32, i8*, i8*, i8*, ...) @snprintf(i8* %10, i32 256, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %3, i8* %2)
br label %26
26: ; preds = %24, %20
%27 = call i32 @def_fuzzlist(i8* %9, i8* %10)
%28 = call i32 @def_buslist(i8* %9, i8* %4)
br label %29
29: ; preds = %26, %17
ret void
}