#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 /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a, b;
  for (a = 1; a < 1000; ++a)
    for (b = a + 1; b < (1000 - a); ++b)
      if (1e6 == (2000 * (a + b) - 2 * a * b))
        printf("%d, %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11bb <main+0xab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
sub    -0x8(%rbp),%ecx
cmp    %ecx,%eax
jge    11a8 <main+0x98>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
imul   $0x7d0,%eax,%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe8d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jne    1195 <main+0x85>
jp     1195 <main+0x85>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
jmp    119a <main+0x8a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <main+0x2c>
jmp    11ad <main+0x9d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%eax
movl   $0x3e5,0x10(%rsp)
mov    $0xfffff068,%r12d
movl   $0xf2ad4,0xc(%rsp)
mov    $0xfffff832,%r14d
jmp    116d <main+0x5d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addl   $0xfffffffe,0x10(%rsp)
add    %r12d,0xc(%rsp)
add    $0x4,%r12d
add    $0x2,%r14d
mov    0x14(%rsp),%eax
cmp    $0x3e8,%eax
je     11c3 <main+0xb3>
mov    %eax,%ebx
lea    0x1(%rbx),%ecx
mov    $0x3e8,%eax
sub    %ebx,%eax
mov    %ecx,0x14(%rsp)
cmp    %eax,%ecx
jae    1150 <main+0x40>
mov    0xc(%rsp),%r13d
mov    0x10(%rsp),%r15d
mov    0x14(%rsp),%ebp
jmp    11ac <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
add    %r14d,%r13d
add    $0xffffffff,%r15d
je     1150 <main+0x40>
test   %r13d,%r13d
jne    11a0 <main+0x90>
lea    0xe48(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
jmp    11a0 <main+0x90>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %4
4: ; preds = %36, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %39
7: ; preds = %4
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %32, %7
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = sub nsw i32 1000, %12
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %35
15: ; preds = %10
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = add nsw i32 %16, %17
%19 = mul nsw i32 2000, %18
%20 = load i32, i32* %2
%21 = mul nsw i32 2, %20
%22 = load i32, i32* %3
%23 = mul nsw i32 %21, %22
%24 = sub nsw i32 %19, %23
%25 = sitofp i32 %24 to double
%26 = fcmp oeq double 1.000000e+06, %25
br i1 %26, label %27, label %31
27: ; preds = %15
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %28, i32 %29)
br label %31
31: ; preds = %27, %15
br label %32
32: ; preds = %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %10
35: ; preds = %10
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %4
39: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d, %d\0A\00"
define i32 @main() {
br label %4
1: ; preds = %21, %4
%2 = add nsw i32 %5, -1
%3 = icmp eq i32 %7, 1000
br i1 %3, label %24, label %4
4: ; preds = %0, %1
%5 = phi i32 [ 999, %0 ], [ %2, %1 ]
%6 = phi i32 [ 1, %0 ], [ %7, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = sub nuw nsw i32 1000, %6
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %1
10: ; preds = %4
%11 = mul nsw i32 %6, -2
br label %12
12: ; preds = %10, %21
%13 = phi i32 [ %7, %10 ], [ %22, %21 ]
%14 = add nuw nsw i32 %13, %6
%15 = mul nuw nsw i32 %14, 2000
%16 = mul i32 %11, %13
%17 = add i32 %15, %16
%18 = icmp eq i32 %17, 1000000
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %13)
br label %21
21: ; preds = %12, %19
%22 = add nuw nsw i32 %13, 1
%23 = icmp eq i32 %22, %5
br i1 %23, label %1, label %12
24: ; preds = %1
ret i32 0
}