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


x86 assembly (clang, -O0):
<test_hil_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    1200 <test_hil_32+0xd0>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cmp    %ecx,%eax
jae    11ed <test_hil_32+0xbd>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <hil_s_from_xy@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <hil_xy_from_s@plt>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    11be <test_hil_32+0x8e>
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
je     11d6 <test_hil_32+0xa6>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1206 <test_hil_32+0xd6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    116b <test_hil_32+0x3b>
jmp    11f2 <test_hil_32+0xc2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <test_hil_32+0x1d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hil_32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0x4(%rsp),%r14
mov    %rsp,%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0xb,%edx
call   1050 <hil_s_from_xy@plt>
mov    %eax,%edi
mov    $0xb,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1040 <hil_xy_from_s@plt>
cmp    %ebx,0x4(%rsp)
jne    1198 <test_hil_32+0x68>
cmp    (%rsp),%ebp
jne    1198 <test_hil_32+0x68>
add    $0x1,%ebp
cmp    $0x800,%ebp
jne    1150 <test_hil_32+0x20>
add    $0x1,%ebx
cmp    $0x800,%ebx
jne    1141 <test_hil_32+0x11>
mov    $0x400000,%eax
jmp    11a6 <test_hil_32+0x76>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"~~~~ failed! ~~~~\0A\00"
define i32 @test_hil_32() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%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 = %44, %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 %47
14: ; preds = %9
store i32 0, i32* %8
br label %15
15: ; preds = %40, %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 %43
20: ; preds = %15
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = load i32, i32* %3
%24 = call i32 @hil_s_from_xy(i32 %21, i32 %22, i32 %23)
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = load i32, i32* %3
%27 = call i32 @hil_xy_from_s(i32 %25, i32 %26, i32* %5, i32* %6)
%28 = load i32, i32* %5
%29 = load i32, i32* %7
%30 = icmp ne i32 %28, %29
br i1 %30, label %35, label %31
31: ; preds = %20
%32 = load i32, i32* %6
%33 = load i32, i32* %8
%34 = icmp ne i32 %32, %33
br i1 %34, label %35, label %37
35: ; preds = %31, %20
%36 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %49
37: ; preds = %31
%38 = load i32, i32* %2
%39 = add i32 %38, 1
store i32 %39, i32* %2
br label %40
40: ; preds = %37
%41 = load i32, i32* %8
%42 = add i32 %41, 1
store i32 %42, i32* %8
br label %15
43: ; preds = %15
br label %44
44: ; preds = %43
%45 = load i32, i32* %7
%46 = add i32 %45, 1
store i32 %46, i32* %7
br label %9
47: ; preds = %9
%48 = load i32, i32* %2
store i32 %48, i32* %1
br label %49
49: ; preds = %47, %35
%50 = load i32, i32* %1
ret i32 %50
}

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