#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*/ configure_abbreviations(unsigned int *, unsigned long *,
                                           unsigned long *, unsigned long *,
                                           unsigned long *);
int /*<<< orphan*/ decode_text(unsigned long *);
scalar_t__ read_data_word(unsigned long *);
int /*<<< orphan*/ tx_printf(char *, ...);
void show_abbreviations(void) {
  unsigned long table_address, abbreviation_address;
  unsigned long abbr_table_base, abbr_table_end, abbr_data_base, abbr_data_end;
  unsigned int abbr_count;
  int i;
  configure_abbreviations(&abbr_count, &abbr_table_base, &abbr_table_end,
                          &abbr_data_base, &abbr_data_end);
  tx_printf("\n    **** Abbreviations ****\n\n");
  if (abbr_count == 0) {
    tx_printf("No abbreviation information.\n");
  } else {
    table_address = abbr_table_base;
    for (i = 0; (unsigned int)i < abbr_count; i++) {
      abbreviation_address = (unsigned long)read_data_word(&table_address) * 2;
      tx_printf("[%2d] \"", (int)i);
      (void)decode_text(&abbreviation_address);
      tx_printf("\"\n");
    }
  }
}


x86 assembly (clang, -O0):
<show_abbreviations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x34(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1030 <configure_abbreviations@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1060 <tx_printf@plt>
cmpl   $0x0,-0x34(%rbp)
jne    118c <show_abbreviations+0x4c>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1060 <tx_printf@plt>
jmp    11f3 <show_abbreviations+0xb3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    11ee <show_abbreviations+0xae>
lea    -0x8(%rbp),%rdi
call   1040 <read_data_word@plt>
shl    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x38(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1060 <tx_printf@plt>
lea    -0x10(%rbp),%rdi
call   1050 <decode_text@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1060 <tx_printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    119b <show_abbreviations+0x5b>
jmp    11f3 <show_abbreviations+0xb3>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_abbreviations>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x30(%rsp),%rcx
lea    0x28(%rsp),%r8
call   1030 <configure_abbreviations@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1060 <tx_printf@plt>
cmpl   $0x0,0xc(%rsp)
je     11e9 <show_abbreviations+0xa9>
mov    0x10(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x20(%rsp),%r14
lea    0xea8(%rip),%r15
lea    0x18(%rsp),%r12
lea    0xea4(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <read_data_word@plt>
add    %rax,%rax
mov    %rax,0x18(%rsp)
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <tx_printf@plt>
mov    %r12,%rdi
call   1050 <decode_text@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <tx_printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jb     11b0 <show_abbreviations+0x70>
jmp    11f7 <show_abbreviations+0xb7>
lea    0xe2f(%rip),%rdi
xor    %eax,%eax
call   1060 <tx_printf@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"\0A **** Abbreviations ****\0A\0A\00"
@.str.1 = [30 x i8] c"No abbreviation information.\0A\00"
@.str.2 = [8 x i8] c"[%2d] \22\00"
@.str.3 = [3 x i8] c"\22\0A\00"
define void @show_abbreviations() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = call i32 @configure_abbreviations(i32* %7, i64* %3, i64* %4, i64* %5, i64* %6)
%10 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %7
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %32
15: ; preds = %0
%16 = load i64, i64* %3
store i64 %16, i64* %1
store i32 0, i32* %8
br label %17
17: ; preds = %28, %15
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = call i64 @read_data_word(i64* %1)
%23 = mul i64 %22, 2
store i64 %23, i64* %2
%24 = load i32, i32* %8
%25 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = call i32 @decode_text(i64* %2)
%27 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %28
28: ; preds = %21
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %17
31: ; preds = %17
br label %32
32: ; preds = %31, %13
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"\0A **** Abbreviations ****\0A\0A\00"
@.str.1 = [30 x i8] c"No abbreviation information.\0A\00"
@.str.2 = [8 x i8] c"[%2d] \22\00"
@.str.3 = [3 x i8] c"\22\0A\00"
define void @show_abbreviations() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = bitcast i64* %1 to i8*
%9 = bitcast i64* %2 to i8*
%10 = bitcast i64* %3 to i8*
%11 = bitcast i64* %4 to i8*
%12 = bitcast i64* %5 to i8*
%13 = bitcast i64* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = call i32 @configure_abbreviations(i32* %7, i64* %3, i64* %4, i64* %5, i64* %6)
%16 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %33
21: ; preds = %0
%22 = load i64, i64* %3
store i64 %22, i64* %1
br label %23
23: ; preds = %21, %23
%24 = phi i32 [ %30, %23 ], [ 0, %21 ]
%25 = call i64 @read_data_word(i64* %1)
%26 = shl i64 %25, 1
store i64 %26, i64* %2
%27 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%28 = call i32 @decode_text(i64* %2)
%29 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%30 = add nuw nsw i32 %24, 1
%31 = load i32, i32* %7
%32 = icmp ult i32 %30, %31
br i1 %32, label %23, label %33
33: ; preds = %23, %19
ret void
}