char *mm_getencode(str, code)
unsigned char *str;
char *code;
{
  if (str) {
    while (isspace(*str))
      str++;
    if (!str_ncmp(str, "quoted-printable", 16)) {
      *code = 'q';
      return str + 16;
    }
    if (!str_ncmp(str, "base64", 6)) {
      *code = 'b';
      return str + 6;
    }
  }
  *code = 0;
  return str;
}


x86 assembly (clang, -O0):
<mm_getencode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11db <mm_getencode+0xbb>
jmp    1140 <mm_getencode+0x20>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
je     1166 <mm_getencode+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1140 <mm_getencode+0x20>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
mov    $0x10,%edx
mov    $0x0,%al
call   1030 <str_ncmp@plt>
cmp    $0x0,%eax
jne    119e <mm_getencode+0x7e>
mov    -0x18(%rbp),%rax
movb   $0x71,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
jmp    11ea <mm_getencode+0xca>
mov    -0x10(%rbp),%rdi
lea    0xe68(%rip),%rsi
mov    $0x6,%edx
mov    $0x0,%al
call   1030 <str_ncmp@plt>
cmp    $0x0,%eax
jne    11d6 <mm_getencode+0xb6>
mov    -0x18(%rbp),%rax
movb   $0x62,(%rax)
mov    -0x10(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
jmp    11ea <mm_getencode+0xca>
jmp    11db <mm_getencode+0xbb>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_getencode>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
test   %rdi,%rdi
je     118f <mm_getencode+0x6f>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1040 <isspace@plt>
test   %eax,%eax
jne    1140 <mm_getencode+0x20>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
xor    %eax,%eax
call   1030 <str_ncmp@plt>
test   %eax,%eax
je     1197 <mm_getencode+0x77>
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <str_ncmp@plt>
test   %eax,%eax
jne    1191 <mm_getencode+0x71>
movb   $0x62,(%r14)
add    $0x6,%rbx
jmp    119f <mm_getencode+0x7f>
xor    %ebx,%ebx
movb   $0x0,(%r14)
jmp    119f <mm_getencode+0x7f>
movb   $0x71,(%r14)
add    $0x10,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"quoted-printable\00"
@.str.1 = [7 x i8] c"base64\00"
define i8* @mm_getencode(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %35
8: ; preds = %2
br label %9
9: ; preds = %15, %8
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 @isspace(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %9
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
br label %9
18: ; preds = %9
%19 = load i8*, i8** %4
%20 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @str_ncmp to i32 (i8*, i8*, i32, ...)*)(i8* %19, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16)
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i8*, i8** %5
store i8 113, i8* %23
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 16
store i8* %25, i8** %3
br label %38
26: ; preds = %18
%27 = load i8*, i8** %4
%28 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @str_ncmp to i32 (i8*, i8*, i32, ...)*)(i8* %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%29 = icmp ne i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8*, i8** %5
store i8 98, i8* %31
%32 = load i8*, i8** %4
%33 = getelementptr inbounds i8, i8* %32, i64 6
store i8* %33, i8** %3
br label %38
34: ; preds = %26
br label %35
35: ; preds = %34, %2
%36 = load i8*, i8** %5
store i8 0, i8* %36
%37 = load i8*, i8** %4
store i8* %37, i8** %3
br label %38
38: ; preds = %35, %30, %22
%39 = load i8*, i8** %3
ret i8* %39
}

LLVM IR (-O2):
@.str = [17 x i8] c"quoted-printable\00"
@.str.1 = [7 x i8] c"base64\00"
define i8* @mm_getencode(i8* %0, i8* nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %21, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = tail call i32 @isspace(i32 %7)
%9 = icmp eq i32 %8, 0
%10 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %9, label %11, label %4
11: ; preds = %4
%12 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @str_ncmp to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 16)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
store i8 113, i8* %1
%15 = getelementptr inbounds i8, i8* %5, i64 16
br label %23
16: ; preds = %11
%17 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @str_ncmp to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 6)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
store i8 98, i8* %1
%20 = getelementptr inbounds i8, i8* %5, i64 6
br label %23
21: ; preds = %16, %2
%22 = phi i8* [ %5, %16 ], [ null, %2 ]
store i8 0, i8* %1
br label %23
23: ; preds = %21, %19, %14
%24 = phi i8* [ %22, %21 ], [ %20, %19 ], [ %15, %14 ]
ret i8* %24
}