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

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char const *, char *);
void show(FILE *fp, const char *fn, const char *offset, char **bufp,
          size_t *buflenp) {
  ssize_t n;
  do {
    (void)printf("%s%s\n", offset, *bufp);
    if ((n = getline(bufp, buflenp, fp)) < 0)
      break;
    if (n > 0 && (*bufp)[n - 1] == '\n')
      (*bufp)[n - 1] = '\0';
  } while (1);
  if (ferror(fp))
    err(1, "%s", fn);
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x8(%rbp),%rdx
call   1060 <getline@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0x0,%eax
jge    1195 <show+0x55>
jmp    11e4 <show+0xa4>
cmpl   $0x0,-0x2c(%rbp)
jle    11d0 <show+0x90>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    11d0 <show+0x90>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    11d5 <show+0x95>
mov    $0x1,%al
test   $0x1,%al
jne    115c <show+0x1c>
jmp    11e4 <show+0xa4>
mov    -0x8(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
je     120c <show+0xcc>
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    0xdff(%rip),%rsi
call   1050 <err@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rcx,%rbx
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%r12
mov    (%rcx),%rdx
lea    0xe9c(%rip),%rdi
mov    %r13,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <getline@plt>
test   %eax,%eax
js     11c6 <show+0x86>
lea    0xe7b(%rip),%rbp
jmp    11b0 <show+0x70>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdx
mov    %rbp,%rdi
mov    %r13,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1060 <getline@plt>
test   %eax,%eax
js     11c6 <show+0x86>
test   %eax,%eax
je     1190 <show+0x50>
mov    (%rbx),%rcx
add    $0xffffffff,%eax
cmpb   $0xa,(%rcx,%rax,1)
jne    1190 <show+0x50>
movb   $0x0,(%rcx,%rax,1)
jmp    1190 <show+0x50>
mov    %r12,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
je     11f5 <show+0xb5>
lea    0xe2c(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <err@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s%s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @show(i32* %0, i8* %1, i8* %2, i8** %3, i64* %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i64*
%11 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8** %3, i8*** %9
store i64* %4, i64** %10
br label %12
12: ; preds = %44, %5
%13 = load i8*, i8** %8
%14 = load i8**, i8*** %9
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %15)
%17 = load i8**, i8*** %9
%18 = load i64*, i64** %10
%19 = load i32*, i32** %6
%20 = call i32 @getline(i8** %17, i64* %18, i32* %19)
store i32 %20, i32* %11
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %12
br label %45
23: ; preds = %12
%24 = load i32, i32* %11
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %43
26: ; preds = %23
%27 = load i8**, i8*** %9
%28 = load i8*, i8** %27
%29 = load i32, i32* %11
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 10
br i1 %35, label %36, label %43
36: ; preds = %26
%37 = load i8**, i8*** %9
%38 = load i8*, i8** %37
%39 = load i32, i32* %11
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %38, i64 %41
store i8 0, i8* %42
br label %43
43: ; preds = %36, %26, %23
br label %44
44: ; preds = %43
br i1 true, label %12, label %45
45: ; preds = %44, %22
%46 = load i32*, i32** %6
%47 = call i64 @ferror(i32* %46)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i8*, i8** %7
%51 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %49, %45
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s%s\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define void @show(i32* %0, i8* %1, i8* %2, i8** %3, i64* %4) {
%6 = load i8*, i8** %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %6)
%8 = tail call i32 @getline(i8** %3, i64* %4, i32* %0)
%9 = icmp slt i32 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %5, %21
%11 = phi i32 [ %24, %21 ], [ %8, %5 ]
%12 = icmp eq i32 %11, 0
br i1 %12, label %21, label %13
13: ; preds = %10
%14 = load i8*, i8** %3
%15 = add nsw i32 %11, -1
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 10
br i1 %19, label %20, label %21
20: ; preds = %13
store i8 0, i8* %17
br label %21
21: ; preds = %10, %13, %20
%22 = load i8*, i8** %3
%23 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %22)
%24 = tail call i32 @getline(i8** %3, i64* %4, i32* %0)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %10
26: ; preds = %21, %5
%27 = tail call i64 @ferror(i32* %0)
%28 = icmp eq i64 %27, 0
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %31
31: ; preds = %29, %26
ret void
}