#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int TextSize();
int /*<<< orphan*/ WriteString(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void PrintAllStrings(FILE *file) {
  int i;
  fprintf(file, "TEXT TABLE\n------------\n");
  for (i = 1; i <= TextSize(); i++) {
    fprintf(file, "%5d:", i);
    WriteString(file, i);
    fprintf(file, "\n");
  }
}


x86 assembly (clang, -O0):
<PrintAllStrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <TextSize@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     11b0 <PrintAllStrings+0x80>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <WriteString@plt>
mov    -0x8(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <PrintAllStrings+0x25>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintAllStrings>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xea2(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
xor    %eax,%eax
call   1060 <TextSize@plt>
test   %eax,%eax
jle    11c4 <PrintAllStrings+0x74>
lea    0xe97(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <WriteString@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
xor    %eax,%eax
call   1060 <TextSize@plt>
cmp    %eax,%ebp
jl     1190 <PrintAllStrings+0x40>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"TEXT TABLE\0A------------\0A\00"
@.str.1 = [5 x i8] c"%5d:\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @PrintAllStrings(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %3
%8 = call i32 (...) @TextSize()
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* %3
%16 = call i32 @WriteString(i32* %14, i32 %15)
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %10
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %6
22: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"TEXT TABLE\0A------------\0A\00"
@.str.1 = [5 x i8] c"%5d:\00"
define void @PrintAllStrings(i32* %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 24, i64 1, i32* %0)
%3 = tail call i32 (...) @TextSize()
%4 = icmp slt i32 %3, 1
br i1 %4, label %13, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %10, %5 ], [ 1, %1 ]
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = tail call i32 @WriteString(i32* %0, i32 %6)
%9 = tail call i32 @fputc(i32 10, i32* %0)
%10 = add nuw nsw i32 %6, 1
%11 = tail call i32 (...) @TextSize()
%12 = icmp slt i32 %6, %11
br i1 %12, label %5, label %13
13: ; preds = %5, %1
ret void
}