#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*/ *);
scalar_t__ isspace(char);
char read_char(FILE *file, int ignore_ws) {
  char c;
redo:
  c = fgetc(file);
  if (ignore_ws && isspace(c))
    goto redo;
  else if (c == ';') {
    while ((c = fgetc(file)) != '\n') {
    };
    goto redo;
  } else
    return c;
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xd(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115d <read_char+0x3d>
movsbl -0xd(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     115d <read_char+0x3d>
jmp    112f <read_char+0xf>
movsbl -0xd(%rbp),%eax
cmp    $0x3b,%eax
jne    1191 <read_char+0x71>
jmp    116f <read_char+0x4f>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0xd(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     118c <read_char+0x6c>
jmp    116f <read_char+0x4f>
jmp    112f <read_char+0xf>
movsbl -0xd(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%r14d
test   %ebp,%ebp
je     114d <read_char+0x2d>
movsbl %r14b,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1130 <read_char+0x10>
cmp    $0x3b,%r14b
jne    116e <read_char+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%al
jne    1160 <read_char+0x40>
jmp    1130 <read_char+0x10>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @read_char(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %27, %15, %2
%7 = load i32*, i32** %3
%8 = call signext i8 @fgetc(i32* %7)
store i8 %8, i8* %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8, i8* %5
%13 = call i64 @isspace(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
br label %6
16: ; preds = %11, %6
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 59
br i1 %19, label %20, label %28
20: ; preds = %16
br label %21
21: ; preds = %26, %20
%22 = load i32*, i32** %3
%23 = call signext i8 @fgetc(i32* %22)
store i8 %23, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 10
br i1 %25, label %26, label %27
26: ; preds = %21
br label %21
27: ; preds = %21
br label %6
28: ; preds = %16
%29 = load i8, i8* %5
ret i8 %29
}

LLVM IR (-O2):
define signext i8 @read_char(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br label %4
4: ; preds = %9, %2
%5 = tail call signext i8 @fgetc(i32* %0)
br i1 %3, label %10, label %6
6: ; preds = %4
%7 = tail call i64 @isspace(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %12, %6
br label %4
10: ; preds = %6, %4
%11 = icmp eq i8 %5, 59
br i1 %11, label %12, label %15
12: ; preds = %10, %12
%13 = tail call signext i8 @fgetc(i32* %0)
%14 = icmp eq i8 %13, 10
br i1 %14, label %9, label %12
15: ; preds = %10
ret i8 %5
}