#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 */
int asciiflag_conv(char *);
scalar_t__ atol(char *);
char *findLine(int /*<<< orphan*/ *, char *);
int sscanf(char *, char *, char *, char *, char *, char *);
int parse_mail_flags(FILE *plr_file) {
  int fl[4], ret = 0;
  char *txt, f1[33], f2[33], f3[33], f4[33];
  if ((txt = findLine(plr_file, "Flag:")) != NULL) {
    if (sscanf(txt, "%s %s %s %s", f1, f2, f3, f4) == 4) {
      fl[0] = asciiflag_conv(f1);
      fl[1] = asciiflag_conv(f2);
      fl[2] = asciiflag_conv(f3);
      fl[3] = asciiflag_conv(f4);
      if (((fl)[((int)(1) / 32)] & (1 << ((1) % 32))))
        ((ret) |= ((1 << (0))));
      if (((fl)[((int)(2) / 32)] & (1 << ((2) % 32))))
        ((ret) |= ((1 << (1))));
      if (((fl)[((int)(3) / 32)] & (1 << ((3) % 32))))
        ((ret) |= ((1 << (4))));
      if (((fl)[((int)(4) / 32)] & (1 << ((4) % 32))))
        ((ret) |= ((1 << (5))));
      if (((fl)[((int)(5) / 32)] & (1 << ((5) % 32))))
        ((ret) |= ((1 << (6))));
      if (((fl)[((int)(6) / 32)] & (1 << ((6) % 32))))
        ((ret) |= ((1 << (7))));
    }
  }
  if ((txt = findLine(plr_file, "Gold:")) != NULL) {
    if (atol(txt) > 0)
      ((ret) |= ((1 << (3))));
  }
  if ((txt = findLine(plr_file, "Objs:")) != NULL) {
    ((ret) |= ((1 << (2))));
  }
  return (ret);
}


