#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 */
unsigned long long hil_s_from_xy_64(unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ hil_xy_from_s_64(unsigned long long, unsigned int,
                                    unsigned long long *, unsigned long long *);
int /*<<< orphan*/ printf(char *);
unsigned test_hil_64() {
  unsigned c = 0;
  unsigned z = 11;
  unsigned long long s, px, py;
  for (unsigned x = 0; x < (1 << z); ++x) {
    for (unsigned y = 0; y < (1 << z); ++y) {
      s = hil_s_from_xy_64(x, y, z);
      hil_xy_from_s_64(s, z, &px, &py);
      if (px != x || py != y) {
        printf("~~~~ failed! ~~~~\n");
        return 0;
      }
      ++c;
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<test_hil_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    120a <test_hil_64+0xda>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    11f7 <test_hil_64+0xc7>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <hil_s_from_xy_64@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1050 <hil_xy_from_s_64@plt>
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
cmp    %rcx,%rax
jne    11c8 <test_hil_64+0x98>
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
cmp    %rcx,%rax
je     11e0 <test_hil_64+0xb0>
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1210 <test_hil_64+0xe0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    116b <test_hil_64+0x3b>
jmp    11fc <test_hil_64+0xcc>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    114d <test_hil_64+0x1d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hil_64>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %r12d,%r12d
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%r15
mov    %r12d,%r12d
xor    %ebx,%ebx
nopl   (%rax)
mov    %r12d,%edi
mov    %ebx,%esi
mov    $0xb,%edx
call   1040 <hil_s_from_xy_64@plt>
mov    %rax,%rdi
mov    $0xb,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <hil_xy_from_s_64@plt>
cmp    %r12,0x10(%rsp)
jne    11a1 <test_hil_64+0x71>
cmp    0x8(%rsp),%rbx
jne    11a1 <test_hil_64+0x71>
add    $0x1,%rbx
cmp    $0x800,%rbx
jne    1150 <test_hil_64+0x20>
add    $0x1,%r12d
cmp    $0x800,%r12d
jne    1148 <test_hil_64+0x18>
mov    $0x400000,%eax
jmp    11af <test_hil_64+0x7f>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"~~~~ failed! ~~~~\0A\00"
define i32 @test_hil_64() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %2
store i32 11, i32* %3
store i32 0, i32* %7
br label %9
9: ; preds = %46, %0
%10 = load i32, i32* %7
%11 = load i32, i32* %3
%12 = shl i32 1, %11
%13 = icmp ult i32 %10, %12
br i1 %13, label %14, label %49
14: ; preds = %9
store i32 0, i32* %8
br label %15
15: ; preds = %42, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %3
%18 = shl i32 1, %17
%19 = icmp ult i32 %16, %18
br i1 %19, label %20, label %45
20: ; preds = %15
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = load i32, i32* %3
%24 = call i64 @hil_s_from_xy_64(i32 %21, i32 %22, i32 %23)
store i64 %24, i64* %4
%25 = load i64, i64* %4
%26 = load i32, i32* %3
%27 = call i32 @hil_xy_from_s_64(i64 %25, i32 %26, i64* %5, i64* %6)
%28 = load i64, i64* %5
%29 = load i32, i32* %7
%30 = zext i32 %29 to i64
%31 = icmp ne i64 %28, %30
br i1 %31, label %37, label %32
32: ; preds = %20
%33 = load i64, i64* %6
%34 = load i32, i32* %8
%35 = zext i32 %34 to i64
%36 = icmp ne i64 %33, %35
br i1 %36, label %37, label %39
37: ; preds = %32, %20
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %51
39: ; preds = %32
%40 = load i32, i32* %2
%41 = add i32 %40, 1
store i32 %41, i32* %2
br label %42
42: ; preds = %39
%43 = load i32, i32* %8
%44 = add i32 %43, 1
store i32 %44, i32* %8
br label %15
45: ; preds = %15
br label %46
46: ; preds = %45
%47 = load i32, i32* %7
%48 = add i32 %47, 1
store i32 %48, i32* %7
br label %9
49: ; preds = %9
%50 = load i32, i32* %2
store i32 %50, i32* %1
br label %51
51: ; preds = %49, %37
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@str = [18 x i8] c"~~~~ failed! ~~~~\00"
define i32 @test_hil_64() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
br label %5
5: ; preds = %0, %21
%6 = phi i32 [ 0, %0 ], [ %22, %21 ]
%7 = zext i32 %6 to i64
br label %8
8: ; preds = %5, %18
%9 = phi i64 [ 0, %5 ], [ %19, %18 ]
%10 = trunc i64 %9 to i32
%11 = call i64 @hil_s_from_xy_64(i32 %6, i32 %10, i32 11)
%12 = call i32 @hil_xy_from_s_64(i64 %11, i32 11, i64* %1, i64* %2)
%13 = load i64, i64* %1
%14 = icmp eq i64 %13, %7
%15 = load i64, i64* %2
%16 = icmp eq i64 %15, %9
%17 = select i1 %14, i1 %16, i1 false
br i1 %17, label %18, label %24
18: ; preds = %8
%19 = add nuw nsw i64 %9, 1
%20 = icmp eq i64 %19, 2048
br i1 %20, label %21, label %8
21: ; preds = %18
%22 = add nuw nsw i32 %6, 1
%23 = icmp eq i32 %22, 2048
br i1 %23, label %26, label %5
24: ; preds = %8
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %21, %24
%27 = phi i32 [ 0, %24 ], [ 4194304, %21 ]
ret i32 %27
}