#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 */
int fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(int);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
int skip_whitespace(FILE *infile, int multiline) {
  int c;
  do {
    c = fgetc(infile);
    if (c < 0)
      return c;
    if (!multiline && c == '\n')
      break;
  } while (isspace(c));
  ungetc(c, infile);
  return 0;
}


x86 assembly (clang, -O0):
<skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1160 <skip_whitespace+0x30>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a3 <skip_whitespace+0x73>
cmpl   $0x0,-0x14(%rbp)
jne    1179 <skip_whitespace+0x49>
cmpl   $0xa,-0x18(%rbp)
jne    1179 <skip_whitespace+0x49>
jmp    1190 <skip_whitespace+0x60>
jmp    117e <skip_whitespace+0x4e>
mov    -0x18(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    113f <skip_whitespace+0xf>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <ungetc@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
jmp    114c <skip_whitespace+0x1c>
nopl   0x0(%rax)
mov    %ebp,%edi
call   1040 <isspace@plt>
test   %rax,%rax
je     1164 <skip_whitespace+0x34>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1170 <skip_whitespace+0x40>
test   %r14d,%r14d
jne    1140 <skip_whitespace+0x10>
cmp    $0xa,%ebp
jne    1140 <skip_whitespace+0x10>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <ungetc@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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