#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(double *);
double *initAminoAcidMass();
void computeFragmentIons(int *n_, char **seq_, double *pim_, double *b_,
                         double *y_) {
  int i;
  double b, y;
  double C_term;
  double N_term;
  double Electron;
  double Hydrogen;
  int letter;
  double *M;
  M = initAminoAcidMass();
  if (M != NULL) {
    C_term = 17.002740;
    N_term = 1.007825;
    Electron = 0.000549;
    Hydrogen = 1.007825;
    b = N_term - Electron;
    y = *pim_;
    for (i = 0; i < *n_; i++) {
      letter = seq_[0][i];
      if (64 < letter && letter < 92) {
        b += M[letter - 65];
        b_[i] = b;
        y_[*n_ - i - 1] = y;
        y -= M[letter - 65];
      }
    }
  }
  free(M);
}


x86 assembly (clang, -O0):
<computeFragmentIons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    $0x0,%al
call   1040 <initAminoAcidMass@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     1265 <computeFragmentIons+0x145>
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1260 <computeFragmentIons+0x140>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x64(%rbp)
mov    $0x40,%eax
cmp    -0x64(%rbp),%eax
jge    124d <computeFragmentIons+0x12d>
cmpl   $0x5c,-0x64(%rbp)
jge    124d <computeFragmentIons+0x12d>
mov    -0x70(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x41,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
sub    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x70(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x41,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1252 <computeFragmentIons+0x132>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11a9 <computeFragmentIons+0x89>
jmp    1265 <computeFragmentIons+0x145>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeFragmentIons>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %rdi,%r13
xor    %eax,%eax
call   1040 <initAminoAcidMass@plt>
test   %rax,%rax
je     11a7 <computeFragmentIons+0x87>
mov    0x0(%r13),%ecx
test   %ecx,%ecx
jle    11a7 <computeFragmentIons+0x87>
movsd  (%r12),%xmm0
mov    (%rbx),%rdx
lea    -0x1(%rcx),%esi
movsd  0xe9e(%rip),%xmm1
xor    %edi,%edi
jmp    117c <computeFragmentIons+0x5c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdi
add    $0xffffffff,%esi
cmp    %rdi,%rcx
je     11a7 <computeFragmentIons+0x87>
movzbl (%rdx,%rdi,1),%ebx
lea    -0x41(%rbx),%ebp
cmp    $0x1a,%bpl
ja     1170 <computeFragmentIons+0x50>
add    $0xffffffbf,%ebx
addsd  (%rax,%rbx,8),%xmm1
movsd  %xmm1,(%r15,%rdi,8)
movslq %esi,%rbp
movsd  %xmm0,(%r14,%rbp,8)
subsd  (%rax,%rbx,8),%xmm0
jmp    1170 <computeFragmentIons+0x50>
mov    %rax,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @computeFragmentIons(i32* %0, i8** %1, double* %2, double* %3, double* %4) {
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca double*
store i32* %0, i32** %6
store i8** %1, i8*** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%20 = call double* (...) @initAminoAcidMass()
store double* %20, double** %19
%21 = load double*, double** %19
%22 = icmp ne double* %21, null
br i1 %22, label %23, label %84
23: ; preds = %5
store double 0x403100B39192641B, double* %14
store double 0x3FF0200D1B71758E, double* %15
store double 5.490000e-04, double* %16
store double 0x3FF0200D1B71758E, double* %17
%24 = load double, double* %15
%25 = load double, double* %16
%26 = fsub double %24, %25
store double %26, double* %12
%27 = load double*, double** %8
%28 = load double, double* %27
store double %28, double* %13
store i32 0, i32* %11
br label %29
29: ; preds = %80, %23
%30 = load i32, i32* %11
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %83
34: ; preds = %29
%35 = load i8**, i8*** %7
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = load i32, i32* %11
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
store i32 %42, i32* %18
%43 = load i32, i32* %18
%44 = icmp slt i32 64, %43
br i1 %44, label %45, label %79
45: ; preds = %34
%46 = load i32, i32* %18
%47 = icmp slt i32 %46, 92
br i1 %47, label %48, label %79
48: ; preds = %45
%49 = load double*, double** %19
%50 = load i32, i32* %18
%51 = sub nsw i32 %50, 65
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %49, i64 %52
%54 = load double, double* %53
%55 = load double, double* %12
%56 = fadd double %55, %54
store double %56, double* %12
%57 = load double, double* %12
%58 = load double*, double** %9
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
store double %57, double* %61
%62 = load double, double* %13
%63 = load double*, double** %10
%64 = load i32*, i32** %6
%65 = load i32, i32* %64
%66 = load i32, i32* %11
%67 = sub nsw i32 %65, %66
%68 = sub nsw i32 %67, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %63, i64 %69
store double %62, double* %70
%71 = load double*, double** %19
%72 = load i32, i32* %18
%73 = sub nsw i32 %72, 65
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %71, i64 %74
%76 = load double, double* %75
%77 = load double, double* %13
%78 = fsub double %77, %76
store double %78, double* %13
br label %79
79: ; preds = %48, %45, %34
br label %80
80: ; preds = %79
%81 = load i32, i32* %11
%82 = add nsw i32 %81, 1
store i32 %82, i32* %11
br label %29
83: ; preds = %29
br label %84
84: ; preds = %83, %5
%85 = load double*, double** %19
%86 = call i32 @free(double* %85)
ret void
}

LLVM IR (-O2):
define void @computeFragmentIons(i32* nocapture %0, i8** nocapture %1, double* nocapture %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = tail call double* (...) @initAminoAcidMass()
%7 = icmp eq double* %6, null
br i1 %7, label %43, label %8
8: ; preds = %5
%9 = load i32, i32* %0
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %43
11: ; preds = %8
%12 = load double, double* %2
%13 = load i8*, i8** %1
%14 = zext i32 %9 to i64
br label %15
15: ; preds = %11, %38
%16 = phi i64 [ 0, %11 ], [ %41, %38 ]
%17 = phi double [ 0x3FF01DCD7060BB2C, %11 ], [ %40, %38 ]
%18 = phi double [ %12, %11 ], [ %39, %38 ]
%19 = getelementptr inbounds i8, i8* %13, i64 %16
%20 = load i8, i8* %19
%21 = add i8 %20, -65
%22 = icmp ult i8 %21, 27
br i1 %22, label %23, label %38
23: ; preds = %15
%24 = zext i8 %20 to i64
%25 = add nuw nsw i64 %24, 4294967231
%26 = and i64 %25, 4294967295
%27 = getelementptr inbounds double, double* %6, i64 %26
%28 = load double, double* %27
%29 = fadd double %17, %28
%30 = getelementptr inbounds double, double* %3, i64 %16
store double %29, double* %30
%31 = trunc i64 %16 to i32
%32 = xor i32 %31, -1
%33 = add i32 %9, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds double, double* %4, i64 %34
store double %18, double* %35
%36 = load double, double* %27
%37 = fsub double %18, %36
br label %38
38: ; preds = %15, %23
%39 = phi double [ %37, %23 ], [ %18, %15 ]
%40 = phi double [ %29, %23 ], [ %17, %15 ]
%41 = add nuw nsw i64 %16, 1
%42 = icmp eq i64 %41, %14
br i1 %42, label %43, label %15
43: ; preds = %38, %8, %5
%44 = tail call i32 @free(double* %6)
ret void
}