#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 read_bsf_peripheral(int ascii, int *FLAG1, int *FLAG2, int *FLAG3,
                        int *FLAG4) {
  switch (ascii) {
  case '1':
    *FLAG1 = 1;
    if (FLAG2 != NULL)
      *FLAG2 = 0;
    if (FLAG3 != NULL)
      *FLAG3 = 0;
    if (FLAG4 != NULL)
      *FLAG4 = 0;
    break;
  case '2':
    *FLAG1 = 0;
    *FLAG2 = 1;
    *FLAG3 = 0;
    *FLAG4 = 0;
    break;
  case '3':
    *FLAG1 = 1;
    *FLAG2 = 1;
    *FLAG3 = 0;
    *FLAG4 = 0;
    break;
  case '4':
    *FLAG1 = 0;
    *FLAG2 = 0;
    *FLAG3 = 1;
    *FLAG4 = 0;
    break;
  case '5':
    *FLAG1 = 1;
    *FLAG2 = 0;
    *FLAG3 = 1;
    *FLAG4 = 0;
    break;
  case '6':
    *FLAG1 = 0;
    *FLAG2 = 1;
    *FLAG3 = 1;
    *FLAG4 = 0;
    break;
  case '7':
    *FLAG1 = 1;
    *FLAG2 = 1;
    *FLAG3 = 1;
    *FLAG4 = 0;
    break;
  case '8':
    *FLAG1 = 0;
    *FLAG2 = 0;
    *FLAG3 = 0;
    *FLAG4 = 1;
    break;
  case '9':
    *FLAG1 = 1;
    *FLAG2 = 0;
    *FLAG3 = 0;
    *FLAG4 = 1;
    break;
  case 'A':
    *FLAG1 = 0;
    *FLAG2 = 1;
    *FLAG3 = 0;
    *FLAG4 = 1;
    break;
  case 'B':
    *FLAG1 = 1;
    *FLAG2 = 1;
    *FLAG3 = 0;
    *FLAG4 = 1;
    break;
  case 'C':
    *FLAG1 = 0;
    *FLAG2 = 0;
    *FLAG3 = 1;
    *FLAG4 = 1;
    break;
  case 'D':
    *FLAG1 = 1;
    *FLAG2 = 0;
    *FLAG3 = 1;
    *FLAG4 = 1;
    break;
  case 'E':
    *FLAG1 = 0;
    *FLAG2 = 1;
    *FLAG3 = 1;
    *FLAG4 = 1;
    break;
  case 'F':
    *FLAG1 = 1;
    *FLAG2 = 1;
    *FLAG3 = 1;
    *FLAG4 = 1;
    break;
  default:
    *FLAG1 = 0;
    if (FLAG2 != NULL)
      *FLAG2 = 0;
    if (FLAG3 != NULL)
      *FLAG3 = 0;
    if (FLAG4 != NULL)
      *FLAG4 = 0;
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<read_bsf_peripheral>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffcf,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x15,%eax
ja     1404 <read_bsf_peripheral+0x304>
mov    -0x30(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     115f <read_bsf_peripheral+0x5f>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1174 <read_bsf_peripheral+0x74>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1189 <read_bsf_peripheral+0x89>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1423 <read_bsf_peripheral+0x323>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1438 <read_bsf_peripheral+0x338>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     144d <read_bsf_peripheral+0x34d>
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
jmp    1452 <read_bsf_peripheral+0x352>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_bsf_peripheral>:
push   %rbx
add    $0xffffffcf,%edi
cmp    $0x15,%edi
ja     11b2 <read_bsf_peripheral+0xb2>
mov    $0x1,%r9d
xor    %r11d,%r11d
lea    0xee3(%rip),%rax
movslq (%rax,%rdi,4),%rbx
add    %rax,%rbx
xor    %r10d,%r10d
xor    %edi,%edi
jmp    *%rbx
movl   $0x1,(%rsi)
test   %rdx,%rdx
jne    11bd <read_bsf_peripheral+0xbd>
jmp    11c3 <read_bsf_peripheral+0xc3>
mov    $0x1,%r10d
mov    $0x1,%r9d
jmp    11ab <read_bsf_peripheral+0xab>
mov    $0x1,%edi
xor    %r10d,%r10d
xor    %r9d,%r9d
xor    %r11d,%r11d
jmp    1238 <read_bsf_peripheral+0x138>
xor    %r9d,%r9d
mov    $0x1,%r10d
mov    $0x1,%edi
xor    %r11d,%r11d
jmp    1238 <read_bsf_peripheral+0x138>
mov    $0x1,%r9d
xor    %r10d,%r10d
mov    $0x1,%edi
jmp    1238 <read_bsf_peripheral+0x138>
mov    $0x1,%r10d
mov    $0x1,%r9d
mov    $0x1,%edi
jmp    1238 <read_bsf_peripheral+0x138>
mov    $0x1,%r11d
xor    %r10d,%r10d
xor    %r9d,%r9d
xor    %edi,%edi
jmp    1238 <read_bsf_peripheral+0x138>
movl   $0x0,(%rsi)
test   %rdx,%rdx
je     11c3 <read_bsf_peripheral+0xc3>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     11ce <read_bsf_peripheral+0xce>
movl   $0x0,(%rcx)
xor    %r11d,%r11d
test   %r8,%r8
jne    1240 <read_bsf_peripheral+0x140>
jmp    1243 <read_bsf_peripheral+0x143>
mov    $0x1,%r9d
xor    %r10d,%r10d
jmp    1230 <read_bsf_peripheral+0x130>
mov    $0x1,%r10d
mov    $0x1,%r9d
jmp    1230 <read_bsf_peripheral+0x130>
mov    $0x1,%edi
xor    %r10d,%r10d
xor    %r9d,%r9d
jmp    1232 <read_bsf_peripheral+0x132>
xor    %r9d,%r9d
mov    $0x1,%r10d
jmp    1220 <read_bsf_peripheral+0x120>
mov    $0x1,%r9d
xor    %r10d,%r10d
jmp    1220 <read_bsf_peripheral+0x120>
mov    $0x1,%r10d
mov    $0x1,%r9d
mov    $0x1,%edi
jmp    1232 <read_bsf_peripheral+0x132>
xor    %r9d,%r9d
mov    $0x1,%r10d
xor    %edi,%edi
mov    $0x1,%r11d
mov    %r10d,(%rsi)
mov    %r9d,(%rdx)
mov    %edi,(%rcx)
mov    %r11d,(%r8)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_bsf_peripheral(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
switch i32 %11, label %99 [
i32 49, label %12
i32 50, label %29
i32 51, label %34
i32 52, label %39
i32 53, label %44
i32 54, label %49
i32 55, label %54
i32 56, label %59
i32 57, label %64
i32 65, label %69
i32 66, label %74
i32 67, label %79
i32 68, label %84
i32 69, label %89
i32 70, label %94
]
12: ; preds = %5
%13 = load i32*, i32** %7
store i32 1, i32* %13
%14 = load i32*, i32** %8
%15 = icmp ne i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32*, i32** %8
store i32 0, i32* %17
br label %18
18: ; preds = %16, %12
%19 = load i32*, i32** %9
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32*, i32** %9
store i32 0, i32* %22
br label %23
23: ; preds = %21, %18
%24 = load i32*, i32** %10
%25 = icmp ne i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = load i32*, i32** %10
store i32 0, i32* %27
br label %28
28: ; preds = %26, %23
br label %116
29: ; preds = %5
%30 = load i32*, i32** %7
store i32 0, i32* %30
%31 = load i32*, i32** %8
store i32 1, i32* %31
%32 = load i32*, i32** %9
store i32 0, i32* %32
%33 = load i32*, i32** %10
store i32 0, i32* %33
br label %116
34: ; preds = %5
%35 = load i32*, i32** %7
store i32 1, i32* %35
%36 = load i32*, i32** %8
store i32 1, i32* %36
%37 = load i32*, i32** %9
store i32 0, i32* %37
%38 = load i32*, i32** %10
store i32 0, i32* %38
br label %116
39: ; preds = %5
%40 = load i32*, i32** %7
store i32 0, i32* %40
%41 = load i32*, i32** %8
store i32 0, i32* %41
%42 = load i32*, i32** %9
store i32 1, i32* %42
%43 = load i32*, i32** %10
store i32 0, i32* %43
br label %116
44: ; preds = %5
%45 = load i32*, i32** %7
store i32 1, i32* %45
%46 = load i32*, i32** %8
store i32 0, i32* %46
%47 = load i32*, i32** %9
store i32 1, i32* %47
%48 = load i32*, i32** %10
store i32 0, i32* %48
br label %116
49: ; preds = %5
%50 = load i32*, i32** %7
store i32 0, i32* %50
%51 = load i32*, i32** %8
store i32 1, i32* %51
%52 = load i32*, i32** %9
store i32 1, i32* %52
%53 = load i32*, i32** %10
store i32 0, i32* %53
br label %116
54: ; preds = %5
%55 = load i32*, i32** %7
store i32 1, i32* %55
%56 = load i32*, i32** %8
store i32 1, i32* %56
%57 = load i32*, i32** %9
store i32 1, i32* %57
%58 = load i32*, i32** %10
store i32 0, i32* %58
br label %116
59: ; preds = %5
%60 = load i32*, i32** %7
store i32 0, i32* %60
%61 = load i32*, i32** %8
store i32 0, i32* %61
%62 = load i32*, i32** %9
store i32 0, i32* %62
%63 = load i32*, i32** %10
store i32 1, i32* %63
br label %116
64: ; preds = %5
%65 = load i32*, i32** %7
store i32 1, i32* %65
%66 = load i32*, i32** %8
store i32 0, i32* %66
%67 = load i32*, i32** %9
store i32 0, i32* %67
%68 = load i32*, i32** %10
store i32 1, i32* %68
br label %116
69: ; preds = %5
%70 = load i32*, i32** %7
store i32 0, i32* %70
%71 = load i32*, i32** %8
store i32 1, i32* %71
%72 = load i32*, i32** %9
store i32 0, i32* %72
%73 = load i32*, i32** %10
store i32 1, i32* %73
br label %116
74: ; preds = %5
%75 = load i32*, i32** %7
store i32 1, i32* %75
%76 = load i32*, i32** %8
store i32 1, i32* %76
%77 = load i32*, i32** %9
store i32 0, i32* %77
%78 = load i32*, i32** %10
store i32 1, i32* %78
br label %116
79: ; preds = %5
%80 = load i32*, i32** %7
store i32 0, i32* %80
%81 = load i32*, i32** %8
store i32 0, i32* %81
%82 = load i32*, i32** %9
store i32 1, i32* %82
%83 = load i32*, i32** %10
store i32 1, i32* %83
br label %116
84: ; preds = %5
%85 = load i32*, i32** %7
store i32 1, i32* %85
%86 = load i32*, i32** %8
store i32 0, i32* %86
%87 = load i32*, i32** %9
store i32 1, i32* %87
%88 = load i32*, i32** %10
store i32 1, i32* %88
br label %116
89: ; preds = %5
%90 = load i32*, i32** %7
store i32 0, i32* %90
%91 = load i32*, i32** %8
store i32 1, i32* %91
%92 = load i32*, i32** %9
store i32 1, i32* %92
%93 = load i32*, i32** %10
store i32 1, i32* %93
br label %116
94: ; preds = %5
%95 = load i32*, i32** %7
store i32 1, i32* %95
%96 = load i32*, i32** %8
store i32 1, i32* %96
%97 = load i32*, i32** %9
store i32 1, i32* %97
%98 = load i32*, i32** %10
store i32 1, i32* %98
br label %116
99: ; preds = %5
%100 = load i32*, i32** %7
store i32 0, i32* %100
%101 = load i32*, i32** %8
%102 = icmp ne i32* %101, null
br i1 %102, label %103, label %105
103: ; preds = %99
%104 = load i32*, i32** %8
store i32 0, i32* %104
br label %105
105: ; preds = %103, %99
%106 = load i32*, i32** %9
%107 = icmp ne i32* %106, null
br i1 %107, label %108, label %110
108: ; preds = %105
%109 = load i32*, i32** %9
store i32 0, i32* %109
br label %110
110: ; preds = %108, %105
%111 = load i32*, i32** %10
%112 = icmp ne i32* %111, null
br i1 %112, label %113, label %115
113: ; preds = %110
%114 = load i32*, i32** %10
store i32 0, i32* %114
br label %115
115: ; preds = %113, %110
br label %116
116: ; preds = %115, %94, %89, %84, %79, %74, %69, %64, %59, %54, %49, %44, %39, %34, %29, %28
ret i32 0
}

LLVM IR (-O2):
define i32 @read_bsf_peripheral(i32 %0, i32* nocapture writeonly %1, i32* writeonly %2, i32* writeonly %3, i32* writeonly %4) {
switch i32 %0, label %27 [
i32 49, label %6
i32 50, label %35
i32 51, label %14
i32 52, label %15
i32 53, label %16
i32 54, label %17
i32 55, label %18
i32 56, label %19
i32 57, label %20
i32 65, label %21
i32 66, label %22
i32 67, label %23
i32 68, label %24
i32 69, label %25
i32 70, label %26
]
6: ; preds = %5
store i32 1, i32* %1
%7 = icmp eq i32* %2, null
br i1 %7, label %9, label %8
8: ; preds = %6
store i32 0, i32* %2
br label %9
9: ; preds = %8, %6
%10 = icmp eq i32* %3, null
br i1 %10, label %12, label %11
11: ; preds = %9
store i32 0, i32* %3
br label %12
12: ; preds = %11, %9
%13 = icmp eq i32* %4, null
br i1 %13, label %42, label %40
14: ; preds = %5
br label %35
15: ; preds = %5
br label %35
16: ; preds = %5
br label %35
17: ; preds = %5
br label %35
18: ; preds = %5
br label %35
19: ; preds = %5
br label %35
20: ; preds = %5
br label %35
21: ; preds = %5
br label %35
22: ; preds = %5
br label %35
23: ; preds = %5
br label %35
24: ; preds = %5
br label %35
25: ; preds = %5
br label %35
26: ; preds = %5
br label %35
27: ; preds = %5
store i32 0, i32* %1
%28 = icmp eq i32* %2, null
br i1 %28, label %30, label %29
29: ; preds = %27
store i32 0, i32* %2
br label %30
30: ; preds = %29, %27
%31 = icmp eq i32* %3, null
br i1 %31, label %33, label %32
32: ; preds = %30
store i32 0, i32* %3
br label %33
33: ; preds = %32, %30
%34 = icmp eq i32* %4, null
br i1 %34, label %42, label %40
35: ; preds = %5, %26, %25, %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14
%36 = phi i32 [ 1, %14 ], [ 0, %15 ], [ 1, %16 ], [ 0, %17 ], [ 1, %18 ], [ 0, %19 ], [ 1, %20 ], [ 0, %21 ], [ 1, %22 ], [ 0, %23 ], [ 1, %24 ], [ 0, %25 ], [ 1, %26 ], [ 0, %5 ]
%37 = phi i32 [ 1, %14 ], [ 0, %15 ], [ 0, %16 ], [ 1, %17 ], [ 1, %18 ], [ 0, %19 ], [ 0, %20 ], [ 1, %21 ], [ 1, %22 ], [ 0, %23 ], [ 0, %24 ], [ 1, %25 ], [ 1, %26 ], [ 1, %5 ]
%38 = phi i32 [ 0, %14 ], [ 1, %15 ], [ 1, %16 ], [ 1, %17 ], [ 1, %18 ], [ 0, %19 ], [ 0, %20 ], [ 0, %21 ], [ 0, %22 ], [ 1, %23 ], [ 1, %24 ], [ 1, %25 ], [ 1, %26 ], [ 0, %5 ]
%39 = phi i32 [ 0, %14 ], [ 0, %15 ], [ 0, %16 ], [ 0, %17 ], [ 0, %18 ], [ 1, %19 ], [ 1, %20 ], [ 1, %21 ], [ 1, %22 ], [ 1, %23 ], [ 1, %24 ], [ 1, %25 ], [ 1, %26 ], [ 0, %5 ]
store i32 %36, i32* %1
store i32 %37, i32* %2
store i32 %38, i32* %3
br label %40
40: ; preds = %35, %33, %12
%41 = phi i32 [ 0, %12 ], [ 0, %33 ], [ %39, %35 ]
store i32 %41, i32* %4
br label %42
42: ; preds = %40, %33, %12
ret i32 0
}