#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, char *, char *, char *, char *);
int statistic(char *, char);
int main(int argc, char *argv[]) {
  char da, db;
  char a[10], b[10];
  if (scanf("%s %c %s %c", a, &da, b, &db) != 4)
    return EXIT_FAILURE;
  int sum = statistic(a, da) + statistic(b, db);
  printf("%d", sum);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1c(%rbp),%rsi
lea    -0x26(%rbp),%rcx
lea    0xeab(%rip),%rdi
lea    -0x11(%rbp),%rdx
lea    -0x12(%rbp),%r8
call   1050 <scanf@plt>
cmp    $0x4,%eax
je     117c <main+0x4c>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11be <main+0x8e>
lea    -0x1c(%rbp),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <statistic@plt>
mov    %eax,-0x30(%rbp)
lea    -0x26(%rbp),%rdi
movsbl -0x12(%rbp),%esi
call   1030 <statistic@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
lea    0x16(%rsp),%rsi
lea    0xb(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0xa(%rsp),%r8
call   1050 <scanf@plt>
cmp    $0x4,%eax
jne    1193 <main+0x63>
movsbl 0xb(%rsp),%esi
lea    0x16(%rsp),%rdi
call   1030 <statistic@plt>
mov    %eax,%ebx
movsbl 0xa(%rsp),%esi
lea    0xc(%rsp),%rdi
call   1030 <statistic@plt>
add    %eax,%ebx
lea    0xe89(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    0x2e47(%rip),%rax
jmp    119a <main+0x6a>
mov    0x2e46(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s %c %s %c\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
%8 = alloca [10 x i8]
%9 = alloca [10 x i8]
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %6, i8* %12, i8* %7)
%14 = icmp ne i32 %13, 4
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = load i32, i32* @EXIT_FAILURE
store i32 %16, i32* %3
br label %28
17: ; preds = %2
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%19 = load i8, i8* %6
%20 = call i32 @statistic(i8* %18, i8 signext %19)
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%22 = load i8, i8* %7
%23 = call i32 @statistic(i8* %21, i8 signext %22)
%24 = add nsw i32 %20, %23
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* @EXIT_SUCCESS
store i32 %27, i32* %3
br label %28
28: ; preds = %17, %15
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s %c %s %c\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca [10 x i8]
%6 = alloca [10 x i8]
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %3, i8* %8, i8* %4)
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8, i8* %3
%13 = call i32 @statistic(i8* %7, i8 signext %12)
%14 = load i8, i8* %4
%15 = call i32 @statistic(i8* %8, i8 signext %14)
%16 = add nsw i32 %15, %13
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %2, %11
%19 = phi i32* [ @EXIT_SUCCESS, %11 ], [ @EXIT_FAILURE, %2 ]
%20 = load i32, i32* %19
ret i32 %20
}