#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 */
char getchar();
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  char base;
  int ntimes[4] = {0};
  base = getchar();
  while (base != '\n') {
    if (base == 'A')
      ntimes[0]++;
    if (base == 'C')
      ntimes[1]++;
    if (base == 'G')
      ntimes[2]++;
    if (base == 'T')
      ntimes[3]++;
    base = getchar();
  }
  printf("%d %d %d %d\n", ntimes[0], ntimes[1], ntimes[2], ntimes[3]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     11cd <main+0x9d>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    117c <main+0x4c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    1192 <main+0x62>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
jne    11a8 <main+0x78>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
jne    11be <main+0x8e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1159 <main+0x29>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1160 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r14d
xor    %ecx,%ecx
cmp    $0x43,%al
sete   %cl
add    %ecx,%ebp
xor    %ecx,%ecx
cmp    $0x47,%al
sete   %cl
add    %ecx,%ebx
xor    %ecx,%ecx
cmp    $0x54,%al
sete   %cl
add    %ecx,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x41,%al
je     1140 <main+0x20>
cmp    $0xa,%al
jne    1144 <main+0x24>
lea    0xe8a(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %r15d,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%d %d %d %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %9, %0
%2 = phi i32 [ 0, %0 ], [ %10, %9 ]
%3 = phi i32 [ 0, %0 ], [ %13, %9 ]
%4 = phi i32 [ 0, %0 ], [ %16, %9 ]
%5 = phi i32 [ 0, %0 ], [ %19, %9 ]
%6 = tail call signext i8 (...) @getchar()
switch i8 %6, label %9 [
i8 10, label %20
i8 65, label %7
]
7: ; preds = %1
%8 = add nsw i32 %2, 1
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ %2, %1 ]
%11 = icmp eq i8 %6, 67
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %3, %12
%14 = icmp eq i8 %6, 71
%15 = zext i1 %14 to i32
%16 = add nuw nsw i32 %4, %15
%17 = icmp eq i8 %6, 84
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %5, %18
br label %1
20: ; preds = %1
%21 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %4, i32 %5)
ret i32 0
}