#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ tokenizeGivenStream(char *);
void processScript(FILE *fp) {
  char givenCommand[1024] = {'\0'};
  while (fgets(givenCommand, 1024, fp) != NULL) {
    if (*(givenCommand + 0) == '\n')
      continue;
    tokenizeGivenStream(givenCommand);
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<processScript>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11a7 <processScript+0x67>
movsbl -0x410(%rbp),%eax
cmp    $0xa,%eax
jne    1196 <processScript+0x56>
jmp    1162 <processScript+0x22>
lea    -0x410(%rbp),%rdi
call   1060 <tokenizeGivenStream@plt>
jmp    1162 <processScript+0x22>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processScript>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%r14
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11a5 <processScript+0x65>
mov    %rsp,%rbx
jmp    1195 <processScript+0x55>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11a5 <processScript+0x65>
cmpb   $0xa,(%rsp)
je     1180 <processScript+0x40>
mov    %rbx,%rdi
call   1060 <tokenizeGivenStream@plt>
jmp    1180 <processScript+0x40>
mov    %r14,%rdi
call   1030 <fclose@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @processScript(i32* %0) {
%2 = alloca i32*
%3 = alloca [1024 x i8]
store i32* %0, i32** %2
%4 = bitcast [1024 x i8]* %3 to i8*
br label %5
5: ; preds = %17, %16, %1
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = load i32*, i32** %2
%8 = call i32* @fgets(i8* %6, i32 1024, i32* %7)
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 10
br i1 %15, label %16, label %17
16: ; preds = %10
br label %5
17: ; preds = %10
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = call i32 @tokenizeGivenStream(i8* %18)
br label %5
20: ; preds = %5
%21 = load i32*, i32** %2
%22 = call i32 @fclose(i32* %21)
ret void
}

LLVM IR (-O2):
define void @processScript(i32* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32* @fgets(i8* %3, i32 1024, i32* %0)
%5 = icmp eq i32* %4, null
br i1 %5, label %14, label %6
6: ; preds = %1, %11
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 10
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call i32 @tokenizeGivenStream(i8* %3)
br label %11
11: ; preds = %9, %6
%12 = call i32* @fgets(i8* %3, i32 1024, i32* %0)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %6
14: ; preds = %11, %1
%15 = call i32 @fclose(i32* %0)
ret void
}