#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 *, int /*<<< orphan*/);
void writelines(char *lineptr[], int nlines, int tail) {
  while (nlines-- > 0)
    if (nlines < tail)
      printf("%s\n", *lineptr++);
    else
      lineptr++;
}


x86 assembly (clang, -O0):
<writelines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1178 <writelines+0x68>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1167 <writelines+0x57>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    1173 <writelines+0x63>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1122 <writelines+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writelines>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1152 <writelines+0x42>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed6(%rip),%r15
jmp    113c <writelines+0x2c>
nopl   0x0(%rax)
add    $0x8,%rbx
lea    0x1(%rbp),%eax
cmp    $0x1,%eax
jbe    1152 <writelines+0x42>
mov    %ebp,%eax
lea    -0x1(%rax),%ebp
cmp    %r14d,%eax
jg     1130 <writelines+0x20>
mov    (%rbx),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
jmp    1130 <writelines+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @writelines(i8** %0, i32 %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
br label %7
7: ; preds = %24, %3
%8 = load i32, i32* %5
%9 = add nsw i32 %8, -1
store i32 %9, i32* %5
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %25
11: ; preds = %7
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %4
%18 = load i8*, i8** %16
%19 = ptrtoint i8* %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %24
21: ; preds = %11
%22 = load i8**, i8*** %4
%23 = getelementptr inbounds i8*, i8** %22, i32 1
store i8** %23, i8*** %4
br label %24
24: ; preds = %21, %15
br label %7
25: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @writelines(i8** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %18
5: ; preds = %3, %15
%6 = phi i8** [ %16, %15 ], [ %0, %3 ]
%7 = phi i32 [ %8, %15 ], [ %1, %3 ]
%8 = add nsw i32 %7, -1
%9 = icmp sgt i32 %7, %2
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = load i8*, i8** %6
%12 = ptrtoint i8* %11 to i64
%13 = trunc i64 %12 to i32
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %5, %10
%16 = getelementptr inbounds i8*, i8** %6, i64 1
%17 = icmp ugt i32 %7, 1
br i1 %17, label %5, label %18
18: ; preds = %15, %3
ret void
}