void ID2table(const unsigned long long ID, const int width, const int hight) {
  int i, j;
  for (i = 0; i < hight; i++) {
    for (j = 0; j < width; j++) {
      unsigned long long p = (1L << ((width)*i + j));
      if ((ID & p) == p)
        printf("G ");
      else
        printf("Y ");
    }
    putchar('\n');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<ID2table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11d2 <ID2table+0xb2>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b8 <ID2table+0x98>
mov    -0xc(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    -0x20(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1197 <ID2table+0x77>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a5 <ID2table+0x85>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11aa <ID2table+0x8a>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <ID2table+0x2c>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <ID2table+0x19>
mov    $0xa,%edi
mov    $0x0,%al
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ID2table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
test   %edx,%edx
jle    11ae <ID2table+0x8e>
mov    %rdi,%rbx
mov    %esi,%eax
mov    %rax,0x10(%rsp)
lea    0xeb9(%rip),%r13
lea    0xeb5(%rip),%rbp
movl   $0x0,0x4(%rsp)
xor    %r14d,%r14d
mov    %esi,0x8(%rsp)
jmp    117f <ID2table+0x5f>
nop
mov    $0xa,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
add    $0x1,%r14d
mov    0x8(%rsp),%esi
add    %esi,0x4(%rsp)
cmp    0xc(%rsp),%r14d
je     11ae <ID2table+0x8e>
test   %esi,%esi
jle    1160 <ID2table+0x40>
mov    0x10(%rsp),%r12
mov    0x4(%rsp),%eax
mov    %eax,%r15d
nop
bt     %r15,%rbx
mov    %rbp,%rdi
cmovb  %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
add    $0xffffffffffffffff,%r12
jne    1190 <ID2table+0x70>
jmp    1160 <ID2table+0x40>
mov    $0xa,%edi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"G \00"
@.str.1 = [3 x i8] c"Y \00"
define void @ID2table(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %10
10: ; preds = %42, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %45
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %37, %14
%16 = load i32, i32* %8
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %40
19: ; preds = %15
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = mul nsw i32 %20, %21
%23 = load i32, i32* %8
%24 = add nsw i32 %22, %23
%25 = zext i32 %24 to i64
%26 = shl i64 1, %25
store i64 %26, i64* %9
%27 = load i64, i64* %4
%28 = load i64, i64* %9
%29 = and i64 %27, %28
%30 = load i64, i64* %9
%31 = icmp eq i64 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %19
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %36
34: ; preds = %19
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
br label %37
37: ; preds = %36
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
br label %15
40: ; preds = %15
%41 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
br label %42
42: ; preds = %40
%43 = load i32, i32* %7
%44 = add nsw i32 %43, 1
store i32 %44, i32* %7
br label %10
45: ; preds = %10
%46 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"G \00"
@.str.1 = [3 x i8] c"Y \00"
define void @ID2table(i64 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %28
5: ; preds = %3
%6 = icmp sgt i32 %1, 0
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %5, %24
%9 = phi i32 [ 0, %5 ], [ %26, %24 ]
br i1 %6, label %10, label %24
10: ; preds = %8
%11 = mul nsw i32 %9, %1
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %22, %12 ]
%14 = trunc i64 %13 to i32
%15 = add nsw i32 %11, %14
%16 = zext i32 %15 to i64
%17 = shl nuw i64 1, %16
%18 = and i64 %17, %0
%19 = icmp eq i64 %18, %17
%20 = select i1 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %20)
%22 = add nuw nsw i64 %13, 1
%23 = icmp eq i64 %22, %7
br i1 %23, label %24, label %12
24: ; preds = %12, %8
%25 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
%26 = add nuw nsw i32 %9, 1
%27 = icmp eq i32 %26, %2
br i1 %27, label %28, label %8
28: ; preds = %24, %3
%29 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 10)
ret void
}