#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 /*<<< orphan*/ inc_char(struct assembler *);
int skip_comment(struct assembler *a) {
  int counter = 0;
  if (cur_char(a) != ';') {
    return counter;
  }
  while (cur_char(a) != '\0' && cur_char(a) != '\n') {
    inc_char(a);
    ++counter;
  }
  if (cur_char(a) == '\n') {
    inc_char(a);
    ++counter;
  }
  return counter;
}


x86 assembly (clang, -O0):
<skip_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%eax
cmp    $0x3b,%eax
je     1153 <skip_comment+0x33>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11db <skip_comment+0xbb>
jmp    1158 <skip_comment+0x38>
mov    -0x10(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     1187 <skip_comment+0x67>
mov    -0x10(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1197 <skip_comment+0x77>
jmp    11ae <skip_comment+0x8e>
mov    -0x10(%rbp),%rdi
call   1030 <inc_char@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <skip_comment+0x38>
mov    -0x10(%rbp),%rdi
call   1040 <cur_char@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11d5 <skip_comment+0xb5>
mov    -0x10(%rbp),%rdi
call   1030 <inc_char@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_comment>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <cur_char@plt>
xor    %ebp,%ebp
cmp    $0x3b,%al
jne    117a <skip_comment+0x5a>
mov    %rbx,%rdi
call   1040 <cur_char@plt>
xor    %ebp,%ebp
test   %al,%al
je     1163 <skip_comment+0x43>
nop
mov    %rbx,%rdi
call   1040 <cur_char@plt>
cmp    $0xa,%al
je     1163 <skip_comment+0x43>
mov    %rbx,%rdi
call   1030 <inc_char@plt>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1040 <cur_char@plt>
test   %al,%al
jne    1140 <skip_comment+0x20>
mov    %rbx,%rdi
call   1040 <cur_char@plt>
cmp    $0xa,%al
jne    117a <skip_comment+0x5a>
mov    %rbx,%rdi
call   1030 <inc_char@plt>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.assembler = type { i32 }
define i32 @skip_comment(%struct.assembler* %0) {
%2 = alloca i32
%3 = alloca %struct.assembler*
%4 = alloca i32
store %struct.assembler* %0, %struct.assembler** %3
store i32 0, i32* %4
%5 = load %struct.assembler*, %struct.assembler** %3
%6 = call signext i8 @cur_char(%struct.assembler* %5)
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 59
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %41
11: ; preds = %1
br label %12
12: ; preds = %24, %11
%13 = load %struct.assembler*, %struct.assembler** %3
%14 = call signext i8 @cur_char(%struct.assembler* %13)
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load %struct.assembler*, %struct.assembler** %3
%19 = call signext i8 @cur_char(%struct.assembler* %18)
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 10
br label %22
22: ; preds = %17, %12
%23 = phi i1 [ false, %12 ], [ %21, %17 ]
br i1 %23, label %24, label %29
24: ; preds = %22
%25 = load %struct.assembler*, %struct.assembler** %3
%26 = call i32 @inc_char(%struct.assembler* %25)
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %12
29: ; preds = %22
%30 = load %struct.assembler*, %struct.assembler** %3
%31 = call signext i8 @cur_char(%struct.assembler* %30)
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 10
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load %struct.assembler*, %struct.assembler** %3
%36 = call i32 @inc_char(%struct.assembler* %35)
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %39
39: ; preds = %34, %29
%40 = load i32, i32* %4
store i32 %40, i32* %2
br label %41
41: ; preds = %39, %9
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
%struct.assembler = type { i32 }
define i32 @skip_comment(%struct.assembler* %0) {
%2 = tail call signext i8 @cur_char(%struct.assembler* %0)
%3 = icmp eq i8 %2, 59
br i1 %3, label %4, label %23
4: ; preds = %1
%5 = tail call signext i8 @cur_char(%struct.assembler* %0)
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %4, %11
%8 = phi i32 [ %13, %11 ], [ 0, %4 ]
%9 = tail call signext i8 @cur_char(%struct.assembler* %0)
%10 = icmp eq i8 %9, 10
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = tail call i32 @inc_char(%struct.assembler* %0)
%13 = add nuw nsw i32 %8, 1
%14 = tail call signext i8 @cur_char(%struct.assembler* %0)
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %11, %4
%17 = phi i32 [ 0, %4 ], [ %13, %11 ], [ %8, %7 ]
%18 = tail call signext i8 @cur_char(%struct.assembler* %0)
%19 = icmp eq i8 %18, 10
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = tail call i32 @inc_char(%struct.assembler* %0)
%22 = add nuw nsw i32 %17, 1
br label %23
23: ; preds = %16, %20, %1
%24 = phi i32 [ 0, %1 ], [ %22, %20 ], [ %17, %16 ]
ret i32 %24
}