#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__ X(unsigned long, int, int);
int power(int, int);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(int argc, char *argv[]) {
  unsigned long c = 0;
  unsigned long n;
  unsigned long upper_limit = power(2, 30) + 1;
  for (n = 1; n < upper_limit; n++) {
    if (X(n, 2 * n, 3 * n) == 0) {
      c++;
    }
  }
  printf("%lu\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    $0x2,%edi
mov    $0x1e,%esi
call   1030 <power@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x28(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11c2 <main+0x92>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x1,%rax
mov    %eax,%esi
imul   $0x3,-0x20(%rbp),%rax
mov    %eax,%edx
call   1040 <X@plt>
cmp    $0x0,%rax
jne    11ac <main+0x7c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11b1 <main+0x81>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    116e <main+0x3e>
mov    -0x18(%rbp),%rsi
lea    0xe33(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x2,%r15d
mov    $0x2,%edi
mov    $0x1e,%esi
call   1030 <power@plt>
add    $0x1,%eax
cmp    $0x2,%eax
jb     1197 <main+0x67>
movslq %eax,%r12
mov    $0x1,%ebx
mov    $0x3,%ebp
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1040 <X@plt>
cmp    $0x1,%rax
adc    $0x0,%r14
add    $0x1,%rbx
add    $0x3,%ebp
add    $0x2,%r15d
cmp    %rbx,%r12
jne    1170 <main+0x40>
jmp    119a <main+0x6a>
xor    %r14d,%r14d
lea    0xe5f(%rip),%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%9 = call i32 @power(i32 2, i32 30)
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
store i64 %11, i64* %8
store i64 1, i64* %7
br label %12
12: ; preds = %30, %2
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %33
16: ; preds = %12
%17 = load i64, i64* %7
%18 = load i64, i64* %7
%19 = mul i64 2, %18
%20 = trunc i64 %19 to i32
%21 = load i64, i64* %7
%22 = mul i64 3, %21
%23 = trunc i64 %22 to i32
%24 = call i64 @X(i64 %17, i32 %20, i32 %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %16
%27 = load i64, i64* %6
%28 = add i64 %27, 1
store i64 %28, i64* %6
br label %29
29: ; preds = %26, %16
br label %30
30: ; preds = %29
%31 = load i64, i64* %7
%32 = add i64 %31, 1
store i64 %32, i64* %7
br label %12
33: ; preds = %12
%34 = load i64, i64* %6
%35 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @power(i32 2, i32 30)
%4 = add nsw i32 %3, 1
%5 = sext i32 %4 to i64
%6 = icmp ugt i32 %4, 1
br i1 %6, label %7, label %19
7: ; preds = %2, %7
%8 = phi i64 [ %16, %7 ], [ 0, %2 ]
%9 = phi i64 [ %17, %7 ], [ 1, %2 ]
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 1
%12 = mul i32 %10, 3
%13 = tail call i64 @X(i64 %9, i32 %11, i32 %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i64
%16 = add i64 %8, %15
%17 = add nuw i64 %9, 1
%18 = icmp eq i64 %17, %5
br i1 %18, label %19, label %7
19: ; preds = %7, %2
%20 = phi i64 [ 0, %2 ], [ %16, %7 ]
%21 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %20)
ret i32 0
}