#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 */
scalar_t__ isspace(char);
int /*<<< orphan*/ rtrim(char *);
int /*<<< orphan*/ strcasecmp(char *, char *);
void *strchr(char const *, char);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
char *strndupa(char *, int);
char *strrchr(char *, char);
size_t strspn(char const *, char *);
void mime_parse_content_type(const char *cts, char *type, size_t type_size,
                             char *subtype, size_t subtype_size, char *charset,
                             size_t charset_size, char *filename,
                             size_t filename_size, char *part_delimiter,
                             size_t part_delimiter_size) {
  const char *type_delim = strchr(cts, '/');
  size_t type_len;
  if (!type_delim)
    type_delim = cts;
  type_len = type_delim - cts;
  if (type_len >= type_size)
    type_len = type_size - 1;
  strncpy(type, cts, type_len);
  type[type_len] = 0;
  size_t subtype_len =
      strspn(type_delim + 1,
             "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-");
  if (subtype_len >= subtype_size)
    subtype_len = subtype_size - 1;
  strncpy(subtype, type_delim + 1, subtype_len);
  subtype[subtype_len] = 0;
  char *arg = strchr(type_delim, ';');
  while (arg && *arg) {
    char *arg_end;
    ++arg;
    while (isspace(*arg))
      ++arg;
    if (!*arg)
      break;
    arg_end = strchr(arg + 1, ';');
    if (!arg_end)
      arg_end = strchr(arg + 1, 0);
    char *arg_delim = strchr(arg, '=');
    if (!arg_delim)
      break;
    char *key = strndupa(arg, arg_delim - arg);
    char *value = strndupa(arg_delim + 1, arg_end - arg_delim - 1);
    rtrim(value);
    if (value[0] == '"' && value[strlen(value) - 1] == '"') {
      value[strlen(value) - 1] = 0;
      ++value;
    }
    if (part_delimiter && !strcasecmp(key, "boundary")) {
      strncpy(part_delimiter, value, part_delimiter_size);
      part_delimiter[part_delimiter_size - 1] = 0;
    } else if (filename && !strcasecmp(key, "name")) {
      if (strchr(value, '/'))
        strncpy(filename, strrchr(value, '/') + 1, filename_size);
      else
        strncpy(filename, value, filename_size);
      filename[filename_size - 1] = 0;
    } else if (!strcasecmp(key, "charset")) {
      strncpy(charset, value, charset_size);
      charset[charset_size - 1] = 0;
    }
    arg = arg_end;
  }
}


