#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 */
double divalent_to_monovalent(double, double);
double log10(double);
unsigned int strlen(char const *);
double long_seq_tm(const char *s, int start, int len, double salt_conc,
                   double divalent_conc, double dntp_conc) {
  int GC_count = 0;
  const char *p, *end;
  if (divalent_to_monovalent(divalent_conc, dntp_conc) == -999999.9999)
    return -999999.9999;
  salt_conc = salt_conc + divalent_to_monovalent(divalent_conc, dntp_conc);
  if ((unsigned)(start + len) > strlen(s) || start < 0 || len <= 0)
    return -999999.9999;
  end = &s[start + len];
  for (p = &s[start]; p < end; p++) {
    if ('G' == *p || 'C' == *p) {
      GC_count++;
    }
  }
  return 81.5 + (16.6 * log10(salt_conc / 1000.0)) +
         (41.0 * (((double)GC_count) / len)) - (600.0 / len);
}


x86 assembly (clang, -O0):
<long_seq_tm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <divalent_to_monovalent@plt>
movsd  0xe91(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1191 <long_seq_tm+0x61>
jp     1191 <long_seq_tm+0x61>
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e1 <long_seq_tm+0x1b1>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1030 <divalent_to_monovalent@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
cmp    %ecx,%eax
ja     11ee <long_seq_tm+0xbe>
cmpl   $0x0,-0x14(%rbp)
jl     11ee <long_seq_tm+0xbe>
cmpl   $0x0,-0x18(%rbp)
jg     1200 <long_seq_tm+0xd0>
movsd  0xe0a(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12e1 <long_seq_tm+0x1b1>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x48(%rbp),%rax
jae    1278 <long_seq_tm+0x148>
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x47,%eax
cmp    %ecx,%eax
je     1259 <long_seq_tm+0x129>
mov    -0x40(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x43,%eax
cmp    %ecx,%eax
jne    1262 <long_seq_tm+0x132>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1267 <long_seq_tm+0x137>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1223 <long_seq_tm+0xf3>
movsd  -0x20(%rbp),%xmm0
movsd  0xda3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <log10@plt>
movaps %xmm0,%xmm1
movsd  0xd7f(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd7b(%rip),%xmm0
addsd  %xmm0,%xmm1
cvtsi2sdl -0x34(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm2
divsd  %xmm2,%xmm0
movsd  0xd51(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm2
movsd  0xd34(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long_seq_tm>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x10(%rsp)
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%r15
movsd  %xmm1,0x18(%rsp)
movapd %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm1
call   1030 <divalent_to_monovalent@plt>
movsd  0xe98(%rip),%xmm3
ucomisd %xmm3,%xmm0
jne    1174 <long_seq_tm+0x44>
jnp    124f <long_seq_tm+0x11f>
movsd  0x18(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <divalent_to_monovalent@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %r14d,%r14d
jle    1247 <long_seq_tm+0x117>
test   %ebx,%ebx
js     1247 <long_seq_tm+0x117>
lea    (%r14,%rbx,1),%ecx
cmp    %eax,%ecx
movsd  0xe4e(%rip),%xmm3
ja     124f <long_seq_tm+0x11f>
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movslq %ecx,%rax
mov    %ebx,%ecx
xor    %ebx,%ebx
cmp    %rax,%rcx
jge    11f9 <long_seq_tm+0xc9>
add    %r15,%rax
add    %r15,%rcx
xor    %ebx,%ebx
jmp    11e9 <long_seq_tm+0xb9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rcx
cmp    %rax,%rcx
jae    11f9 <long_seq_tm+0xc9>
movzbl (%rcx),%edx
or     $0x4,%dl
cmp    $0x47,%dl
jne    11e0 <long_seq_tm+0xb0>
add    $0x1,%ebx
jmp    11e0 <long_seq_tm+0xb0>
divsd  0xe07(%rip),%xmm0
call   1050 <log10@plt>
mulsd  0xe02(%rip),%xmm0
addsd  0xe02(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %r14d,%xmm2
divsd  %xmm2,%xmm1
mulsd  0xdef(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xdeb(%rip),%xmm3
divsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
jmp    124f <long_seq_tm+0x11f>
movsd  0xdb1(%rip),%xmm3
movapd %xmm3,%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @long_seq_tm(i8* %0, i32 %1, i32 %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store i32 0, i32* %14
%17 = load double, double* %12
%18 = load double, double* %13
%19 = call double @divalent_to_monovalent(double %17, double %18)
%20 = fcmp oeq double %19, 0xC12E847FFFF2E48F
br i1 %20, label %21, label %22
21: ; preds = %6
store double 0xC12E847FFFF2E48F, double* %7
br label %88
22: ; preds = %6
%23 = load double, double* %11
%24 = load double, double* %12
%25 = load double, double* %13
%26 = call double @divalent_to_monovalent(double %24, double %25)
%27 = fadd double %23, %26
store double %27, double* %11
%28 = load i32, i32* %9
%29 = load i32, i32* %10
%30 = add nsw i32 %28, %29
%31 = load i8*, i8** %8
%32 = call i32 @strlen(i8* %31)
%33 = icmp ugt i32 %30, %32
br i1 %33, label %40, label %34
34: ; preds = %22
%35 = load i32, i32* %9
%36 = icmp slt i32 %35, 0
br i1 %36, label %40, label %37
37: ; preds = %34
%38 = load i32, i32* %10
%39 = icmp sle i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %37, %34, %22
store double 0xC12E847FFFF2E48F, double* %7
br label %88
41: ; preds = %37
%42 = load i8*, i8** %8
%43 = load i32, i32* %9
%44 = load i32, i32* %10
%45 = add nsw i32 %43, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %42, i64 %46
store i8* %47, i8** %16
%48 = load i8*, i8** %8
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
store i8* %51, i8** %15
br label %52
52: ; preds = %70, %41
%53 = load i8*, i8** %15
%54 = load i8*, i8** %16
%55 = icmp ult i8* %53, %54
br i1 %55, label %56, label %73
56: ; preds = %52
%57 = load i8*, i8** %15
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 71, %59
br i1 %60, label %66, label %61
61: ; preds = %56
%62 = load i8*, i8** %15
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 67, %64
br i1 %65, label %66, label %69
66: ; preds = %61, %56
%67 = load i32, i32* %14
%68 = add nsw i32 %67, 1
store i32 %68, i32* %14
br label %69
69: ; preds = %66, %61
br label %70
70: ; preds = %69
%71 = load i8*, i8** %15
%72 = getelementptr inbounds i8, i8* %71, i32 1
store i8* %72, i8** %15
br label %52
73: ; preds = %52
%74 = load double, double* %11
%75 = fdiv double %74, 1.000000e+03
%76 = call double @log10(double %75)
%77 = call double @llvm.fmuladd.f64(double 1.660000e+01, double %76, double 8.150000e+01)
%78 = load i32, i32* %14
%79 = sitofp i32 %78 to double
%80 = load i32, i32* %10
%81 = sitofp i32 %80 to double
%82 = fdiv double %79, %81
%83 = call double @llvm.fmuladd.f64(double 4.100000e+01, double %82, double %77)
%84 = load i32, i32* %10
%85 = sitofp i32 %84 to double
%86 = fdiv double 6.000000e+02, %85
%87 = fsub double %83, %86
store double %87, double* %7
br label %88
88: ; preds = %73, %40, %21
%89 = load double, double* %7
ret double %89
}

LLVM IR (-O2):
define double @long_seq_tm(i8* %0, i32 %1, i32 %2, double %3, double %4, double %5) {
%7 = tail call double @divalent_to_monovalent(double %4, double %5)
%8 = fcmp oeq double %7, 0xC12E847FFFF2E48F
br i1 %8, label %47, label %9
9: ; preds = %6
%10 = tail call double @divalent_to_monovalent(double %4, double %5)
%11 = fadd double %10, %3
%12 = add nsw i32 %2, %1
%13 = tail call i32 @strlen(i8* %0)
%14 = icmp ugt i32 %12, %13
%15 = icmp slt i32 %1, 0
%16 = or i1 %15, %14
%17 = icmp slt i32 %2, 1
%18 = or i1 %17, %16
br i1 %18, label %47, label %19
19: ; preds = %9
%20 = sext i32 %12 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = zext i32 %1 to i64
%23 = icmp slt i64 %22, %20
br i1 %23, label %24, label %36
24: ; preds = %19
%25 = getelementptr inbounds i8, i8* %0, i64 %22
br label %26
26: ; preds = %24, %32
%27 = phi i8* [ %34, %32 ], [ %25, %24 ]
%28 = phi i32 [ %33, %32 ], [ 0, %24 ]
%29 = load i8, i8* %27
switch i8 %29, label %32 [
i8 71, label %30
i8 67, label %30
]
30: ; preds = %26, %26
%31 = add nsw i32 %28, 1
br label %32
32: ; preds = %26, %30
%33 = phi i32 [ %31, %30 ], [ %28, %26 ]
%34 = getelementptr inbounds i8, i8* %27, i64 1
%35 = icmp ult i8* %34, %21
br i1 %35, label %26, label %36
36: ; preds = %32, %19
%37 = phi i32 [ 0, %19 ], [ %33, %32 ]
%38 = fdiv double %11, 1.000000e+03
%39 = tail call double @log10(double %38)
%40 = tail call double @llvm.fmuladd.f64(double %39, double 1.660000e+01, double 8.150000e+01)
%41 = sitofp i32 %37 to double
%42 = sitofp i32 %2 to double
%43 = fdiv double %41, %42
%44 = tail call double @llvm.fmuladd.f64(double %43, double 4.100000e+01, double %40)
%45 = fdiv double 6.000000e+02, %42
%46 = fsub double %44, %45
br label %47
47: ; preds = %9, %6, %36
%48 = phi double [ %46, %36 ], [ 0xC12E847FFFF2E48F, %6 ], [ 0xC12E847FFFF2E48F, %9 ]
ret double %48
}