#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 abs(double);
double cos(double);
double sin(double);
double incrementoMomento(double x, double y, double z, double vx, double vy,
                         double vz, double momento, double rr, double teta,
                         double phi, double l, double m) {
  if (x + rr * sin(teta) * cos(phi) > l ||
      (x + rr * sin(teta) * cos(phi)) < 0) {
    return (momento += 2.0 * m * abs(vx));
  } else if ((y + rr * sin(teta) * sin(phi)) > l ||
             (y + rr * sin(teta) * sin(phi)) < 0) {
    return (momento += 2.0 * m * abs(vy));
  } else if ((z + rr * cos(teta)) > l || (z + rr * cos(teta)) < 0) {
    return (momento += 2.0 * m * abs(vz));
  }
  return momento;
}


x86 assembly (clang, -O0):
<incrementoMomento>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movsd  0x28(%rbp),%xmm8
movsd  0x20(%rbp),%xmm8
movsd  0x18(%rbp),%xmm8
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  %xmm6,-0x40(%rbp)
movsd  %xmm7,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0x20(%rbp),%xmm0
ja     122f <incrementoMomento+0xff>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    126f <incrementoMomento+0x13f>
movsd  0xdc9(%rip),%xmm0
mulsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm0,-0x8(%rbp)
jmp    147d <incrementoMomento+0x34d>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0x20(%rbp),%xmm0
ja     1347 <incrementoMomento+0x217>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0x10(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    138d <incrementoMomento+0x25d>
movsd  0xcb1(%rip),%xmm0
mulsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm2
movsd  -0xb8(%rbp),%xmm0
ff
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm0,-0x8(%rbp)
jmp    147d <incrementoMomento+0x34d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0x20(%rbp),%xmm0
ja     1423 <incrementoMomento+0x2f3>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0x10(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1469 <incrementoMomento+0x339>
movsd  0xbd5(%rip),%xmm0
mulsd  0x28(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm2
movsd  -0xe0(%rbp),%xmm0
ff
movsd  -0x40(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  %xmm0,-0x8(%rbp)
jmp    147d <incrementoMomento+0x34d>
jmp    146e <incrementoMomento+0x33e>
jmp    1473 <incrementoMomento+0x343>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<incrementoMomento>:
sub    $0x48,%rsp
movsd  %xmm7,(%rsp)
movsd  %xmm6,0x40(%rsp)
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x28(%rsp)
movsd  %xmm3,0x38(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x8(%rsp)
movsd  0x50(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x58(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
ucomisd 0x60(%rsp),%xmm0
jbe    11a3 <incrementoMomento+0x73>
movsd  0x38(%rsp),%xmm0
jmp    12b9 <incrementoMomento+0x189>
movsd  0x50(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x58(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
ja     12b9 <incrementoMomento+0x189>
movsd  0x50(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x58(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
addsd  %xmm1,%xmm0
ucomisd 0x60(%rsp),%xmm0
jbe    1228 <incrementoMomento+0xf8>
movsd  0x28(%rsp),%xmm0
jmp    12b9 <incrementoMomento+0x189>
movsd  0x50(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x58(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x30(%rsp),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
ja     12b9 <incrementoMomento+0x189>
movsd  0x50(%rsp),%xmm0
call   1050 <cos@plt>
mulsd  (%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm1,%xmm0
ucomisd 0x60(%rsp),%xmm0
jbe    128f <incrementoMomento+0x15f>
movsd  0x18(%rsp),%xmm0
jmp    12b9 <incrementoMomento+0x189>
movsd  0x50(%rsp),%xmm0
call   1050 <cos@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x20(%rsp),%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
movsd  0x18(%rsp),%xmm0
jbe    12dd <incrementoMomento+0x1ad>
movsd  0x68(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <abs@plt>
mulsd  (%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
add    $0x48,%rsp
ret
movsd  0x40(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @incrementoMomento(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11) {
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
store double %0, double* %14
store double %1, double* %15
store double %2, double* %16
store double %3, double* %17
store double %4, double* %18
store double %5, double* %19
store double %6, double* %20
store double %7, double* %21
store double %8, double* %22
store double %9, double* %23
store double %10, double* %24
store double %11, double* %25
%26 = load double, double* %14
%27 = load double, double* %21
%28 = load double, double* %22
%29 = call double @sin(double %28)
%30 = fmul double %27, %29
%31 = load double, double* %23
%32 = call double @cos(double %31)
%33 = call double @llvm.fmuladd.f64(double %30, double %32, double %26)
%34 = load double, double* %24
%35 = fcmp ogt double %33, %34
br i1 %35, label %46, label %36
36: ; preds = %12
%37 = load double, double* %14
%38 = load double, double* %21
%39 = load double, double* %22
%40 = call double @sin(double %39)
%41 = fmul double %38, %40
%42 = load double, double* %23
%43 = call double @cos(double %42)
%44 = call double @llvm.fmuladd.f64(double %41, double %43, double %37)
%45 = fcmp olt double %44, 0.000000e+00
br i1 %45, label %46, label %53
46: ; preds = %36, %12
%47 = load double, double* %25
%48 = fmul double 2.000000e+00, %47
%49 = load double, double* %17
%50 = call double @abs(double %49)
%51 = load double, double* %20
%52 = call double @llvm.fmuladd.f64(double %48, double %50, double %51)
store double %52, double* %20
store double %52, double* %13
br label %107
53: ; preds = %36
%54 = load double, double* %15
%55 = load double, double* %21
%56 = load double, double* %22
%57 = call double @sin(double %56)
%58 = fmul double %55, %57
%59 = load double, double* %23
%60 = call double @sin(double %59)
%61 = call double @llvm.fmuladd.f64(double %58, double %60, double %54)
%62 = load double, double* %24
%63 = fcmp ogt double %61, %62
br i1 %63, label %74, label %64
64: ; preds = %53
%65 = load double, double* %15
%66 = load double, double* %21
%67 = load double, double* %22
%68 = call double @sin(double %67)
%69 = fmul double %66, %68
%70 = load double, double* %23
%71 = call double @sin(double %70)
%72 = call double @llvm.fmuladd.f64(double %69, double %71, double %65)
%73 = fcmp olt double %72, 0.000000e+00
br i1 %73, label %74, label %81
74: ; preds = %64, %53
%75 = load double, double* %25
%76 = fmul double 2.000000e+00, %75
%77 = load double, double* %18
%78 = call double @abs(double %77)
%79 = load double, double* %20
%80 = call double @llvm.fmuladd.f64(double %76, double %78, double %79)
store double %80, double* %20
store double %80, double* %13
br label %107
81: ; preds = %64
%82 = load double, double* %16
%83 = load double, double* %21
%84 = load double, double* %22
%85 = call double @cos(double %84)
%86 = call double @llvm.fmuladd.f64(double %83, double %85, double %82)
%87 = load double, double* %24
%88 = fcmp ogt double %86, %87
br i1 %88, label %96, label %89
89: ; preds = %81
%90 = load double, double* %16
%91 = load double, double* %21
%92 = load double, double* %22
%93 = call double @cos(double %92)
%94 = call double @llvm.fmuladd.f64(double %91, double %93, double %90)
%95 = fcmp olt double %94, 0.000000e+00
br i1 %95, label %96, label %103
96: ; preds = %89, %81
%97 = load double, double* %25
%98 = fmul double 2.000000e+00, %97
%99 = load double, double* %19
%100 = call double @abs(double %99)
%101 = load double, double* %20
%102 = call double @llvm.fmuladd.f64(double %98, double %100, double %101)
store double %102, double* %20
store double %102, double* %13
br label %107
103: ; preds = %89
br label %104
104: ; preds = %103
br label %105
105: ; preds = %104
%106 = load double, double* %20
store double %106, double* %13
br label %107
107: ; preds = %105, %96, %74, %46
%108 = load double, double* %13
ret double %108
}

LLVM IR (-O2):
define double @incrementoMomento(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11) {
%13 = tail call double @sin(double %8)
%14 = fmul double %13, %7
%15 = tail call double @cos(double %9)
%16 = tail call double @llvm.fmuladd.f64(double %14, double %15, double %0)
%17 = fcmp ogt double %16, %10
br i1 %17, label %44, label %18
18: ; preds = %12
%19 = tail call double @sin(double %8)
%20 = fmul double %19, %7
%21 = tail call double @cos(double %9)
%22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %0)
%23 = fcmp olt double %22, 0.000000e+00
br i1 %23, label %44, label %24
24: ; preds = %18
%25 = tail call double @sin(double %8)
%26 = fmul double %25, %7
%27 = tail call double @sin(double %9)
%28 = tail call double @llvm.fmuladd.f64(double %26, double %27, double %1)
%29 = fcmp ogt double %28, %10
br i1 %29, label %44, label %30
30: ; preds = %24
%31 = tail call double @sin(double %8)
%32 = fmul double %31, %7
%33 = tail call double @sin(double %9)
%34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %1)
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %44, label %36
36: ; preds = %30
%37 = tail call double @cos(double %8)
%38 = tail call double @llvm.fmuladd.f64(double %7, double %37, double %2)
%39 = fcmp ogt double %38, %10
br i1 %39, label %44, label %40
40: ; preds = %36
%41 = tail call double @cos(double %8)
%42 = tail call double @llvm.fmuladd.f64(double %7, double %41, double %2)
%43 = fcmp olt double %42, 0.000000e+00
br i1 %43, label %44, label %49
44: ; preds = %36, %40, %24, %30, %12, %18
%45 = phi double [ %3, %18 ], [ %3, %12 ], [ %4, %30 ], [ %4, %24 ], [ %5, %40 ], [ %5, %36 ]
%46 = fmul double %11, 2.000000e+00
%47 = tail call double @abs(double %45)
%48 = tail call double @llvm.fmuladd.f64(double %46, double %47, double %6)
br label %49
49: ; preds = %44, %40
%50 = phi double [ %6, %40 ], [ %48, %44 ]
ret double %50
}