#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
    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    11e2 <fdasd_partition_type+0xc2>
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    11dd <fdasd_partition_type+0xbd>
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    11d8 <fdasd_partition_type+0xb8>
mov    -0x8(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <strcpy@plt>
jmp    11dd <fdasd_partition_type+0xbd>
jmp    11e2 <fdasd_partition_type+0xc2>
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     1189 <fdasd_partition_type+0x69>
lea    0xec6(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1189 <fdasd_partition_type+0x69>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
lea    0xea4(%rip),%rax
lea    0xea8(%rip),%r14
cmove  %rax,%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 = [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 %28
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 %27
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 %26
23: ; preds = %16
%24 = load i8*, i8** %2
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %13
br label %28
28: ; preds = %27, %6
%29 = load i8*, i8** %2
ret i8* %29
}

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 = [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 %11, 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 %11, 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
%10 = select i1 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0)
br label %11
11: ; preds = %7, %4, %1
%12 = 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 ], [ %10, %7 ]
%13 = tail call i32 @strcpy(i8* %0, i8* %12)
ret i8* %0
}