#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*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void print_lines(char *prefix, char *message) {
  char *head, *tail;
  head = tail = message;
  while (*head != '\0') {
    if (*head == '\n') {
      *head = '\0';
      fprintf(stderr, "%s%s\n", prefix, tail);
      tail = head + 1;
    }
    head++;
  }
  fprintf(stderr, "%s%s\n", prefix, tail);
}


x86 assembly (clang, -O0):
<print_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118d <print_lines+0x7d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    117c <print_lines+0x6c>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe95(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112c <print_lines+0x1c>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe5b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_lines>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rcx
mov    %rdi,%r12
lea    0x1(%rsi),%rbx
mov    0x2eb7(%rip),%r15
lea    0xed0(%rip),%r14
jmp    1159 <print_lines+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x0,-0x1(%rbx)
mov    (%r15),%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rcx
add    $0x1,%rbx
movzbl -0x1(%rbx),%eax
cmp    $0xa,%al
je     1140 <print_lines+0x30>
test   %al,%al
jne    1155 <print_lines+0x45>
mov    (%r15),%edi
lea    0xe91(%rip),%rsi
mov    %r12,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"%s%s\0A\00"
define void @print_lines(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
store i8* %7, i8** %6
store i8* %7, i8** %5
br label %8
8: ; preds = %26, %2
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %8
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %26
18: ; preds = %13
%19 = load i8*, i8** %5
store i8 0, i8* %19
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %3
%22 = load i8*, i8** %6
%23 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 1
store i8* %25, i8** %6
br label %26
26: ; preds = %18, %13
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %5
br label %8
29: ; preds = %8
%30 = load i32, i32* @stderr
%31 = load i8*, i8** %3
%32 = load i8*, i8** %6
%33 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %31, i8* %32)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%s%s\0A\00"
define void @print_lines(i8* %0, i8* %1) {
br label %3
3: ; preds = %11, %2
%4 = phi i8* [ %1, %2 ], [ %13, %11 ]
%5 = phi i8* [ %1, %2 ], [ %12, %11 ]
%6 = load i8, i8* %4
switch i8 %6, label %11 [
i8 0, label %14
i8 10, label %7
]
7: ; preds = %3
store i8 0, i8* %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
%10 = getelementptr inbounds i8, i8* %4, i64 1
br label %11
11: ; preds = %3, %7
%12 = phi i8* [ %10, %7 ], [ %5, %3 ]
%13 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
14: ; preds = %3
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
ret void
}