#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 *, ...);
void gen(int isVoidRetType) {
  int numPreArgs, numPrintArgs, preArg, printArg;
  for (numPreArgs = 0; numPreArgs <= 3; ++numPreArgs) {
    printf("/*RT=Return Type, fn=function name, ft=forward to, a=gcc/clang "
           "attribute, T<N>=Type N, a<N>=function argument name N*/\n");
    if (!isVoidRetType) {
      printf("#define STRING_FORMAT_FORWARD_ARGS_%d(_RT_,_fn_,_ft_,_a_",
             numPreArgs);
    } else {
      printf("#define STRING_FORMAT_FORWARD_ARGS_VOID_%d(_fn_,_ft_,_a_",
             numPreArgs);
    }
    for (preArg = 0; preArg < numPreArgs; ++preArg) {
      printf(",_T%d_,_a%d_", preArg, preArg);
    }
    printf(")");
    for (numPrintArgs = 0; numPrintArgs <= 16; ++numPrintArgs) {
      if (!isVoidRetType) {
        printf("inline _RT_ _a_ _fn_(");
      } else {
        printf("inline void _a_ _fn_(");
      }
      for (preArg = 0; preArg < numPreArgs; ++preArg) {
        printf("_T%d_ _a%d_", preArg, preArg);
        if (preArg < numPreArgs - 1 || numPrintArgs > 0) {
          printf(",");
        }
      }
      for (printArg = 0; printArg < numPrintArgs; ++printArg) {
        printf("::string_format::Print_Arg _pa%d", printArg);
        if (printArg < numPrintArgs - 1) {
          printf(",");
        }
      }
      printf(")");
      printf("{");
      if (numPrintArgs > 0) {
        printf("::string_format::Print_Arg _pas[%d]={", numPrintArgs);
        for (printArg = 0; printArg < numPrintArgs; ++printArg) {
          printf("_pa%d", printArg);
          if (printArg < numPrintArgs - 1) {
            printf(",");
          }
        }
        printf("};");
      }
      if (!isVoidRetType) {
        printf("return ");
      }
      printf("_ft_(");
      for (preArg = 0; preArg < numPreArgs; ++preArg) {
        printf("_a%d_,", preArg);
      }
      if (numPrintArgs > 0) {
        printf("_pas,%d", numPrintArgs);
      } else {
        printf("0,0");
      }
      printf(");");
      printf("}");
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<gen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     140a <gen+0x2fa>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    115a <gen+0x4a>
mov    -0x8(%rbp),%esi
lea    0xf2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116b <gen+0x5b>
mov    -0x8(%rbp),%esi
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a0 <gen+0x90>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xf5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1172 <gen+0x62>
lea    0xf50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jg     13ee <gen+0x2de>
cmpl   $0x0,-0x4(%rbp)
jne    11dc <gen+0xcc>
lea    0xf29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ea <gen+0xda>
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    124d <gen+0x13d>
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jl     122c <gen+0x11c>
cmpl   $0x0,-0xc(%rbp)
jle    123a <gen+0x12a>
lea    0xf5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <gen+0x12f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f1 <gen+0xe1>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12a3 <gen+0x193>
mov    -0x14(%rbp),%esi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1290 <gen+0x180>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1295 <gen+0x185>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1254 <gen+0x144>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    133e <gen+0x22e>
mov    -0xc(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1330 <gen+0x220>
mov    -0x14(%rbp),%esi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    131d <gen+0x20d>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1322 <gen+0x212>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12e1 <gen+0x1d1>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1356 <gen+0x246>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1396 <gen+0x286>
mov    -0x10(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    136b <gen+0x25b>
cmpl   $0x0,-0xc(%rbp)
jle    13b6 <gen+0x2a6>
mov    -0xc(%rbp),%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c4 <gen+0x2b4>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b5 <gen+0xa5>
lea    0xc81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <gen+0x12>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,0x4(%rsp)
test   %edi,%edi
lea    0xeb5(%rip),%rax
lea    0xee7(%rip),%rcx
cmove  %rax,%rcx
mov    %rcx,0x8(%rsp)
lea    0xf1d(%rip),%rax
lea    0xf2c(%rip),%rcx
cmove  %rax,%rcx
mov    %rcx,0x10(%rsp)
lea    0xf32(%rip),%rbp
lea    0xef2(%rip),%r14
xor    %r15d,%r15d
jmp    11af <gen+0x7f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    $0x4,%r15d
lea    0xec9(%rip),%r14
je     13e5 <gen+0x2b5>
lea    0xf6f(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     11f6 <gen+0xc6>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%r15d
jne    11e0 <gen+0xb0>
mov    $0x29,%edi
call   1030 <putchar@plt>
lea    -0x1(%r15),%r12d
xor    %r14d,%r14d
jmp    1244 <gen+0x114>
nopl   0x0(%rax)
lea    0xf07(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xefd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x7d,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    $0x11,%r14d
je     1190 <gen+0x60>
mov    0x10(%rsp),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     1290 <gen+0x160>
xor    %r13d,%r13d
jmp    1273 <gen+0x143>
nopw   0x0(%rax,%rax,1)
mov    $0x2c,%edi
call   1030 <putchar@plt>
add    $0x1,%r13d
cmp    %r13d,%r15d
je     1290 <gen+0x160>
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r12d,%r13d
jl     1260 <gen+0x130>
test   %r14d,%r14d
je     126a <gen+0x13a>
jmp    1260 <gen+0x130>
nop
test   %r14d,%r14d
je     13b0 <gen+0x280>
lea    -0x1(%r14),%ebx
xor    %ebp,%ebp
lea    0xe69(%rip),%r13
jmp    12b8 <gen+0x188>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ebp,%r14d
je     12e0 <gen+0x1b0>
lea    0xdf8(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%ebp
jge    12b0 <gen+0x180>
mov    $0x2c,%edi
call   1030 <putchar@plt>
jmp    12b0 <gen+0x180>
nopl   0x0(%rax,%rax,1)
mov    $0x29,%edi
call   1030 <putchar@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
je     134e <gen+0x21e>
xor    %ebp,%ebp
lea    0xdd6(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1318 <gen+0x1e8>
xchg   %ax,%ax
add    $0x1,%ebp
cmp    %ebp,%r14d
je     1340 <gen+0x210>
lea    0xdb3(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %ebx,%ebp
jge    1310 <gen+0x1e0>
mov    $0x2c,%edi
call   1030 <putchar@plt>
jmp    1310 <gen+0x1e0>
nopl   0x0(%rax,%rax,1)
lea    0xdb7(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmpl   $0x0,0x4(%rsp)
je     13d2 <gen+0x2a2>
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     1384 <gen+0x254>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    1370 <gen+0x240>
test   %r14d,%r14d
lea    0xd1d(%rip),%rbp
je     1210 <gen+0xe0>
lea    0xd7b(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    121e <gen+0xee>
nopw   0x0(%rax,%rax,1)
mov    $0x29,%edi
call   1030 <putchar@plt>
mov    $0x7b,%edi
call   1030 <putchar@plt>
lea    0xd44(%rip),%r13
cmpl   $0x0,0x4(%rsp)
jne    1355 <gen+0x225>
lea    0xd28(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1355 <gen+0x225>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [120 x i8] c"/*RT=Return Type, fn=function name, ft=forward to, a=gcc/clang attribute, T<N>=Type N, a<N>=function argument name N*/\0A\00"
@.str.1 = [57 x i8] c"#define STRING_FORMAT_FORWARD_ARGS_%d(_RT_,_fn_,_ft_,_a_\00"
@.str.2 = [57 x i8] c"#define STRING_FORMAT_FORWARD_ARGS_VOID_%d(_fn_,_ft_,_a_\00"
@.str.3 = [13 x i8] c",_T%d_,_a%d_\00"
@.str.4 = [2 x i8] c")\00"
@.str.5 = [22 x i8] c"inline _RT_ _a_ _fn_(\00"
@.str.6 = [22 x i8] c"inline void _a_ _fn_(\00"
@.str.7 = [12 x i8] c"_T%d_ _a%d_\00"
@.str.8 = [2 x i8] c",\00"
@.str.9 = [33 x i8] c"::string_format::Print_Arg _pa%d\00"
@.str.10 = [2 x i8] c"{\00"
@.str.11 = [38 x i8] c"::string_format::Print_Arg _pas[%d]={\00"
@.str.12 = [6 x i8] c"_pa%d\00"
@.str.13 = [3 x i8] c"};\00"
@.str.14 = [8 x i8] c"return \00"
@.str.15 = [6 x i8] c"_ft_(\00"
@.str.16 = [7 x i8] c"_a%d_,\00"
@.str.17 = [8 x i8] c"_pas,%d\00"
@.str.18 = [4 x i8] c"0,0\00"
@.str.19 = [3 x i8] c");\00"
@.str.20 = [2 x i8] c"}\00"
@.str.21 = [2 x i8] c"\0A\00"
define void @gen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %7
7: ; preds = %144, %1
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 3
br i1 %9, label %10, label %147
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = icmp ne i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %20
17: ; preds = %10
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17, %14
store i32 0, i32* %5
br label %21
21: ; preds = %29, %20
%22 = load i32, i32* %5
%23 = load i32, i32* %3
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i32, i32* %5
%27 = load i32, i32* %5
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %27)
br label %29
29: ; preds = %25
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %21
32: ; preds = %21
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %34
34: ; preds = %139, %32
%35 = load i32, i32* %4
%36 = icmp sle i32 %35, 16
br i1 %36, label %37, label %142
37: ; preds = %34
%38 = load i32, i32* %2
%39 = icmp ne i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %44
42: ; preds = %37
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
store i32 0, i32* %5
br label %45
45: ; preds = %63, %44
%46 = load i32, i32* %5
%47 = load i32, i32* %3
%48 = icmp slt i32 %46, %47
br i1 %48, label %49, label %66
49: ; preds = %45
%50 = load i32, i32* %5
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %50, i32 %51)
%53 = load i32, i32* %5
%54 = load i32, i32* %3
%55 = sub nsw i32 %54, 1
%56 = icmp slt i32 %53, %55
br i1 %56, label %60, label %57
57: ; preds = %49
%58 = load i32, i32* %4
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %57, %49
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %62
62: ; preds = %60, %57
br label %63
63: ; preds = %62
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
br label %45
66: ; preds = %45
store i32 0, i32* %6
br label %67
67: ; preds = %81, %66
%68 = load i32, i32* %6
%69 = load i32, i32* %4
%70 = icmp slt i32 %68, %69
br i1 %70, label %71, label %84
71: ; preds = %67
%72 = load i32, i32* %6
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %72)
%74 = load i32, i32* %6
%75 = load i32, i32* %4
%76 = sub nsw i32 %75, 1
%77 = icmp slt i32 %74, %76
br i1 %77, label %78, label %80
78: ; preds = %71
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %80
80: ; preds = %78, %71
br label %81
81: ; preds = %80
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %67
84: ; preds = %67
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%87 = load i32, i32* %4
%88 = icmp sgt i32 %87, 0
br i1 %88, label %89, label %111
89: ; preds = %84
%90 = load i32, i32* %4
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %90)
store i32 0, i32* %6
br label %92
92: ; preds = %106, %89
%93 = load i32, i32* %6
%94 = load i32, i32* %4
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %109
96: ; preds = %92
%97 = load i32, i32* %6
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %97)
%99 = load i32, i32* %6
%100 = load i32, i32* %4
%101 = sub nsw i32 %100, 1
%102 = icmp slt i32 %99, %101
br i1 %102, label %103, label %105
103: ; preds = %96
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
br label %105
105: ; preds = %103, %96
br label %106
106: ; preds = %105
%107 = load i32, i32* %6
%108 = add nsw i32 %107, 1
store i32 %108, i32* %6
br label %92
109: ; preds = %92
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
br label %111
111: ; preds = %109, %84
%112 = load i32, i32* %2
%113 = icmp ne i32 %112, 0
br i1 %113, label %116, label %114
114: ; preds = %111
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %116
116: ; preds = %114, %111
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
store i32 0, i32* %5
br label %118
118: ; preds = %125, %116
%119 = load i32, i32* %5
%120 = load i32, i32* %3
%121 = icmp slt i32 %119, %120
br i1 %121, label %122, label %128
122: ; preds = %118
%123 = load i32, i32* %5
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %123)
br label %125
125: ; preds = %122
%126 = load i32, i32* %5
%127 = add nsw i32 %126, 1
store i32 %127, i32* %5
br label %118
128: ; preds = %118
%129 = load i32, i32* %4
%130 = icmp sgt i32 %129, 0
br i1 %130, label %131, label %134
131: ; preds = %128
%132 = load i32, i32* %4
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 %132)
br label %136
134: ; preds = %128
%135 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %136
136: ; preds = %134, %131
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
br label %139
139: ; preds = %136
%140 = load i32, i32* %4
%141 = add nsw i32 %140, 1
store i32 %141, i32* %4
br label %34
142: ; preds = %34
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.21, i64 0, i64 0))
br label %144
144: ; preds = %142
%145 = load i32, i32* %3
%146 = add nsw i32 %145, 1
store i32 %146, i32* %3
br label %7
147: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [57 x i8] c"#define STRING_FORMAT_FORWARD_ARGS_%d(_RT_,_fn_,_ft_,_a_\00"
@.str.2 = [57 x i8] c"#define STRING_FORMAT_FORWARD_ARGS_VOID_%d(_fn_,_ft_,_a_\00"
@.str.3 = [13 x i8] c",_T%d_,_a%d_\00"
@.str.5 = [22 x i8] c"inline _RT_ _a_ _fn_(\00"
@.str.6 = [22 x i8] c"inline void _a_ _fn_(\00"
@.str.7 = [12 x i8] c"_T%d_ _a%d_\00"
@.str.9 = [33 x i8] c"::string_format::Print_Arg _pa%d\00"
@.str.11 = [38 x i8] c"::string_format::Print_Arg _pas[%d]={\00"
@.str.12 = [6 x i8] c"_pa%d\00"
@.str.13 = [3 x i8] c"};\00"
@.str.14 = [8 x i8] c"return \00"
@.str.15 = [6 x i8] c"_ft_(\00"
@.str.16 = [7 x i8] c"_a%d_,\00"
@.str.17 = [8 x i8] c"_pas,%d\00"
@.str.18 = [4 x i8] c"0,0\00"
@.str.19 = [3 x i8] c");\00"
@str = [119 x i8] c"/*RT=Return Type, fn=function name, ft=forward to, a=gcc/clang attribute, T<N>=Type N, a<N>=function argument name N*/\00"
define void @gen(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0)
%4 = select i1 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0)
br label %5
5: ; preds = %1, %86
%6 = phi i32 [ 0, %1 ], [ %88, %86 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %3, i32 %6)
%9 = icmp eq i32 %6, 0
br i1 %9, label %15, label %10
10: ; preds = %5, %10
%11 = phi i32 [ %13, %10 ], [ 0, %5 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %11)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, %6
br i1 %14, label %15, label %10
15: ; preds = %10, %5
%16 = tail call i32 @putchar(i32 41)
%17 = add nsw i32 %6, -1
br label %18
18: ; preds = %15, %81
%19 = phi i32 [ 0, %15 ], [ %84, %81 ]
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %4)
br i1 %9, label %23, label %21
21: ; preds = %18
%22 = icmp ne i32 %19, 0
br label %27
23: ; preds = %34, %18
%24 = icmp eq i32 %19, 0
br i1 %24, label %63, label %25
25: ; preds = %23
%26 = add nsw i32 %19, -1
br label %37
27: ; preds = %21, %34
%28 = phi i32 [ 0, %21 ], [ %35, %34 ]
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i32 %28, i32 %28)
%30 = icmp slt i32 %28, %17
%31 = select i1 %30, i1 true, i1 %22
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = tail call i32 @putchar(i32 44)
br label %34
34: ; preds = %32, %27
%35 = add nuw nsw i32 %28, 1
%36 = icmp eq i32 %35, %6
br i1 %36, label %23, label %27
37: ; preds = %25, %43
%38 = phi i32 [ 0, %25 ], [ %44, %43 ]
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %38)
%40 = icmp slt i32 %38, %26
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = tail call i32 @putchar(i32 44)
br label %43
43: ; preds = %37, %41
%44 = add nuw nsw i32 %38, 1
%45 = icmp eq i32 %44, %19
br i1 %45, label %46, label %37
46: ; preds = %43
%47 = tail call i32 @putchar(i32 41)
%48 = tail call i32 @putchar(i32 123)
br i1 %24, label %66, label %49
49: ; preds = %46
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32 %19)
%51 = add nsw i32 %19, -1
br label %52
52: ; preds = %49, %58
%53 = phi i32 [ 0, %49 ], [ %59, %58 ]
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0), i32 %53)
%55 = icmp slt i32 %53, %51
br i1 %55, label %56, label %58
56: ; preds = %52
%57 = tail call i32 @putchar(i32 44)
br label %58
58: ; preds = %52, %56
%59 = add nuw nsw i32 %53, 1
%60 = icmp eq i32 %59, %19
br i1 %60, label %61, label %52
61: ; preds = %58
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
br label %66
63: ; preds = %23
%64 = tail call i32 @putchar(i32 41)
%65 = tail call i32 @putchar(i32 123)
br label %66
66: ; preds = %63, %61, %46
br i1 %2, label %67, label %69
67: ; preds = %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0))
br label %69
69: ; preds = %67, %66
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0))
br i1 %9, label %76, label %71
71: ; preds = %69, %71
%72 = phi i32 [ %74, %71 ], [ 0, %69 ]
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i32 %72)
%74 = add nuw nsw i32 %72, 1
%75 = icmp eq i32 %74, %6
br i1 %75, label %76, label %71
76: ; preds = %71, %69
br i1 %24, label %79, label %77
77: ; preds = %76
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i32 %19)
br label %81
79: ; preds = %76
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %81
81: ; preds = %79, %77
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0))
%83 = tail call i32 @putchar(i32 125)
%84 = add nuw nsw i32 %19, 1
%85 = icmp eq i32 %84, 17
br i1 %85, label %86, label %18
86: ; preds = %81
%87 = tail call i32 @putchar(i32 10)
%88 = add nuw nsw i32 %6, 1
%89 = icmp eq i32 %88, 4
br i1 %89, label %90, label %5
90: ; preds = %86
ret void
}