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

/* Variables and functions */
char EOF;
int /*<<< orphan*/ buildString(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ eraseSpaces(int /*<<< orphan*/ *, char *);
char *malloc(int);
int getNextString(FILE *pFile, char *str) {
  str[0] = '\0';
  int out = 0;
  char *strOut = malloc(sizeof(str));
  strOut[0] = '\0';
  char *c = malloc(sizeof(char));
  c[0] = '\0';
  eraseSpaces(pFile, c);
  buildString(pFile, strOut, c);
  if (*c == EOF)
    out = -1;
  return out;
}


x86 assembly (clang, -O0):
<getNextString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x14(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <eraseSpaces@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <buildString@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
mov    0x2e44(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11b6 <getNextString+0x86>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextString>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
movb   $0x0,(%rsi)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
movb   $0x0,(%rax)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <eraseSpaces@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <buildString@plt>
mov    (%rbx),%cl
mov    0x2e6b(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%cl
sete   %al
neg    %eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @getNextString(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 0, i8* %9
store i32 0, i32* %5
%10 = call i8* @malloc(i32 8)
store i8* %10, i8** %6
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 0, i8* %12
%13 = call i8* @malloc(i32 1)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
%15 = getelementptr inbounds i8, i8* %14, i64 0
store i8 0, i8* %15
%16 = load i32*, i32** %3
%17 = load i8*, i8** %7
%18 = call i32 @eraseSpaces(i32* %16, i8* %17)
%19 = load i32*, i32** %3
%20 = load i8*, i8** %6
%21 = load i8*, i8** %7
%22 = call i32 @buildString(i32* %19, i8* %20, i8* %21)
%23 = load i8*, i8** %7
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i8, i8* @EOF
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %25, %27
br i1 %28, label %29, label %30
29: ; preds = %2
store i32 -1, i32* %5
br label %30
30: ; preds = %29, %2
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @getNextString(i32* %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
%3 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
store i8 0, i8* %3
%4 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8 0, i8* %4
%5 = tail call i32 @eraseSpaces(i32* %0, i8* %4)
%6 = tail call i32 @buildString(i32* %0, i8* %3, i8* %4)
%7 = load i8, i8* %4
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
%10 = sext i1 %9 to i32
ret i32 %10
}