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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int lineNum(void *fp);
  FILE *p = NULL;
  p = fopen("testTxt/lineNum", "r");
  char s[32];
  if (NULL != fgets(s, 5557, p))
    printf("%s", s);
  fscanf(p, "%s", s);
  printf("%s", s);
  fscanf(p, "%s", s);
  printf("%s", s);
  fgets(s, 5557, p);
  printf("%s", s);
  fgets(s, 5557, p);
  printf("%s", s);
  fgets(s, 5557, p);
  printf("%s", s);
  printf("%ld\n", sizeof(s));
  fclose(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xe92(%rip),%rdi
lea    0xe9b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x15b5,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     11b0 <main+0x60>
lea    -0x30(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe53(%rip),%rsi
call   1050 <fscanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe2d(%rip),%rsi
call   1050 <fscanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x15b5,%esi
call   1060 <fgets@plt>
lea    -0x30(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x15b5,%esi
call   1060 <fgets@plt>
lea    -0x30(%rbp),%rsi
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x15b5,%esi
call   1060 <fgets@plt>
lea    -0x30(%rbp),%rsi
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xda6(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xea0(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x15b5,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1195 <main+0x45>
lea    0xe87(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe76(%rip),%r14
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x15b5,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x15b5,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x15b5,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde2(%rip),%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"testTxt/lineNum\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [32 x i8]
store i32 0, i32* %1
store i32* null, i32** %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = call i32* @fgets(i8* %5, i32 5557, i32* %6)
%8 = icmp ne i32* null, %7
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %0
%13 = load i32*, i32** %2
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%15 = call i32 @fscanf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %2
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%20 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%24 = load i32*, i32** %2
%25 = call i32* @fgets(i8* %23, i32 5557, i32* %24)
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%29 = load i32*, i32** %2
%30 = call i32* @fgets(i8* %28, i32 5557, i32* %29)
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %31)
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%34 = load i32*, i32** %2
%35 = call i32* @fgets(i8* %33, i32 5557, i32* %34)
%36 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 32)
%39 = load i32*, i32** %2
%40 = call i32 @fclose(i32* %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"testTxt/lineNum\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = call i32* @fgets(i8* %3, i32 5557, i32* %2)
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %8
8: ; preds = %6, %0
%9 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = call i32 @fscanf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%13 = call i32* @fgets(i8* %3, i32 5557, i32* %2)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%15 = call i32* @fgets(i8* %3, i32 5557, i32* %2)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%17 = call i32* @fgets(i8* %3, i32 5557, i32* %2)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i64 32)
%20 = call i32 @fclose(i32* %2)
ret i32 0
}