#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*/ printf(char *, ...);
char *strtok(char *, char *);
void dump_data(const char *type, size_t len, char *data) {
  char *line;
  printf("# %s (%lu bytes):\n", type, len);
  line = strtok(data, "\n");
  while (line != NULL) {
    printf("#\t%s\n", line);
    line = strtok(NULL, "\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<dump_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xebc(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1194 <dump_data+0x74>
mov    -0x20(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe8b(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
jmp    115e <dump_data+0x3e>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_data>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strtok@plt>
test   %rax,%rax
je     118c <dump_data+0x5c>
lea    0xead(%rip),%r14
lea    0xea4(%rip),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
test   %rax,%rax
jne    1170 <dump_data+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"# %s (%lu bytes):\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"#\09%s\0A\00"
define void @dump_data(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %8, i64 %9)
%11 = load i8*, i8** %6
%12 = call i8* @strtok(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %12, i8** %7
br label %13
13: ; preds = %16, %3
%14 = load i8*, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i8*, i8** %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %19, i8** %7
br label %13
20: ; preds = %13
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"# %s (%lu bytes):\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"#\09%s\0A\00"
define void @dump_data(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
%5 = tail call i8* @strtok(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i8* %5, null
br i1 %6, label %12, label %7
7: ; preds = %3, %7
%8 = phi i8* [ %10, %7 ], [ %5, %3 ]
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %7
12: ; preds = %7, %3
%13 = tail call i32 @putchar(i32 10)
ret void
}