#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 */

/* Variables and functions */
int EOF;
scalar_t__ feof(int /*<<< orphan*/);
char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int llegeixx(int *x) {
  int tx, c;
  while (!feof(stdin)) {
    c = fgetc(stdin);
    if (c == EOF)
      return -1;
    if (c == '\n')
      continue;
    else if (c == '#') {
      while (fgetc(stdin) != '\n' || feof(stdin))
        ;
      continue;
    } else
      ungetc(c, stdin);
    if (fscanf(stdin, "%d", &tx) == 1) {
      *x = tx;
      return 0;
    } else {
      while (fgetc(stdin) != '\n' || feof(stdin))
        ;
      fprintf(stderr, "Error at data. Ignoring a line\n");
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<llegeixx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1180 <llegeixx+0x30>
jmp    12d9 <llegeixx+0x189>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
movsbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e42(%rip),%rcx
cmp    (%rcx),%eax
jne    11b2 <llegeixx+0x62>
movl   $0xffffffff,-0x4(%rbp)
jmp    12e0 <llegeixx+0x190>
cmpl   $0xa,-0x18(%rbp)
jne    11c1 <llegeixx+0x71>
jmp    115c <llegeixx+0xc>
cmpl   $0x23,-0x18(%rbp)
jne    1221 <llegeixx+0xd1>
jmp    11d0 <llegeixx+0x80>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
jne    1207 <llegeixx+0xb7>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1217 <llegeixx+0xc7>
jmp    121c <llegeixx+0xcc>
jmp    11d0 <llegeixx+0x80>
jmp    115c <llegeixx+0xc>
mov    -0x18(%rbp),%edi
mov    0x2dbd(%rip),%rax
mov    (%rax),%esi
call   1070 <ungetc@plt>
jmp    1237 <llegeixx+0xe7>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
lea    0xdb9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    126e <llegeixx+0x11e>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    12e0 <llegeixx+0x190>
jmp    1273 <llegeixx+0x123>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
movsbl %al,%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x1a(%rbp)
jne    12aa <llegeixx+0x15a>
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
call   1060 <feof@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    12ba <llegeixx+0x16a>
jmp    12bf <llegeixx+0x16f>
jmp    1273 <llegeixx+0x123>
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
lea    0xd34(%rip),%rsi
call   1050 <fprintf@plt>
jmp    115c <llegeixx+0xc>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llegeixx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    0x2e80(%rip),%rbp
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
mov    $0xffffffff,%r13d
test   %rax,%rax
je     118d <llegeixx+0x3d>
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,0x10(%rsp)
mov    0x2e47(%rip),%r14
lea    0xe60(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xe57(%rip),%rbx
jmp    11bd <llegeixx+0x6d>
xchg   %ax,%ax
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %rax,%rax
jne    117b <llegeixx+0x2b>
mov    0x0(%rbp),%edi
call   1040 <fgetc@plt>
movsbl %al,%edi
cmp    %edi,(%r14)
je     117b <llegeixx+0x2b>
cmp    $0xa,%al
je     11b0 <llegeixx+0x60>
cmp    $0x23,%al
jne    1200 <llegeixx+0xb0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0xa,%al
jne    11e0 <llegeixx+0x90>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %rax,%rax
jne    11e0 <llegeixx+0x90>
jmp    11b0 <llegeixx+0x60>
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%esi
call   1070 <ungetc@plt>
mov    0x0(%rbp),%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <fscanf@plt>
cmp    $0x1,%eax
je     124f <llegeixx+0xff>
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
call   1040 <fgetc@plt>
cmp    $0xa,%al
jne    1220 <llegeixx+0xd0>
mov    0x0(%rbp),%edi
call   1060 <feof@plt>
test   %rax,%rax
jne    1220 <llegeixx+0xd0>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1050 <fprintf@plt>
jmp    11b0 <llegeixx+0x60>
mov    0xc(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
xor    %r13d,%r13d
jmp    117b <llegeixx+0x2b>

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Error at data. Ignoring a line\0A\00"
define i32 @llegeixx(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
br label %6
6: ; preds = %68, %39, %22, %1
%7 = load i32, i32* @stdin
%8 = call i64 @feof(i32 %7)
%9 = icmp ne i64 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %69
11: ; preds = %6
%12 = load i32, i32* @stdin
%13 = call signext i8 @fgetc(i32 %12)
%14 = sext i8 %13 to i32
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = load i32, i32* @EOF
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 -1, i32* %2
br label %70
19: ; preds = %11
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, 10
br i1 %21, label %22, label %23
22: ; preds = %19
br label %6
23: ; preds = %19
%24 = load i32, i32* %5
%25 = icmp eq i32 %24, 35
br i1 %25, label %26, label %40
26: ; preds = %23
br label %27
27: ; preds = %38, %26
%28 = load i32, i32* @stdin
%29 = call signext i8 @fgetc(i32 %28)
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 10
br i1 %31, label %36, label %32
32: ; preds = %27
%33 = load i32, i32* @stdin
%34 = call i64 @feof(i32 %33)
%35 = icmp ne i64 %34, 0
br label %36
36: ; preds = %32, %27
%37 = phi i1 [ true, %27 ], [ %35, %32 ]
br i1 %37, label %38, label %39
38: ; preds = %36
br label %27
39: ; preds = %36
br label %6
40: ; preds = %23
%41 = load i32, i32* %5
%42 = load i32, i32* @stdin
%43 = call i32 @ungetc(i32 %41, i32 %42)
br label %44
44: ; preds = %40
br label %45
45: ; preds = %44
%46 = load i32, i32* @stdin
%47 = call i32 @fscanf(i32 %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%48 = icmp eq i32 %47, 1
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i32, i32* %4
%51 = load i32*, i32** %3
store i32 %50, i32* %51
store i32 0, i32* %2
br label %70
52: ; preds = %45
br label %53
53: ; preds = %64, %52
%54 = load i32, i32* @stdin
%55 = call signext i8 @fgetc(i32 %54)
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 10
br i1 %57, label %62, label %58
58: ; preds = %53
%59 = load i32, i32* @stdin
%60 = call i64 @feof(i32 %59)
%61 = icmp ne i64 %60, 0
br label %62
62: ; preds = %58, %53
%63 = phi i1 [ true, %53 ], [ %61, %58 ]
br i1 %63, label %64, label %65
64: ; preds = %62
br label %53
65: ; preds = %62
%66 = load i32, i32* @stderr
%67 = call i32 @fprintf(i32 %66, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %68
68: ; preds = %65
br label %6
69: ; preds = %6
store i32 -1, i32* %2
br label %70
70: ; preds = %69, %49, %18
%71 = load i32, i32* %2
ret i32 %71
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [32 x i8] c"Error at data. Ignoring a line\0A\00"
define i32 @llegeixx(i32* nocapture writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @stdin
%5 = call i64 @feof(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %47
7: ; preds = %1, %43
%8 = load i32, i32* @stdin
%9 = call signext i8 @fgetc(i32 %8)
%10 = sext i8 %9 to i32
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %11, %10
br i1 %12, label %47, label %13
13: ; preds = %7
switch i8 %9, label %23 [
i8 10, label %43
i8 35, label %14
]
14: ; preds = %13, %18
%15 = load i32, i32* @stdin
%16 = call signext i8 @fgetc(i32 %15)
%17 = icmp eq i8 %16, 10
br i1 %17, label %19, label %18
18: ; preds = %14, %19
br label %14
19: ; preds = %14
%20 = load i32, i32* @stdin
%21 = call i64 @feof(i32 %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %43, label %18
23: ; preds = %13
%24 = load i32, i32* @stdin
%25 = call i32 @ungetc(i32 %10, i32 %24)
%26 = load i32, i32* @stdin
%27 = call i32 @fscanf(i32 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load i32, i32* %2
store i32 %30, i32* %0
br label %47
31: ; preds = %23, %35
%32 = load i32, i32* @stdin
%33 = call signext i8 @fgetc(i32 %32)
%34 = icmp eq i8 %33, 10
br i1 %34, label %36, label %35
35: ; preds = %31, %36
br label %31
36: ; preds = %31
%37 = load i32, i32* @stdin
%38 = call i64 @feof(i32 %37)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %35
40: ; preds = %36
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %43
43: ; preds = %19, %40, %13
%44 = load i32, i32* @stdin
%45 = call i64 @feof(i32 %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %7, label %47
47: ; preds = %7, %43, %1, %29
%48 = phi i32 [ 0, %29 ], [ -1, %1 ], [ -1, %43 ], [ -1, %7 ]
ret i32 %48
}