#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 computeFragmentIonsModification(int *n_, char **seq_, double *pim_,
                                     double *b_, double *y_, int *modified_,
                                     double *modification_) {
  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] + modification_[modified_[i]];
        b_[i] = b;
        y_[*n_ - i - 1] = y;
        y -= (M[letter - 65] + modification_[modified_[i]]);
      }
    }
  }
  free(M);
}


x86 assembly (clang, -O0):
<computeFragmentIonsModification>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x0,%al
call   1040 <initAminoAcidMass@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     129a <computeFragmentIonsModification+0x17a>
movsd  0xeab(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe8e(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe74(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jge    1295 <computeFragmentIonsModification+0x175>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x6c(%rbp)
mov    $0x40,%eax
cmp    -0x6c(%rbp),%eax
jge    1282 <computeFragmentIonsModification+0x162>
cmpl   $0x5c,-0x6c(%rbp)
jge    1282 <computeFragmentIonsModification+0x162>
mov    -0x78(%rbp),%rax
mov    -0x6c(%rbp),%ecx
sub    $0x41,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
addsd  (%rax,%rcx,8),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
sub    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%rax
mov    -0x6c(%rbp),%ecx
sub    $0x41,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movslq (%rcx,%rdx,4),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    1287 <computeFragmentIonsModification+0x167>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11b4 <computeFragmentIonsModification+0x94>
jmp    129a <computeFragmentIonsModification+0x17a>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeFragmentIonsModification>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,(%rsp)
mov    %rdi,%rbp
mov    0x40(%rsp),%r12
xor    %eax,%eax
call   1040 <initAminoAcidMass@plt>
test   %rax,%rax
je     11cf <computeFragmentIonsModification+0xaf>
mov    0x0(%rbp),%r8d
test   %r8d,%r8d
jle    11cf <computeFragmentIonsModification+0xaf>
movsd  (%rbx),%xmm0
mov    (%rsp),%rcx
mov    (%rcx),%rdx
lea    -0x1(%r8),%esi
movsd  0xe8d(%rip),%xmm1
xor    %edi,%edi
jmp    118c <computeFragmentIonsModification+0x6c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdi
add    $0xffffffff,%esi
cmp    %rdi,%r8
je     11cf <computeFragmentIonsModification+0xaf>
movzbl (%rdx,%rdi,1),%ebp
lea    -0x41(%rbp),%ebx
cmp    $0x1a,%bl
ja     1180 <computeFragmentIonsModification+0x60>
add    $0xffffffbf,%ebp
movsd  (%rax,%rbp,8),%xmm2
movslq (%r14,%rdi,4),%rbx
addsd  (%r12,%rbx,8),%xmm2
addsd  %xmm2,%xmm1
movsd  %xmm1,0x0(%r13,%rdi,8)
movslq %esi,%rcx
movsd  %xmm0,(%r15,%rcx,8)
movsd  (%rax,%rbp,8),%xmm2
addsd  (%r12,%rbx,8),%xmm2
subsd  %xmm2,%xmm0
jmp    1180 <computeFragmentIonsModification+0x60>
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 @computeFragmentIonsModification(i32* %0, i8** %1, double* %2, double* %3, double* %4, i32* %5, double* %6) {
%8 = alloca i32*
%9 = alloca i8**
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32*
%14 = alloca double*
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca double*
store i32* %0, i32** %8
store i8** %1, i8*** %9
store double* %2, double** %10
store double* %3, double** %11
store double* %4, double** %12
store i32* %5, i32** %13
store double* %6, double** %14
%24 = call double* (...) @initAminoAcidMass()
store double* %24, double** %23
%25 = load double*, double** %23
%26 = icmp ne double* %25, null
br i1 %26, label %27, label %108
27: ; preds = %7
store double 0x403100B39192641B, double* %18
store double 0x3FF0200D1B71758E, double* %19
store double 5.490000e-04, double* %20
store double 0x3FF0200D1B71758E, double* %21
%28 = load double, double* %19
%29 = load double, double* %20
%30 = fsub double %28, %29
store double %30, double* %16
%31 = load double*, double** %10
%32 = load double, double* %31
store double %32, double* %17
store i32 0, i32* %15
br label %33
33: ; preds = %104, %27
%34 = load i32, i32* %15
%35 = load i32*, i32** %8
%36 = load i32, i32* %35
%37 = icmp slt i32 %34, %36
br i1 %37, label %38, label %107
38: ; preds = %33
%39 = load i8**, i8*** %9
%40 = getelementptr inbounds i8*, i8** %39, i64 0
%41 = load i8*, i8** %40
%42 = load i32, i32* %15
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
store i32 %46, i32* %22
%47 = load i32, i32* %22
%48 = icmp slt i32 64, %47
br i1 %48, label %49, label %103
49: ; preds = %38
%50 = load i32, i32* %22
%51 = icmp slt i32 %50, 92
br i1 %51, label %52, label %103
52: ; preds = %49
%53 = load double*, double** %23
%54 = load i32, i32* %22
%55 = sub nsw i32 %54, 65
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %14
%60 = load i32*, i32** %13
%61 = load i32, i32* %15
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
%64 = load i32, i32* %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %59, i64 %65
%67 = load double, double* %66
%68 = fadd double %58, %67
%69 = load double, double* %16
%70 = fadd double %69, %68
store double %70, double* %16
%71 = load double, double* %16
%72 = load double*, double** %11
%73 = load i32, i32* %15
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %72, i64 %74
store double %71, double* %75
%76 = load double, double* %17
%77 = load double*, double** %12
%78 = load i32*, i32** %8
%79 = load i32, i32* %78
%80 = load i32, i32* %15
%81 = sub nsw i32 %79, %80
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %77, i64 %83
store double %76, double* %84
%85 = load double*, double** %23
%86 = load i32, i32* %22
%87 = sub nsw i32 %86, 65
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds double, double* %85, i64 %88
%90 = load double, double* %89
%91 = load double*, double** %14
%92 = load i32*, i32** %13
%93 = load i32, i32* %15
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %92, i64 %94
%96 = load i32, i32* %95
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %91, i64 %97
%99 = load double, double* %98
%100 = fadd double %90, %99
%101 = load double, double* %17
%102 = fsub double %101, %100
store double %102, double* %17
br label %103
103: ; preds = %52, %49, %38
br label %104
104: ; preds = %103
%105 = load i32, i32* %15
%106 = add nsw i32 %105, 1
store i32 %106, i32* %15
br label %33
107: ; preds = %33
br label %108
108: ; preds = %107, %7
%109 = load double*, double** %23
%110 = call i32 @free(double* %109)
ret void
}

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