int main(int argc, char const *argv[]) {
  char a[64], b[64];
  while (~scanf("%[^-]-%[^\n]\n", a, b)) {
    int *ai = infoCard(a), *bi = infoCard(b);
    if (ai[0] == 6)
      printf("%s\n", a);
    else if (bi[0] == 6)
      printf("%s\n", b);
    else if (ai[0] == bi[0])
      printf("%s\n", ai[1] > bi[1] ? a : b);
    else if (ai[0] == 4)
      printf("%s\n", a);
    else if (bi[0] == 4)
      printf("%s\n", b);
    else
      printf("ERROR\n");
    free(ai);
    free(bi);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rsi
lea    -0x90(%rbp),%rdx
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
xor    $0xffffffff,%eax
cmp    $0x0,%eax
je     12f4 <main+0x1b4>
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1050 <infoCard@plt>
cltq
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
mov    $0x0,%al
call   1050 <infoCard@plt>
cltq
mov    %rax,-0xa0(%rbp)
mov    -0x98(%rbp),%rax
cmpl   $0x6,(%rax)
jne    11d0 <main+0x90>
lea    -0x50(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d7 <main+0x197>
mov    -0xa0(%rbp),%rax
cmpl   $0x6,(%rax)
jne    11fa <main+0xba>
lea    -0x90(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d2 <main+0x192>
mov    -0x98(%rbp),%rax
mov    (%rax),%eax
mov    -0xa0(%rbp),%rcx
cmp    (%rcx),%eax
jne    1264 <main+0x124>
mov    -0x98(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0xa0(%rbp),%rcx
cmp    0x4(%rcx),%eax
jle    123c <main+0xfc>
lea    -0x50(%rbp),%rax
mov    %rax,-0xa8(%rbp)
jmp    124a <main+0x10a>
lea    -0x90(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rsi
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12cd <main+0x18d>
mov    -0x98(%rbp),%rax
cmpl   $0x4,(%rax)
jne    128b <main+0x14b>
lea    -0x50(%rbp),%rsi
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c8 <main+0x188>
mov    -0xa0(%rbp),%rax
cmpl   $0x4,(%rax)
jne    12b5 <main+0x175>
lea    -0x90(%rbp),%rsi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c3 <main+0x183>
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c8 <main+0x188>
jmp    12cd <main+0x18d>
jmp    12d2 <main+0x192>
jmp    12d7 <main+0x197>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
jmp    1159 <main+0x19>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xea8(%rip),%rdi
lea    0x40(%rsp),%r13
mov    %rsp,%r14
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0xffffffff,%eax
je     1212 <main+0xd2>
lea    0xe83(%rip),%r15
lea    0xe89(%rip),%r12
jmp    11bd <main+0x7d>
cs nopw 0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
cmp    $0xffffffff,%eax
je     1212 <main+0xd2>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <infoCard@plt>
movslq %eax,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <infoCard@plt>
movslq %eax,%rbp
mov    (%rbx),%eax
cmp    $0x6,%eax
je     1190 <main+0x50>
mov    0x0(%rbp),%ecx
cmp    $0x6,%ecx
jne    11f0 <main+0xb0>
mov    %r14,%rdi
jmp    1193 <main+0x53>
nopl   0x0(%rax,%rax,1)
cmp    %ecx,%eax
jne    1203 <main+0xc3>
mov    0x4(%rbx),%eax
cmp    0x4(%rbp),%eax
mov    %r14,%rdi
cmovg  %r13,%rdi
jmp    1193 <main+0x53>
cmp    $0x4,%eax
je     1190 <main+0x50>
cmp    $0x4,%ecx
je     11e6 <main+0xa6>
mov    %r12,%rdi
jmp    1193 <main+0x53>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%[^-]-%[^\0A]\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [7 x i8] c"ERROR\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %85, %2
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
%14 = xor i32 %13, -1
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %90
16: ; preds = %10
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @infoCard to i32 (i8*, ...)*)(i8* %17)
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store i32* %20, i32** %8
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @infoCard to i32 (i8*, ...)*)(i8* %21)
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
store i32* %24, i32** %9
%25 = load i32*, i32** %8
%26 = getelementptr inbounds i32, i32* %25, i64 0
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 6
br i1 %28, label %29, label %32
29: ; preds = %16
%30 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %85
32: ; preds = %16
%33 = load i32*, i32** %9
%34 = getelementptr inbounds i32, i32* %33, i64 0
%35 = load i32, i32* %34
%36 = icmp eq i32 %35, 6
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %38)
br label %84
40: ; preds = %32
%41 = load i32*, i32** %8
%42 = getelementptr inbounds i32, i32* %41, i64 0
%43 = load i32, i32* %42
%44 = load i32*, i32** %9
%45 = getelementptr inbounds i32, i32* %44, i64 0
%46 = load i32, i32* %45
%47 = icmp eq i32 %43, %46
br i1 %47, label %48, label %63
48: ; preds = %40
%49 = load i32*, i32** %8
%50 = getelementptr inbounds i32, i32* %49, i64 1
%51 = load i32, i32* %50
%52 = load i32*, i32** %9
%53 = getelementptr inbounds i32, i32* %52, i64 1
%54 = load i32, i32* %53
%55 = icmp sgt i32 %51, %54
br i1 %55, label %56, label %58
56: ; preds = %48
%57 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
br label %60
58: ; preds = %48
%59 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
br label %60
60: ; preds = %58, %56
%61 = phi i8* [ %57, %56 ], [ %59, %58 ]
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %61)
br label %83
63: ; preds = %40
%64 = load i32*, i32** %8
%65 = getelementptr inbounds i32, i32* %64, i64 0
%66 = load i32, i32* %65
%67 = icmp eq i32 %66, 4
br i1 %67, label %68, label %71
68: ; preds = %63
%69 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %69)
br label %82
71: ; preds = %63
%72 = load i32*, i32** %9
%73 = getelementptr inbounds i32, i32* %72, i64 0
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, 4
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %77)
br label %81
79: ; preds = %71
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %81
81: ; preds = %79, %76
br label %82
82: ; preds = %81, %68
br label %83
83: ; preds = %82, %60
br label %84
84: ; preds = %83, %37
br label %85
85: ; preds = %84, %29
%86 = load i32*, i32** %8
%87 = bitcast i32* %86 to i8*
%88 = load i32*, i32** %9
%89 = bitcast i32* %88 to i8*
br label %10
90: ; preds = %10
ret i32 0
}

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