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

/* Variables and functions */
int /*<<< orphan*/ shellGetc(struct shell_data *);
unsigned char shellPeekc(struct shell_data *);
int shellGetWhitespace(struct shell_data *sd) {
  unsigned char c = shellPeekc(sd);
  if (!(c == ' ' || c == '\t'))
    return -1;
  while ((c == ' ' || c == '\t')) {
    shellGetc(sd);
    c = shellPeekc(sd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<shellGetWhitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <shellPeekc@plt>
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x20,%eax
je     115e <shellGetWhitespace+0x3e>
movzbl -0x11(%rbp),%eax
cmp    $0x9,%eax
je     115e <shellGetWhitespace+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b3 <shellGetWhitespace+0x93>
jmp    1163 <shellGetWhitespace+0x43>
movzbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x12(%rbp)
je     1182 <shellGetWhitespace+0x62>
movzbl -0x11(%rbp),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1192 <shellGetWhitespace+0x72>
jmp    11ac <shellGetWhitespace+0x8c>
mov    -0x10(%rbp),%rdi
call   1030 <shellGetc@plt>
mov    -0x10(%rbp),%rdi
call   1040 <shellPeekc@plt>
mov    %al,-0x11(%rbp)
jmp    1163 <shellGetWhitespace+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shellGetWhitespace>:
push   %rbx
mov    %rdi,%rbx
call   1040 <shellPeekc@plt>
cmp    $0x20,%al
je     1150 <shellGetWhitespace+0x30>
mov    $0xffffffff,%ecx
cmp    $0x9,%al
je     1150 <shellGetWhitespace+0x30>
jmp    115a <shellGetWhitespace+0x3a>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <shellGetc@plt>
mov    %rbx,%rdi
call   1040 <shellPeekc@plt>
cmp    $0x20,%al
je     1140 <shellGetWhitespace+0x20>
cmp    $0x9,%al
je     1140 <shellGetWhitespace+0x20>
xor    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.shell_data = type { i32 }
define i32 @shellGetWhitespace(%struct.shell_data* %0) {
%2 = alloca i32
%3 = alloca %struct.shell_data*
%4 = alloca i8
store %struct.shell_data* %0, %struct.shell_data** %3
%5 = load %struct.shell_data*, %struct.shell_data** %3
%6 = call zeroext i8 @shellPeekc(%struct.shell_data* %5)
store i8 %6, i8* %4
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %15, label %10
10: ; preds = %1
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 9
br i1 %13, label %15, label %14
14: ; preds = %10
store i32 -1, i32* %2
br label %32
15: ; preds = %10, %1
br label %16
16: ; preds = %26, %15
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 32
br i1 %19, label %24, label %20
20: ; preds = %16
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = icmp eq i32 %22, 9
br label %24
24: ; preds = %20, %16
%25 = phi i1 [ true, %16 ], [ %23, %20 ]
br i1 %25, label %26, label %31
26: ; preds = %24
%27 = load %struct.shell_data*, %struct.shell_data** %3
%28 = call i32 @shellGetc(%struct.shell_data* %27)
%29 = load %struct.shell_data*, %struct.shell_data** %3
%30 = call zeroext i8 @shellPeekc(%struct.shell_data* %29)
store i8 %30, i8* %4
br label %16
31: ; preds = %24
store i32 0, i32* %2
br label %32
32: ; preds = %31, %14
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
%struct.shell_data = type { i32 }
define i32 @shellGetWhitespace(%struct.shell_data* %0) {
%2 = tail call zeroext i8 @shellPeekc(%struct.shell_data* %0)
switch i8 %2, label %9 [
i8 32, label %3
i8 9, label %3
]
3: ; preds = %1, %1
br label %4
4: ; preds = %3, %6
%5 = phi i8 [ %8, %6 ], [ %2, %3 ]
switch i8 %5, label %9 [
i8 32, label %6
i8 9, label %6
]
6: ; preds = %4, %4
%7 = tail call i32 @shellGetc(%struct.shell_data* %0)
%8 = tail call zeroext i8 @shellPeekc(%struct.shell_data* %0)
br label %4
9: ; preds = %4, %1
%10 = phi i32 [ -1, %1 ], [ 0, %4 ]
ret i32 %10
}