#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*/ tests;

/* Variables and functions */
int /*<<< orphan*/ expand(char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int main(void) {
  char *tests[] = {"-",
                   "a",
                   "a-",
                   "a-z",
                   "A-Z",
                   "0-5",
                   "text a-Z text",
                   "text c-a text",
                   "text a----z text",
                   "text a-z text",
                   "text A-Z text",
                   "text 0-9 text",
                   "text 5-1 text",
                   "text c-nB-H text",
                   "text a-d0-9 text",
                   "text A-M0-9 text",
                   "text a-cF-L4-7 text",
                   "text a-c- text",
                   "text a-d-m text",
                   "text A-D-M text",
                   "text 0-5-9 text",
                   "text -a-d-m text",
                   "text -A-D-M text",
                   "text -0-5-9 text"};
  char expanded[128];
  int len;
  len = sizeof(tests) / sizeof(tests[0]);
  for (int i = 0; i < len; ++i) {
    expand(tests[i], expanded);
    printf("%-20s ->  %s\n", tests[i], expanded);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
lea    0x2c10(%rip),%rsi
mov    $0xc0,%edx
call   1040 <memcpy@plt>
movl   $0x18,-0x154(%rbp)
movl   $0x0,-0x158(%rbp)
mov    -0x158(%rbp),%eax
cmp    -0x154(%rbp),%eax
jge    11d1 <main+0xa1>
movslq -0x158(%rbp),%rax
mov    -0xd0(%rbp,%rax,8),%rdi
ff
lea    -0x150(%rbp),%rsi
call   1050 <expand@plt>
movslq -0x158(%rbp),%rax
mov    -0xd0(%rbp,%rax,8),%rsi
ff
lea    -0x150(%rbp),%rdx
lea    0xf77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
jmp    116e <main+0x3e>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
xor    %ebx,%ebx
lea    0x2c27(%rip),%r13
mov    %rsp,%r15
lea    0xfec(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx,%r13,1),%r12
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <expand@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <printf@plt>
add    $0x8,%rbx
cmp    $0xc0,%rbx
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [3 x i8] c"a-\00"
@.str.3 = [4 x i8] c"a-z\00"
@.str.4 = [4 x i8] c"A-Z\00"
@.str.5 = [4 x i8] c"0-5\00"
@.str.6 = [14 x i8] c"text a-Z text\00"
@.str.7 = [14 x i8] c"text c-a text\00"
@.str.8 = [17 x i8] c"text a----z text\00"
@.str.9 = [14 x i8] c"text a-z text\00"
@.str.10 = [14 x i8] c"text A-Z text\00"
@.str.11 = [14 x i8] c"text 0-9 text\00"
@.str.12 = [14 x i8] c"text 5-1 text\00"
@.str.13 = [17 x i8] c"text c-nB-H text\00"
@.str.14 = [17 x i8] c"text a-d0-9 text\00"
@.str.15 = [17 x i8] c"text A-M0-9 text\00"
@.str.16 = [20 x i8] c"text a-cF-L4-7 text\00"
@.str.17 = [15 x i8] c"text a-c- text\00"
@.str.18 = [16 x i8] c"text a-d-m text\00"
@.str.19 = [16 x i8] c"text A-D-M text\00"
@.str.20 = [16 x i8] c"text 0-5-9 text\00"
@.str.21 = [17 x i8] c"text -a-d-m text\00"
@.str.22 = [17 x i8] c"text -A-D-M text\00"
@.str.23 = [17 x i8] c"text -0-5-9 text\00"
@__const.main.tests = [24 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i32 0, i32 0)]
@.str.24 = [14 x i8] c"%-20s -> %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [24 x i8*]
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [24 x i8*]* %2 to i8*
store i32 24, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [24 x i8*], [24 x i8*]* %2, i64 0, i64 %13
%15 = load i8*, i8** %14
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%17 = call i32 @expand(i8* %15, i8* %16)
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [24 x i8*], [24 x i8*]* %2, i64 0, i64 %19
%21 = load i8*, i8** %20
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0), i8* %21, i8* %22)
br label %24
24: ; preds = %11
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %7
27: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [3 x i8] c"a-\00"
@.str.3 = [4 x i8] c"a-z\00"
@.str.4 = [4 x i8] c"A-Z\00"
@.str.5 = [4 x i8] c"0-5\00"
@.str.6 = [14 x i8] c"text a-Z text\00"
@.str.7 = [14 x i8] c"text c-a text\00"
@.str.8 = [17 x i8] c"text a----z text\00"
@.str.9 = [14 x i8] c"text a-z text\00"
@.str.10 = [14 x i8] c"text A-Z text\00"
@.str.11 = [14 x i8] c"text 0-9 text\00"
@.str.12 = [14 x i8] c"text 5-1 text\00"
@.str.13 = [17 x i8] c"text c-nB-H text\00"
@.str.14 = [17 x i8] c"text a-d0-9 text\00"
@.str.15 = [17 x i8] c"text A-M0-9 text\00"
@.str.16 = [20 x i8] c"text a-cF-L4-7 text\00"
@.str.17 = [15 x i8] c"text a-c- text\00"
@.str.18 = [16 x i8] c"text a-d-m text\00"
@.str.19 = [16 x i8] c"text A-D-M text\00"
@.str.20 = [16 x i8] c"text 0-5-9 text\00"
@.str.21 = [17 x i8] c"text -a-d-m text\00"
@.str.22 = [17 x i8] c"text -A-D-M text\00"
@.str.23 = [17 x i8] c"text -0-5-9 text\00"
@__const.main.tests = [24 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.23, i32 0, i32 0)]
@.str.24 = [14 x i8] c"%-20s -> %s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %4
3: ; preds = %4
ret i32 0
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %10, %4 ]
%6 = getelementptr inbounds [24 x i8*], [24 x i8*]* @__const.main.tests, i64 0, i64 %5
%7 = load i8*, i8** %6
%8 = call i32 @expand(i8* %7, i8* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.24, i64 0, i64 0), i8* %7, i8* %2)
%10 = add nuw nsw i64 %5, 1
%11 = icmp eq i64 %10, 24
br i1 %11, label %3, label %4
}