#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 /*<<< orphan*/ printf(char *, ...);
char *registers_get_string(char const *);
int registers_len();
char **registers_names();
int debug_display_all_registers() {
  int num_regs, i;
  char *content;
  const char **reg_names;
  reg_names = registers_names();
  num_regs = registers_len();
  for (i = 0; i < num_regs; ++i) {
    content = registers_get_string(reg_names[i]);
    printf("%s: %s\t", reg_names[i], content);
    if ((i < 20 && i % 5 == 4) || i == 23 || i == 28)
      printf("\n");
  }
  printf("\n");
  return 1;
}


x86 assembly (clang, -O0):
<debug_display_all_registers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <registers_names@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <registers_len@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f6 <debug_display_all_registers+0xb6>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <registers_get_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x14,-0x8(%rbp)
jge    11c1 <debug_display_all_registers+0x81>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x4,%edx
je     11d5 <debug_display_all_registers+0x95>
cmpl   $0x17,-0x8(%rbp)
je     11d5 <debug_display_all_registers+0x95>
cmpl   $0x1c,-0x8(%rbp)
jne    11e3 <debug_display_all_registers+0xa3>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <debug_display_all_registers+0xa8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <debug_display_all_registers+0x24>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_display_all_registers>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1050 <registers_names@plt>
mov    %rax,%r12
xor    %eax,%eax
call   1070 <registers_len@plt>
test   %eax,%eax
jle    11dc <debug_display_all_registers+0x8c>
mov    %eax,%r15d
mov    $0x4,%bpl
lea    0xe86(%rip),%r14
xor    %ebx,%ebx
jmp    1197 <debug_display_all_registers+0x47>
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
add    $0xff,%bpl
cmp    %rbx,%r15
je     11dc <debug_display_all_registers+0x8c>
mov    (%r12,%rbx,8),%rdi
call   1060 <registers_get_string@plt>
mov    (%r12,%rbx,8),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x13,%rbx
ja     11d0 <debug_display_all_registers+0x80>
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
lea    (%rax,%rax,4),%eax
add    %bpl,%al
jne    118a <debug_display_all_registers+0x3a>
jmp    1180 <debug_display_all_registers+0x30>
nopl   (%rax)
cmp    $0x1c,%ebx
je     1180 <debug_display_all_registers+0x30>
cmp    $0x17,%ebx
je     1180 <debug_display_all_registers+0x30>
jmp    118a <debug_display_all_registers+0x3a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\09\00"
define i32 @debug_display_all_registers() {
%1 = tail call i8** (...) @registers_names()
%2 = tail call i32 (...) @registers_len()
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %25
4: ; preds = %0
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %22
%7 = phi i64 [ 0, %4 ], [ %23, %22 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i8* @registers_get_string(i8* %9)
%11 = load i8*, i8** %8
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %10)
%13 = icmp ult i64 %7, 20
br i1 %13, label %14, label %18
14: ; preds = %6
%15 = trunc i64 %7 to i8
%16 = urem i8 %15, 5
%17 = icmp eq i8 %16, 4
br i1 %17, label %20, label %22
18: ; preds = %6
%19 = trunc i64 %7 to i32
switch i32 %19, label %22 [
i32 23, label %20
i32 28, label %20
]
20: ; preds = %18, %18, %14
%21 = tail call i32 @putchar(i32 10)
br label %22
22: ; preds = %14, %18, %20
%23 = add nuw nsw i64 %7, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %6
25: ; preds = %22, %0
%26 = tail call i32 @putchar(i32 10)
ret i32 1
}