#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 satno(int, int);
int sscanf(char const *, char *, ...);
extern int satid2no(const char *id) {
  int sys, prn;
  char code;
  if (sscanf(id, "%d", &prn) == 1) {
    if (1 <= prn && prn <= 32) {
      sys = 0x01;
    } else if (120 <= prn && prn <= 142) {
      sys = 0x02;
    } else if (0 <= prn && prn <= 0) {
      sys = 0x10;
    } else {
      return 0;
    }
    return satno(sys, prn);
  }
  if (sscanf(id, "%c%d", &code, &prn) < 2) {
    return 0;
  }
  switch (code) {
  case 'G':
    sys = 0x01;
    prn += 1 - 1;
    break;
  case 'R':
    sys = 0x04;
    prn += 1 - 1;
    break;
  case 'E':
    sys = 0x08;
    prn += 0 - 1;
    break;
  case 'J':
    sys = 0x10;
    prn += 0 - 1;
    break;
  case 'C':
    sys = 0x20;
    prn += 1 - 1;
    break;
  case 'L':
    sys = 0x40;
    prn += 0 - 1;
    break;
  case 'S':
    sys = 0x02;
    prn += 100;
    break;
  default:
    return 0;
  }
  return satno(sys, prn);
}


x86 assembly (clang, -O0):
<satid2no>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xf0f(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    11e0 <satid2no+0xc0>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
jg     116f <satid2no+0x4f>
cmpl   $0x20,-0x18(%rbp)
jg     116f <satid2no+0x4f>
movl   $0x1,-0x14(%rbp)
jmp    11cd <satid2no+0xad>
mov    $0x78,%eax
cmp    -0x18(%rbp),%eax
jg     1196 <satid2no+0x76>
cmpl   $0x8e,-0x18(%rbp)
jg     1196 <satid2no+0x76>
movl   $0x2,-0x14(%rbp)
jmp    11c8 <satid2no+0xa8>
xor    %eax,%eax
cmp    -0x18(%rbp),%eax
jg     11b7 <satid2no+0x97>
cmpl   $0x0,-0x18(%rbp)
jg     11b7 <satid2no+0x97>
movl   $0x10,-0x14(%rbp)
jmp    11c3 <satid2no+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    12e6 <satid2no+0x1c6>
jmp    11c8 <satid2no+0xa8>
jmp    11cd <satid2no+0xad>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <satno@plt>
mov    %eax,-0x4(%rbp)
jmp    12e6 <satid2no+0x1c6>
mov    -0x10(%rbp),%rdi
lea    0xe59(%rip),%rsi
lea    -0x19(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jge    120f <satid2no+0xef>
movl   $0x0,-0x4(%rbp)
jmp    12e6 <satid2no+0x1c6>
movsbl -0x19(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x10,%eax
ja     12cc <satid2no+0x1ac>
mov    -0x28(%rbp),%rax
lea    0xdd0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x4,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x8,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x10,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x20,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x40,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x2,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0x18(%rbp)
jmp    12d8 <satid2no+0x1b8>
movl   $0x0,-0x4(%rbp)
jmp    12e6 <satid2no+0x1c6>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <satno@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<satid2no>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xf19(%rip),%rsi
xor    %ebp,%ebp
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jne    116a <satid2no+0x4a>
mov    (%rsp),%esi
lea    -0x1(%rsi),%eax
mov    $0x1,%edi
cmp    $0x20,%eax
jb     1168 <satid2no+0x48>
lea    -0x78(%rsi),%eax
mov    $0x2,%edi
cmp    $0x17,%eax
jb     1168 <satid2no+0x48>
test   %esi,%esi
jne    11ec <satid2no+0xcc>
mov    $0x10,%edi
jmp    11e5 <satid2no+0xc5>
lea    0xed3(%rip),%rsi
lea    0x7(%rsp),%rdx
mov    %rsp,%rcx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x2,%eax
jl     11ec <satid2no+0xcc>
movsbl 0x7(%rsp),%eax
add    $0xffffffbd,%eax
cmp    $0x10,%eax
ja     11ec <satid2no+0xcc>
mov    $0x1,%edi
lea    0xe5f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x20,%edi
jmp    11e2 <satid2no+0xc2>
addl   $0xffffffff,(%rsp)
mov    $0x8,%edi
jmp    11e2 <satid2no+0xc2>
addl   $0xffffffff,(%rsp)
mov    $0x10,%edi
jmp    11e2 <satid2no+0xc2>
mov    $0x4,%edi
jmp    11e2 <satid2no+0xc2>
addl   $0x64,(%rsp)
mov    $0x2,%edi
jmp    11e2 <satid2no+0xc2>
addl   $0xffffffff,(%rsp)
mov    $0x40,%edi
mov    (%rsp),%esi
call   1030 <satno@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%c%d\00"
define i32 @satid2no(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %38
10: ; preds = %1
%11 = load i32, i32* %5
%12 = icmp sle i32 1, %11
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %5
%15 = icmp sle i32 %14, 32
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %4
br label %34
17: ; preds = %13, %10
%18 = load i32, i32* %5
%19 = icmp sle i32 120, %18
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %5
%22 = icmp sle i32 %21, 142
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 2, i32* %4
br label %33
24: ; preds = %20, %17
%25 = load i32, i32* %5
%26 = icmp sle i32 0, %25
br i1 %26, label %27, label %31
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp sle i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 16, i32* %4
br label %32
31: ; preds = %27, %24
store i32 0, i32* %2
br label %72
32: ; preds = %30
br label %33
33: ; preds = %32, %23
br label %34
34: ; preds = %33, %16
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = call i32 @satno(i32 %35, i32 %36)
store i32 %37, i32* %2
br label %72
38: ; preds = %1
%39 = load i8*, i8** %3
%40 = call i32 (i8*, i8*, ...) @sscanf(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6, i32* %5)
%41 = icmp slt i32 %40, 2
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 0, i32* %2
br label %72
43: ; preds = %38
%44 = load i8, i8* %6
%45 = sext i8 %44 to i32
switch i32 %45, label %67 [
i32 71, label %46
i32 82, label %49
i32 69, label %52
i32 74, label %55
i32 67, label %58
i32 76, label %61
i32 83, label %64
]
46: ; preds = %43
store i32 1, i32* %4
%47 = load i32, i32* %5
%48 = add nsw i32 %47, 0
store i32 %48, i32* %5
br label %68
49: ; preds = %43
store i32 4, i32* %4
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 0
store i32 %51, i32* %5
br label %68
52: ; preds = %43
store i32 8, i32* %4
%53 = load i32, i32* %5
%54 = add nsw i32 %53, -1
store i32 %54, i32* %5
br label %68
55: ; preds = %43
store i32 16, i32* %4
%56 = load i32, i32* %5
%57 = add nsw i32 %56, -1
store i32 %57, i32* %5
br label %68
58: ; preds = %43
store i32 32, i32* %4
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 0
store i32 %60, i32* %5
br label %68
61: ; preds = %43
store i32 64, i32* %4
%62 = load i32, i32* %5
%63 = add nsw i32 %62, -1
store i32 %63, i32* %5
br label %68
64: ; preds = %43
store i32 2, i32* %4
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 100
store i32 %66, i32* %5
br label %68
67: ; preds = %43
store i32 0, i32* %2
br label %72
68: ; preds = %64, %61, %58, %55, %52, %49, %46
%69 = load i32, i32* %4
%70 = load i32, i32* %5
%71 = call i32 @satno(i32 %69, i32 %70)
store i32 %71, i32* %2
br label %72
72: ; preds = %68, %67, %42, %34, %31
%73 = load i32, i32* %2
ret i32 %73
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%c%d\00"
define i32 @satid2no(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = load i32, i32* %2
%9 = add i32 %8, -1
%10 = icmp ult i32 %9, 32
br i1 %10, label %16, label %11
11: ; preds = %7
%12 = add i32 %8, -120
%13 = icmp ult i32 %12, 23
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = icmp eq i32 %8, 0
br i1 %15, label %16, label %43
16: ; preds = %14, %11, %7
%17 = phi i32 [ 1, %7 ], [ 2, %11 ], [ 16, %14 ]
%18 = call i32 @satno(i32 %17, i32 %8)
br label %43
19: ; preds = %1
%20 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32* %2)
%21 = icmp slt i32 %20, 2
br i1 %21, label %43, label %22
22: ; preds = %19
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
switch i32 %24, label %43 [
i32 71, label %39
i32 82, label %25
i32 69, label %26
i32 74, label %29
i32 67, label %32
i32 76, label %33
i32 83, label %36
]
25: ; preds = %22
br label %39
26: ; preds = %22
%27 = load i32, i32* %2
%28 = add nsw i32 %27, -1
store i32 %28, i32* %2
br label %39
29: ; preds = %22
%30 = load i32, i32* %2
%31 = add nsw i32 %30, -1
store i32 %31, i32* %2
br label %39
32: ; preds = %22
br label %39
33: ; preds = %22
%34 = load i32, i32* %2
%35 = add nsw i32 %34, -1
store i32 %35, i32* %2
br label %39
36: ; preds = %22
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 100
store i32 %38, i32* %2
br label %39
39: ; preds = %22, %36, %33, %32, %29, %26, %25
%40 = phi i32 [ 2, %36 ], [ 64, %33 ], [ 32, %32 ], [ 16, %29 ], [ 8, %26 ], [ 4, %25 ], [ 1, %22 ]
%41 = load i32, i32* %2
%42 = call i32 @satno(i32 %40, i32 %41)
br label %43
43: ; preds = %22, %19, %14, %39, %16
%44 = phi i32 [ %18, %16 ], [ %42, %39 ], [ 0, %14 ], [ 0, %19 ], [ 0, %22 ]
ret i32 %44
}