#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 main() {
  char string[1000];
  char base;
  int i = 0;
  int length = 0;
  base = getchar();
  while (base != '\n') {
    length++;
    if (base == 'A')
      string[i] = 'T';
    if (base == 'T')
      string[i] = 'A';
    if (base == 'C')
      string[i] = 'G';
    if (base == 'G')
      string[i] = 'C';
    base = getchar();
    i++;
  }
  for (i = length - 1; i >= 0; i--) {
    printf("%c", string[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x3f8(%rbp)
movl   $0x0,-0x3fc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x3f1(%rbp)
movsbl -0x3f1(%rbp),%eax
cmp    $0xa,%eax
je     120f <main+0xef>
mov    -0x3fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3fc(%rbp)
movsbl -0x3f1(%rbp),%eax
cmp    $0x41,%eax
jne    1191 <main+0x71>
movslq -0x3f8(%rbp),%rax
movb   $0x54,-0x3f0(%rbp,%rax,1)
54
movsbl -0x3f1(%rbp),%eax
cmp    $0x54,%eax
jne    11b0 <main+0x90>
movslq -0x3f8(%rbp),%rax
movb   $0x41,-0x3f0(%rbp,%rax,1)
41
movsbl -0x3f1(%rbp),%eax
cmp    $0x43,%eax
jne    11cf <main+0xaf>
movslq -0x3f8(%rbp),%rax
movb   $0x47,-0x3f0(%rbp,%rax,1)
47
movsbl -0x3f1(%rbp),%eax
cmp    $0x47,%eax
jne    11ee <main+0xce>
movslq -0x3f8(%rbp),%rax
movb   $0x43,-0x3f0(%rbp,%rax,1)
43
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x3f1(%rbp)
mov    -0x3f8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f8(%rbp)
jmp    1153 <main+0x33>
mov    -0x3fc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3f8(%rbp)
cmpl   $0x0,-0x3f8(%rbp)
jl     125c <main+0x13c>
movslq -0x3f8(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%esi
ff
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3f8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f8(%rbp)
jmp    121e <main+0xfe>
lea    0xda0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     11a6 <main+0x86>
mov    $0x1,%ebx
lea    0xebf(%rip),%r14
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x43,%cl
mov    %cl,-0x1(%rsp,%rbx,1)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%rbx
cmp    $0xa,%al
je     1190 <main+0x70>
add    $0xbf,%al
cmp    $0x13,%al
ja     1156 <main+0x36>
mov    $0x54,%cl
movzbl %al,%eax
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    $0x47,%cl
jmp    1152 <main+0x32>
nopl   (%rax)
mov    $0x41,%cl
jmp    1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x2(%rbx),%eax
movsbl (%rsp,%rax,1),%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1190 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call signext i8 (...) @getchar()
%4 = icmp eq i8 %3, 10
br i1 %4, label %31, label %7
5: ; preds = %18
%6 = zext i32 %11 to i64
br label %22
7: ; preds = %0, %18
%8 = phi i64 [ %20, %18 ], [ 0, %0 ]
%9 = phi i32 [ %11, %18 ], [ 0, %0 ]
%10 = phi i8 [ %19, %18 ], [ %3, %0 ]
%11 = add nuw nsw i32 %9, 1
switch i8 %10, label %18 [
i8 65, label %15
i8 84, label %12
i8 67, label %13
i8 71, label %14
]
12: ; preds = %7
br label %15
13: ; preds = %7
br label %15
14: ; preds = %7
br label %15
15: ; preds = %7, %14, %12, %13
%16 = phi i8 [ 71, %13 ], [ 65, %12 ], [ 67, %14 ], [ 84, %7 ]
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %8
store i8 %16, i8* %17
br label %18
18: ; preds = %15, %7
%19 = tail call signext i8 (...) @getchar()
%20 = add nuw i64 %8, 1
%21 = icmp eq i8 %19, 10
br i1 %21, label %5, label %7
22: ; preds = %5, %22
%23 = phi i64 [ %6, %5 ], [ %24, %22 ]
%24 = add nsw i64 %23, -1
%25 = and i64 %24, 4294967295
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = tail call i32 @putchar(i32 %28)
%30 = icmp ugt i64 %23, 1
br i1 %30, label %22, label %31
31: ; preds = %22, %0
%32 = tail call i32 @putchar(i32 10)
ret i32 0
}