#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 *);
scalar_t__ strncmp(char *, char *, int);
char *fdasd_partition_type(char *str) {
  if (strncmp("NATIVE", str, 6) == 0)
    strcpy(str, "Linux native");
  else if (strncmp("NEW   ", str, 6) == 0)
    strcpy(str, "Linux native");
  else if (strncmp("SWAP  ", str, 6) == 0)
    strcpy(str, "Linux swap");
  else if (strncmp("RAID  ", str, 6) == 0)
    strcpy(str, "Linux raid");
  else if (strncmp("LVM   ", str, 6) == 0)
    strcpy(str, "Linux lvm");
  else
    strcpy(str, "unknown");
  return str;
}


x86 assembly (clang, -O0):
<fdasd_partition_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1160 <fdasd_partition_type+0x40>
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1254 <fdasd_partition_type+0x134>
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1194 <fdasd_partition_type+0x74>
mov    -0x8(%rbp),%rdi
lea    0xe7d(%rip),%rsi
call   1040 <strcpy@plt>
jmp    124f <fdasd_partition_type+0x12f>
mov    -0x8(%rbp),%rsi
lea    0xe7c(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c8 <fdasd_partition_type+0xa8>
mov    -0x8(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <strcpy@plt>
jmp    124a <fdasd_partition_type+0x12a>
mov    -0x8(%rbp),%rsi
lea    0xe5a(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11fc <fdasd_partition_type+0xdc>
mov    -0x8(%rbp),%rdi
lea    0xe42(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1245 <fdasd_partition_type+0x125>
mov    -0x8(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1230 <fdasd_partition_type+0x110>
mov    -0x8(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1240 <fdasd_partition_type+0x120>
mov    -0x8(%rbp),%rdi
lea    0xe15(%rip),%rsi
call   1040 <strcpy@plt>
jmp    1245 <fdasd_partition_type+0x125>
jmp    124a <fdasd_partition_type+0x12a>
jmp    124f <fdasd_partition_type+0x12f>
jmp    1254 <fdasd_partition_type+0x134>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdasd_partition_type>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
lea    0xec5(%rip),%r14
test   %rax,%rax
je     11d1 <fdasd_partition_type+0xb1>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11d1 <fdasd_partition_type+0xb1>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11c1 <fdasd_partition_type+0xa1>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11ca <fdasd_partition_type+0xaa>
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
lea    0xe92(%rip),%rax
lea    0xe95(%rip),%r14
cmove  %rax,%r14
jmp    11d1 <fdasd_partition_type+0xb1>
lea    0xe5a(%rip),%r14
jmp    11d1 <fdasd_partition_type+0xb1>
lea    0xe63(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"NATIVE\00"
@.str.1 = [13 x i8] c"Linux native\00"
@.str.2 = [7 x i8] c"NEW \00"
@.str.3 = [7 x i8] c"SWAP \00"
@.str.4 = [11 x i8] c"Linux swap\00"
@.str.5 = [7 x i8] c"RAID \00"
@.str.6 = [11 x i8] c"Linux raid\00"
@.str.7 = [7 x i8] c"LVM \00"
@.str.8 = [10 x i8] c"Linux lvm\00"
@.str.9 = [8 x i8] c"unknown\00"
define i8* @fdasd_partition_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3, i32 6)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %44
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %10, i32 6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %43
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %17, i32 6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = call i32 @strcpy(i8* %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %42
23: ; preds = %16
%24 = load i8*, i8** %2
%25 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %24, i32 6)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i8*, i8** %2
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %41
30: ; preds = %23
%31 = load i8*, i8** %2
%32 = call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %31, i32 6)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i8*, i8** %2
%36 = call i32 @strcpy(i8* %35, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %40
37: ; preds = %30
%38 = load i8*, i8** %2
%39 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
br label %40
40: ; preds = %37, %34
br label %41
41: ; preds = %40, %27
br label %42
42: ; preds = %41, %20
br label %43
43: ; preds = %42, %13
br label %44
44: ; preds = %43, %6
%45 = load i8*, i8** %2
ret i8* %45
}

LLVM IR (-O2):
@.str = [7 x i8] c"NATIVE\00"
@.str.1 = [13 x i8] c"Linux native\00"
@.str.2 = [7 x i8] c"NEW \00"
@.str.3 = [7 x i8] c"SWAP \00"
@.str.4 = [11 x i8] c"Linux swap\00"
@.str.5 = [7 x i8] c"RAID \00"
@.str.6 = [11 x i8] c"Linux raid\00"
@.str.7 = [7 x i8] c"LVM \00"
@.str.8 = [10 x i8] c"Linux lvm\00"
@.str.9 = [8 x i8] c"unknown\00"
define i8* @fdasd_partition_type(i8* returned %0) {
%2 = tail call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 6)
%3 = icmp eq i64 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0, i32 6)
%6 = icmp eq i64 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = tail call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %0, i32 6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = tail call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %0, i32 6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = tail call i64 @strncmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %0, i32 6)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0)
br label %17
17: ; preds = %13, %10, %7, %4, %1
%18 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %10 ], [ %16, %13 ]
%19 = tail call i32 @strcpy(i8* %0, i8* %18)
ret i8* %0
}