#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(1, "aa\n", sizeof("aa\n") - 1);
  _do_scan(1, "aaa\n", sizeof("aaa\n") - 1);
  _do_scan(1, "aaaa\n", sizeof("aaaa\n") - 1);
  _do_scan(1, "\n", sizeof("\n") - 1);
  _do_scan(0, "q", sizeof("q") - 1);
  _do_scan(0, "a", sizeof("a") - 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xee3(%rip),%rsi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
mov    $0x1,%edi
lea    0xecc(%rip),%rsi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
mov    $0x1,%edi
lea    0xeb5(%rip),%rsi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
mov    $0x1,%edi
lea    0xe9e(%rip),%rsi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
mov    $0x1,%edx
lea    0xe8c(%rip),%rsi
mov    %edx,%edi
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xe7e(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %edi,%edi
lea    0xe6d(%rip),%rsi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeeb(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1030 <_do_scan@plt>
lea    0xed4(%rip),%rsi
mov    $0x1,%edi
mov    $0x3,%edx
call   1030 <_do_scan@plt>
lea    0xebd(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1030 <_do_scan@plt>
lea    0xea6(%rip),%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1030 <_do_scan@plt>
lea    0xe94(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xe80(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
lea    0xe6f(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <_do_scan@plt>
xor    %eax,%eax
pop    %rcx
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"\0A\00"
@.str.5 = [2 x i8] c"q\00"
@.str.6 = [2 x i8] c"a\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 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%3 = call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%4 = call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%5 = call i32 @_do_scan(i32 1, 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 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, 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"\0A\00"
@.str.5 = [2 x i8] c"q\00"
@.str.6 = [2 x i8] c"a\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 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%3 = tail call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%4 = tail call i32 @_do_scan(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 5)
%5 = tail call i32 @_do_scan(i32 1, 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 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0), i32 1)
ret i32 0
}