#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 fabs(int /*<<< orphan*/);
int /*<<< orphan*/ torsion_angle(double **, int);
double get_nT(double(**atoms_ptr), unsigned int numtorsions) {
  int count_T = 0;
  for (int dim1 = 0; dim1 < (numtorsions); dim1++) {
    if (fabs(torsion_angle(atoms_ptr, dim1)) > 120.0) {
      count_T += 1;
    }
  }
  return ((double)count_T);
}


x86 assembly (clang, -O0):
<get_nT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    118a <get_nT+0x6a>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <torsion_angle@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
movsd  0xe9c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1177 <get_nT+0x57>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <get_nT+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <get_nT+0x1d>
cvtsi2sdl -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nT>:
test   %esi,%esi
je     117a <get_nT+0x5a>
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <torsion_angle@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
xor    %eax,%eax
ucomisd 0xea5(%rip),%xmm0
seta   %al
add    %eax,%ebx
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1140 <get_nT+0x20>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @get_nT(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load double**, double*** %3
%13 = load i32, i32* %6
%14 = call i32 @torsion_angle(double** %12, i32 %13)
%15 = call double @fabs(i32 %14)
%16 = fcmp ogt double %15, 1.200000e+02
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %20
20: ; preds = %17, %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %7
24: ; preds = %7
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
ret double %26
}

LLVM IR (-O2):
define double @get_nT(double** %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %8
4: ; preds = %8
%5 = sitofp i32 %15 to double
br label %6
6: ; preds = %4, %2
%7 = phi double [ 0.000000e+00, %2 ], [ %5, %4 ]
ret double %7
8: ; preds = %2, %8
%9 = phi i32 [ %16, %8 ], [ 0, %2 ]
%10 = phi i32 [ %15, %8 ], [ 0, %2 ]
%11 = tail call i32 @torsion_angle(double** %0, i32 %9)
%12 = tail call double @fabs(i32 %11)
%13 = fcmp ogt double %12, 1.200000e+02
%14 = zext i1 %13 to i32
%15 = add nuw nsw i32 %10, %14
%16 = add nuw i32 %9, 1
%17 = icmp eq i32 %16, %1
br i1 %17, label %4, label %8
}