#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*/ is_triplet(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a = 1, b = 2, c = 3;
  while (a + b + c != 1000 || !is_triplet(a, b, c)) {
    if (++a >= b) {
      a = 1;
      if (++b >= c) {
        b = 2;
        c++;
      }
    }
  }
  printf("%llu\n", a * b * c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    $0x1,%al
cmp    $0x3e8,%ecx
mov    %al,-0x11(%rbp)
jne    1177 <main+0x57>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <is_triplet@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1187 <main+0x67>
jmp    11cc <main+0xac>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    -0xc(%rbp),%eax
jl     11c7 <main+0xa7>
movl   $0x1,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    -0x10(%rbp),%eax
jl     11c2 <main+0xa2>
movl   $0x2,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c7 <main+0xa7>
jmp    1144 <main+0x24>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
imul   -0x10(%rbp),%esi
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x3,%r14d
mov    $0x2,%r15d
jmp    115b <main+0x3b>
nopl   0x0(%rax)
add    $0x1,%r15d
xor    %eax,%eax
cmp    %r14d,%r15d
setge  %al
mov    $0x2,%ecx
cmovge %ecx,%r15d
add    %r14d,%eax
mov    %eax,%r14d
mov    %r15d,%r13d
imul   %r14d,%r13d
lea    (%r15,%r14,1),%r12d
mov    $0x1,%ebx
mov    %r13d,%ebp
jmp    117b <main+0x5b>
add    $0x1,%ebx
add    %r13d,%ebp
cmp    %r15d,%ebx
jge    1140 <main+0x20>
lea    (%r12,%rbx,1),%eax
cmp    $0x3e8,%eax
jne    1170 <main+0x50>
mov    %ebx,%edi
mov    %r15d,%esi
mov    %r14d,%edx
call   1040 <is_triplet@plt>
test   %eax,%eax
je     1170 <main+0x50>
lea    0xe62(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
br label %5
5: ; preds = %35, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
%11 = icmp ne i32 %10, 1000
br i1 %11, label %19, label %12
12: ; preds = %5
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @is_triplet(i32 %13, i32 %14, i32 %15)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
br label %19
19: ; preds = %12, %5
%20 = phi i1 [ true, %5 ], [ %18, %12 ]
br i1 %20, label %21, label %36
21: ; preds = %19
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
%24 = load i32, i32* %3
%25 = icmp sge i32 %23, %24
br i1 %25, label %26, label %35
26: ; preds = %21
store i32 1, i32* %2
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
%29 = load i32, i32* %4
%30 = icmp sge i32 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %26
store i32 2, i32* %3
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %34
34: ; preds = %31, %26
br label %35
35: ; preds = %34, %21
br label %5
36: ; preds = %19
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = mul nsw i32 %37, %38
%40 = load i32, i32* %4
%41 = mul nsw i32 %39, %40
%42 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %41)
ret i32 0
}

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