#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(int, char *, int);
main() {
  _do_scan(1, "a\n", sizeof("a\n") - 1);
  _do_scan(2, "aa\n", sizeof("aa\n") - 1);
  _do_scan(2, "aaa\n", sizeof("aaa\n") - 1);
  _do_scan(4, "aaaa\n", sizeof("aaaa\n") - 1);
  _do_scan(0, "q", sizeof("q") - 1);
  _do_scan(0, "a", sizeof("a") - 1);
  _do_scan(1, "A\n", sizeof("A\n") - 1);
  _do_scan(2, "AA\n", sizeof("AA\n") - 1);
  _do_scan(2, "aAa\n", sizeof("aAa\n") - 1);
  _do_scan(4, "AaaA\n", sizeof("AaaA\n") - 1);
  _do_scan(5, "Q", sizeof("Q") - 1);
  _do_scan(4, "AaaAa\n", sizeof("AaaAa\n") - 1);
  _do_scan(3, "AaaAaA\n", sizeof("AaaAaA\n") - 1);
  _do_scan(5, "A", sizeof("A") - 1);
  _do_scan(0, "\n", sizeof("\n") - 1);
  _do_scan(5, "0", sizeof("0") - 1);
  _do_scan(0, "a", sizeof("a") - 1);
  _do_scan(0, "q", sizeof("q") - 1);
  _do_scan(5, "x", sizeof("x") - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xefa(%rip),%rsi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
mov    $0x2,%edi
lea    0xecc(%rip),%rsi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
mov    $0x2,%edi
lea    0xeb5(%rip),%rsi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
mov    $0x4,%edi
lea    0xe9e(%rip),%rsi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xe91(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xe80(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
mov    $0x1,%edi
lea    0xe6d(%rip),%rsi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
mov    $0x2,%edi
lea    0xe56(%rip),%rsi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
mov    $0x2,%edi
lea    0xe4e(%rip),%rsi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
mov    $0x4,%edi
lea    0xe2e(%rip),%rsi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
mov    $0x5,%edi
lea    0xe1e(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
mov    $0x4,%edi
lea    0xe0a(%rip),%rsi
mov    $0x6,%edx
call   1030 <_do_scan@plt>
mov    $0x3,%edi
lea    0xdfb(%rip),%rsi
mov    $0x7,%edx
call   1030 <_do_scan@plt>
mov    $0x5,%edi
lea    0xded(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xdc1(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
mov    $0x5,%edi
lea    0xdc6(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xd94(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xd7f(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
mov    $0x5,%edi
lea    0xd8c(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeff(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
lea    0xed1(%rip),%rsi
mov    $0x2,%edi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
lea    0xeba(%rip),%rsi
mov    $0x2,%edi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
lea    0xea3(%rip),%rsi
mov    $0x4,%edi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
lea    0xe93(%rip),%r14
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xe7f(%rip),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xe6c(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
lea    0xe55(%rip),%rsi
mov    $0x2,%edi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
lea    0xe4d(%rip),%rsi
mov    $0x2,%edi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
lea    0xe2d(%rip),%rsi
mov    $0x4,%edi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
lea    0xe1d(%rip),%rsi
mov    $0x5,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xe09(%rip),%rsi
mov    $0x4,%edi
mov    $0x6,%edx
call   1030 <_do_scan@plt>
lea    0xdfa(%rip),%rsi
mov    $0x3,%edi
mov    $0x7,%edx
call   1030 <_do_scan@plt>
lea    0xdec(%rip),%rsi
mov    $0x5,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xdbd(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xdc5(%rip),%rsi
mov    $0x5,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xd93(%rip),%rsi
mov    $0x5,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"a\0A\00"
@.str.1 = [4 x i8] c"aa\0A\00"
@.str.2 = [5 x i8] c"aaa\0A\00"
@.str.3 = [6 x i8] c"aaaa\0A\00"
@.str.4 = [2 x i8] c"q\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [3 x i8] c"A\0A\00"
@.str.7 = [4 x i8] c"AA\0A\00"
@.str.8 = [5 x i8] c"aAa\0A\00"
@.str.9 = [6 x i8] c"AaaA\0A\00"
@.str.10 = [2 x i8] c"Q\00"
@.str.11 = [7 x i8] c"AaaAa\0A\00"
@.str.12 = [8 x i8] c"AaaAaA\0A\00"
@.str.13 = [2 x i8] c"A\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [2 x i8] c"0\00"
@.str.16 = [2 x i8] c"x\00"
define i32 @main() {
%1 = call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%3 = call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%4 = call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%5 = call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%6 = call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%7 = call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%8 = call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%9 = call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%10 = call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%11 = call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 1)
%12 = call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 6)
%13 = call i32 @_do_scan(i32 3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 7)
%14 = call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 1)
%15 = call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32 1)
%16 = call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 1)
%17 = call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%18 = call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%19 = call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0), i32 1)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"a\0A\00"
@.str.1 = [4 x i8] c"aa\0A\00"
@.str.2 = [5 x i8] c"aaa\0A\00"
@.str.3 = [6 x i8] c"aaaa\0A\00"
@.str.4 = [2 x i8] c"q\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [3 x i8] c"A\0A\00"
@.str.7 = [4 x i8] c"AA\0A\00"
@.str.8 = [5 x i8] c"aAa\0A\00"
@.str.9 = [6 x i8] c"AaaA\0A\00"
@.str.10 = [2 x i8] c"Q\00"
@.str.11 = [7 x i8] c"AaaAa\0A\00"
@.str.12 = [8 x i8] c"AaaAaA\0A\00"
@.str.13 = [2 x i8] c"A\00"
@.str.14 = [2 x i8] c"\0A\00"
@.str.15 = [2 x i8] c"0\00"
@.str.16 = [2 x i8] c"x\00"
define i32 @main() {
%1 = tail call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%3 = tail call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%4 = tail call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%5 = tail call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%6 = tail call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%7 = tail call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 2)
%8 = tail call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%9 = tail call i32 @_do_scan(i32 2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32 4)
%10 = tail call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%11 = tail call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 1)
%12 = tail call i32 @_do_scan(i32 4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 6)
%13 = tail call i32 @_do_scan(i32 3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i32 7)
%14 = tail call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 1)
%15 = tail call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0), i32 1)
%16 = tail call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 1)
%17 = tail call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0), i32 1)
%18 = tail call i32 @_do_scan(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%19 = tail call i32 @_do_scan(i32 5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0), i32 1)
ret i32 0
}