#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*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read_line(char **, size_t *, int /*<<< orphan*/ *);
int main() {
  char *fileName = "oddLines.txt";
  FILE *srcFile = fopen(fileName, "r");
  if (!srcFile) {
    error(fileName);
  }
  char *buffer = NULL;
  size_t size = 0;
  int lineNumber = 1;
  while (!feof(srcFile)) {
    lineNumber %= 2;
    read_line(&buffer, &size, srcFile);
    if (lineNumber != 0) {
      printf("%s\n", buffer);
    }
    lineNumber++;
  }
  free(buffer);
  fclose(srcFile);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11b2 <main+0x42>
mov    -0x10(%rbp),%rdi
call   1080 <error@plt>
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e7 <main+0x77>
jmp    122e <main+0xbe>
mov    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x2c(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <read_line@plt>
cmpl   $0x0,-0x2c(%rbp)
je     1220 <main+0xb0>
mov    -0x20(%rbp),%rsi
lea    0xdf4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c9 <main+0x59>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    0x2d99(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe7d(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11a3 <main+0x33>
lea    0xe62(%rip),%rdi
call   1080 <error@plt>
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     11c4 <main+0x54>
xor    %edi,%edi
jmp    1214 <main+0xa4>
mov    $0x1,%ebp
mov    %rsp,%r14
lea    0x8(%rsp),%r15
lea    0xe37(%rip),%r12
jmp    11ef <main+0x7f>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <feof@plt>
test   %eax,%eax
jne    1210 <main+0xa0>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1070 <read_line@plt>
and    $0x1,%ebp
je     11e0 <main+0x70>
mov    (%rsp),%rsi
mov    %r12,%rdi
call   1050 <printf@plt>
jmp    11e0 <main+0x70>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    0x2db8(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"oddLines.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8*
%2 = alloca i64
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%9 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%10 = call i32 @feof(i32* %3)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %7, %20
%13 = phi i32 [ %21, %20 ], [ 1, %7 ]
%14 = and i32 %13, 1
%15 = call i32 @read_line(i8** %1, i64* %2, i32* %3)
%16 = icmp eq i32 %14, 0
br i1 %16, label %20, label %17
17: ; preds = %12
%18 = load i8*, i8** %1
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %12
%21 = add nuw nsw i32 %14, 1
%22 = call i32 @feof(i32* %3)
%23 = icmp eq i32 %22, 0
br i1 %23, label %12, label %24
24: ; preds = %20
%25 = load i8*, i8** %1
br label %26
26: ; preds = %24, %7
%27 = phi i8* [ %25, %24 ], [ null, %7 ]
%28 = call i32 @free(i8* %27)
%29 = call i32 @fclose(i32* %3)
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}