#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*/ _do_scan(char *, int, int, char *, int);
main() {
  _do_scan("?1??", sizeof("?1??") - 1, 4, "20", sizeof("20") - 1);
  _do_scan("#", sizeof("#") - 1, 1, "0", sizeof("0") - 1);
  _do_scan("##", sizeof("##") - 1, 1, "0", sizeof("0") - 1);
  _do_scan("##?", sizeof("##?") - 1, 1, "0", sizeof("0") - 1);
  _do_scan("##|", sizeof("##|") - 1, 1, "0", sizeof("0") - 1);
  _do_scan("?!|", sizeof("?!|") - 1, 3, "10", sizeof("10") - 1);
  _do_scan("?!?1|", sizeof("?!?1|") - 1, 5, "120", sizeof("120") - 1);
  _do_scan("?!?a+", sizeof("?!?a+") - 1, 5, "120", sizeof("120") - 1);
  _do_scan("?2!1?2??", sizeof("?2!1?2??") - 1, 3, "20", sizeof("20") - 1);
  _do_scan("?1?2!1?2??", sizeof("?1?2!1?2??") - 1, 5, "220", sizeof("220") - 1);
  _do_scan("?1?2?!1?2??", sizeof("?1?2?!1?2??") - 1, 11, "22120",
           sizeof("22120") - 1);
  _do_scan("?1?2?!1?2?!", sizeof("?1?2?!1?2?!") - 1, 12, "221210",
           sizeof("221210") - 1);
  _do_scan("?1?123?45??", sizeof("?1?123?45??") - 1, 11, "2220",
           sizeof("2220") - 1);
  _do_scan("?1?123?45?!", sizeof("?1?123?45?!") - 1, 12, "22210",
           sizeof("22210") - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%edx
lea    0xf13(%rip),%rcx
mov    $0x2,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xecb(%rip),%rdi
mov    $0x1,%r8d
lea    0xf06(%rip),%rcx
mov    %r8d,%esi
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xeab(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%r8d
lea    0xee2(%rip),%rcx
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xe8d(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%r8d
lea    0xec1(%rip),%rcx
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xe70(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%r8d
lea    0xea0(%rip),%rcx
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xe53(%rip),%rdi
mov    $0x3,%edx
lea    0xe84(%rip),%rcx
mov    $0x2,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe37(%rip),%rdi
mov    $0x5,%edx
lea    0xe50(%rip),%rcx
mov    $0x3,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe1d(%rip),%rdi
mov    $0x5,%edx
lea    0xe30(%rip),%rcx
mov    $0x3,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe05(%rip),%rdi
mov    $0x8,%esi
mov    $0x3,%edx
lea    0xe0c(%rip),%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xde0(%rip),%rdi
mov    $0xa,%esi
mov    $0x5,%edx
lea    0xe0c(%rip),%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdc8(%rip),%rdi
mov    $0xb,%edx
lea    0xdc8(%rip),%rcx
mov    $0x5,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xdba(%rip),%rdi
mov    $0xb,%esi
mov    $0xc,%edx
lea    0xdb5(%rip),%rcx
mov    $0x6,%r8d
call   1030 <_do_scan@plt>
lea    0xdaa(%rip),%rdi
mov    $0xb,%edx
lea    0xdaa(%rip),%rcx
mov    $0x4,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xd9b(%rip),%rdi
mov    $0xb,%esi
mov    $0xc,%edx
lea    0xd96(%rip),%rcx
mov    $0x5,%r8d
call   1030 <_do_scan@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rdi
lea    0xf18(%rip),%r14
mov    $0x4,%esi
mov    $0x4,%edx
mov    %r14,%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xec5(%rip),%rdi
lea    0xf06(%rip),%rbx
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe9e(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe82(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe67(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe4c(%rip),%rdi
lea    0xe82(%rip),%rcx
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xe2d(%rip),%rdi
lea    0xe4b(%rip),%rbx
mov    $0x5,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xe0d(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdf6(%rip),%rdi
mov    $0x8,%esi
mov    $0x3,%edx
mov    %r14,%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xdd5(%rip),%rdi
lea    0xe0b(%rip),%rcx
mov    $0xa,%esi
mov    $0x5,%edx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdbd(%rip),%rdi
lea    0xdc2(%rip),%rcx
mov    $0xb,%esi
mov    $0xb,%edx
mov    $0x5,%r8d
call   1030 <_do_scan@plt>
lea    0xdac(%rip),%rdi
lea    0xdb1(%rip),%rcx
mov    $0xb,%esi
mov    $0xc,%edx
mov    $0x6,%r8d
call   1030 <_do_scan@plt>
lea    0xd9c(%rip),%rdi
lea    0xda1(%rip),%rcx
mov    $0xb,%esi
mov    $0xb,%edx
mov    $0x4,%r8d
call   1030 <_do_scan@plt>
lea    0xd8a(%rip),%rdi
lea    0xd8f(%rip),%rcx
mov    $0xb,%esi
mov    $0xc,%edx
mov    $0x5,%r8d
call   1030 <_do_scan@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"?1??\00"
@.str.1 = [3 x i8] c"20\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [3 x i8] c"##\00"
@.str.5 = [4 x i8] c"##?\00"
@.str.6 = [4 x i8] c"##|\00"
@.str.7 = [4 x i8] c"?!|\00"
@.str.8 = [3 x i8] c"10\00"
@.str.9 = [6 x i8] c"?!?1|\00"
@.str.10 = [4 x i8] c"120\00"
@.str.11 = [6 x i8] c"?!?a+\00"
@.str.12 = [9 x i8] c"?2!1?2??\00"
@.str.13 = [11 x i8] c"?1?2!1?2??\00"
@.str.14 = [4 x i8] c"220\00"
@.str.15 = [12 x i8] c"?1?2?!1?2??\00"
@.str.16 = [6 x i8] c"22120\00"
@.str.17 = [12 x i8] c"?1?2?!1?2?!\00"
@.str.18 = [7 x i8] c"221210\00"
@.str.19 = [12 x i8] c"?1?123?45??\00"
@.str.20 = [5 x i8] c"2220\00"
@.str.21 = [12 x i8] c"?1?123?45?!\00"
@.str.22 = [6 x i8] c"22210\00"
define i32 @main() {
%1 = call i32 @_do_scan(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%2 = call i32 @_do_scan(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%3 = call i32 @_do_scan(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%4 = call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%6 = call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2)
%7 = call i32 @_do_scan(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 3)
%8 = call i32 @_do_scan(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 3)
%9 = call i32 @_do_scan(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 8, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%10 = call i32 @_do_scan(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i32 10, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 3)
%11 = call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 11, i32 11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 5)
%12 = call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 11, i32 12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32 6)
%13 = call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 11, i32 11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 4)
%14 = call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i32 11, i32 12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"?1??\00"
@.str.1 = [3 x i8] c"20\00"
@.str.2 = [2 x i8] c"#\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [3 x i8] c"##\00"
@.str.5 = [4 x i8] c"##?\00"
@.str.6 = [4 x i8] c"##|\00"
@.str.7 = [4 x i8] c"?!|\00"
@.str.8 = [3 x i8] c"10\00"
@.str.9 = [6 x i8] c"?!?1|\00"
@.str.10 = [4 x i8] c"120\00"
@.str.11 = [6 x i8] c"?!?a+\00"
@.str.12 = [9 x i8] c"?2!1?2??\00"
@.str.13 = [11 x i8] c"?1?2!1?2??\00"
@.str.14 = [4 x i8] c"220\00"
@.str.15 = [12 x i8] c"?1?2?!1?2??\00"
@.str.16 = [6 x i8] c"22120\00"
@.str.17 = [12 x i8] c"?1?2?!1?2?!\00"
@.str.18 = [7 x i8] c"221210\00"
@.str.19 = [12 x i8] c"?1?123?45??\00"
@.str.20 = [5 x i8] c"2220\00"
@.str.21 = [12 x i8] c"?1?123?45?!\00"
@.str.22 = [6 x i8] c"22210\00"
define i32 @main() {
%1 = tail call i32 @_do_scan(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4, i32 4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%2 = tail call i32 @_do_scan(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%3 = tail call i32 @_do_scan(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%4 = tail call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 3, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%5 = tail call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3, i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%6 = tail call i32 @_do_scan(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2)
%7 = tail call i32 @_do_scan(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 3)
%8 = tail call i32 @_do_scan(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 5, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 3)
%9 = tail call i32 @_do_scan(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 8, i32 3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%10 = tail call i32 @_do_scan(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i32 10, i32 5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i32 3)
%11 = tail call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 11, i32 11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32 5)
%12 = tail call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i32 11, i32 12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32 6)
%13 = tail call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.19, i64 0, i64 0), i32 11, i32 11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.20, i64 0, i64 0), i32 4)
%14 = tail call i32 @_do_scan(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.21, i64 0, i64 0), i32 11, i32 12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.22, i64 0, i64 0), i32 5)
ret i32 0
}