#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 */
int **__ctype_toupper_loc();
int /*<<< orphan*/ printf(char *, int, int const);
int main(int argc, char *argv[]) {
  const int **upper_loc = __ctype_toupper_loc();
  for (int i = -128; i < 256; i++) {
    printf("%d->0x%x\n", i, (*upper_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   1030 <__ctype_toupper_loc@plt>
mov    %rax,-0x18(%rbp)
movl   $0xffffff80,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    1180 <main+0x60>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe93(%rip),%rdi
call   1040 <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   1030 <__ctype_toupper_loc@plt>
mov    %rax,%r14
mov    $0xffffffffffffff80,%rbx
lea    0xec3(%rip),%r15
nopl   (%rax)
mov    (%r14),%rax
mov    (%rax,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <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 i32**
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32** (...) @__ctype_toupper_loc()
store i32** %8, i32*** %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 i32**, i32*** %6
%15 = load i32*, i32** %14
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %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 i32** (...) @__ctype_toupper_loc()
br label %5
4: ; preds = %5
ret i32 0
5: ; preds = %2, %5
%6 = phi i64 [ -128, %2 ], [ %12, %5 ]
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 %6
%9 = load i32, i32* %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, i32 %9)
%12 = add nsw i64 %6, 1
%13 = icmp eq i64 %12, 256
br i1 %13, label %4, label %5
}