#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 */
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
void _getNextString(FILE *fp, char *line) {
  int i;
  line[0] = '\0';
  while (line[0] == '\0') {
    fscanf(fp, "%s", line);
    i = -1;
    do {
      i++;
      if (line[i] == '#') {
        line[i] = '\0';
        while (fgetc(fp) != '\n')
          ;
      }
    } while (line[i] != '\0');
  }
}


x86 assembly (clang, -O0):
<_getNextString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11ca <_getNextString+0xaa>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1030 <fscanf@plt>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    11ab <_getNextString+0x8b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11a6 <_getNextString+0x86>
jmp    118c <_getNextString+0x6c>
jmp    11ab <_getNextString+0x8b>
jmp    11b0 <_getNextString+0x90>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1162 <_getNextString+0x42>
jmp    1137 <_getNextString+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getNextString>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movb   $0x0,(%rsi)
lea    0xec8(%rip),%r15
jmp    1146 <_getNextString+0x26>
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%r14)
jne    1192 <_getNextString+0x72>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <fscanf@plt>
mov    $0xffffffffffffffff,%r12
jmp    1164 <_getNextString+0x44>
nopl   (%rax)
test   %al,%al
je     1140 <_getNextString+0x20>
mov    0x1(%r14,%r12,1),%al
add    $0x1,%r12
cmp    $0x23,%al
jne    1160 <_getNextString+0x40>
movb   $0x0,(%r14,%r12,1)
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0xa,%al
jne    1180 <_getNextString+0x60>
mov    (%r14,%r12,1),%al
jmp    1160 <_getNextString+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @_getNextString(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
br label %8
8: ; preds = %49, %2
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %50
14: ; preds = %8
%15 = load i32*, i32** %3
%16 = load i8*, i8** %4
%17 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 -1, i32* %5
br label %18
18: ; preds = %41, %14
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
%21 = load i8*, i8** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 35
br i1 %27, label %28, label %40
28: ; preds = %18
%29 = load i8*, i8** %4
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %38, %28
%34 = load i32*, i32** %3
%35 = call signext i8 @fgetc(i32* %34)
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 10
br i1 %37, label %38, label %39
38: ; preds = %33
br label %33
39: ; preds = %33
br label %40
40: ; preds = %39, %18
br label %41
41: ; preds = %40
%42 = load i8*, i8** %4
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %18, label %49
49: ; preds = %41
br label %8
50: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @_getNextString(i32* nocapture %0, i8* %1) {
store i8 0, i8* %1
br label %6
3: ; preds = %20
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %6, label %23
6: ; preds = %2, %3
%7 = tail call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %20, %6
%9 = phi i64 [ %10, %20 ], [ -1, %6 ]
%10 = add nsw i64 %9, 1
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 35
br i1 %13, label %14, label %20
14: ; preds = %8
store i8 0, i8* %11
br label %15
15: ; preds = %15, %14
%16 = tail call signext i8 @fgetc(i32* %0)
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %15
18: ; preds = %15
%19 = load i8, i8* %11
br label %20
20: ; preds = %18, %8
%21 = phi i8 [ %19, %18 ], [ %12, %8 ]
%22 = icmp eq i8 %21, 0
br i1 %22, label %3, label %8
23: ; preds = %3
ret void
}