#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__ arithmetic(double *, int);
int /*<<< orphan*/ assert(int);
scalar_t__ geometric(double *, int);
void test_pythagorean_inequality(void) {
  size_t i, j;
  for (i = 0; i < 1000; i++) {
    for (j = 0; j < 1000; j++) {
      double v[] = {i, j};
      assert(arithmetic(v, 2) >= geometric(v, 2));
    }
  }
}


x86 assembly (clang, -O0):
<test_pythagorean_inequality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x3e8,-0x8(%rbp)
jae    120b <test_pythagorean_inequality+0xdb>
movq   $0x0,-0x10(%rbp)
cmpq   $0x3e8,-0x10(%rbp)
jae    11f5 <test_pythagorean_inequality+0xc5>
movq   -0x8(%rbp),%xmm0
movaps 0xe90(%rip),%xmm2
punpckldq %xmm2,%xmm0
movapd 0xe94(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm3
unpckhpd %xmm0,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,-0x20(%rbp)
movq   -0x10(%rbp),%xmm0
punpckldq %xmm2,%xmm0
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1040 <arithmetic@plt>
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1030 <geometric@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <test_pythagorean_inequality+0x26>
jmp    11fa <test_pythagorean_inequality+0xca>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1140 <test_pythagorean_inequality+0x10>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pythagorean_inequality>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %r15d,%r15d
movdqa 0xeba(%rip),%xmm1
movapd 0xec2(%rip),%xmm2
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movq   %r15,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm3,0x10(%rsp)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movaps 0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
movq   %rbx,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
call   1040 <arithmetic@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <geometric@plt>
xor    %edi,%edi
cmp    %rax,%r12
setge  %dil
call   1050 <assert@plt>
movapd 0xe24(%rip),%xmm2
movdqa 0xe0c(%rip),%xmm1
add    $0x1,%rbx
cmp    $0x3e8,%rbx
jne    1190 <test_pythagorean_inequality+0x60>
add    $0x1,%r15
cmp    $0x3e8,%r15
jne    1160 <test_pythagorean_inequality+0x30>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @test_pythagorean_inequality() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca [2 x double]
store i64 0, i64* %1
br label %4
4: ; preds = %29, %0
%5 = load i64, i64* %1
%6 = icmp ult i64 %5, 1000
br i1 %6, label %7, label %32
7: ; preds = %4
store i64 0, i64* %2
br label %8
8: ; preds = %25, %7
%9 = load i64, i64* %2
%10 = icmp ult i64 %9, 1000
br i1 %10, label %11, label %28
11: ; preds = %8
%12 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%13 = load i64, i64* %1
%14 = uitofp i64 %13 to double
store double %14, double* %12
%15 = getelementptr inbounds double, double* %12, i64 1
%16 = load i64, i64* %2
%17 = uitofp i64 %16 to double
store double %17, double* %15
%18 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%19 = call i64 @arithmetic(double* %18, i32 2)
%20 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%21 = call i64 @geometric(double* %20, i32 2)
%22 = icmp sge i64 %19, %21
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
br label %25
25: ; preds = %11
%26 = load i64, i64* %2
%27 = add i64 %26, 1
store i64 %27, i64* %2
br label %8
28: ; preds = %8
br label %29
29: ; preds = %28
%30 = load i64, i64* %1
%31 = add i64 %30, 1
store i64 %31, i64* %1
br label %4
32: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @test_pythagorean_inequality() {
%1 = alloca [2 x double]
%2 = bitcast [2 x double]* %1 to i8*
%3 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 0
%4 = getelementptr inbounds [2 x double], [2 x double]* %1, i64 0, i64 1
br label %5
5: ; preds = %0, %18
%6 = phi i64 [ 0, %0 ], [ %19, %18 ]
%7 = uitofp i64 %6 to double
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %16, %8 ]
store double %7, double* %3
%10 = uitofp i64 %9 to double
store double %10, double* %4
%11 = call i64 @arithmetic(double* %3, i32 2)
%12 = call i64 @geometric(double* %3, i32 2)
%13 = icmp sge i64 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = add nuw nsw i64 %9, 1
%17 = icmp eq i64 %16, 1000
br i1 %17, label %18, label %8
18: ; preds = %8
%19 = add nuw nsw i64 %6, 1
%20 = icmp eq i64 %19, 1000
br i1 %20, label %21, label %5
21: ; preds = %18
ret void
}