#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 */
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strchr(char *, char);
int /*<<< orphan*/ strncpy(char *, char *, int);
void print_mp_extra(const char *extra) {
  int n;
  char b[128];
  char *cp;
  char *p;
  for (p = (char *)extra; (cp = (char *)strchr(p, '\t')); p = cp + 1) {
    n = cp - p;
    if (n > (int)(sizeof(b) - 1))
      n = (sizeof(b) - 1);
    strncpy(b, p, n);
    b[n] = '\0';
    printf("\t%s\n", b);
  }
  printf("\t%s\n", p);
}


x86 assembly (clang, -O0):
<print_mp_extra>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rdi
mov    $0x9,%esi
call   1040 <strchr@plt>
mov    %rax,-0x98(%rbp)
cmp    $0x0,%rax
je     11dd <print_mp_extra+0xad>
mov    -0x98(%rbp),%rax
mov    -0xa0(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0xc(%rbp)
cmpl   $0x7f,-0xc(%rbp)
jle    1191 <print_mp_extra+0x61>
movl   $0x7f,-0xc(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
lea    -0x90(%rbp),%rsi
lea    0xe3f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x98(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xa0(%rbp)
jmp    114a <print_mp_extra+0x1a>
mov    -0xa0(%rbp),%rsi
lea    0xe15(%rip),%rdi
call   1050 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mp_extra>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %rdi,%rbx
mov    $0x9,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11b7 <print_mp_extra+0x87>
mov    %rax,%r12
mov    $0x7f,%r13d
mov    %rsp,%r14
lea    0xe9a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %r12d,%ebp
sub    %ebx,%ebp
cmp    $0x7f,%ebp
cmovge %r13d,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
mov    %r12,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <strchr@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1170 <print_mp_extra+0x40>
lea    0xe42(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\09%s\0A\00"
define void @print_mp_extra(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [128 x i8]
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i8*, i8** %2
store i8* %7, i8** %6
br label %8
8: ; preds = %33, %1
%9 = load i8*, i8** %6
%10 = call i64 @strchr(i8* %9, i8 signext 9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %36
13: ; preds = %8
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 127
br i1 %21, label %22, label %23
22: ; preds = %13
store i32 127, i32* %3
br label %23
23: ; preds = %22, %13
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%25 = load i8*, i8** %6
%26 = load i32, i32* %3
%27 = call i32 @strncpy(i8* %24, i8* %25, i32 %26)
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 %29
store i8 0, i8* %30
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %23
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8* %35, i8** %6
br label %8
36: ; preds = %8
%37 = load i8*, i8** %6
%38 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %37)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09%s\0A\00"
define void @print_mp_extra(i8* %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = call i64 @strchr(i8* %0, i8 signext 9)
%5 = icmp eq i64 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %1, %6
%7 = phi i64 [ %20, %6 ], [ %4, %1 ]
%8 = phi i8* [ %19, %6 ], [ %0, %1 ]
%9 = inttoptr i64 %7 to i8*
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %7, %10
%12 = trunc i64 %11 to i32
%13 = icmp slt i32 %12, 127
%14 = select i1 %13, i32 %12, i32 127
%15 = call i32 @strncpy(i8* %3, i8* %8, i32 %14)
%16 = sext i32 %14 to i64
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %16
store i8 0, i8* %17
%18 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%19 = getelementptr inbounds i8, i8* %9, i64 1
%20 = call i64 @strchr(i8* %19, i8 signext 9)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %6
22: ; preds = %6, %1
%23 = phi i8* [ %0, %1 ], [ %19, %6 ]
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %23)
ret void
}