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

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
void show_file_in_line(FILE *fp, intmax_t cnt) {
  char buf[200];
  while (cnt-- && fgets(buf, 200, fp))
    printf("%s", buf);
}


x86 assembly (clang, -O0):
<show_file_in_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe1(%rbp)
je     1170 <show_file_in_line+0x50>
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0xc8,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    1183 <show_file_in_line+0x63>
jmp    119b <show_file_in_line+0x7b>
lea    -0xe0(%rbp),%rsi
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
jmp    1132 <show_file_in_line+0x12>
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_file_in_line>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xc8,%rsp
test   %esi,%esi
je     1177 <show_file_in_line+0x57>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %rsp,%r15
lea    0xebf(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0xc8,%esi
mov    %r14,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1177 <show_file_in_line+0x57>
add    $0xffffffff,%ebx
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
test   %ebx,%ebx
jne    1150 <show_file_in_line+0x30>
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @show_file_in_line(i32* nocapture %0, i32 %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %1, 0
br i1 %5, label %14, label %6
6: ; preds = %2, %11
%7 = phi i32 [ %8, %11 ], [ %1, %2 ]
%8 = add nsw i32 %7, -1
%9 = call i64 @fgets(i8* %4, i32 200, i32* %0)
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%13 = icmp eq i32 %8, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %11, %2
ret void
}