#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 toupper(char);
int prepareLine(char *from, char *to, int *size) {
  int i = 0;
  int endOfLine = 0;
  while (!endOfLine) {
    if (from[i] == 10 || from[i] == 32 || from[i] == '\0') {
      endOfLine = 1;
      *size = i;
      to[i] = '\0';
      return 1;
    } else {
      char curr = from[i];
      switch (curr) {
      case 'a':
      case 'c':
      case 'g':
      case 't':
      case 'A':
      case 'C':
      case 'G':
      case 'T':
        to[i] = toupper(curr);
        break;
      default:
        return 0;
      }
      i++;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<prepareLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1148 <prepareLine+0x38>
jmp    127e <prepareLine+0x16e>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
je     1187 <prepareLine+0x77>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1187 <prepareLine+0x77>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11af <prepareLine+0x9f>
movl   $0x1,-0x28(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    1285 <prepareLine+0x175>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x41,%eax
je     1249 <prepareLine+0x139>
jmp    11d2 <prepareLine+0xc2>
mov    -0x30(%rbp),%eax
sub    $0x43,%eax
je     1249 <prepareLine+0x139>
jmp    11e3 <prepareLine+0xd3>
mov    -0x30(%rbp),%eax
sub    $0x47,%eax
je     1249 <prepareLine+0x139>
jmp    11f4 <prepareLine+0xe4>
mov    -0x30(%rbp),%eax
sub    $0x54,%eax
je     1249 <prepareLine+0x139>
jmp    1205 <prepareLine+0xf5>
mov    -0x30(%rbp),%eax
sub    $0x61,%eax
je     1249 <prepareLine+0x139>
jmp    1216 <prepareLine+0x106>
mov    -0x30(%rbp),%eax
sub    $0x63,%eax
je     1249 <prepareLine+0x139>
jmp    1227 <prepareLine+0x117>
mov    -0x30(%rbp),%eax
sub    $0x67,%eax
je     1249 <prepareLine+0x139>
jmp    1238 <prepareLine+0x128>
mov    -0x30(%rbp),%eax
sub    $0x74,%eax
jne    1264 <prepareLine+0x154>
jmp    1249 <prepareLine+0x139>
movsbl -0x29(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1270 <prepareLine+0x160>
movl   $0x0,-0x4(%rbp)
jmp    1285 <prepareLine+0x175>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1132 <prepareLine+0x22>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepareLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
movabs $0x8004500080045,%r13
movabs $0x100000401,%rbp
nopw   0x0(%rax,%rax,1)
movzbl (%r12,%rbx,1),%eax
cmp    $0x20,%rax
ja     1151 <prepareLine+0x41>
bt     %rax,%rbp
jb     1171 <prepareLine+0x61>
movsbl %al,%edi
lea    -0x41(%rdi),%eax
cmp    $0x33,%eax
ja     118f <prepareLine+0x7f>
bt     %rax,%r13
jae    118f <prepareLine+0x7f>
call   1030 <toupper@plt>
mov    %al,(%r15,%rbx,1)
add    $0x1,%rbx
jmp    1140 <prepareLine+0x30>
mov    %ebx,%eax
mov    %ebx,(%r14)
movb   $0x0,(%r15,%rax,1)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
jmp    1180 <prepareLine+0x70>

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

LLVM IR (-O2):
define i32 @prepareLine(i8* nocapture %0, i8* nocapture writeonly %1, i32* nocapture writeonly %2) {
br label %4
4: ; preds = %14, %3
%5 = phi i64 [ %17, %14 ], [ 0, %3 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
switch i8 %7, label %12 [
i8 10, label %8
i8 32, label %8
i8 0, label %8
]
8: ; preds = %4, %4, %4
%9 = trunc i64 %5 to i32
%10 = and i64 %5, 4294967295
store i32 %9, i32* %2
%11 = getelementptr inbounds i8, i8* %1, i64 %10
store i8 0, i8* %11
br label %18
12: ; preds = %4
%13 = sext i8 %7 to i32
switch i32 %13, label %18 [
i32 97, label %14
i32 99, label %14
i32 103, label %14
i32 116, label %14
i32 65, label %14
i32 67, label %14
i32 71, label %14
i32 84, label %14
]
14: ; preds = %12, %12, %12, %12, %12, %12, %12, %12
%15 = tail call signext i8 @toupper(i8 signext %7)
%16 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 %15, i8* %16
%17 = add nuw i64 %5, 1
br label %4
18: ; preds = %12, %8
%19 = phi i32 [ 1, %8 ], [ 0, %12 ]
ret i32 %19
}