#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 */
char fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
void skip_to_next_value(FILE *in) {
  char ch = fgetc(in);
  while (ch == '#' || isspace(ch)) {
    if (ch == '#') {
      while (ch != '\n') {
        ch = fgetc(in);
      }
    } else {
      while (isspace(ch)) {
        ch = fgetc(in);
      }
    }
  }
  ungetc(ch, in);
  return;
}


x86 assembly (clang, -O0):
<skip_to_next_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
mov    $0x1,%al
cmp    $0x23,%ecx
mov    %al,-0xa(%rbp)
je     116d <skip_to_next_value+0x3d>
movsbl -0x9(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    117d <skip_to_next_value+0x4d>
jmp    11e5 <skip_to_next_value+0xb5>
movsbl -0x9(%rbp),%eax
cmp    $0x23,%eax
jne    11b2 <skip_to_next_value+0x82>
jmp    118f <skip_to_next_value+0x5f>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
je     11ad <skip_to_next_value+0x7d>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
jmp    118f <skip_to_next_value+0x5f>
jmp    11e0 <skip_to_next_value+0xb0>
jmp    11b7 <skip_to_next_value+0x87>
movsbl -0x9(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     11db <skip_to_next_value+0xab>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
jmp    11b7 <skip_to_next_value+0x87>
jmp    11e0 <skip_to_next_value+0xb0>
jmp    1148 <skip_to_next_value+0x18>
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1050 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_to_next_value>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <fgetc@plt>
mov    %eax,%ebx
xchg   %ax,%ax
cmp    $0x23,%bl
je     1170 <skip_to_next_value+0x40>
movsbl %bl,%ebp
mov    %ebp,%edi
call   1040 <isspace@plt>
mov    %ebp,%edi
test   %rax,%rax
je     1180 <skip_to_next_value+0x50>
call   1040 <isspace@plt>
test   %rax,%rax
je     1140 <skip_to_next_value+0x10>
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
jmp    1156 <skip_to_next_value+0x26>
nop
mov    %r14,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%al
jne    1170 <skip_to_next_value+0x40>
mov    $0xa,%bl
jmp    1140 <skip_to_next_value+0x10>
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <ungetc@plt>

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

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