#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 cos(int);
int malloc(int);
double sin(int);
void *isTrigonometryRuleCorrect(void *arg) {
  int argument = (int)arg;
  int start_number = malloc(sizeof(int));
  start_number = argument;
  int i, error = 0;
  for (i = start_number; i <= start_number + 25000000; ++i) {
    double a = cos(i) * cos(i) + sin(i) * sin(i);
    if (a > 1.0005 || a < 0.9995) {
      error = 1;
      break;
    }
  }
  return error;
}


x86 assembly (clang, -O0):
<isTrigonometryRuleCorrect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x17d7840,%ecx
cmp    %ecx,%eax
jg     1212 <isTrigonometryRuleCorrect+0xe2>
mov    -0x14(%rbp),%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <cos@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <sin@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <sin@plt>
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe2a(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     11f3 <isTrigonometryRuleCorrect+0xc3>
movsd  0xe20(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ff <isTrigonometryRuleCorrect+0xcf>
movl   $0x1,-0x18(%rbp)
jmp    1212 <isTrigonometryRuleCorrect+0xe2>
jmp    1204 <isTrigonometryRuleCorrect+0xd4>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1163 <isTrigonometryRuleCorrect+0x33>
movslq -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isTrigonometryRuleCorrect>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
lea    0x17d7840(%rbx),%ebp
cmp    %ebx,%ebp
cmovle %ebx,%ebp
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1050 <cos@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
ucomisd 0xe56(%rip),%xmm1
mov    $0x1,%eax
ja     11c8 <isTrigonometryRuleCorrect+0x98>
movsd  0xe4f(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11c8 <isTrigonometryRuleCorrect+0x98>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1160 <isTrigonometryRuleCorrect+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @isTrigonometryRuleCorrect(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = ptrtoint i8* %8 to i32
store i32 %9, i32* %3
%10 = call i32 @malloc(i32 4)
store i32 %10, i32* %4
%11 = load i32, i32* %3
store i32 %11, i32* %4
store i32 0, i32* %6
%12 = load i32, i32* %4
store i32 %12, i32* %5
br label %13
13: ; preds = %36, %1
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 25000000
%17 = icmp sle i32 %14, %16
br i1 %17, label %18, label %39
18: ; preds = %13
%19 = load i32, i32* %5
%20 = call double @cos(i32 %19)
%21 = load i32, i32* %5
%22 = call double @cos(i32 %21)
%23 = load i32, i32* %5
%24 = call double @sin(i32 %23)
%25 = load i32, i32* %5
%26 = call double @sin(i32 %25)
%27 = fmul double %24, %26
%28 = call double @llvm.fmuladd.f64(double %20, double %22, double %27)
store double %28, double* %7
%29 = load double, double* %7
%30 = fcmp ogt double %29, 1.000500e+00
br i1 %30, label %34, label %31
31: ; preds = %18
%32 = load double, double* %7
%33 = fcmp olt double %32, 9.995000e-01
br i1 %33, label %34, label %35
34: ; preds = %31, %18
store i32 1, i32* %6
br label %39
35: ; preds = %31
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %13
39: ; preds = %34, %13
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = inttoptr i64 %41 to i8*
ret i8* %42
}

LLVM IR (-O2):
define i8* @isTrigonometryRuleCorrect(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @malloc(i32 4)
%5 = add i32 %3, 25000000
%6 = call i32 @llvm.smax.i32(i32 %5, i32 %3)
br label %10
7: ; preds = %10
%8 = add i32 %11, 1
%9 = icmp eq i32 %11, %6
br i1 %9, label %21, label %10
10: ; preds = %1, %7
%11 = phi i32 [ %3, %1 ], [ %8, %7 ]
%12 = tail call double @cos(i32 %11)
%13 = tail call double @cos(i32 %11)
%14 = tail call double @sin(i32 %11)
%15 = tail call double @sin(i32 %11)
%16 = fmul double %14, %15
%17 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %16)
%18 = fcmp ogt double %17, 1.000500e+00
%19 = fcmp olt double %17, 9.995000e-01
%20 = or i1 %18, %19
br i1 %20, label %21, label %7
21: ; preds = %10, %7
%22 = phi i8* [ inttoptr (i64 1 to i8*), %10 ], [ null, %7 ]
ret i8* %22
}