#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*/ print_arr(int *, size_t);
int /*<<< orphan*/ puts(char *);
size_t run(int *, size_t, int *, size_t);
void test_automata(int moves[], size_t moves_len, int res[], size_t res_len) {
  size_t n = run(moves, moves_len, res, res_len);
  puts("Input:");
  print_arr(moves, moves_len);
  puts("Output:");
  print_arr(res, n);
  puts("");
}


x86 assembly (clang, -O0):
<test_automata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <run@plt>
mov    %rax,-0x28(%rbp)
lea    0xe98(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <print_arr@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <print_arr@plt>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_automata>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1050 <run@plt>
mov    %rax,%r12
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <print_arr@plt>
lea    0xe90(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1060 <print_arr@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Input:\00"
@.str.1 = [8 x i8] c"Output:\00"
@.str.2 = [1 x i8] zeroinitializer
define void @test_automata(i32* %0, i64 %1, i32* %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
store i32* %0, i32** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i64 %3, i64* %8
%10 = load i32*, i32** %5
%11 = load i64, i64* %6
%12 = load i32*, i32** %7
%13 = load i64, i64* %8
%14 = call i64 @run(i32* %10, i64 %11, i32* %12, i64 %13)
store i64 %14, i64* %9
%15 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%16 = load i32*, i32** %5
%17 = load i64, i64* %6
%18 = call i32 @print_arr(i32* %16, i64 %17)
%19 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32*, i32** %7
%21 = load i64, i64* %9
%22 = call i32 @print_arr(i32* %20, i64 %21)
%23 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Input:\00"
@.str.1 = [8 x i8] c"Output:\00"
define void @test_automata(i32* %0, i64 %1, i32* %2, i64 %3) {
%5 = tail call i64 @run(i32* %0, i64 %1, i32* %2, i64 %3)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @print_arr(i32* %0, i64 %1)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @print_arr(i32* %2, i64 %5)
%10 = tail call i32 @putchar(i32 10)
ret void
}