x86 assembly (clang, -O0):
<parse_mail_flags>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1060 <findLine@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     127b <parse_mail_flags+0x13b>
mov    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    -0xc0(%rbp),%r8
lea    -0xf0(%rbp),%r9
lea    0xe6e(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x4,%eax
jne    1276 <parse_mail_flags+0x136>
lea    -0x60(%rbp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %eax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %eax,-0x1c(%rbp)
lea    -0xc0(%rbp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %eax,-0x18(%rbp)
lea    -0xf0(%rbp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11f7 <parse_mail_flags+0xb7>
mov    -0x24(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     120f <parse_mail_flags+0xcf>
mov    -0x24(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1227 <parse_mail_flags+0xe7>
mov    -0x24(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     123f <parse_mail_flags+0xff>
mov    -0x24(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1257 <parse_mail_flags+0x117>
mov    -0x24(%rbp),%eax
or     $0x40,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1271 <parse_mail_flags+0x131>
mov    -0x24(%rbp),%eax
or     $0x80,%eax
mov    %eax,-0x24(%rbp)
jmp    1276 <parse_mail_flags+0x136>
jmp    127b <parse_mail_flags+0x13b>
mov    -0x8(%rbp),%rdi
lea    0xd8c(%rip),%rsi
call   1060 <findLine@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     12ba <parse_mail_flags+0x17a>
mov    -0x30(%rbp),%rdi
call   1050 <atol@plt>
cmp    $0x0,%rax
jle    12b5 <parse_mail_flags+0x175>
mov    -0x24(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x24(%rbp)
jmp    12ba <parse_mail_flags+0x17a>
mov    -0x8(%rbp),%rdi
lea    0xd53(%rip),%rsi
call   1060 <findLine@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     12e1 <parse_mail_flags+0x1a1>
mov    -0x24(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_mail_flags>:
push   %rbp
push   %rbx
sub    $0xb8,%rsp
mov    %rdi,%rbx
lea    0xead(%rip),%rsi
call   1060 <findLine@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     11d9 <parse_mail_flags+0x99>
lea    0xea0(%rip),%rsi
lea    0x90(%rsp),%rdx
lea    0x60(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    %rsp,%r9
mov    %rax,%rdi
call   1030 <sscanf@plt>
cmp    $0x4,%eax
jne    11d9 <parse_mail_flags+0x99>
lea    0x90(%rsp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %eax,%ebp
lea    0x60(%rsp),%rdi
call   1040 <asciiflag_conv@plt>
lea    0x30(%rsp),%rdi
call   1040 <asciiflag_conv@plt>
mov    %rsp,%rdi
call   1040 <asciiflag_conv@plt>
mov    %ebp,%eax
shr    %eax
and    $0x3,%eax
add    %ebp,%ebp
mov    %ebp,%ecx
and    $0x10,%ecx
or     %eax,%ecx
mov    %ebp,%eax
and    $0x20,%eax
or     %ecx,%eax
mov    %ebp,%ecx
and    $0x40,%ecx
or     %eax,%ecx
and    $0x80,%ebp
or     %ecx,%ebp
lea    0xe32(%rip),%rsi
mov    %rbx,%rdi
call   1060 <findLine@plt>
test   %rax,%rax
je     1200 <parse_mail_flags+0xc0>
mov    %rax,%rdi
call   1050 <atol@plt>
mov    %ebp,%ecx
or     $0x8,%ecx
test   %rax,%rax
cmovg  %ecx,%ebp
lea    0xe11(%rip),%rsi
mov    %rbx,%rdi
call   1060 <findLine@plt>
mov    %ebp,%ecx
or     $0x4,%ecx
test   %rax,%rax
cmove  %ebp,%ecx
mov    %ecx,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Flag:\00"
@.str.1 = [12 x i8] c"%s %s %s %s\00"
@.str.2 = [6 x i8] c"Gold:\00"
@.str.3 = [6 x i8] c"Objs:\00"
define i32 @parse_mail_flags(i32* %0) {
%2 = alloca i32*
%3 = alloca [4 x i32]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [33 x i8]
%7 = alloca [33 x i8]
%8 = alloca [33 x i8]
%9 = alloca [33 x i8]
store i32* %0, i32** %2
store i32 0, i32* %4
%10 = load i32*, i32** %2
%11 = call i8* @findLine(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %5
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %83
13: ; preds = %1
%14 = load i8*, i8** %5
%15 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%17 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%18 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%19 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i8* %18)
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %82
21: ; preds = %13
%22 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%23 = call i32 @asciiflag_conv(i8* %22)
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 %23, i32* %24
%25 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%26 = call i32 @asciiflag_conv(i8* %25)
%27 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
store i32 %26, i32* %27
%28 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%29 = call i32 @asciiflag_conv(i8* %28)
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
store i32 %29, i32* %30
%31 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%32 = call i32 @asciiflag_conv(i8* %31)
%33 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
store i32 %32, i32* %33
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%35 = load i32, i32* %34
%36 = and i32 %35, 2
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %21
%39 = load i32, i32* %4
%40 = or i32 %39, 1
store i32 %40, i32* %4
br label %41
41: ; preds = %38, %21
%42 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%43 = load i32, i32* %42
%44 = and i32 %43, 4
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i32, i32* %4
%48 = or i32 %47, 2
store i32 %48, i32* %4
br label %49
49: ; preds = %46, %41
%50 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%51 = load i32, i32* %50
%52 = and i32 %51, 8
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = load i32, i32* %4
%56 = or i32 %55, 16
store i32 %56, i32* %4
br label %57
57: ; preds = %54, %49
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%59 = load i32, i32* %58
%60 = and i32 %59, 16
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %57
%63 = load i32, i32* %4
%64 = or i32 %63, 32
store i32 %64, i32* %4
br label %65
65: ; preds = %62, %57
%66 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%67 = load i32, i32* %66
%68 = and i32 %67, 32
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %65
%71 = load i32, i32* %4
%72 = or i32 %71, 64
store i32 %72, i32* %4
br label %73
73: ; preds = %70, %65
%74 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%75 = load i32, i32* %74
%76 = and i32 %75, 64
%77 = icmp ne i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %73
%79 = load i32, i32* %4
%80 = or i32 %79, 128
store i32 %80, i32* %4
br label %81
81: ; preds = %78, %73
br label %82
82: ; preds = %81, %13
br label %83
83: ; preds = %82, %1
%84 = load i32*, i32** %2
%85 = call i8* @findLine(i32* %84, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* %85, i8** %5
%86 = icmp ne i8* %85, null
br i1 %86, label %87, label %95
87: ; preds = %83
%88 = load i8*, i8** %5
%89 = call i64 @atol(i8* %88)
%90 = icmp sgt i64 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = load i32, i32* %4
%93 = or i32 %92, 8
store i32 %93, i32* %4
br label %94
94: ; preds = %91, %87
br label %95
95: ; preds = %94, %83
%96 = load i32*, i32** %2
%97 = call i8* @findLine(i32* %96, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i8* %97, i8** %5
%98 = icmp ne i8* %97, null
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = load i32, i32* %4
%101 = or i32 %100, 4
store i32 %101, i32* %4
br label %102
102: ; preds = %99, %95
%103 = load i32, i32* %4
ret i32 %103
}

LLVM IR (-O2):
@.str = [6 x i8] c"Flag:\00"
@.str.1 = [12 x i8] c"%s %s %s %s\00"
@.str.2 = [6 x i8] c"Gold:\00"
@.str.3 = [6 x i8] c"Objs:\00"
define i32 @parse_mail_flags(i32* %0) {
%2 = alloca [33 x i8]
%3 = alloca [33 x i8]
%4 = alloca [33 x i8]
%5 = alloca [33 x i8]
%6 = getelementptr inbounds [33 x i8], [33 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [33 x i8], [33 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %5, i64 0, i64 0
%10 = tail call i8* @findLine(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i8* %10, null
br i1 %11, label %31, label %12
12: ; preds = %1
%13 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7, i8* %8, i8* %9)
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %31
15: ; preds = %12
%16 = call i32 @asciiflag_conv(i8* %6)
%17 = call i32 @asciiflag_conv(i8* %7)
%18 = call i32 @asciiflag_conv(i8* %8)
%19 = call i32 @asciiflag_conv(i8* %9)
%20 = lshr i32 %16, 1
%21 = and i32 %20, 3
%22 = shl i32 %16, 1
%23 = and i32 %22, 16
%24 = or i32 %21, %23
%25 = and i32 %22, 32
%26 = or i32 %24, %25
%27 = and i32 %22, 64
%28 = or i32 %26, %27
%29 = and i32 %22, 128
%30 = or i32 %28, %29
br label %31
31: ; preds = %15, %12, %1
%32 = phi i32 [ 0, %12 ], [ 0, %1 ], [ %30, %15 ]
%33 = call i8* @findLine(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i8* %33, null
br i1 %34, label %40, label %35
35: ; preds = %31
%36 = call i64 @atol(i8* %33)
%37 = icmp sgt i64 %36, 0
%38 = or i32 %32, 8
%39 = select i1 %37, i32 %38, i32 %32
br label %40
40: ; preds = %35, %31
%41 = phi i32 [ %32, %31 ], [ %39, %35 ]
%42 = call i8* @findLine(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i8* %42, null
%44 = or i32 %41, 4
%45 = select i1 %43, i32 %41, i32 %44
ret i32 %45
}