#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 atoi(int /*<<< orphan*/);
char getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  int n;
  char c;
  n = 0;
  opterr = 0;
  while ((c = getopt(argc, argv, "hn:")) != -1)
    switch (c) {
    case 'n':
      n = atoi(optarg);
      break;
    case 'h':
      usage();
    default:
      usage();
    }
  if (n < 1)
    usage();
  long N1, N2, i, j, l;
  int N;
  N = (1 << n);
  printf(
      "/* This file has been automatically generated by whtgen/whtgen.c. */\n");
  printf("\n");
  printf("/*\n");
  printf("EXTERNS: {\n");
  printf("extern codelet_apply_fp apply_small%d;\n", n);
  printf("}\n");
  printf("STRUCTS: {\n");
  printf("#if (%d <= WHT_MAX_UNROLL)\n", n);
  printf("CODELET_APPLY_ENTRY(\"small[%d]\", apply_small%d),\n", n, n);
  printf("#endif\n");
  printf("}\n");
  printf("*/\n");
  printf("\n");
  printf("#include \"wht.h\"\n");
  printf("\n");
  printf("void apply_small%d(Wht *W, long S, long U, wht_value *x)\n", n);
  printf("{\n");
  printf("#if (%d <= WHT_MAX_UNROLL)\n", n);
  printf("  wht_value a, b;\n");
  N1 = N / 2;
  N2 = 1;
  for (i = 1; i <= N; i *= 2) {
    for (j = 0; j < N1; j++) {
      for (l = 0; l < N2; l++) {
        printf("  a = x[%ld * S];\n", j * 2 * N2 + l);
        printf("  b = x[%ld * S];\n", j * 2 * N2 + N2 + l);
        printf("  x[%ld * S] = a + b;\n", j * 2 * N2 + l);
        printf("  x[%ld * S] = a - b;\n", j * 2 * N2 + N2 + l);
      }
    }
    N1 /= 2;
    N2 *= 2;
  }
  printf("#else\n");
  printf("   wht_exit(\"runtime guards should prevent this message\");\n");
  printf("#endif\n");
  printf("}\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2e74(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe87(%rip),%rdx
call   1050 <getopt@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     11dc <main+0x9c>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x48(%rbp)
sub    $0x68,%eax
je     11c9 <main+0x89>
jmp    11a2 <main+0x62>
mov    -0x48(%rbp),%eax
sub    $0x6e,%eax
jne    11d0 <main+0x90>
jmp    11b3 <main+0x73>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11d7 <main+0x97>
mov    $0x0,%al
call   1040 <usage@plt>
mov    $0x0,%al
call   1040 <usage@plt>
jmp    116b <main+0x2b>
cmpl   $0x1,-0x14(%rbp)
jge    11ed <main+0xad>
mov    $0x0,%al
call   1040 <usage@plt>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x44(%rbp)
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x44(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
movq   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
cmp    %rcx,%rax
jg     144e <main+0x30e>
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    141f <main+0x2df>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1409 <main+0x2c9>
mov    -0x38(%rbp),%rsi
shl    $0x1,%rsi
imul   -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
shl    $0x1,%rsi
imul   -0x28(%rbp),%rsi
add    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
shl    $0x1,%rsi
imul   -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rsi
shl    $0x1,%rsi
imul   -0x28(%rbp),%rsi
add    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1366 <main+0x226>
jmp    140e <main+0x2ce>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1350 <main+0x210>
mov    -0x20(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1337 <main+0x1f7>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e5e(%rip),%rax
movq   $0x0,(%rax)
lea    0xe78(%rip),%rdx
call   1070 <getopt@plt>
cmp    $0xff,%al
je     11f1 <main+0x91>
lea    0xe68(%rip),%r15
mov    0x2e59(%rip),%r12
xor    %r14d,%r14d
jmp    11cf <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <usage@plt>
xor    %eax,%eax
call   1060 <usage@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
cmp    $0xff,%al
je     11ea <main+0x8a>
movsbl %al,%eax
cmp    $0x68,%eax
je     11b0 <main+0x50>
cmp    $0x6e,%eax
jne    11b7 <main+0x57>
mov    (%r12),%edi
call   1080 <atoi@plt>
mov    %eax,%r14d
jmp    11be <main+0x5e>
test   %r14d,%r14d
jg     11fb <main+0x9b>
jmp    11f4 <main+0x94>
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0x1,%ebx
mov    %r14d,%ecx
shl    %cl,%ebx
lea    0xefc(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf2b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf22(%rip),%rdi
call   1040 <puts@plt>
lea    0xdca(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf86(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xf01(%rip),%rdi
call   1040 <puts@plt>
lea    0xdc6(%rip),%r15
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdce(%rip),%rdi
mov    %r14d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf3c(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdac(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    140f <main+0x2af>
movslq %ebx,%rax
mov    %rax,0x10(%rsp)
shr    %ebx
mov    $0x1,%ecx
lea    0xd99(%rip),%r12
mov    $0x1,%r15d
jmp    1356 <main+0x1f6>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rax
shr    $0x3f,%rax
add    %rbx,%rax
sar    %rax
add    %r15,%r15
mov    0x18(%rsp),%rcx
add    %rcx,%rcx
mov    %rax,%rbx
cmp    0x10(%rsp),%rcx
jg     140f <main+0x2af>
mov    %rcx,0x18(%rsp)
test   %rbx,%rbx
jle    1330 <main+0x1d0>
lea    (%r15,%r15,1),%rax
mov    %rax,0x20(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
xor    %ecx,%ecx
mov    %rbx,0x28(%rsp)
jmp    13a2 <main+0x242>
nopl   0x0(%rax)
mov    0x30(%rsp),%rcx
add    $0x1,%rcx
mov    0x8(%rsp),%rax
add    0x20(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x28(%rsp),%rbx
cmp    %rbx,%rcx
je     1330 <main+0x1d0>
mov    %rcx,0x30(%rsp)
test   %r15,%r15
lea    0xd40(%rip),%r13
jle    1380 <main+0x220>
mov    0x8(%rsp),%rbp
mov    %r15,%r14
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%r15,%rbp,1),%rbx
lea    0xcef(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcf1(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
add    $0xffffffffffffffff,%r14
jne    13c0 <main+0x260>
jmp    1380 <main+0x220>
lea    0xd73(%rip),%rdi
call   1040 <puts@plt>
lea    0xd6d(%rip),%rdi
call   1040 <puts@plt>
lea    0xd9c(%rip),%rdi
call   1040 <puts@plt>
lea    0xd97(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@opterr = global i64 0
@.str = [4 x i8] c"hn:\00"
@optarg = global i32 0
@.str.1 = [70 x i8] c"/* This file has been automatically generated by whtgen/whtgen.c. */\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"/*\0A\00"
@.str.4 = [12 x i8] c"EXTERNS: {\0A\00"
@.str.5 = [40 x i8] c"extern codelet_apply_fp apply_small%d;\0A\00"
@.str.6 = [3 x i8] c"}\0A\00"
@.str.7 = [12 x i8] c"STRUCTS: {\0A\00"
@.str.8 = [28 x i8] c"#if (%d <= WHT_MAX_UNROLL)\0A\00"
@.str.9 = [50 x i8] c"CODELET_APPLY_ENTRY(\22small[%d]\22, apply_small%d),\0A\00"
@.str.10 = [8 x i8] c"#endif\0A\00"
@.str.11 = [4 x i8] c"*/\0A\00"
@.str.12 = [18 x i8] c"#include \22wht.h\22\0A\00"
@.str.13 = [58 x i8] c"void apply_small%d(Wht *W, long S, long U, wht_value *x)\0A\00"
@.str.14 = [3 x i8] c"{\0A\00"
@.str.15 = [19 x i8] c" wht_value a, b;\0A\00"
@.str.16 = [19 x i8] c" a = x[%ld * S];\0A\00"
@.str.17 = [19 x i8] c" b = x[%ld * S];\0A\00"
@.str.18 = [23 x i8] c" x[%ld * S] = a + b;\0A\00"
@.str.19 = [23 x i8] c" x[%ld * S] = a - b;\0A\00"
@.str.20 = [7 x i8] c"#else\0A\00"
@.str.21 = [60 x i8] c" wht_exit(\22runtime guards should prevent this message\22);\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i64 0, i64* @opterr
br label %14
14: ; preds = %30, %2
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call signext i8 @getopt(i32 %15, i8** %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8 %17, i8* %7
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %31
20: ; preds = %14
%21 = load i8, i8* %7
%22 = sext i8 %21 to i32
switch i32 %22, label %28 [
i32 110, label %23
i32 104, label %26
]
23: ; preds = %20
%24 = load i32, i32* @optarg
%25 = call i32 @atoi(i32 %24)
store i32 %25, i32* %6
br label %30
26: ; preds = %20
%27 = call i32 (...) @usage()
br label %28
28: ; preds = %20, %26
%29 = call i32 (...) @usage()
br label %30
30: ; preds = %28, %23
br label %14
31: ; preds = %14
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (...) @usage()
br label %36
36: ; preds = %34, %31
%37 = load i32, i32* %6
%38 = shl i32 1, %37
store i32 %38, i32* %13
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%47 = load i32, i32* %6
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %6
%50 = load i32, i32* %6
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), i32 %49, i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0))
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%58 = load i32, i32* %6
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%61 = load i32, i32* %6
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
%64 = load i32, i32* %13
%65 = sdiv i32 %64, 2
%66 = sext i32 %65 to i64
store i64 %66, i64* %8
store i64 1, i64* %9
store i64 1, i64* %10
br label %67
67: ; preds = %127, %36
%68 = load i64, i64* %10
%69 = load i32, i32* %13
%70 = sext i32 %69 to i64
%71 = icmp sle i64 %68, %70
br i1 %71, label %72, label %130
72: ; preds = %67
store i64 0, i64* %11
br label %73
73: ; preds = %119, %72
%74 = load i64, i64* %11
%75 = load i64, i64* %8
%76 = icmp slt i64 %74, %75
br i1 %76, label %77, label %122
77: ; preds = %73
store i64 0, i64* %12
br label %78
78: ; preds = %115, %77
%79 = load i64, i64* %12
%80 = load i64, i64* %9
%81 = icmp slt i64 %79, %80
br i1 %81, label %82, label %118
82: ; preds = %78
%83 = load i64, i64* %11
%84 = mul nsw i64 %83, 2
%85 = load i64, i64* %9
%86 = mul nsw i64 %84, %85
%87 = load i64, i64* %12
%88 = add nsw i64 %86, %87
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i64 %88)
%90 = load i64, i64* %11
%91 = mul nsw i64 %90, 2
%92 = load i64, i64* %9
%93 = mul nsw i64 %91, %92
%94 = load i64, i64* %9
%95 = add nsw i64 %93, %94
%96 = load i64, i64* %12
%97 = add nsw i64 %95, %96
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i64 %97)
%99 = load i64, i64* %11
%100 = mul nsw i64 %99, 2
%101 = load i64, i64* %9
%102 = mul nsw i64 %100, %101
%103 = load i64, i64* %12
%104 = add nsw i64 %102, %103
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i64 %104)
%106 = load i64, i64* %11
%107 = mul nsw i64 %106, 2
%108 = load i64, i64* %9
%109 = mul nsw i64 %107, %108
%110 = load i64, i64* %9
%111 = add nsw i64 %109, %110
%112 = load i64, i64* %12
%113 = add nsw i64 %111, %112
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i64 %113)
br label %115
115: ; preds = %82
%116 = load i64, i64* %12
%117 = add nsw i64 %116, 1
store i64 %117, i64* %12
br label %78
118: ; preds = %78
br label %119
119: ; preds = %118
%120 = load i64, i64* %11
%121 = add nsw i64 %120, 1
store i64 %121, i64* %11
br label %73
122: ; preds = %73
%123 = load i64, i64* %8
%124 = sdiv i64 %123, 2
store i64 %124, i64* %8
%125 = load i64, i64* %9
%126 = mul nsw i64 %125, 2
store i64 %126, i64* %9
br label %127
127: ; preds = %122
%128 = load i64, i64* %10
%129 = mul nsw i64 %128, 2
store i64 %129, i64* %10
br label %67
130: ; preds = %67
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.20, i64 0, i64 0))
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.21, i64 0, i64 0))
%133 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [4 x i8] c"hn:\00"
@optarg = global i32 0
@.str.5 = [40 x i8] c"extern codelet_apply_fp apply_small%d;\0A\00"
@.str.8 = [28 x i8] c"#if (%d <= WHT_MAX_UNROLL)\0A\00"
@.str.9 = [50 x i8] c"CODELET_APPLY_ENTRY(\22small[%d]\22, apply_small%d),\0A\00"
@.str.13 = [58 x i8] c"void apply_small%d(Wht *W, long S, long U, wht_value *x)\0A\00"
@.str.16 = [19 x i8] c" a = x[%ld * S];\0A\00"
@.str.17 = [19 x i8] c" b = x[%ld * S];\0A\00"
@.str.18 = [23 x i8] c" x[%ld * S] = a + b;\0A\00"
@.str.19 = [23 x i8] c" x[%ld * S] = a - b;\0A\00"
@str = [69 x i8] c"/* This file has been automatically generated by whtgen/whtgen.c. */\00"
@str.22 = [3 x i8] c"/*\00"
@str.23 = [11 x i8] c"EXTERNS: {\00"
@str.25 = [11 x i8] c"STRUCTS: {\00"
@str.28 = [3 x i8] c"*/\00"
@str.29 = [17 x i8] c"#include \22wht.h\22\00"
@str.30 = [2 x i8] c"{\00"
@str.31 = [18 x i8] c" wht_value a, b;\00"
@str.32 = [6 x i8] c"#else\00"
@str.33 = [59 x i8] c" wht_exit(\22runtime guards should prevent this message\22);\00"
@str.34 = [7 x i8] c"#endif\00"
@str.35 = [2 x i8] c"}\00"
define i32 @main(i32 %0, i8** %1) {
store i64 0, i64* @opterr
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8 %3, -1
br i1 %4, label %22, label %5
5: ; preds = %2, %16
%6 = phi i8 [ %18, %16 ], [ %3, %2 ]
%7 = phi i32 [ %17, %16 ], [ 0, %2 ]
%8 = sext i8 %6 to i32
switch i32 %8, label %14 [
i32 110, label %9
i32 104, label %12
]
9: ; preds = %5
%10 = load i32, i32* @optarg
%11 = tail call i32 @atoi(i32 %10)
br label %16
12: ; preds = %5
%13 = tail call i32 (...) @usage()
br label %14
14: ; preds = %5, %12
%15 = tail call i32 (...) @usage()
br label %16
16: ; preds = %14, %9
%17 = phi i32 [ %7, %14 ], [ %11, %9 ]
%18 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i8 %18, -1
br i1 %19, label %20, label %5
20: ; preds = %16
%21 = icmp slt i32 %17, 1
br i1 %21, label %22, label %25
22: ; preds = %2, %20
%23 = phi i32 [ %17, %20 ], [ 0, %2 ]
%24 = tail call i32 (...) @usage()
br label %25
25: ; preds = %22, %20
%26 = phi i32 [ %23, %22 ], [ %17, %20 ]
%27 = shl nuw i32 1, %26
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%29 = tail call i32 @putchar(i32 10)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.22, i64 0, i64 0))
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.23, i64 0, i64 0))
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.35, i64 0, i64 0))
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.25, i64 0, i64 0))
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %26)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.9, i64 0, i64 0), i32 %26, i32 %26)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.34, i64 0, i64 0))
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.35, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.28, i64 0, i64 0))
%40 = tail call i32 @putchar(i32 10)
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.29, i64 0, i64 0))
%42 = tail call i32 @putchar(i32 10)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.13, i64 0, i64 0), i32 %26)
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.30, i64 0, i64 0))
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 %26)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.31, i64 0, i64 0))
%47 = sext i32 %27 to i64
%48 = icmp slt i32 %27, 1
br i1 %48, label %82, label %49
49: ; preds = %25
%50 = lshr i32 %27, 1
%51 = zext i32 %50 to i64
br label %52
52: ; preds = %49, %77
%53 = phi i64 [ %80, %77 ], [ 1, %49 ]
%54 = phi i64 [ %79, %77 ], [ 1, %49 ]
%55 = phi i64 [ %78, %77 ], [ %51, %49 ]
%56 = icmp sgt i64 %55, 0
br i1 %56, label %57, label %77
57: ; preds = %52
%58 = icmp sgt i64 %54, 0
br label %59
59: ; preds = %57, %74
%60 = phi i64 [ 0, %57 ], [ %75, %74 ]
br i1 %58, label %61, label %74
61: ; preds = %59
%62 = shl nuw nsw i64 %60, 1
%63 = mul nsw i64 %62, %54
br label %64
64: ; preds = %61, %64
%65 = phi i64 [ 0, %61 ], [ %72, %64 ]
%66 = add i64 %65, %63
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i64 0, i64 0), i64 %66)
%68 = add i64 %66, %54
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i64 %68)
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.18, i64 0, i64 0), i64 %66)
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.19, i64 0, i64 0), i64 %68)
%72 = add nuw nsw i64 %65, 1
%73 = icmp eq i64 %72, %54
br i1 %73, label %74, label %64
74: ; preds = %64, %59
%75 = add nuw nsw i64 %60, 1
%76 = icmp eq i64 %75, %55
br i1 %76, label %77, label %59
77: ; preds = %74, %52
%78 = sdiv i64 %55, 2
%79 = shl nsw i64 %54, 1
%80 = shl nsw i64 %53, 1
%81 = icmp sgt i64 %80, %47
br i1 %81, label %82, label %52
82: ; preds = %77, %25
%83 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.32, i64 0, i64 0))
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.33, i64 0, i64 0))
%85 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.34, i64 0, i64 0))
%86 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.35, i64 0, i64 0))
ret i32 0
}