#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 *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ string_is_comment(char *);
char *fgets_noncomment(char *s, int l, FILE *f) {
  char *S = fgets(s, l, f);
  while (S && string_is_comment(s))
    S = fgets(s, l, f);
  return S;
}


x86 assembly (clang, -O0):
<fgets_noncomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <fgets@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x20(%rbp)
mov    %al,-0x21(%rbp)
je     116a <fgets_noncomment+0x4a>
mov    -0x8(%rbp),%rdi
call   1030 <string_is_comment@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    117a <fgets_noncomment+0x5a>
jmp    1193 <fgets_noncomment+0x73>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <fgets@plt>
mov    %rax,-0x20(%rbp)
jmp    1147 <fgets_noncomment+0x27>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets_noncomment>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
call   1040 <fgets@plt>
test   %rax,%rax
je     1155 <fgets_noncomment+0x35>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <string_is_comment@plt>
test   %rax,%rax
je     1157 <fgets_noncomment+0x37>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
jmp    1130 <fgets_noncomment+0x10>
xor    %ebp,%ebp
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @fgets_noncomment(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = call i8* @fgets(i8* %8, i32 %9, i32* %10)
store i8* %11, i8** %7
br label %12
12: ; preds = %21, %3
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = call i64 @string_is_comment(i8* %16)
%18 = icmp ne i64 %17, 0
br label %19
19: ; preds = %15, %12
%20 = phi i1 [ false, %12 ], [ %18, %15 ]
br i1 %20, label %21, label %26
21: ; preds = %19
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = load i32*, i32** %6
%25 = call i8* @fgets(i8* %22, i32 %23, i32* %24)
store i8* %25, i8** %7
br label %12
26: ; preds = %19
%27 = load i8*, i8** %7
ret i8* %27
}

LLVM IR (-O2):
define i8* @fgets_noncomment(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %6
6: ; preds = %3
%7 = tail call i64 @string_is_comment(i8* %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %12
9: ; preds = %12
%10 = tail call i64 @string_is_comment(i8* %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6, %9
%13 = tail call i8* @fgets(i8* %0, i32 %1, i32* %2)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %9
15: ; preds = %12, %9, %6, %3
%16 = phi i8* [ null, %3 ], [ %4, %6 ], [ %13, %9 ], [ null, %12 ]
ret i8* %16
}