x86 assembly (clang, -O0):
<mime_parse_content_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    11ec <mime_parse_content_type+0x5c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x18(%rbp),%rax
jb     1215 <mime_parse_content_type+0x85>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x40(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
lea    0xdbf(%rip),%rsi
call   1080 <strspn@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x28(%rbp),%rax
jb     1264 <mime_parse_content_type+0xd4>
mov    -0x28(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    $0x1,%rsi
mov    -0x48(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x50(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x50(%rbp)
mov    %al,-0x71(%rbp)
je     12b7 <mime_parse_content_type+0x127>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
test   $0x1,%al
jne    12c7 <mime_parse_content_type+0x137>
jmp    1546 <mime_parse_content_type+0x3b6>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movsbl (%rax),%edi
call   1090 <isspace@plt>
cmp    $0x0,%rax
je     12fa <mime_parse_content_type+0x16a>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    12d3 <mime_parse_content_type+0x143>
mov    -0x50(%rbp),%rax
cmpb   $0x0,(%rax)
jne    130c <mime_parse_content_type+0x17c>
jmp    1546 <mime_parse_content_type+0x3b6>
mov    -0x50(%rbp),%rdi
add    $0x1,%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1340 <mime_parse_content_type+0x1b0>
mov    -0x50(%rbp),%rdi
add    $0x1,%rdi
xor    %esi,%esi
call   1060 <strchr@plt>
mov    %rax,-0x58(%rbp)
mov    -0x50(%rbp),%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1362 <mime_parse_content_type+0x1d2>
jmp    1546 <mime_parse_content_type+0x3b6>
mov    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    -0x50(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%esi
call   10b0 <strndupa@plt>
mov    %rax,-0x68(%rbp)
mov    -0x60(%rbp),%rdi
add    $0x1,%rdi
mov    -0x58(%rbp),%rax
mov    -0x60(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%esi
call   10b0 <strndupa@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
call   10a0 <rtrim@plt>
mov    -0x70(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    1414 <mime_parse_content_type+0x284>
mov    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x80(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    1414 <mime_parse_content_type+0x284>
mov    -0x70(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
cmpq   $0x0,0x28(%rbp)
je     145e <mime_parse_content_type+0x2ce>
mov    -0x68(%rbp),%rdi
lea    0xc16(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    145e <mime_parse_content_type+0x2ce>
mov    0x28(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    0x30(%rbp),%rdx
call   1040 <strncpy@plt>
mov    0x28(%rbp),%rax
mov    0x30(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1539 <mime_parse_content_type+0x3a9>
cmpq   $0x0,0x18(%rbp)
je     14f5 <mime_parse_content_type+0x365>
mov    -0x68(%rbp),%rdi
lea    0xbd5(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14f5 <mime_parse_content_type+0x365>
mov    -0x70(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     14cf <mime_parse_content_type+0x33f>
mov    0x18(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x70(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    -0x90(%rbp),%rdi
mov    %rax,%rsi
add    $0x1,%rsi
mov    0x20(%rbp),%rdx
call   1040 <strncpy@plt>
jmp    14e0 <mime_parse_content_type+0x350>
mov    0x18(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    0x20(%rbp),%rdx
call   1040 <strncpy@plt>
mov    0x18(%rbp),%rax
mov    0x20(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1534 <mime_parse_content_type+0x3a4>
mov    -0x68(%rbp),%rdi
lea    0xb4e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    152f <mime_parse_content_type+0x39f>
mov    -0x30(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    0x10(%rbp),%rdx
call   1040 <strncpy@plt>
mov    -0x30(%rbp),%rax
mov    0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1534 <mime_parse_content_type+0x3a4>
jmp    1539 <mime_parse_content_type+0x3a9>
mov    -0x58(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1297 <mime_parse_content_type+0x107>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mime_parse_content_type>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r15
mov    %rcx,0x8(%rsp)
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1060 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
cmove  %rbx,%rbp
mov    %rbp,%rax
sub    %rbx,%rax
lea    -0x1(%r13),%r14
cmp    %r13,%rax
cmovb  %rax,%r14
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <strncpy@plt>
movb   $0x0,(%r12,%r14,1)
lea    0x1(%rbp),%r14
lea    0xe09(%rip),%rsi
mov    %r14,%rdi
call   1080 <strspn@plt>
lea    -0x1(%r15),%rbx
cmp    %r15,%rax
cmovb  %rax,%rbx
mov    0x8(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <strncpy@plt>
movb   $0x0,(%r15,%rbx,1)
mov    %rbp,%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1423 <mime_parse_content_type+0x293>
mov    %rax,%r13
mov    0x80(%rsp),%rax
mov    0x78(%rsp),%r15
mov    0x70(%rsp),%rcx
mov    0x68(%rsp),%rdx
mov    0x60(%rsp),%rsi
lea    -0x1(%rax,%r15,1),%rax
mov    %rax,0x8(%rsp)
lea    -0x1(%rcx,%rdx,1),%rax
mov    %rax,0x18(%rsp)
mov    0x10(%rsp),%rax
add    %rsi,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,0x20(%rsp)
jmp    12a4 <mime_parse_content_type+0x114>
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x80(%rsp),%rdx
call   1040 <strncpy@plt>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
test   %r13,%r13
je     1423 <mime_parse_content_type+0x293>
cmpb   $0x0,0x0(%r13)
je     1423 <mime_parse_content_type+0x293>
lea    0x1(%r13),%rbx
mov    %r13d,%ebp
cs nopw 0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1090 <isspace@plt>
add    $0x1,%rbx
add    $0x1,%ebp
test   %rax,%rax
jne    12c0 <mime_parse_content_type+0x130>
cmpb   $0x0,-0x1(%rbx)
je     1423 <mime_parse_content_type+0x293>
lea    -0x1(%rbx),%r14
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1060 <strchr@plt>
mov    %rax,%r13
test   %rax,%rax
jne    1305 <mime_parse_content_type+0x175>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rax,%r13
add    %rbx,%r13
mov    %r14,%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1423 <mime_parse_content_type+0x293>
mov    %rax,%rbx
mov    %ebx,%esi
sub    %ebp,%esi
mov    %r14,%rdi
call   10b0 <strndupa@plt>
mov    %rax,%r14
mov    %rbx,%rdi
add    $0x1,%rdi
not    %ebx
lea    (%rbx,%r13,1),%esi
call   10b0 <strndupa@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   10a0 <rtrim@plt>
cmpb   $0x22,(%r12)
jne    1377 <mime_parse_content_type+0x1e7>
mov    %r12,%rdi
call   1050 <strlen@plt>
cltq
cmpb   $0x22,-0x1(%rax,%r12,1)
jne    1377 <mime_parse_content_type+0x1e7>
mov    %r12,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r12,1)
add    $0x1,%r12
test   %r15,%r15
je     1393 <mime_parse_content_type+0x203>
mov    %r14,%rdi
lea    0xcba(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     1280 <mime_parse_content_type+0xf0>
cmpq   $0x0,0x68(%rsp)
je     13ae <mime_parse_content_type+0x21e>
mov    %r14,%rdi
lea    0xca4(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     13e1 <mime_parse_content_type+0x251>
mov    %r14,%rdi
lea    0xc96(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    129b <mime_parse_content_type+0x10b>
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
mov    0x60(%rsp),%rdx
call   1040 <strncpy@plt>
mov    0x20(%rsp),%rax
jmp    1298 <mime_parse_content_type+0x108>
mov    %r12,%rdi
mov    $0x2f,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1407 <mime_parse_content_type+0x277>
mov    %r12,%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,%r12
add    $0x1,%r12
mov    0x68(%rsp),%rdi
mov    %r12,%rsi
mov    0x70(%rsp),%rdx
call   1040 <strncpy@plt>
mov    0x18(%rsp),%rax
jmp    1298 <mime_parse_content_type+0x108>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-\00"
@.str.1 = [9 x i8] c"boundary\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [8 x i8] c"charset\00"
define void @mime_parse_content_type(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i8* %5, i64 %6, i8* %7, i64 %8, i8* %9, i64 %10) {
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i64
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i8*
%24 = alloca i64
%25 = alloca i64
%26 = alloca i8*
%27 = alloca i8*
%28 = alloca i8*
%29 = alloca i8*
%30 = alloca i8*
store i8* %0, i8** %12
store i8* %1, i8** %13
store i64 %2, i64* %14
store i8* %3, i8** %15
store i64 %4, i64* %16
store i8* %5, i8** %17
store i64 %6, i64* %18
store i8* %7, i8** %19
store i64 %8, i64* %20
store i8* %9, i8** %21
store i64 %10, i64* %22
%31 = load i8*, i8** %12
%32 = call i8* @strchr(i8* %31, i8 signext 47)
store i8* %32, i8** %23
%33 = load i8*, i8** %23
%34 = icmp ne i8* %33, null
br i1 %34, label %37, label %35
35: ; preds = %11
%36 = load i8*, i8** %12
store i8* %36, i8** %23
br label %37
37: ; preds = %35, %11
%38 = load i8*, i8** %23
%39 = load i8*, i8** %12
%40 = ptrtoint i8* %38 to i64
%41 = ptrtoint i8* %39 to i64
%42 = sub i64 %40, %41
store i64 %42, i64* %24
%43 = load i64, i64* %24
%44 = load i64, i64* %14
%45 = icmp uge i64 %43, %44
br i1 %45, label %46, label %49
46: ; preds = %37
%47 = load i64, i64* %14
%48 = sub i64 %47, 1
store i64 %48, i64* %24
br label %49
49: ; preds = %46, %37
%50 = load i8*, i8** %13
%51 = load i8*, i8** %12
%52 = load i64, i64* %24
%53 = call i32 @strncpy(i8* %50, i8* %51, i64 %52)
%54 = load i8*, i8** %13
%55 = load i64, i64* %24
%56 = getelementptr inbounds i8, i8* %54, i64 %55
store i8 0, i8* %56
%57 = load i8*, i8** %23
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i64 @strspn(i8* %58, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
store i64 %59, i64* %25
%60 = load i64, i64* %25
%61 = load i64, i64* %16
%62 = icmp uge i64 %60, %61
br i1 %62, label %63, label %66
63: ; preds = %49
%64 = load i64, i64* %16
%65 = sub i64 %64, 1
store i64 %65, i64* %25
br label %66
66: ; preds = %63, %49
%67 = load i8*, i8** %15
%68 = load i8*, i8** %23
%69 = getelementptr inbounds i8, i8* %68, i64 1
%70 = load i64, i64* %25
%71 = call i32 @strncpy(i8* %67, i8* %69, i64 %70)
%72 = load i8*, i8** %15
%73 = load i64, i64* %25
%74 = getelementptr inbounds i8, i8* %72, i64 %73
store i8 0, i8* %74
%75 = load i8*, i8** %23
%76 = call i8* @strchr(i8* %75, i8 signext 59)
store i8* %76, i8** %26
br label %77
77: ; preds = %223, %66
%78 = load i8*, i8** %26
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %85
80: ; preds = %77
%81 = load i8*, i8** %26
%82 = load i8, i8* %81
%83 = sext i8 %82 to i32
%84 = icmp ne i32 %83, 0
br label %85
85: ; preds = %80, %77
%86 = phi i1 [ false, %77 ], [ %84, %80 ]
br i1 %86, label %87, label %225
87: ; preds = %85
%88 = load i8*, i8** %26
%89 = getelementptr inbounds i8, i8* %88, i32 1
store i8* %89, i8** %26
br label %90
90: ; preds = %95, %87
%91 = load i8*, i8** %26
%92 = load i8, i8* %91
%93 = call i64 @isspace(i8 signext %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = load i8*, i8** %26
%97 = getelementptr inbounds i8, i8* %96, i32 1
store i8* %97, i8** %26
br label %90
98: ; preds = %90
%99 = load i8*, i8** %26
%100 = load i8, i8* %99
%101 = icmp ne i8 %100, 0
br i1 %101, label %103, label %102
102: ; preds = %98
br label %225
103: ; preds = %98
%104 = load i8*, i8** %26
%105 = getelementptr inbounds i8, i8* %104, i64 1
%106 = call i8* @strchr(i8* %105, i8 signext 59)
store i8* %106, i8** %27
%107 = load i8*, i8** %27
%108 = icmp ne i8* %107, null
br i1 %108, label %113, label %109
109: ; preds = %103
%110 = load i8*, i8** %26
%111 = getelementptr inbounds i8, i8* %110, i64 1
%112 = call i8* @strchr(i8* %111, i8 signext 0)
store i8* %112, i8** %27
br label %113
113: ; preds = %109, %103
%114 = load i8*, i8** %26
%115 = call i8* @strchr(i8* %114, i8 signext 61)
store i8* %115, i8** %28
%116 = load i8*, i8** %28
%117 = icmp ne i8* %116, null
br i1 %117, label %119, label %118
118: ; preds = %113
br label %225
119: ; preds = %113
%120 = load i8*, i8** %26
%121 = load i8*, i8** %28
%122 = load i8*, i8** %26
%123 = ptrtoint i8* %121 to i64
%124 = ptrtoint i8* %122 to i64
%125 = sub i64 %123, %124
%126 = trunc i64 %125 to i32
%127 = call i8* @strndupa(i8* %120, i32 %126)
store i8* %127, i8** %29
%128 = load i8*, i8** %28
%129 = getelementptr inbounds i8, i8* %128, i64 1
%130 = load i8*, i8** %27
%131 = load i8*, i8** %28
%132 = ptrtoint i8* %130 to i64
%133 = ptrtoint i8* %131 to i64
%134 = sub i64 %132, %133
%135 = sub nsw i64 %134, 1
%136 = trunc i64 %135 to i32
%137 = call i8* @strndupa(i8* %129, i32 %136)
store i8* %137, i8** %30
%138 = load i8*, i8** %30
%139 = call i32 @rtrim(i8* %138)
%140 = load i8*, i8** %30
%141 = getelementptr inbounds i8, i8* %140, i64 0
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp eq i32 %143, 34
br i1 %144, label %145, label %164
145: ; preds = %119
%146 = load i8*, i8** %30
%147 = load i8*, i8** %30
%148 = call i32 @strlen(i8* %147)
%149 = sub nsw i32 %148, 1
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %146, i64 %150
%152 = load i8, i8* %151
%153 = sext i8 %152 to i32
%154 = icmp eq i32 %153, 34
br i1 %154, label %155, label %164
155: ; preds = %145
%156 = load i8*, i8** %30
%157 = load i8*, i8** %30
%158 = call i32 @strlen(i8* %157)
%159 = sub nsw i32 %158, 1
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %156, i64 %160
store i8 0, i8* %161
%162 = load i8*, i8** %30
%163 = getelementptr inbounds i8, i8* %162, i32 1
store i8* %163, i8** %30
br label %164
164: ; preds = %155, %145, %119
%165 = load i8*, i8** %21
%166 = icmp ne i8* %165, null
br i1 %166, label %167, label %180
167: ; preds = %164
%168 = load i8*, i8** %29
%169 = call i32 @strcasecmp(i8* %168, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%170 = icmp ne i32 %169, 0
br i1 %170, label %180, label %171
171: ; preds = %167
%172 = load i8*, i8** %21
%173 = load i8*, i8** %30
%174 = load i64, i64* %22
%175 = call i32 @strncpy(i8* %172, i8* %173, i64 %174)
%176 = load i8*, i8** %21
%177 = load i64, i64* %22
%178 = sub i64 %177, 1
%179 = getelementptr inbounds i8, i8* %176, i64 %178
store i8 0, i8* %179
br label %223
180: ; preds = %167, %164
%181 = load i8*, i8** %19
%182 = icmp ne i8* %181, null
br i1 %182, label %183, label %208
183: ; preds = %180
%184 = load i8*, i8** %29
%185 = call i32 @strcasecmp(i8* %184, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%186 = icmp ne i32 %185, 0
br i1 %186, label %208, label %187
187: ; preds = %183
%188 = load i8*, i8** %30
%189 = call i8* @strchr(i8* %188, i8 signext 47)
%190 = icmp ne i8* %189, null
br i1 %190, label %191, label %198
191: ; preds = %187
%192 = load i8*, i8** %19
%193 = load i8*, i8** %30
%194 = call i8* @strrchr(i8* %193, i8 signext 47)
%195 = getelementptr inbounds i8, i8* %194, i64 1
%196 = load i64, i64* %20
%197 = call i32 @strncpy(i8* %192, i8* %195, i64 %196)
br label %203
198: ; preds = %187
%199 = load i8*, i8** %19
%200 = load i8*, i8** %30
%201 = load i64, i64* %20
%202 = call i32 @strncpy(i8* %199, i8* %200, i64 %201)
br label %203
203: ; preds = %198, %191
%204 = load i8*, i8** %19
%205 = load i64, i64* %20
%206 = sub i64 %205, 1
%207 = getelementptr inbounds i8, i8* %204, i64 %206
store i8 0, i8* %207
br label %222
208: ; preds = %183, %180
%209 = load i8*, i8** %29
%210 = call i32 @strcasecmp(i8* %209, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%211 = icmp ne i32 %210, 0
br i1 %211, label %221, label %212
212: ; preds = %208
%213 = load i8*, i8** %17
%214 = load i8*, i8** %30
%215 = load i64, i64* %18
%216 = call i32 @strncpy(i8* %213, i8* %214, i64 %215)
%217 = load i8*, i8** %17
%218 = load i64, i64* %18
%219 = sub i64 %218, 1
%220 = getelementptr inbounds i8, i8* %217, i64 %219
store i8 0, i8* %220
br label %221
221: ; preds = %212, %208
br label %222
222: ; preds = %221, %203
br label %223
223: ; preds = %222, %171
%224 = load i8*, i8** %27
store i8* %224, i8** %26
br label %77
225: ; preds = %118, %102, %85
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-\00"
@.str.1 = [9 x i8] c"boundary\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [8 x i8] c"charset\00"
define void @mime_parse_content_type(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i8* %5, i64 %6, i8* %7, i64 %8, i8* %9, i64 %10) {
%12 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 47)
%13 = icmp eq i8* %12, null
%14 = select i1 %13, i8* %0, i8* %12
%15 = ptrtoint i8* %14 to i64
%16 = ptrtoint i8* %0 to i64
%17 = sub i64 %15, %16
%18 = icmp ult i64 %17, %2
%19 = add i64 %2, -1
%20 = select i1 %18, i64 %17, i64 %19
%21 = tail call i32 @strncpy(i8* %1, i8* %0, i64 %20)
%22 = getelementptr inbounds i8, i8* %1, i64 %20
store i8 0, i8* %22
%23 = getelementptr inbounds i8, i8* %14, i64 1
%24 = tail call i64 @strspn(i8* %23, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%25 = icmp ult i64 %24, %4
%26 = add i64 %4, -1
%27 = select i1 %25, i64 %24, i64 %26
%28 = tail call i32 @strncpy(i8* %3, i8* %23, i64 %27)
%29 = getelementptr inbounds i8, i8* %3, i64 %27
store i8 0, i8* %29
%30 = tail call i8* @strchr(i8* dereferenceable(1) %14, i8 signext 59)
%31 = icmp eq i8* %30, null
br i1 %31, label %122, label %32
32: ; preds = %11
%33 = icmp eq i8* %9, null
%34 = add i64 %10, -1
%35 = getelementptr inbounds i8, i8* %9, i64 %34
%36 = icmp eq i8* %7, null
%37 = add i64 %8, -1
%38 = getelementptr inbounds i8, i8* %7, i64 %37
%39 = add i64 %6, -1
%40 = getelementptr inbounds i8, i8* %5, i64 %39
br label %41
41: ; preds = %32, %120
%42 = phi i8* [ %30, %32 ], [ %62, %120 ]
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 0
br i1 %44, label %122, label %45
45: ; preds = %41, %45
%46 = phi i8* [ %47, %45 ], [ %42, %41 ]
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = load i8, i8* %47
%49 = tail call i64 @isspace(i8 signext %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %45
51: ; preds = %45
%52 = load i8, i8* %47
%53 = icmp eq i8 %52, 0
br i1 %53, label %122, label %54
54: ; preds = %51
%55 = getelementptr inbounds i8, i8* %46, i64 2
%56 = tail call i8* @strchr(i8* %55, i8 signext 59)
%57 = icmp eq i8* %56, null
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %55)
%60 = getelementptr i8, i8* %55, i64 %59
br label %61
61: ; preds = %58, %54
%62 = phi i8* [ %56, %54 ], [ %60, %58 ]
%63 = tail call i8* @strchr(i8* %47, i8 signext 61)
%64 = icmp eq i8* %63, null
br i1 %64, label %122, label %65
65: ; preds = %61
%66 = ptrtoint i8* %63 to i64
%67 = ptrtoint i8* %47 to i64
%68 = sub i64 %66, %67
%69 = trunc i64 %68 to i32
%70 = tail call i8* @strndupa(i8* %47, i32 %69)
%71 = getelementptr inbounds i8, i8* %63, i64 1
%72 = ptrtoint i8* %62 to i64
%73 = xor i64 %66, -1
%74 = add i64 %73, %72
%75 = trunc i64 %74 to i32
%76 = tail call i8* @strndupa(i8* %71, i32 %75)
%77 = tail call i32 @rtrim(i8* %76)
%78 = load i8, i8* %76
%79 = icmp eq i8 %78, 34
br i1 %79, label %80, label %93
80: ; preds = %65
%81 = tail call i32 @strlen(i8* %76)
%82 = add nsw i32 %81, -1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %76, i64 %83
%85 = load i8, i8* %84
%86 = icmp eq i8 %85, 34
br i1 %86, label %87, label %93
87: ; preds = %80
%88 = tail call i32 @strlen(i8* %76)
%89 = add nsw i32 %88, -1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %76, i64 %90
store i8 0, i8* %91
%92 = getelementptr inbounds i8, i8* %76, i64 1
br label %93
93: ; preds = %87, %80, %65
%94 = phi i8* [ %92, %87 ], [ %76, %80 ], [ %76, %65 ]
br i1 %33, label %100, label %95
95: ; preds = %93
%96 = tail call i32 @strcasecmp(i8* %70, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = tail call i32 @strncpy(i8* %9, i8* %94, i64 %10)
br label %118
100: ; preds = %95, %93
br i1 %36, label %113, label %101
101: ; preds = %100
%102 = tail call i32 @strcasecmp(i8* %70, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %113
104: ; preds = %101
%105 = tail call i8* @strchr(i8* %94, i8 signext 47)
%106 = icmp eq i8* %105, null
br i1 %106, label %110, label %107
107: ; preds = %104
%108 = tail call i8* @strrchr(i8* %94, i8 signext 47)
%109 = getelementptr inbounds i8, i8* %108, i64 1
br label %110
110: ; preds = %104, %107
%111 = phi i8* [ %109, %107 ], [ %94, %104 ]
%112 = tail call i32 @strncpy(i8* %7, i8* %111, i64 %8)
br label %118
113: ; preds = %101, %100
%114 = tail call i32 @strcasecmp(i8* %70, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%115 = icmp eq i32 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %113
%117 = tail call i32 @strncpy(i8* %5, i8* %94, i64 %6)
br label %118
118: ; preds = %98, %116, %110
%119 = phi i8* [ %38, %110 ], [ %40, %116 ], [ %35, %98 ]
store i8 0, i8* %119
br label %120
120: ; preds = %118, %113
%121 = icmp eq i8* %62, null
br i1 %121, label %122, label %41
122: ; preds = %41, %120, %51, %61, %11
ret void
}