#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 /*<<< orphan*/ free(char *);
int get_specific_char(char, char *, int);
int getline(char **, unsigned int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main() {
  int a_num = 0;
  int c_num = 0;
  int g_num = 0;
  int t_num = 0;
  char *buffer = NULL;
  int read;
  unsigned int len;
  read = getline(&buffer, &len, stdin);
  if (-1 != read)
    puts(buffer);
  else
    printf("No line read...\n");
  printf("read %d\n", read);
  a_num = get_specific_char('A', buffer, read);
  c_num = get_specific_char('C', buffer, read);
  g_num = get_specific_char('G', buffer, read);
  t_num = get_specific_char('T', buffer, read);
  printf("a_num %d, c_num %d g_num %d t_num %d \n", a_num, c_num, g_num, t_num);
  if (a_num)
    free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1070 <getline@plt>
mov    %eax,-0x24(%rbp)
mov    $0xffffffff,%eax
cmp    -0x24(%rbp),%eax
je     11b8 <main+0x68>
mov    -0x20(%rbp),%rdi
call   1040 <puts@plt>
jmp    11c6 <main+0x76>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    $0x41,%edi
call   1060 <get_specific_char@plt>
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    $0x43,%edi
call   1060 <get_specific_char@plt>
mov    %eax,-0xc(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    $0x47,%edi
call   1060 <get_specific_char@plt>
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    $0x54,%edi
call   1060 <get_specific_char@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1255 <main+0x105>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1070 <getline@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1189 <main+0x39>
mov    0x8(%rsp),%rdi
jmp    1190 <main+0x40>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe64(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%rsi
mov    $0x41,%edi
mov    %ebx,%edx
call   1060 <get_specific_char@plt>
mov    %eax,%r15d
mov    0x8(%rsp),%rsi
mov    $0x43,%edi
mov    %ebx,%edx
call   1060 <get_specific_char@plt>
mov    %eax,%r14d
mov    0x8(%rsp),%rsi
mov    $0x47,%edi
mov    %ebx,%edx
call   1060 <get_specific_char@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%rsi
mov    $0x54,%edi
mov    %ebx,%edx
call   1060 <get_specific_char@plt>
lea    0xe11(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     1219 <main+0xc9>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [17 x i8] c"No line read...\0A\00"
@.str.1 = [9 x i8] c"read %d\0A\00"
@.str.2 = [39 x i8] c"a_num %d, c_num %d g_num %d t_num %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i8* null, i8** %6
%9 = load i32, i32* @stdin
%10 = call i32 @getline(i8** %6, i32* %8, i32 %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = icmp ne i32 -1, %11
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i8*, i8** %6
%15 = call i32 @puts(i8* %14)
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = load i8*, i8** %6
%22 = load i32, i32* %7
%23 = call i32 @get_specific_char(i8 signext 65, i8* %21, i32 %22)
store i32 %23, i32* %2
%24 = load i8*, i8** %6
%25 = load i32, i32* %7
%26 = call i32 @get_specific_char(i8 signext 67, i8* %24, i32 %25)
store i32 %26, i32* %3
%27 = load i8*, i8** %6
%28 = load i32, i32* %7
%29 = call i32 @get_specific_char(i8 signext 71, i8* %27, i32 %28)
store i32 %29, i32* %4
%30 = load i8*, i8** %6
%31 = load i32, i32* %7
%32 = call i32 @get_specific_char(i8 signext 84, i8* %30, i32 %31)
store i32 %32, i32* %5
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %34, i32 %35, i32 %36)
%38 = load i32, i32* %2
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %18
%41 = load i8*, i8** %6
%42 = call i32 @free(i8* %41)
br label %43
43: ; preds = %40, %18
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [9 x i8] c"read %d\0A\00"
@.str.2 = [39 x i8] c"a_num %d, c_num %d g_num %d t_num %d \0A\00"
@str = [16 x i8] c"No line read...\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @stdin
%6 = call i32 @getline(i8** %1, i32* %2, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i8*, i8** %1
%10 = call i32 @puts(i8* dereferenceable(1) %9)
br label %13
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%15 = load i8*, i8** %1
%16 = call i32 @get_specific_char(i8 signext 65, i8* %15, i32 %6)
%17 = load i8*, i8** %1
%18 = call i32 @get_specific_char(i8 signext 67, i8* %17, i32 %6)
%19 = load i8*, i8** %1
%20 = call i32 @get_specific_char(i8 signext 71, i8* %19, i32 %6)
%21 = load i8*, i8** %1
%22 = call i32 @get_specific_char(i8 signext 84, i8* %21, i32 %6)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %18, i32 %20, i32 %22)
%24 = icmp eq i32 %16, 0
br i1 %24, label %28, label %25
25: ; preds = %13
%26 = load i8*, i8** %1
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %25, %13
ret i32 0
}