#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 */
char *strstr(char const *, char *);
void parse_descr(const char *field, const char **descrp, const char **markp,
                 int *mark_width) {
  const char *m = strstr(field, "\tM");
  const char *n = m ? strstr(m + 2, "\t") : NULL;
  const char *d = strstr(field, "\tD");
  if (m && n)
    *mark_width = n - m - 2, *markp = m + 2;
  else
    *markp = "", *mark_width = 0;
  *descrp = d ? d + 2 : field;
}


x86 assembly (clang, -O0):
<parse_descr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1164 <parse_descr+0x54>
mov    -0x28(%rbp),%rdi
add    $0x2,%rdi
lea    0xead(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x40(%rbp)
jmp    116f <parse_descr+0x5f>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    116f <parse_descr+0x5f>
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11cc <parse_descr+0xbc>
cmpq   $0x0,-0x30(%rbp)
je     11cc <parse_descr+0xbc>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
sub    $0x2,%rax
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rcx
add    $0x2,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    11e4 <parse_descr+0xd4>
mov    -0x18(%rbp),%rax
lea    0xe2d(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x38(%rbp)
je     1200 <parse_descr+0xf0>
mov    -0x38(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x48(%rbp)
jmp    1208 <parse_descr+0xf8>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_descr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%r13
lea    0xec2(%rip),%rsi
call   1040 <strstr@plt>
test   %rax,%rax
je     118b <parse_descr+0x6b>
mov    %rax,%rbx
mov    %rbp,(%rsp)
lea    0x2(%rax),%rbp
mov    %rbp,%rdi
mov    $0x9,%esi
call   1030 <strchr@plt>
mov    %rax,%r14
lea    0xe99(%rip),%rsi
mov    %r13,%rdi
call   1040 <strstr@plt>
test   %r14,%r14
je     119c <parse_descr+0x7c>
sub    %ebx,%r14d
add    $0xfffffffe,%r14d
mov    %r14d,(%r15)
mov    %rbp,(%r12)
mov    (%rsp),%rbp
jmp    11b2 <parse_descr+0x92>
lea    0xe71(%rip),%rsi
mov    %r13,%rdi
call   1040 <strstr@plt>
jmp    11a0 <parse_descr+0x80>
mov    (%rsp),%rbp
lea    0xe5e(%rip),%rcx
mov    %rcx,(%r12)
movl   $0x0,(%r15)
lea    0x2(%rax),%rcx
test   %rax,%rax
cmove  %r13,%rcx
mov    %rcx,0x0(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"\09M\00"
@.str.2 = [3 x i8] c"\09D\00"
@.str.3 = [1 x i8] zeroinitializer
define void @parse_descr(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %20
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %5, i64 2
%11 = tail call i8* @strchr(i8* %10, i32 9)
%12 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i8* %11, null
br i1 %13, label %20, label %14
14: ; preds = %9
%15 = ptrtoint i8* %11 to i64
%16 = ptrtoint i8* %5 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
%19 = add i32 %18, -2
store i32 %19, i32* %3
store i8* %10, i8** %2
br label %22
20: ; preds = %7, %9
%21 = phi i8* [ %8, %7 ], [ %12, %9 ]
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %2
store i32 0, i32* %3
br label %22
22: ; preds = %20, %14
%23 = phi i8* [ %21, %20 ], [ %12, %14 ]
%24 = icmp eq i8* %23, null
%25 = getelementptr inbounds i8, i8* %23, i64 2
%26 = select i1 %24, i8* %0, i8* %25
store i8* %26, i8** %1
ret void
}