#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 M_PI;
double M_PI_4;
double func(double, double);
int /*<<< orphan*/ printf(char *, ...);
main() {
  double x = -M_PI, X = M_PI, y = -2 * M_PI, Y = 2 * M_PI, h = M_PI_4, a = y;
  int i = 1;
  printf("\nШаг\tx\t\ty\t\tf(x,y)\n\n");
  while (x <= X) {
    printf("%d\t%.3f\t\t%.3f\t\t%.3f\n", i, x, y, func(x, y));
    if (y < Y)
      y += h;
    else {
      x += h;
      y = a;
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    0x2eb0(%rip),%rcx
sub    (%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e9e(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e8e(%rip),%rax
imul   $0xfffffffe,(%rax),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e5b(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x3c(%rbp)
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1257 <main+0x137>
mov    -0x3c(%rbp),%eax
mov    %eax,-0x54(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1040 <func@plt>
mov    -0x54(%rbp),%esi
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
lea    0xe16(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1230 <main+0x110>
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1249 <main+0x129>
movsd  -0x30(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11ad <main+0x8d>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0x2eaa(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
neg    %eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    0x2e7f(%rip),%rax
movsd  (%rax),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jae    1191 <main+0x61>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret
add    %ebx,%ebx
cvtsi2sd %ebx,%xmm4
neg    %ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mov    $0x1,%ebx
lea    0xe5c(%rip),%r14
movsd  %xmm1,0x10(%rsp)
movsd  %xmm4,0x18(%rsp)
jmp    1205 <main+0xd5>
nopw   0x0(%rax,%rax,1)
movsd  0x10(%rsp),%xmm2
movsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm3
cmpltsd %xmm4,%xmm6
movapd %xmm6,%xmm1
movsd  0xe1e(%rip),%xmm5
andpd  %xmm5,%xmm1
andnpd %xmm3,%xmm6
orpd   %xmm1,%xmm6
addsd  %xmm6,%xmm0
add    $0x1,%ebx
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm2,%xmm1
jb     1187 <main+0x57>
movsd  %xmm0,(%rsp)
movapd %xmm1,0x30(%rsp)
call   1050 <func@plt>
movapd %xmm0,%xmm2
mov    %r14,%rdi
mov    %ebx,%esi
movsd  (%rsp),%xmm0
movaps 0x30(%rsp),%xmm1
mov    $0x3,%al
call   1040 <printf@plt>
movapd 0x30(%rsp),%xmm6
movsd  0x18(%rsp),%xmm4
ucomisd %xmm6,%xmm4
jbe    11c0 <main+0x90>
movapd 0x20(%rsp),%xmm3
movapd %xmm3,%xmm2
addsd  %xmm6,%xmm2
movsd  (%rsp),%xmm0
jmp    11d1 <main+0xa1>

LLVM IR (-O0):
@M_PI = global i32 0
@M_PI_4 = global double 0.000000e+00
@.str = [23 x i8] c"\0A\D0\A8\D0\B0\D0\B3\09x\09\09y\09\09f(x,y)\0A\0A\00"
@.str.1 = [21 x i8] c"%d\09%.3f\09\09%.3f\09\09%.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i32 0, i32* %1
%9 = load i32, i32* @M_PI
%10 = sub nsw i32 0, %9
%11 = sitofp i32 %10 to double
store double %11, double* %2
%12 = load i32, i32* @M_PI
%13 = sitofp i32 %12 to double
store double %13, double* %3
%14 = load i32, i32* @M_PI
%15 = mul nsw i32 -2, %14
%16 = sitofp i32 %15 to double
store double %16, double* %4
%17 = load i32, i32* @M_PI
%18 = mul nsw i32 2, %17
%19 = sitofp i32 %18 to double
store double %19, double* %5
%20 = load double, double* @M_PI_4
store double %20, double* %6
%21 = load double, double* %4
store double %21, double* %7
store i32 1, i32* %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %47, %0
%24 = load double, double* %2
%25 = load double, double* %3
%26 = fcmp ole double %24, %25
br i1 %26, label %27, label %50
27: ; preds = %23
%28 = load i32, i32* %8
%29 = load double, double* %2
%30 = load double, double* %4
%31 = load double, double* %2
%32 = load double, double* %4
%33 = call double @func(double %31, double %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %28, double %29, double %30, double %33)
%35 = load double, double* %4
%36 = load double, double* %5
%37 = fcmp olt double %35, %36
br i1 %37, label %38, label %42
38: ; preds = %27
%39 = load double, double* %6
%40 = load double, double* %4
%41 = fadd double %40, %39
store double %41, double* %4
br label %47
42: ; preds = %27
%43 = load double, double* %6
%44 = load double, double* %2
%45 = fadd double %44, %43
store double %45, double* %2
%46 = load double, double* %7
store double %46, double* %4
br label %47
47: ; preds = %42, %38
%48 = load i32, i32* %8
%49 = add nsw i32 %48, 1
store i32 %49, i32* %8
br label %23
50: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@M_PI = global i32 0
@M_PI_4 = global double 0.000000e+00
@.str.1 = [21 x i8] c"%d\09%.3f\09\09%.3f\09\09%.3f\0A\00"
@str = [22 x i8] c"\0A\D0\A8\D0\B0\D0\B3\09x\09\09y\09\09f(x,y)\0A\00"
define i32 @main() {
%1 = load i32, i32* @M_PI
%2 = sub nsw i32 0, %1
%3 = sitofp i32 %2 to double
%4 = sitofp i32 %1 to double
%5 = mul nsw i32 %1, -2
%6 = sitofp i32 %5 to double
%7 = shl nsw i32 %1, 1
%8 = sitofp i32 %7 to double
%9 = load double, double* @M_PI_4
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%11 = fcmp ugt double %3, %4
br i1 %11, label %25, label %12
12: ; preds = %0, %12
%13 = phi i32 [ %23, %12 ], [ 1, %0 ]
%14 = phi double [ %22, %12 ], [ %3, %0 ]
%15 = phi double [ %20, %12 ], [ %6, %0 ]
%16 = tail call double @func(double %14, double %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %13, double %14, double %15, double %16)
%18 = fcmp olt double %15, %8
%19 = fadd double %9, %15
%20 = select i1 %18, double %19, double %6
%21 = select i1 %18, double -0.000000e+00, double %9
%22 = fadd double %14, %21
%23 = add nuw nsw i32 %13, 1
%24 = fcmp ugt double %22, %4
br i1 %24, label %25, label %12
25: ; preds = %12, %0
ret i32 0
}