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

/* Variables and functions */
char cur_char(struct assembler *);
int skip_all_whitespaces(struct assembler *);
int skip_comment(struct assembler *);
void skip_whitespaces_and_comments(struct assembler *a) {
  int ws_enc = 0, cm_enc = 0;
  do {
    if (cur_char(a) == '\0') {
      break;
    }
    ws_enc = skip_all_whitespaces(a);
    if (cur_char(a) == '\0') {
      break;
    }
    cm_enc = skip_comment(a);
  } while (ws_enc > 0 || cm_enc > 0);
}


x86 assembly (clang, -O0):
<skip_whitespaces_and_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%eax
cmp    $0x0,%eax
jne    1164 <skip_whitespaces_and_comments+0x34>
jmp    11ba <skip_whitespaces_and_comments+0x8a>
mov    -0x8(%rbp),%rdi
call   1050 <skip_all_whitespaces@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%eax
cmp    $0x0,%eax
jne    118a <skip_whitespaces_and_comments+0x5a>
jmp    11ba <skip_whitespaces_and_comments+0x8a>
mov    -0x8(%rbp),%rdi
call   1030 <skip_comment@plt>
mov    %eax,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jg     11af <skip_whitespaces_and_comments+0x7f>
cmpl   $0x0,-0x10(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114a <skip_whitespaces_and_comments+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespaces_and_comments>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <cur_char@plt>
test   %al,%al
je     1172 <skip_whitespaces_and_comments+0x42>
mov    %rbx,%rdi
call   1050 <skip_all_whitespaces@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <cur_char@plt>
test   %al,%al
je     1172 <skip_whitespaces_and_comments+0x42>
mov    %rbx,%rdi
call   1030 <skip_comment@plt>
test   %ebp,%ebp
jg     1140 <skip_whitespaces_and_comments+0x10>
test   %eax,%eax
jg     1140 <skip_whitespaces_and_comments+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.assembler = type { i32 }
define void @skip_whitespaces_and_comments(%struct.assembler* %0) {
%2 = alloca %struct.assembler*
%3 = alloca i32
%4 = alloca i32
store %struct.assembler* %0, %struct.assembler** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %28, %1
%6 = load %struct.assembler*, %struct.assembler** %2
%7 = call signext i8 @cur_char(%struct.assembler* %6)
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %5
br label %30
11: ; preds = %5
%12 = load %struct.assembler*, %struct.assembler** %2
%13 = call i32 @skip_all_whitespaces(%struct.assembler* %12)
store i32 %13, i32* %3
%14 = load %struct.assembler*, %struct.assembler** %2
%15 = call signext i8 @cur_char(%struct.assembler* %14)
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
br label %30
19: ; preds = %11
%20 = load %struct.assembler*, %struct.assembler** %2
%21 = call i32 @skip_comment(%struct.assembler* %20)
store i32 %21, i32* %4
br label %22
22: ; preds = %19
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 0
br label %28
28: ; preds = %25, %22
%29 = phi i1 [ true, %22 ], [ %27, %25 ]
br i1 %29, label %5, label %30
30: ; preds = %28, %18, %10
ret void
}

LLVM IR (-O2):
%struct.assembler = type { i32 }
define void @skip_whitespaces_and_comments(%struct.assembler* %0) {
br label %2
2: ; preds = %9, %1
%3 = tail call signext i8 @cur_char(%struct.assembler* %0)
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = tail call i32 @skip_all_whitespaces(%struct.assembler* %0)
%7 = tail call signext i8 @cur_char(%struct.assembler* %0)
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = tail call i32 @skip_comment(%struct.assembler* %0)
%11 = icmp sgt i32 %6, 0
%12 = icmp sgt i32 %10, 0
%13 = select i1 %11, i1 true, i1 %12
br i1 %13, label %2, label %14
14: ; preds = %5, %2, %9
ret void
}