#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, char *const);
char *strchr(char *const, char);
void print_unique_lines(char *const *lines, unsigned len, int is_file1) {
  char file_indicator = (is_file1) ? '<' : '>';
  char *has_newline = NULL;
  unsigned i = 0;
  while (i < len) {
    if ((has_newline = strchr(lines[i], '\n')) == NULL) {
      printf("%c %s\n", file_indicator, lines[i++]);
    } else {
      printf("%c %s", file_indicator, lines[i++]);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<print_unique_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    $0x3e,%eax
mov    $0x3c,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x11(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    11de <print_unique_lines+0xbe>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11b2 <print_unique_lines+0x92>
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rcx
mov    -0x24(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
mov    %edx,%edx
mov    (%rcx,%rdx,8),%rdx
lea    0xe5b(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
jmp    11d9 <print_unique_lines+0xb9>
mov    -0x11(%rbp),%al
mov    -0x8(%rbp),%rcx
mov    -0x24(%rbp),%edx
mov    %edx,%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
mov    %edx,%edx
mov    (%rcx,%rdx,8),%rdx
lea    0xe36(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
jmp    1157 <print_unique_lines+0x37>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_unique_lines>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
sete   %al
test   %esi,%esi
je     1186 <print_unique_lines+0x66>
mov    %rdi,%r14
add    %al,%al
or     $0x3c,%al
mov    %esi,%r15d
xor    %ebp,%ebp
lea    0xec0(%rip),%r13
movzbl %al,%r12d
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbp,8),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
mov    %r13,%rdi
lea    0xe92(%rip),%rax
cmove  %rax,%rdi
mov    %r12d,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1150 <print_unique_lines+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%c %s\0A\00"
@.str.1 = [6 x i8] c"%c %s\00"
define void @print_unique_lines(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 60, i32 62
%14 = trunc i32 %13 to i8
store i8 %14, i8* %7
store i8* null, i8** %8
store i32 0, i32* %9
br label %15
15: ; preds = %45, %3
%16 = load i32, i32* %9
%17 = load i32, i32* %5
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %46
19: ; preds = %15
%20 = load i8**, i8*** %4
%21 = load i32, i32* %9
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8*, i8** %20, i64 %22
%24 = load i8*, i8** %23
%25 = call i8* @strchr(i8* %24, i8 signext 10)
store i8* %25, i8** %8
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %36
27: ; preds = %19
%28 = load i8, i8* %7
%29 = load i8**, i8*** %4
%30 = load i32, i32* %9
%31 = add i32 %30, 1
store i32 %31, i32* %9
%32 = zext i32 %30 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %28, i8* %34)
br label %45
36: ; preds = %19
%37 = load i8, i8* %7
%38 = load i8**, i8*** %4
%39 = load i32, i32* %9
%40 = add i32 %39, 1
store i32 %40, i32* %9
%41 = zext i32 %39 to i64
%42 = getelementptr inbounds i8*, i8** %38, i64 %41
%43 = load i8*, i8** %42
%44 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %37, i8* %43)
br label %45
45: ; preds = %36, %27
br label %15
46: ; preds = %15
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%c %s\0A\00"
@.str.1 = [6 x i8] c"%c %s\00"
define void @print_unique_lines(i8** nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8 62, i8 60
%6 = icmp eq i32 %1, 0
br i1 %6, label %19, label %7
7: ; preds = %3
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %17, %9 ]
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i8* @strchr(i8* dereferenceable(1) %12, i8 signext 10)
%14 = icmp eq i8* %13, null
%15 = select i1 %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%16 = tail call i32 @printf(i8* %15, i8 signext %5, i8* %12)
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %9, %3
ret void
}