#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, 2, "20", sizeof("20") - 1);
  _do_scan("#", sizeof("#") - 1, 1, "0", sizeof("0") - 1);
  _do_scan("##", sizeof("##") - 1, 2, "0", sizeof("0") - 1);
  _do_scan("##?", sizeof("##?") - 1, 2, "0", sizeof("0") - 1);
  _do_scan("##|", sizeof("##|") - 1, 3, "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, 4, "20", sizeof("20") - 1);
  _do_scan("?1?2!1?2??", sizeof("?1?2!1?2??") - 1, 6, "220", sizeof("220") - 1);
  _do_scan("?1?2?!1?2??", sizeof("?1?2?!1?2??") - 1, 9, "22120",
           sizeof("22120") - 1);
  _do_scan("?1?2?!1?2?!", sizeof("?1?2?!1?2?!") - 1, 12, "221213",
           sizeof("221213") - 1);
  _do_scan("?1?123?45??", sizeof("?1?123?45??") - 1, 9, "2220",
           sizeof("2220") - 1);
  _do_scan("?1?123?45?!", sizeof("?1?123?45?!") - 1, 12, "22213",
           sizeof("22213") - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
mov    $0x2,%r8d
lea    0xf10(%rip),%rcx
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xeca(%rip),%rdi
mov    $0x1,%r8d
lea    0xecc(%rip),%rcx
mov    %r8d,%esi
mov    %r8d,%edx
call   1030 <_do_scan@plt>
lea    0xeaa(%rip),%rdi
mov    $0x2,%edx
lea    0xeae(%rip),%rcx
mov    $0x1,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe8d(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
lea    0xe89(%rip),%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe6e(%rip),%rdi
mov    $0x3,%edx
lea    0xe6b(%rip),%rcx
mov    $0x1,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe52(%rip),%rdi
mov    $0x3,%edx
lea    0xe4a(%rip),%rcx
mov    $0x2,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe39(%rip),%rdi
mov    $0x5,%edx
lea    0xe52(%rip),%rcx
mov    $0x3,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe1f(%rip),%rdi
mov    $0x5,%edx
lea    0xe32(%rip),%rcx
mov    $0x3,%r8d
mov    %edx,%esi
call   1030 <_do_scan@plt>
lea    0xe07(%rip),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
lea    0xe0e(%rip),%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xde2(%rip),%rdi
mov    $0xa,%esi
mov    $0x6,%edx
lea    0xe0e(%rip),%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdca(%rip),%rdi
mov    $0xb,%esi
mov    $0x9,%edx
lea    0xdc5(%rip),%rcx
mov    $0x5,%r8d
call   1030 <_do_scan@plt>
lea    0xdb9(%rip),%rdi
mov    $0xb,%esi
mov    $0xc,%edx
lea    0xdb4(%rip),%rcx
mov    $0x6,%r8d
call   1030 <_do_scan@plt>
lea    0xda9(%rip),%rdi
mov    $0xb,%esi
mov    $0x9,%edx
lea    0xda4(%rip),%rcx
mov    $0x4,%r8d
call   1030 <_do_scan@plt>
lea    0xd97(%rip),%rdi
mov    $0xb,%esi
mov    $0xc,%edx
lea    0xd92(%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    0xf1b(%rip),%r14
mov    $0x4,%esi
mov    $0x2,%edx
mov    %r14,%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xec5(%rip),%rdi
lea    0xecd(%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    $0x2,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe82(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe67(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
mov    %rbx,%rcx
mov    $0x1,%r8d
call   1030 <_do_scan@plt>
lea    0xe4c(%rip),%rdi
lea    0xe49(%rip),%rcx
mov    $0x3,%esi
mov    $0x3,%edx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xe30(%rip),%rdi
lea    0xe4e(%rip),%rbx
mov    $0x5,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xe10(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    %rbx,%rcx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdf9(%rip),%rdi
mov    $0x8,%esi
mov    $0x4,%edx
mov    %r14,%rcx
mov    $0x2,%r8d
call   1030 <_do_scan@plt>
lea    0xdd8(%rip),%rdi
lea    0xe0e(%rip),%rcx
mov    $0xa,%esi
mov    $0x6,%edx
mov    $0x3,%r8d
call   1030 <_do_scan@plt>
lea    0xdc0(%rip),%rdi
lea    0xdc5(%rip),%rcx
mov    $0xb,%esi
mov    $0x9,%edx
mov    $0x5,%r8d
call   1030 <_do_scan@plt>
lea    0xdaf(%rip),%rdi
lea    0xdb4(%rip),%rcx
mov    $0xb,%esi
mov    $0xc,%edx
mov    $0x6,%r8d
call   1030 <_do_scan@plt>
lea    0xd9f(%rip),%rdi
lea    0xda4(%rip),%rcx
mov    $0xb,%esi
mov    $0x9,%edx
mov    $0x4,%r8d
call   1030 <_do_scan@plt>
lea    0xd8d(%rip),%rdi
lea    0xd92(%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"221213\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"22213\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 2, 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 2, 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 2, 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 3, 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 4, 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 6, 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 9, 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 9, 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"221213\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"22213\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 2, 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 2, 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 2, 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 3, 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 4, 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 6, 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 9, 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 9, 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
}