#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__ gets(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ puts(char *);
char *strrchr(char *, char);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  char s[256];
  (void)argv;
  (void)argc;
  while (gets(s)) {
    int len = 0;
    char *p = strstr(s, "FMT__");
    if (p) {
      p += 5;
      while (*p != ' ' && *p != '\t') {
        switch (*p) {
        case 'H':
        case 'D':
        case 'C':
          len += 2;
          break;
        case 'P':
          len += 2;
          break;
        case 'A':
          len += 8;
          break;
        case 'L':
          len += 4;
          break;
        }
        p += 2;
      }
      p = strrchr(s, ',');
      p[1] = 0;
      printf("%s %d\n", s, len);
    } else {
      puts(s);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     12f1 <main+0x1a1>
movl   $0x0,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1070 <strstr@plt>
mov    %rax,-0x120(%rbp)
cmpq   $0x0,-0x120(%rbp)
je     12e0 <main+0x190>
mov    -0x120(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x121(%rbp)
je     11f4 <main+0xa4>
mov    -0x120(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
setne  %al
mov    %al,-0x121(%rbp)
mov    -0x121(%rbp),%al
test   $0x1,%al
jne    1207 <main+0xb7>
jmp    129f <main+0x14f>
mov    -0x120(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x130(%rbp)
sub    $0xf,%eax
ja     1288 <main+0x138>
mov    -0x130(%rbp),%rax
lea    0xdcc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x114(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x114(%rbp)
jmp    1288 <main+0x138>
mov    -0x114(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x114(%rbp)
jmp    1288 <main+0x138>
mov    -0x114(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x114(%rbp)
jmp    1288 <main+0x138>
mov    -0x114(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x114(%rbp)
mov    -0x120(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x120(%rbp)
jmp    11c3 <main+0x73>
lea    -0x110(%rbp),%rdi
mov    $0x2c,%esi
call   1050 <strrchr@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
movb   $0x0,0x1(%rax)
lea    -0x110(%rbp),%rsi
mov    -0x114(%rbp),%edx
lea    0xd70(%rip),%rdi
call   1040 <printf@plt>
jmp    12ec <main+0x19c>
lea    -0x110(%rbp),%rdi
call   1030 <puts@plt>
jmp    1169 <main+0x19>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x100,%rsp
mov    %rsp,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     122a <main+0xda>
lea    0xec9(%rip),%r14
mov    %rsp,%r12
lea    0xec5(%rip),%r15
lea    0xe78(%rip),%rbx
jmp    11bb <main+0x6b>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x2c,%esi
call   1050 <strrchr@plt>
movb   $0x0,0x1(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1040 <printf@plt>
mov    %r12,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     122a <main+0xda>
mov    %r12,%rdi
mov    %r14,%rsi
call   1070 <strstr@plt>
test   %rax,%rax
je     1220 <main+0xd0>
add    $0x5,%rax
xor    %ebp,%ebp
jmp    11e7 <main+0x97>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%ebp
add    $0x2,%rax
movsbl (%rax),%ecx
cmp    $0x9,%ecx
je     1190 <main+0x40>
cmp    $0x20,%cl
je     1190 <main+0x40>
add    $0xffffffbf,%ecx
cmp    $0xf,%ecx
ja     1211 <main+0xc1>
movslq (%rbx,%rcx,4),%rcx
add    %rbx,%rcx
jmp    *%rcx
add    $0x8,%ebp
add    $0x2,%rax
jmp    11e7 <main+0x97>
add    $0x4,%ebp
add    $0x2,%rax
jmp    11e7 <main+0x97>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
jmp    11ae <main+0x5e>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"FMT__\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = load i32, i32* %4
br label %11
11: ; preds = %65, %2
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%13 = call i64 @gets(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %66
15: ; preds = %11
store i32 0, i32* %7
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%17 = call i8* @strstr(i8* %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %17, i8** %8
%18 = load i8*, i8** %8
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %62
20: ; preds = %15
%21 = load i8*, i8** %8
%22 = getelementptr inbounds i8, i8* %21, i64 5
store i8* %22, i8** %8
br label %23
23: ; preds = %51, %20
%24 = load i8*, i8** %8
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 32
br i1 %27, label %28, label %33
28: ; preds = %23
%29 = load i8*, i8** %8
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 9
br label %33
33: ; preds = %28, %23
%34 = phi i1 [ false, %23 ], [ %32, %28 ]
br i1 %34, label %35, label %54
35: ; preds = %33
%36 = load i8*, i8** %8
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
switch i32 %38, label %51 [
i32 72, label %39
i32 68, label %39
i32 67, label %39
i32 80, label %42
i32 65, label %45
i32 76, label %48
]
39: ; preds = %35, %35, %35
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 2
store i32 %41, i32* %7
br label %51
42: ; preds = %35
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 2
store i32 %44, i32* %7
br label %51
45: ; preds = %35
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 8
store i32 %47, i32* %7
br label %51
48: ; preds = %35
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 4
store i32 %50, i32* %7
br label %51
51: ; preds = %35, %48, %45, %42, %39
%52 = load i8*, i8** %8
%53 = getelementptr inbounds i8, i8* %52, i64 2
store i8* %53, i8** %8
br label %23
54: ; preds = %33
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%56 = call i8* @strrchr(i8* %55, i8 signext 44)
store i8* %56, i8** %8
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i64 1
store i8 0, i8* %58
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%60 = load i32, i32* %7
%61 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %59, i32 %60)
br label %65
62: ; preds = %15
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%64 = call i32 @puts(i8* %63)
br label %65
65: ; preds = %62, %54
br label %11
66: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"FMT__\00"
@.str.1 = [7 x i8] c"%s %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i64 @gets(i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %38, label %7
7: ; preds = %2, %35
%8 = call i8* @strstr(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i8* %8, null
br i1 %9, label %33, label %10
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %8, i64 5
br label %12
12: ; preds = %26, %10
%13 = phi i32 [ 0, %10 ], [ %27, %26 ]
%14 = phi i8* [ %11, %10 ], [ %28, %26 ]
%15 = load i8, i8* %14
switch i8 %15, label %16 [
i8 32, label %29
i8 9, label %29
]
16: ; preds = %12
%17 = sext i8 %15 to i32
switch i32 %17, label %26 [
i32 72, label %18
i32 68, label %18
i32 67, label %18
i32 80, label %20
i32 65, label %22
i32 76, label %24
]
18: ; preds = %16, %16, %16
%19 = add nsw i32 %13, 2
br label %26
20: ; preds = %16
%21 = add nsw i32 %13, 2
br label %26
22: ; preds = %16
%23 = add nsw i32 %13, 8
br label %26
24: ; preds = %16
%25 = add nsw i32 %13, 4
br label %26
26: ; preds = %16, %24, %22, %20, %18
%27 = phi i32 [ %13, %16 ], [ %25, %24 ], [ %23, %22 ], [ %21, %20 ], [ %19, %18 ]
%28 = getelementptr inbounds i8, i8* %14, i64 2
br label %12
29: ; preds = %12, %12
%30 = call i8* @strrchr(i8* %4, i8 signext 44)
%31 = getelementptr inbounds i8, i8* %30, i64 1
store i8 0, i8* %31
%32 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %13)
br label %35
33: ; preds = %7
%34 = call i32 @puts(i8* %4)
br label %35
35: ; preds = %33, %29
%36 = call i64 @gets(i8* %4)
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %7
38: ; preds = %35, %2
ret i32 0
}