#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(unsigned char);
double libMolWTFunc(unsigned char *sequence) {
  int i;
  double result;
  char t;
  result = 0.0;
  for (i = 0; sequence[i]; i++) {
    t = toupper(sequence[i]);
    switch (t) {
    case 'C': {
      result += 289.2;
      break;
    }
    case 'A': {
      result += 313.2;
      break;
    }
    case 'G': {
      result += 329.2;
      break;
    }
    case 'T': {
      result += 304.2;
      break;
    }
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<libMolWTFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11e5 <libMolWTFunc+0xd5>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x13,%eax
ja     11d2 <libMolWTFunc+0xc2>
mov    -0x28(%rbp),%rax
lea    0xeae(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xe95(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d2 <libMolWTFunc+0xc2>
movsd  0xe76(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d2 <libMolWTFunc+0xc2>
movsd  0xe57(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d2 <libMolWTFunc+0xc2>
movsd  0xe38(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d7 <libMolWTFunc+0xc7>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <libMolWTFunc+0x1b>
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libMolWTFunc>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     11af <libMolWTFunc+0x9f>
mov    %rdi,%rbx
add    $0x1,%rbx
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
lea    0xeeb(%rip),%r14
jmp    115d <libMolWTFunc+0x4d>
nopw   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
addsd  0xeb3(%rip),%xmm0
movsd  %xmm0,(%rsp)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     11b8 <libMolWTFunc+0xa8>
movzbl %al,%edi
call   1030 <toupper@plt>
movsbl %al,%eax
add    $0xffffffbf,%eax
cmp    $0x13,%eax
ja     1152 <libMolWTFunc+0x42>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
movsd  (%rsp),%xmm0
addsd  0xe8a(%rip),%xmm0
jmp    114d <libMolWTFunc+0x3d>
nopl   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
addsd  0xe7b(%rip),%xmm0
jmp    114d <libMolWTFunc+0x3d>
nop
movsd  (%rsp),%xmm0
addsd  0xe5b(%rip),%xmm0
jmp    114d <libMolWTFunc+0x3d>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @libMolWTFunc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca double
%5 = alloca i8
store i8* %0, i8** %2
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %6
6: ; preds = %35, %1
%7 = load i8*, i8** %2
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %38
13: ; preds = %6
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call signext i8 @toupper(i8 zeroext %18)
store i8 %19, i8* %5
%20 = load i8, i8* %5
%21 = sext i8 %20 to i32
switch i32 %21, label %34 [
i32 67, label %22
i32 65, label %25
i32 71, label %28
i32 84, label %31
]
22: ; preds = %13
%23 = load double, double* %4
%24 = fadd double %23, 2.892000e+02
store double %24, double* %4
br label %34
25: ; preds = %13
%26 = load double, double* %4
%27 = fadd double %26, 3.132000e+02
store double %27, double* %4
br label %34
28: ; preds = %13
%29 = load double, double* %4
%30 = fadd double %29, 3.292000e+02
store double %30, double* %4
br label %34
31: ; preds = %13
%32 = load double, double* %4
%33 = fadd double %32, 3.042000e+02
store double %33, double* %4
br label %34
34: ; preds = %13, %31, %28, %25, %22
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %6
38: ; preds = %6
%39 = load double, double* %4
ret double %39
}

LLVM IR (-O2):
define double @libMolWTFunc(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %24, label %4
4: ; preds = %1, %18
%5 = phi i64 [ %20, %18 ], [ 0, %1 ]
%6 = phi i8 [ %22, %18 ], [ %2, %1 ]
%7 = phi double [ %19, %18 ], [ 0.000000e+00, %1 ]
%8 = tail call signext i8 @toupper(i8 zeroext %6)
%9 = sext i8 %8 to i32
switch i32 %9, label %18 [
i32 67, label %10
i32 65, label %12
i32 71, label %14
i32 84, label %16
]
10: ; preds = %4
%11 = fadd double %7, 2.892000e+02
br label %18
12: ; preds = %4
%13 = fadd double %7, 3.132000e+02
br label %18
14: ; preds = %4
%15 = fadd double %7, 3.292000e+02
br label %18
16: ; preds = %4
%17 = fadd double %7, 3.042000e+02
br label %18
18: ; preds = %10, %12, %14, %16, %4
%19 = phi double [ %7, %4 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ]
%20 = add nuw i64 %5, 1
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %4
24: ; preds = %18, %1
%25 = phi double [ 0.000000e+00, %1 ], [ %19, %18 ]
ret double %25
}