#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 */
scalar_t__ atan2(float, float);
void GradientArgument2D(float *gradient_argument, float *derivative_along_X,
                        float *derivative_along_Y, int length) {
  register int i;
  register float *argu = gradient_argument;
  register float *gx = derivative_along_X;
  register float *gy = derivative_along_Y;
  for (i = 0; i < length; i++, argu++, gx++, gy++) {
    if (((*gx) * (*gx) + (*gy) * (*gy)) > 0.000001 * 0.000001)
      *argu = (float)atan2((*gy), (*gx));
    else
      *argu = 10.0;
  }
}


x86 assembly (clang, -O0):
<GradientArgument2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11fe <GradientArgument2D+0xee>
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x38(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x38(%rbp),%rax
mulss  (%rax),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b7 <GradientArgument2D+0xa7>
mov    -0x38(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm1
call   1030 <atan2@plt>
cvtsi2ss %rax,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11c7 <GradientArgument2D+0xb7>
mov    -0x28(%rbp),%rax
movss  0xe45(%rip),%xmm0
movss  %xmm0,(%rax)
jmp    11cc <GradientArgument2D+0xbc>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    1146 <GradientArgument2D+0x36>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GradientArgument2D>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %ecx,%ecx
jle    119c <GradientArgument2D+0x8c>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %ecx,%r13d
xor    %ebx,%ebx
movss  0xecd(%rip),%xmm4
movsd  0xecd(%rip),%xmm5
jmp    114f <GradientArgument2D+0x3f>
nopl   (%rax)
movss  %xmm2,(%r12,%rbx,4)
add    $0x1,%rbx
cmp    %ebx,%r13d
je     119c <GradientArgument2D+0x8c>
movss  (%r15,%rbx,4),%xmm1
movss  (%r14,%rbx,4),%xmm0
movaps %xmm0,%xmm2
mulss  %xmm0,%xmm2
movaps %xmm1,%xmm3
mulss  %xmm1,%xmm3
addss  %xmm2,%xmm3
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
ucomisd %xmm5,%xmm2
movaps %xmm4,%xmm2
jbe    1140 <GradientArgument2D+0x30>
call   1030 <atan2@plt>
movsd  0xe7e(%rip),%xmm5
movss  0xe6e(%rip),%xmm4
xorps  %xmm2,%xmm2
cvtsi2ss %rax,%xmm2
jmp    1140 <GradientArgument2D+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @GradientArgument2D(float* %0, float* %1, float* %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i32
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
%13 = load float*, float** %5
store float* %13, float** %10
%14 = load float*, float** %6
store float* %14, float** %11
%15 = load float*, float** %7
store float* %15, float** %12
store i32 0, i32* %9
br label %16
16: ; preds = %44, %4
%17 = load i32, i32* %9
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %53
20: ; preds = %16
%21 = load float*, float** %11
%22 = load float, float* %21
%23 = load float*, float** %11
%24 = load float, float* %23
%25 = load float*, float** %12
%26 = load float, float* %25
%27 = load float*, float** %12
%28 = load float, float* %27
%29 = fmul float %26, %28
%30 = call float @llvm.fmuladd.f32(float %22, float %24, float %29)
%31 = fpext float %30 to double
%32 = fcmp ogt double %31, 0x3D719799812DEA11
br i1 %32, label %33, label %41
33: ; preds = %20
%34 = load float*, float** %12
%35 = load float, float* %34
%36 = load float*, float** %11
%37 = load float, float* %36
%38 = call i64 @atan2(float %35, float %37)
%39 = sitofp i64 %38 to float
%40 = load float*, float** %10
store float %39, float* %40
br label %43
41: ; preds = %20
%42 = load float*, float** %10
store float 1.000000e+01, float* %42
br label %43
43: ; preds = %41, %33
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
%47 = load float*, float** %10
%48 = getelementptr inbounds float, float* %47, i32 1
store float* %48, float** %10
%49 = load float*, float** %11
%50 = getelementptr inbounds float, float* %49, i32 1
store float* %50, float** %11
%51 = load float*, float** %12
%52 = getelementptr inbounds float, float* %51, i32 1
store float* %52, float** %12
br label %16
53: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @GradientArgument2D(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %27
6: ; preds = %4, %20
%7 = phi float* [ %25, %20 ], [ %2, %4 ]
%8 = phi float* [ %24, %20 ], [ %1, %4 ]
%9 = phi float* [ %23, %20 ], [ %0, %4 ]
%10 = phi i32 [ %22, %20 ], [ 0, %4 ]
%11 = load float, float* %8
%12 = load float, float* %7
%13 = fmul float %12, %12
%14 = tail call float @llvm.fmuladd.f32(float %11, float %11, float %13)
%15 = fpext float %14 to double
%16 = fcmp ogt double %15, 0x3D719799812DEA11
br i1 %16, label %17, label %20
17: ; preds = %6
%18 = tail call i64 @atan2(float %12, float %11)
%19 = sitofp i64 %18 to float
br label %20
20: ; preds = %6, %17
%21 = phi float [ %19, %17 ], [ 1.000000e+01, %6 ]
store float %21, float* %9
%22 = add nuw nsw i32 %10, 1
%23 = getelementptr inbounds float, float* %9, i64 1
%24 = getelementptr inbounds float, float* %8, i64 1
%25 = getelementptr inbounds float, float* %7, i64 1
%26 = icmp eq i32 %22, %3
br i1 %26, label %27, label %6
27: ; preds = %20, %4
ret void
}