#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 */
unsigned int count_ones(unsigned char);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned int i;
  printf("// auto-generated file (do not edit)\n");
  printf("\n");
  printf("// number of ones in a byte\n");
  printf("unsigned const char liquid_c_ones[256] = {\n    ");
  for (i = 0; i < 256; i++) {
    unsigned int n = count_ones((unsigned char)i);
    printf("%1u", n);
    if (i != 255) {
      printf(",");
      if (((i + 1) % 16) == 0)
        printf("\n    ");
      else
        printf(" ");
    }
  }
  printf("};\n\n");
  printf("// number of ones in a byte modulo 2\n");
  printf("unsigned const char liquid_c_ones_mod2[256] = {\n    ");
  for (i = 0; i < 256; i++) {
    unsigned int n = count_ones((unsigned char)i);
    printf("%1u", n % 2);
    if (i != 255) {
      printf(",");
      if (((i + 1) % 16) == 0)
        printf("\n    ");
      else
        printf(" ");
    }
  }
  printf("};\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    1200 <main+0xe0>
mov    -0x8(%rbp),%eax
movzbl %al,%edi
call   1030 <count_ones@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xff,-0x8(%rbp)
je     11ed <main+0xcd>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    11da <main+0xba>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e8 <main+0xc8>
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11ed <main+0xcd>
jmp    11f2 <main+0xd2>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116e <main+0x4e>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    12c6 <main+0x1a6>
mov    -0x8(%rbp),%eax
movzbl %al,%edi
call   1030 <count_ones@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
and    $0x1,%esi
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xff,-0x8(%rbp)
je     12b3 <main+0x193>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    12a0 <main+0x180>
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12ae <main+0x18e>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12b3 <main+0x193>
jmp    12b8 <main+0x198>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1231 <main+0x111>
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xf1e(%rip),%rdi
call   1050 <puts@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xf2d(%rip),%rdi
call   1050 <puts@plt>
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xeb5(%rip),%rbx
lea    0xee1(%rip),%r14
xor    %ebp,%ebp
jmp    11a2 <main+0x62>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x100,%ebp
je     11e4 <main+0xa4>
movzbl %bpl,%edi
call   1030 <count_ones@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0xff,%ebp
je     11e4 <main+0xa4>
mov    $0x2c,%edi
call   1040 <putchar@plt>
add    $0x1,%ebp
test   $0xf,%bpl
je     1190 <main+0x50>
mov    $0x20,%edi
call   1040 <putchar@plt>
cmp    $0x100,%ebp
jne    11a2 <main+0x62>
lea    0xee4(%rip),%rdi
call   1050 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1050 <puts@plt>
lea    0xe31(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe1f(%rip),%rbx
lea    0xe4b(%rip),%r14
xor    %ebp,%ebp
jmp    1232 <main+0xf2>
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x100,%ebp
je     1277 <main+0x137>
movzbl %bpl,%edi
call   1030 <count_ones@plt>
and    $0x1,%eax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0xff,%ebp
je     1277 <main+0x137>
mov    $0x2c,%edi
call   1040 <putchar@plt>
add    $0x1,%ebp
test   $0xf,%bpl
je     1220 <main+0xe0>
mov    $0x20,%edi
call   1040 <putchar@plt>
cmp    $0x100,%ebp
jne    1232 <main+0xf2>
lea    0xe51(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"// auto-generated file (do not edit)\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [29 x i8] c"// number of ones in a byte\0A\00"
@.str.3 = [48 x i8] c"unsigned const char liquid_c_ones[256] = {\0A \00"
@.str.4 = [4 x i8] c"%1u\00"
@.str.5 = [2 x i8] c",\00"
@.str.6 = [6 x i8] c"\0A \00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [5 x i8] c"};\0A\0A\00"
@.str.9 = [38 x i8] c"// number of ones in a byte modulo 2\0A\00"
@.str.10 = [53 x i8] c"unsigned const char liquid_c_ones_mod2[256] = {\0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %2
br label %9
9: ; preds = %32, %0
%10 = load i32, i32* %2
%11 = icmp ult i32 %10, 256
br i1 %11, label %12, label %35
12: ; preds = %9
%13 = load i32, i32* %2
%14 = trunc i32 %13 to i8
%15 = call i32 @count_ones(i8 zeroext %14)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 255
br i1 %19, label %20, label %31
20: ; preds = %12
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = add i32 %22, 1
%24 = urem i32 %23, 16
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %30
28: ; preds = %20
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %31
31: ; preds = %30, %12
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add i32 %33, 1
store i32 %34, i32* %2
br label %9
35: ; preds = %9
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %2
br label %39
39: ; preds = %63, %35
%40 = load i32, i32* %2
%41 = icmp ult i32 %40, 256
br i1 %41, label %42, label %66
42: ; preds = %39
%43 = load i32, i32* %2
%44 = trunc i32 %43 to i8
%45 = call i32 @count_ones(i8 zeroext %44)
store i32 %45, i32* %4
%46 = load i32, i32* %4
%47 = urem i32 %46, 2
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %2
%50 = icmp ne i32 %49, 255
br i1 %50, label %51, label %62
51: ; preds = %42
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%53 = load i32, i32* %2
%54 = add i32 %53, 1
%55 = urem i32 %54, 16
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %61
59: ; preds = %51
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %61
61: ; preds = %59, %57
br label %62
62: ; preds = %61, %42
br label %63
63: ; preds = %62
%64 = load i32, i32* %2
%65 = add i32 %64, 1
store i32 %65, i32* %2
br label %39
66: ; preds = %39
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [48 x i8] c"unsigned const char liquid_c_ones[256] = {\0A \00"
@.str.4 = [4 x i8] c"%1u\00"
@.str.6 = [6 x i8] c"\0A \00"
@.str.10 = [53 x i8] c"unsigned const char liquid_c_ones_mod2[256] = {\0A \00"
@str = [37 x i8] c"// auto-generated file (do not edit)\00"
@str.11 = [28 x i8] c"// number of ones in a byte\00"
@str.13 = [37 x i8] c"// number of ones in a byte modulo 2\00"
@str.14 = [4 x i8] c"};\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %0, %20
%6 = phi i32 [ 0, %0 ], [ %13, %20 ]
%7 = trunc i32 %6 to i8
%8 = tail call i32 @count_ones(i8 zeroext %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %6, 255
br i1 %10, label %22, label %11
11: ; preds = %5
%12 = tail call i32 @putchar(i32 44)
%13 = add nuw nsw i32 %6, 1
%14 = and i32 %13, 15
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %20
18: ; preds = %11
%19 = tail call i32 @putchar(i32 32)
br label %20
20: ; preds = %16, %18
%21 = icmp eq i32 %13, 256
br i1 %21, label %22, label %5
22: ; preds = %5, %20
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.14, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.13, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.10, i64 0, i64 0))
br label %26
26: ; preds = %22, %42
%27 = phi i32 [ 0, %22 ], [ %35, %42 ]
%28 = trunc i32 %27 to i8
%29 = tail call i32 @count_ones(i8 zeroext %28)
%30 = and i32 %29, 1
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %27, 255
br i1 %32, label %44, label %33
33: ; preds = %26
%34 = tail call i32 @putchar(i32 44)
%35 = add nuw nsw i32 %27, 1
%36 = and i32 %35, 15
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %42
40: ; preds = %33
%41 = tail call i32 @putchar(i32 32)
br label %42
42: ; preds = %38, %40
%43 = icmp eq i32 %35, 256
br i1 %43, label %44, label %26
44: ; preds = %26, %42
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.14, i64 0, i64 0))
ret i32 0
}