#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*/ print_charset(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i;
  int start = 0;
  int end = (1 << 4) - 1;
  printf("typedef struct charset_s\n{\n"
         "\tconst char *value;\n"
         "\tunsigned char length; // set length\n"
         "\tunsigned char numsets; // number of sets used\n"
         "\tunsigned char lensets[%i]; // lengths of sets used\n"
         "} charset_t;\n\n",
         4);
  printf("static const charset_t cslist[] = \n{\n");
  for (i = start; i <= end; i++) {
    print_charset(i, i == end);
  }
  printf("};\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xf,-0x10(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1194 <main+0x74>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
call   1040 <print_charset@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x44>
lea    0xf51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf7b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x6,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x7,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x8,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0x9,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xb,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xc,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xd,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xe,%edi
xor    %esi,%esi
call   1050 <print_charset@plt>
mov    $0xf,%edi
mov    $0x1,%esi
call   1050 <print_charset@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [198 x i8] c"typedef struct charset_s\0A{\0A\09const char *value;\0A\09unsigned char length; // set length\0A\09unsigned char numsets; // number of sets used\0A\09unsigned char lensets[%i]; // lengths of sets used\0A} charset_t;\0A\0A\00"
@.str.1 = [38 x i8] c"static const charset_t cslist[] = \0A{\0A\00"
@.str.2 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 15, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %22
12: ; preds = %8
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %14, %15
%17 = zext i1 %16 to i32
%18 = call i32 @print_charset(i32 %13, i32 %17)
br label %19
19: ; preds = %12
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %8
22: ; preds = %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [198 x i8] c"typedef struct charset_s\0A{\0A\09const char *value;\0A\09unsigned char length; // set length\0A\09unsigned char numsets; // number of sets used\0A\09unsigned char lensets[%i]; // lengths of sets used\0A} charset_t;\0A\0A\00"
@str = [37 x i8] c"static const charset_t cslist[] = \0A{\00"
@str.3 = [3 x i8] c"};\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0), i32 4)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @print_charset(i32 0, i32 0)
%4 = tail call i32 @print_charset(i32 1, i32 0)
%5 = tail call i32 @print_charset(i32 2, i32 0)
%6 = tail call i32 @print_charset(i32 3, i32 0)
%7 = tail call i32 @print_charset(i32 4, i32 0)
%8 = tail call i32 @print_charset(i32 5, i32 0)
%9 = tail call i32 @print_charset(i32 6, i32 0)
%10 = tail call i32 @print_charset(i32 7, i32 0)
%11 = tail call i32 @print_charset(i32 8, i32 0)
%12 = tail call i32 @print_charset(i32 9, i32 0)
%13 = tail call i32 @print_charset(i32 10, i32 0)
%14 = tail call i32 @print_charset(i32 11, i32 0)
%15 = tail call i32 @print_charset(i32 12, i32 0)
%16 = tail call i32 @print_charset(i32 13, i32 0)
%17 = tail call i32 @print_charset(i32 14, i32 0)
%18 = tail call i32 @print_charset(i32 15, i32 1)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}