#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 short **__ctype_b_loc();
int /*<<< orphan*/ printf(char *, int, unsigned short const);
int main(int argc, char *argv[]) {
  const unsigned short int **b_loc = __ctype_b_loc();
  for (int i = -128; i < 256; i++) {
    printf("%d->0x%x\n", i, (*b_loc)[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <__ctype_b_loc@plt>
mov    %rax,-0x18(%rbp)
movl   $0xffffff80,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    1181 <main+0x61>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
lea    0xe96(%rip),%rdi
movzwl (%rax,%rcx,2),%edx
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <__ctype_b_loc@plt>
mov    %rax,%r14
mov    $0xffffffffffffff80,%rbx
lea    0xec3(%rip),%r15
nopl   (%rax)
mov    (%r14),%rax
movzwl (%rax,%rbx,2),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d->0x%x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16**
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i16** (...) @__ctype_b_loc()
store i16** %8, i16*** %6
store i32 -128, i32* %7
br label %9
9: ; preds = %21, %2
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 256
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %7
%14 = load i16**, i16*** %6
%15 = load i16*, i16** %14
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i16, i16* %15, i64 %17
%19 = load i16, i16* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13, i16 zeroext %19)
br label %21
21: ; preds = %12
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %9
24: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d->0x%x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i16** (...) @__ctype_b_loc()
br label %5
4: ; preds = %5
ret i32 0
5: ; preds = %2, %5
%6 = phi i64 [ -128, %2 ], [ %12, %5 ]
%7 = load i16*, i16** %3
%8 = getelementptr inbounds i16, i16* %7, i64 %6
%9 = load i16, i16* %8
%10 = trunc i64 %6 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10, i16 zeroext %9)
%12 = add nsw i64 %6, 1
%13 = icmp eq i64 %12, 256
br i1 %13, label %4, label %5
}