#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 df_t {
  int dummy;
};

/* Variables and functions */
scalar_t__ isspace(char);
char next_char(struct df_t *);
char skip_whitespace(struct df_t *D, int skip_newlines) {
  char c = next_char(D);
  if (skip_newlines) {
    while (isspace(c))
      c = next_char(D);
  } else {
    while (isspace(c) && c != '\n')
      c = next_char(D);
  }
  return c;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <next_char@plt>
mov    %al,-0xd(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1173 <skip_whitespace+0x53>
jmp    114a <skip_whitespace+0x2a>
movsbl -0xd(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     116e <skip_whitespace+0x4e>
mov    -0x8(%rbp),%rdi
call   1030 <next_char@plt>
mov    %al,-0xd(%rbp)
jmp    114a <skip_whitespace+0x2a>
jmp    11c6 <skip_whitespace+0xa6>
jmp    1178 <skip_whitespace+0x58>
movsbl -0xd(%rbp),%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0xe(%rbp)
je     11a0 <skip_whitespace+0x80>
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    11b0 <skip_whitespace+0x90>
jmp    11c1 <skip_whitespace+0xa1>
mov    -0x8(%rbp),%rdi
call   1030 <next_char@plt>
mov    %al,-0xd(%rbp)
jmp    1178 <skip_whitespace+0x58>
jmp    11c6 <skip_whitespace+0xa6>
movsbl -0xd(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <next_char@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1040 <isspace@plt>
test   %ebp,%ebp
je     1163 <skip_whitespace+0x43>
nopl   0x0(%rax)
test   %rax,%rax
je     115c <skip_whitespace+0x3c>
mov    %r14,%rdi
call   1030 <next_char@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1145 <skip_whitespace+0x25>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
cmp    $0xa,%bl
je     115c <skip_whitespace+0x3c>
nopl   0x0(%rax,%rax,1)
test   %rax,%rax
je     115c <skip_whitespace+0x3c>
mov    %r14,%rdi
call   1030 <next_char@plt>
mov    %eax,%ebx
movsbl %al,%ebp
mov    %ebp,%edi
call   1040 <isspace@plt>
cmp    $0xa,%bpl
jne    1170 <skip_whitespace+0x50>
jmp    115c <skip_whitespace+0x3c>

LLVM IR (-O0):
%struct.df_t = type { i32 }
define signext i8 @skip_whitespace(%struct.df_t* %0, i32 %1) {
%3 = alloca %struct.df_t*
%4 = alloca i32
%5 = alloca i8
store %struct.df_t* %0, %struct.df_t** %3
store i32 %1, i32* %4
%6 = load %struct.df_t*, %struct.df_t** %3
%7 = call signext i8 @next_char(%struct.df_t* %6)
store i8 %7, i8* %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %2
br label %11
11: ; preds = %15, %10
%12 = load i8, i8* %5
%13 = call i64 @isspace(i8 signext %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load %struct.df_t*, %struct.df_t** %3
%17 = call signext i8 @next_char(%struct.df_t* %16)
store i8 %17, i8* %5
br label %11
18: ; preds = %11
br label %34
19: ; preds = %2
br label %20
20: ; preds = %30, %19
%21 = load i8, i8* %5
%22 = call i64 @isspace(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 10
br label %28
28: ; preds = %24, %20
%29 = phi i1 [ false, %20 ], [ %27, %24 ]
br i1 %29, label %30, label %33
30: ; preds = %28
%31 = load %struct.df_t*, %struct.df_t** %3
%32 = call signext i8 @next_char(%struct.df_t* %31)
store i8 %32, i8* %5
br label %20
33: ; preds = %28
br label %34
34: ; preds = %33, %18
%35 = load i8, i8* %5
ret i8 %35
}

LLVM IR (-O2):
%struct.df_t = type { i32 }
define signext i8 @skip_whitespace(%struct.df_t* %0, i32 %1) {
%3 = tail call signext i8 @next_char(%struct.df_t* %0)
%4 = icmp eq i32 %1, 0
%5 = tail call i64 @isspace(i8 signext %3)
br i1 %4, label %8, label %6
6: ; preds = %2
%7 = icmp eq i64 %5, 0
br i1 %7, label %22, label %12
8: ; preds = %2
%9 = icmp ne i64 %5, 0
%10 = icmp ne i8 %3, 10
%11 = and i1 %10, %9
br i1 %11, label %16, label %22
12: ; preds = %6, %12
%13 = tail call signext i8 @next_char(%struct.df_t* %0)
%14 = tail call i64 @isspace(i8 signext %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %22, label %12
16: ; preds = %8, %16
%17 = tail call signext i8 @next_char(%struct.df_t* %0)
%18 = tail call i64 @isspace(i8 signext %17)
%19 = icmp ne i64 %18, 0
%20 = icmp ne i8 %17, 10
%21 = and i1 %20, %19
br i1 %21, label %16, label %22
22: ; preds = %12, %16, %6, %8
%23 = phi i8 [ %3, %8 ], [ %3, %6 ], [ %17, %16 ], [ %13, %12 ]
ret i8 %23
}