#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 */
scalar_t__ calloc(size_t, int);
long lcs3(long *, size_t, long *, size_t, long *, size_t);
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  size_t size_a, size_b, size_c;
  long i;
  long *strA, *strB, *strC;
  scanf("%ld", &size_a);
  strA = (long *)calloc(size_a, sizeof(long));
  i = 0;
  while (i < size_a) {
    scanf("%ld", &strA[i++]);
  }
  scanf("%ld", &size_b);
  strB = (long *)calloc(size_b, sizeof(long));
  i = 0;
  while (i < size_b) {
    scanf("%ld", &strB[i++]);
  }
  scanf("%ld", &size_c);
  strC = (long *)calloc(size_c, sizeof(long));
  i = 0;
  while (i < size_c) {
    scanf("%ld", &strC[i++]);
  }
  long LCS3 = lcs3(strA, size_a, strB, size_b, strC, size_c);
  printf("%ld\n", LCS3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    11b6 <main+0x76>
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
jmp    117b <main+0x3b>
lea    0xe43(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    121d <main+0xdd>
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
shl    $0x3,%rax
add    %rax,%rsi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
jmp    11e2 <main+0xa2>
lea    0xddc(%rip),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x20(%rbp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1284 <main+0x144>
mov    -0x40(%rbp),%rsi
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
shl    $0x3,%rax
add    %rax,%rsi
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
jmp    1249 <main+0x109>
mov    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <lcs3@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xd54(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
cmpq   $0x0,0x10(%rsp)
je     11ac <main+0x6c>
lea    0xe7e(%rip),%r14
mov    %r15,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x8,%rbp
cmp    0x10(%rsp),%rbx
jb     1190 <main+0x50>
mov    %r15,0x20(%rsp)
lea    0xe48(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
cmpq   $0x0,0x8(%rsp)
je     120c <main+0xcc>
lea    0xe1b(%rip),%r14
mov    %r15,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x8,%rbp
cmp    0x8(%rsp),%rbx
jb     11f0 <main+0xb0>
lea    0xded(%rip),%rdi
xor    %ebx,%ebx
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x18(%rsp),%rdi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,%r12
cmpq   $0x0,0x18(%rsp)
je     126f <main+0x12f>
lea    0xdbe(%rip),%r13
mov    %r12,%rbp
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x18(%rsp),%rbx
add    $0x8,%rbp
cmp    %rbx,%r14
jb     1250 <main+0x110>
mov    0x10(%rsp),%rsi
mov    0x8(%rsp),%rcx
mov    0x20(%rsp),%rdi
mov    %r15,%rdx
mov    %r12,%r8
mov    %rbx,%r9
call   1030 <lcs3@plt>
lea    0xd71(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i64
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%11 = load i64, i64* %2
%12 = call i64 @calloc(i64 %11, i32 8)
%13 = inttoptr i64 %12 to i64*
store i64* %13, i64** %6
store i64 0, i64* %5
br label %14
14: ; preds = %18, %0
%15 = load i64, i64* %5
%16 = load i64, i64* %2
%17 = icmp ult i64 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i64*, i64** %6
%20 = load i64, i64* %5
%21 = add nsw i64 %20, 1
store i64 %21, i64* %5
%22 = getelementptr inbounds i64, i64* %19, i64 %20
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %22)
br label %14
24: ; preds = %14
%25 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%26 = load i64, i64* %3
%27 = call i64 @calloc(i64 %26, i32 8)
%28 = inttoptr i64 %27 to i64*
store i64* %28, i64** %7
store i64 0, i64* %5
br label %29
29: ; preds = %33, %24
%30 = load i64, i64* %5
%31 = load i64, i64* %3
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i64*, i64** %7
%35 = load i64, i64* %5
%36 = add nsw i64 %35, 1
store i64 %36, i64* %5
%37 = getelementptr inbounds i64, i64* %34, i64 %35
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %37)
br label %29
39: ; preds = %29
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %4)
%41 = load i64, i64* %4
%42 = call i64 @calloc(i64 %41, i32 8)
%43 = inttoptr i64 %42 to i64*
store i64* %43, i64** %8
store i64 0, i64* %5
br label %44
44: ; preds = %48, %39
%45 = load i64, i64* %5
%46 = load i64, i64* %4
%47 = icmp ult i64 %45, %46
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = load i64*, i64** %8
%50 = load i64, i64* %5
%51 = add nsw i64 %50, 1
store i64 %51, i64* %5
%52 = getelementptr inbounds i64, i64* %49, i64 %50
%53 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %52)
br label %44
54: ; preds = %44
%55 = load i64*, i64** %6
%56 = load i64, i64* %2
%57 = load i64*, i64** %7
%58 = load i64, i64* %3
%59 = load i64*, i64** %8
%60 = load i64, i64* %4
%61 = call i64 @lcs3(i64* %55, i64 %56, i64* %57, i64 %58, i64* %59, i64 %60)
store i64 %61, i64* %9
%62 = load i64, i64* %9
%63 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %62)
%64 = load i32, i32* %1
ret i32 %64
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = bitcast i64* %1 to i8*
%5 = bitcast i64* %2 to i8*
%6 = bitcast i64* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%8 = load i64, i64* %1
%9 = call i64 @calloc(i64 %8, i32 8)
%10 = inttoptr i64 %9 to i64*
%11 = load i64, i64* %1
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %0, %13
%14 = phi i64 [ %15, %13 ], [ 0, %0 ]
%15 = add nuw nsw i64 %14, 1
%16 = getelementptr inbounds i64, i64* %10, i64 %14
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %16)
%18 = load i64, i64* %1
%19 = icmp ult i64 %15, %18
br i1 %19, label %13, label %20
20: ; preds = %13, %0
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %2)
%22 = load i64, i64* %2
%23 = call i64 @calloc(i64 %22, i32 8)
%24 = inttoptr i64 %23 to i64*
%25 = load i64, i64* %2
%26 = icmp eq i64 %25, 0
br i1 %26, label %34, label %27
27: ; preds = %20, %27
%28 = phi i64 [ %29, %27 ], [ 0, %20 ]
%29 = add nuw nsw i64 %28, 1
%30 = getelementptr inbounds i64, i64* %24, i64 %28
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %30)
%32 = load i64, i64* %2
%33 = icmp ult i64 %29, %32
br i1 %33, label %27, label %34
34: ; preds = %27, %20
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%36 = load i64, i64* %3
%37 = call i64 @calloc(i64 %36, i32 8)
%38 = inttoptr i64 %37 to i64*
%39 = load i64, i64* %3
%40 = icmp eq i64 %39, 0
br i1 %40, label %48, label %41
41: ; preds = %34, %41
%42 = phi i64 [ %43, %41 ], [ 0, %34 ]
%43 = add nuw nsw i64 %42, 1
%44 = getelementptr inbounds i64, i64* %38, i64 %42
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %44)
%46 = load i64, i64* %3
%47 = icmp ult i64 %43, %46
br i1 %47, label %41, label %48
48: ; preds = %41, %34
%49 = phi i64 [ 0, %34 ], [ %46, %41 ]
%50 = load i64, i64* %1
%51 = load i64, i64* %2
%52 = call i64 @lcs3(i64* %10, i64 %50, i64* %24, i64 %51, i64* %38, i64 %49)
%53 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %52)
ret i32 0
}