#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 /*<<< orphan*/ exit(int);
unsigned char fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int fscanf(int /*<<< orphan*/, char *, unsigned long *, unsigned long *,
           unsigned char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
void pfile_info(unsigned long *length, unsigned long *numpatt) {
  int error;
  unsigned char c;
  unsigned char origfilename[257];
  error = fscanf(stdin, "# number=%lu length=%lu file=%s forbidden=", numpatt,
                 length, origfilename);
  if (error != 3) {
    fprintf(stderr, "Error: Patterns file header not correct\n");
    perror("run_queries");
    exit(1);
  }
  fprintf(stderr, "# patterns = %lu length = %lu file = %s forbidden chars = ",
          *numpatt, *length, origfilename);
  while ((c = fgetc(stdin)) != 0) {
    if (c == '\n')
      break;
    fprintf(stderr, "%d", c);
  }
  fprintf(stderr, "\n");
}


x86 assembly (clang, -O0):
<pfile_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    -0x120(%rbp),%r8
lea    0xe7e(%rip),%rsi
call   1030 <fscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
je     11c1 <pfile_info+0x71>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
lea    0xe87(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
lea    0xea2(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
lea    -0x120(%rbp),%r8
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    %al,-0x15(%rbp)
movzbl %al,%eax
cmp    $0x0,%eax
je     123c <pfile_info+0xec>
movzbl -0x15(%rbp),%eax
cmp    $0xa,%eax
jne    121c <pfile_info+0xcc>
jmp    123c <pfile_info+0xec>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
movzbl -0x15(%rbp),%edx
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11ed <pfile_info+0x9d>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
lea    0xe06(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfile_info>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e7d(%rip),%r15
mov    (%r15),%edi
lea    0xe8b(%rip),%rsi
mov    %rsp,%r8
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <fscanf@plt>
mov    0x2e4e(%rip),%r12
mov    (%r12),%edi
cmp    $0x3,%eax
jne    1204 <pfile_info+0xb4>
mov    (%r14),%rdx
mov    (%rbx),%rcx
lea    0xec0(%rip),%rsi
mov    %rsp,%r8
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xeea(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
call   1040 <fgetc@plt>
test   %al,%al
je     11e3 <pfile_info+0x93>
cmp    $0xa,%al
je     11e3 <pfile_info+0x93>
movzbl %al,%edx
mov    (%r12),%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11c0 <pfile_info+0x70>
mov    (%r12),%edi
lea    0xe64(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe20(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe3b(%rip),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [43 x i8] c"# number=%lu length=%lu file=%s forbidden=\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"Error: Patterns file header not correct\0A\00"
@.str.2 = [12 x i8] c"run_queries\00"
@.str.3 = [59 x i8] c"# patterns = %lu length = %lu file = %s forbidden chars = \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @pfile_info(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i8
%7 = alloca [257 x i8]
store i64* %0, i64** %3
store i64* %1, i64** %4
%8 = load i32, i32* @stdin
%9 = load i64*, i64** %4
%10 = load i64*, i64** %3
%11 = getelementptr inbounds [257 x i8], [257 x i8]* %7, i64 0, i64 0
%12 = call i32 @fscanf(i32 %8, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64* %9, i64* %10, i8* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i64*, i64** %4
%23 = load i64, i64* %22
%24 = load i64*, i64** %3
%25 = load i64, i64* %24
%26 = getelementptr inbounds [257 x i8], [257 x i8]* %7, i64 0, i64 0
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i64 %23, i64 %25, i8* %26)
br label %28
28: ; preds = %38, %20
%29 = load i32, i32* @stdin
%30 = call zeroext i8 @fgetc(i32 %29)
store i8 %30, i8* %6
%31 = zext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %43
33: ; preds = %28
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %38
37: ; preds = %33
br label %43
38: ; preds = %33
%39 = load i32, i32* @stderr
%40 = load i8, i8* %6
%41 = zext i8 %40 to i32
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %41)
br label %28
43: ; preds = %37, %28
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [43 x i8] c"# number=%lu length=%lu file=%s forbidden=\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"Error: Patterns file header not correct\0A\00"
@.str.2 = [12 x i8] c"run_queries\00"
@.str.3 = [59 x i8] c"# patterns = %lu length = %lu file = %s forbidden chars = \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @pfile_info(i64* %0, i64* %1) {
%3 = alloca [257 x i8]
%4 = getelementptr inbounds [257 x i8], [257 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fscanf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %0, i8* %4)
%7 = icmp eq i32 %6, 3
%8 = load i32, i32* @stderr
br i1 %7, label %13, label %9
9: ; preds = %2
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i64, i64* %1
%15 = load i64, i64* %0
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), i64 %14, i64 %15, i8* %4)
br label %17
17: ; preds = %20, %13
%18 = load i32, i32* @stdin
%19 = call zeroext i8 @fgetc(i32 %18)
switch i8 %19, label %20 [
i8 10, label %24
i8 0, label %24
]
20: ; preds = %17
%21 = zext i8 %19 to i32
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %17
24: ; preds = %17, %17
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}