#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 */
struct commands {
  int dummy;
};

/* Variables and functions */
scalar_t__ fscanf(int /*<<< orphan*/, char *, char *);
scalar_t__ processCommand(char *, unsigned int);
scalar_t__ processLabel(char *, unsigned int);
int /*<<< orphan*/ stdin;
int loadInput(struct commands *commands) {
  char *line = NULL;
  unsigned int lineNumber = 0;
  while (fscanf(stdin, "%s\n", line)) {
    if (line[0] != '/') {
      if (processCommand(line, lineNumber)) {
      } else if (processLabel(line, lineNumber)) {
      }
    }
    lineNumber++;
  }
}


x86 assembly (clang, -O0):
<loadInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xea1(%rip),%rsi
call   1040 <fscanf@plt>
cmp    $0x0,%rax
je     11cc <loadInput+0x9c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     11be <loadInput+0x8e>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <processCommand@plt>
cmp    $0x0,%rax
je     1199 <loadInput+0x69>
jmp    11b9 <loadInput+0x89>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <processLabel@plt>
cmp    $0x0,%rax
je     11b4 <loadInput+0x84>
jmp    11b4 <loadInput+0x84>
jmp    11b9 <loadInput+0x89>
jmp    11be <loadInput+0x8e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <loadInput+0x1b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loadInput>:
push   %r15
push   %r14
push   %rbx
mov    0x2eac(%rip),%r15
mov    (%r15),%edi
lea    0xeba(%rip),%rsi
xor    %ebx,%ebx
xor    %edx,%edx
call   1040 <fscanf@plt>
test   %rax,%rax
je     118e <loadInput+0x5e>
lea    0xea5(%rip),%r14
jmp    1175 <loadInput+0x45>
nopl   (%rax)
add    $0x1,%ebx
mov    (%r15),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1040 <fscanf@plt>
test   %rax,%rax
je     118e <loadInput+0x5e>
xor    %edi,%edi
mov    %ebx,%esi
call   1050 <processCommand@plt>
test   %rax,%rax
jne    1160 <loadInput+0x30>
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <processLabel@plt>
jmp    1160 <loadInput+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.commands = type { i32 }
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @loadInput(%struct.commands* %0) {
%2 = alloca i32
%3 = alloca %struct.commands*
%4 = alloca i8*
%5 = alloca i32
store %struct.commands* %0, %struct.commands** %3
store i8* null, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %31, %1
%7 = load i32, i32* @stdin
%8 = load i8*, i8** %4
%9 = call i64 @fscanf(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %34
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 47
br i1 %16, label %17, label %31
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = call i64 @processCommand(i8* %18, i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %30
23: ; preds = %17
%24 = load i8*, i8** %4
%25 = load i32, i32* %5
%26 = call i64 @processLabel(i8* %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %23
br label %29
29: ; preds = %28, %23
br label %30
30: ; preds = %29, %22
br label %31
31: ; preds = %30, %11
%32 = load i32, i32* %5
%33 = add i32 %32, 1
store i32 %33, i32* %5
br label %6
34: ; preds = %6
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
%struct.commands = type { i32 }
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @loadInput(%struct.commands* nocapture readnone %0) {
%2 = load i32, i32* @stdin
%3 = tail call i64 @fscanf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %1, %11
%6 = phi i32 [ %12, %11 ], [ 0, %1 ]
%7 = tail call i64 @processCommand(i8* null, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i64 @processLabel(i8* null, i32 %6)
br label %11
11: ; preds = %9, %5
%12 = add i32 %6, 1
%13 = load i32, i32* @stdin
%14 = tail call i64 @fscanf(i32 %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* null)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %1
ret i32 undef
}