#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 *, ...);
int main(void) {
  int i, j;
  for (i = 0; i < 256; ++i) {
    printf("extern int ");
    for (j = 0; j < 255; ++j)
      printf("foo%02x%02x (void), ", i, j);
    printf("foo%02xff (void);\nint bar%02x (int x) { return x", i, i);
    for (j = 0; j < 256; ++j)
      printf(" + foo%02x%02x ()", i, j);
    printf("; }\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11dd <main+0xcd>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jge    1177 <main+0x67>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x38>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    11c1 <main+0xb1>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1192 <main+0x82>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeda(%rip),%r12
lea    0xf19(%rip),%r15
lea    0xf24(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0xff,%ebx
jne    1160 <main+0x40>
xor    %r14d,%r14d
lea    0xe9e(%rip),%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r14d
cmp    $0x100,%r14d
jne    1190 <main+0x70>
mov    %r13,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"extern int \00"
@.str.1 = [21 x i8] c"foo%02x%02x (void), \00"
@.str.2 = [49 x i8] c"foo%02xff (void);\0Aint bar%02x (int x) { return x\00"
@.str.3 = [18 x i8] c" + foo%02x%02x ()\00"
@.str.4 = [5 x i8] c"; }\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %35, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %38
7: ; preds = %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %9
9: ; preds = %16, %7
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 255
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %9
19: ; preds = %9
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %20, i32 %21)
store i32 0, i32* %3
br label %23
23: ; preds = %30, %19
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 256
br i1 %25, label %26, label %33
26: ; preds = %23
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28)
br label %30
30: ; preds = %26
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %23
33: ; preds = %23
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33
%36 = load i32, i32* %2
%37 = add nsw i32 %36, 1
store i32 %37, i32* %2
br label %4
38: ; preds = %4
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [12 x i8] c"extern int \00"
@.str.1 = [21 x i8] c"foo%02x%02x (void), \00"
@.str.2 = [49 x i8] c"foo%02xff (void);\0Aint bar%02x (int x) { return x\00"
@.str.3 = [18 x i8] c" + foo%02x%02x ()\00"
@str = [4 x i8] c"; }\00"
define i32 @main() {
br label %1
1: ; preds = %0, %16
%2 = phi i32 [ 0, %0 ], [ %18, %16 ]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %7, %4 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %5)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 255
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %2, i32 %2)
br label %11
11: ; preds = %9, %11
%12 = phi i32 [ 0, %9 ], [ %14, %11 ]
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %2, i32 %12)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 256
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%18 = add nuw nsw i32 %2, 1
%19 = icmp eq i32 %18, 256
br i1 %19, label %20, label %1
20: ; preds = %16
ret i32 0
}