#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
scalar_t__ strncmp(char *, char *, int);
void parse_pal(char *dname, char *msk_name, int *oid_seqs, int *max_oid,
               FILE *fd) {
  char line[512];
  while (fgets(line, sizeof(line), fd)) {
    if (line[0] == '#')
      continue;
    if (strncmp(line, "DBLIST", 6) == 0) {
      sscanf(line + 7, "%s", dname);
    } else if (strncmp(line, "OIDLIST", 7) == 0) {
      sscanf(line + 8, "%s", msk_name);
    } else if (strncmp(line, "NSEQ", 4) == 0) {
      sscanf(line + 5, "%d", oid_seqs);
    } else if (strncmp(line, "MAXOID", 6) == 0) {
      sscanf(line + 7, "%d", max_oid);
    }
  }
}


x86 assembly (clang, -O0):
<parse_pal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x200,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     12a2 <parse_pal+0x172>
movsbl -0x230(%rbp),%eax
cmp    $0x23,%eax
jne    1183 <parse_pal+0x53>
jmp    114f <parse_pal+0x1f>
lea    -0x230(%rbp),%rdi
lea    0xe6f(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c7 <parse_pal+0x97>
lea    -0x230(%rbp),%rdi
add    $0x7,%rdi
mov    -0x8(%rbp),%rdx
lea    0xe4c(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
jmp    129d <parse_pal+0x16d>
lea    -0x230(%rbp),%rdi
lea    0xe35(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    120b <parse_pal+0xdb>
lea    -0x230(%rbp),%rdi
add    $0x8,%rdi
mov    -0x10(%rbp),%rdx
lea    0xe08(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
jmp    1298 <parse_pal+0x168>
lea    -0x230(%rbp),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    124f <parse_pal+0x11f>
lea    -0x230(%rbp),%rdi
add    $0x5,%rdi
mov    -0x18(%rbp),%rdx
lea    0xdd4(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
jmp    1293 <parse_pal+0x163>
lea    -0x230(%rbp),%rdi
lea    0xdbd(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    128e <parse_pal+0x15e>
lea    -0x230(%rbp),%rdi
add    $0x7,%rdi
mov    -0x20(%rbp),%rdx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1050 <sscanf@plt>
jmp    1293 <parse_pal+0x163>
jmp    1298 <parse_pal+0x168>
jmp    129d <parse_pal+0x16d>
jmp    114f <parse_pal+0x1f>
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_pal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x228,%rsp
mov    %r8,%rbx
mov    %rcx,0x8(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%r13
lea    0x20(%rsp),%rdi
mov    $0x200,%esi
mov    %r8,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1259 <parse_pal+0x129>
lea    0x20(%rsp),%r14
lea    0xe83(%rip),%r15
lea    0xe83(%rip),%rbp
lea    0xe7f(%rip),%r12
jmp    11b8 <parse_pal+0x88>
lea    0x27(%rsp),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
mov    %r14,%rdi
mov    $0x200,%esi
mov    %rbx,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1259 <parse_pal+0x129>
cmpb   $0x23,0x20(%rsp)
je     119f <parse_pal+0x6f>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     118d <parse_pal+0x5d>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1231 <parse_pal+0x101>
mov    %r14,%rdi
lea    0xe1f(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1243 <parse_pal+0x113>
mov    %r14,%rdi
lea    0xe0e(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    119f <parse_pal+0x6f>
lea    0x27(%rsp),%rdi
lea    0xdf0(%rip),%rsi
mov    0x8(%rsp),%rdx
jmp    1198 <parse_pal+0x68>
lea    0x28(%rsp),%rdi
mov    %rbp,%rsi
mov    0x18(%rsp),%rdx
jmp    1198 <parse_pal+0x68>
lea    0x25(%rsp),%rdi
lea    0xdc8(%rip),%rsi
mov    0x10(%rsp),%rdx
jmp    1198 <parse_pal+0x68>
add    $0x228,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"DBLIST\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c"OIDLIST\00"
@.str.3 = [5 x i8] c"NSEQ\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [7 x i8] c"MAXOID\00"
define void @parse_pal(i8* %0, i8* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [512 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
br label %12
12: ; preds = %62, %22, %5
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%14 = load i32*, i32** %10
%15 = call i64 @fgets(i8* %13, i32 512, i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %63
17: ; preds = %12
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 35
br i1 %21, label %22, label %23
22: ; preds = %17
br label %12
23: ; preds = %17
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%25 = call i64 @strncmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%29 = getelementptr inbounds i8, i8* %28, i64 7
%30 = load i8*, i8** %6
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %62
32: ; preds = %23
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%34 = call i64 @strncmp(i8* %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %32
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%38 = getelementptr inbounds i8, i8* %37, i64 8
%39 = load i8*, i8** %7
%40 = call i32 (i8*, i8*, ...) @sscanf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %61
41: ; preds = %32
%42 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%43 = call i64 @strncmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%47 = getelementptr inbounds i8, i8* %46, i64 5
%48 = load i32*, i32** %8
%49 = call i32 (i8*, i8*, ...) @sscanf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %48)
br label %60
50: ; preds = %41
%51 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%52 = call i64 @strncmp(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%56 = getelementptr inbounds i8, i8* %55, i64 7
%57 = load i32*, i32** %9
%58 = call i32 (i8*, i8*, ...) @sscanf(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %57)
br label %59
59: ; preds = %54, %50
br label %60
60: ; preds = %59, %45
br label %61
61: ; preds = %60, %36
br label %62
62: ; preds = %61, %27
br label %12
63: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"DBLIST\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [8 x i8] c"OIDLIST\00"
@.str.3 = [5 x i8] c"NSEQ\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [7 x i8] c"MAXOID\00"
define void @parse_pal(i8* %0, i8* %1, i32* %2, i32* %3, i32* nocapture %4) {
%6 = alloca [512 x i8]
%7 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%8 = call i64 @fgets(i8* %7, i32 512, i32* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %40, label %10
10: ; preds = %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 7
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 5
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 8
br label %14
14: ; preds = %10, %37
%15 = load i8, i8* %7
%16 = icmp eq i8 %15, 35
br i1 %16, label %37, label %17
17: ; preds = %14
%18 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %37
22: ; preds = %17
%23 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 7)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, i8*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %37
27: ; preds = %22
%28 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 4)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
br label %37
32: ; preds = %27
%33 = call i64 @strncmp(i8* %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 6)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
br label %37
37: ; preds = %20, %30, %35, %32, %25, %14
%38 = call i64 @fgets(i8* %7, i32 512, i32* %4)
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %14
40: ; preds = %37, %5
ret void
}