#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 *);
int /*<<< orphan*/ table_add(int);
int /*<<< orphan*/ table_end();
int /*<<< orphan*/ table_start(char *, int);
int update_zns_flags(int, int);
void gen_flag_update_tables(void) {
  int i, result, sreg;
  printf("// Auto-generated file. Do not edit.\n"
         "// Generated by : gen-flag-tables\n"
         "// Included by  : avrtest.c\n");
  table_start("flag_update_table_add8", 8192);
  for (i = 0; i < 8192; i++) {
    result = i & 0x01FF;
    sreg = 0;
    if ((!(i & 0x0400) == !(i & 0x0200)) && (!(result & 0x80) != !(i & 0x0400)))
      sreg |= (1 << 3);
    if (result & 0x100)
      sreg |= (1 << 0);
    if (((i & 0x1800) == 0x1800) ||
        ((result & 0x08) == 0 && ((i & 0x1800) != 0x0000)))
      sreg |= (1 << 5);
    sreg = update_zns_flags(result, sreg);
    table_add(sreg);
  }
  table_end();
  table_start("flag_update_table_sub8", 8192);
  for (i = 0; i < 8192; i++) {
    result = i & 0x01FF;
    sreg = 0;
    if ((!(result & 0x80) == !(i & 0x0200)) && (!(i & 0x0400) != !(i & 0x0200)))
      sreg |= (1 << 3);
    if (result & 0x100)
      sreg |= (1 << 0);
    if (((i & 0x1800) == 0x1800) ||
        ((result & 0x08) == 0 && ((i & 0x1800) != 0x0000)))
      sreg |= (1 << 5);
    sreg = update_zns_flags(result, sreg);
    table_add(sreg);
  }
  table_end();
  table_start("flag_update_table_ror8", 512);
  for (i = 0; i < 512; i++) {
    result = i >> 1;
    sreg = 0;
    if (i & 0x01)
      sreg |= (1 << 0);
    if (((result & 0x80) != 0) != ((sreg & (1 << 0)) != 0))
      sreg |= (1 << 3);
    sreg = update_zns_flags(result, sreg);
    table_add(sreg);
  }
  table_end();
  table_start("flag_update_table_inc", 256);
  for (i = 0; i < 256; i++) {
    sreg = (i == 0x80) ? (1 << 3) : 0;
    sreg = update_zns_flags(i, sreg);
    table_add(sreg);
  }
  table_end();
  table_start("flag_update_table_dec", 256);
  for (i = 0; i < 256; i++) {
    sreg = (i == 0x7F) ? (1 << 3) : 0;
    sreg = update_zns_flags(i, sreg);
    table_add(sreg);
  }
  table_end();
  table_start("flag_update_table_logical", 256);
  for (i = 0; i < 256; i++) {
    sreg = update_zns_flags(i, 0);
    table_add(sreg);
  }
  table_end();
}


x86 assembly (clang, -O0):
<gen_flag_update_tables>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x2000,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2000,-0x4(%rbp)
jge    1288 <gen_flag_update_tables+0x138>
mov    -0x4(%rbp),%eax
and    $0x1ff,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
and    $0x200,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    120e <gen_flag_update_tables+0xbe>
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
and    $0x400,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     120e <gen_flag_update_tables+0xbe>
mov    -0xc(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1228 <gen_flag_update_tables+0xd8>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1800,%eax
cmp    $0x1800,%eax
je     125b <gen_flag_update_tables+0x10b>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    1264 <gen_flag_update_tables+0x114>
mov    -0x4(%rbp),%eax
and    $0x1800,%eax
cmp    $0x0,%eax
je     1264 <gen_flag_update_tables+0x114>
mov    -0xc(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <gen_flag_update_tables+0x2c>
mov    $0x0,%al
call   1030 <table_end@plt>
lea    0xde5(%rip),%rdi
mov    $0x2000,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x2000,-0x4(%rbp)
jge    13b3 <gen_flag_update_tables+0x263>
mov    -0x4(%rbp),%eax
and    $0x1ff,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
and    $0x200,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    1339 <gen_flag_update_tables+0x1e9>
mov    -0x4(%rbp),%eax
and    $0x400,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%ecx
and    $0x200,%ecx
cmp    $0x0,%ecx
setne  %cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     1339 <gen_flag_update_tables+0x1e9>
mov    -0xc(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     1353 <gen_flag_update_tables+0x203>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1800,%eax
cmp    $0x1800,%eax
je     1386 <gen_flag_update_tables+0x236>
mov    -0x8(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    138f <gen_flag_update_tables+0x23f>
mov    -0x4(%rbp),%eax
and    $0x1800,%eax
cmp    $0x0,%eax
je     138f <gen_flag_update_tables+0x23f>
mov    -0xc(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    12a7 <gen_flag_update_tables+0x157>
mov    $0x0,%al
call   1030 <table_end@plt>
lea    0xcd1(%rip),%rdi
mov    $0x200,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x200,-0x4(%rbp)
jge    1461 <gen_flag_update_tables+0x311>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1407 <gen_flag_update_tables+0x2b7>
mov    -0xc(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
cmp    $0x0,%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     143d <gen_flag_update_tables+0x2ed>
mov    -0xc(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    13d2 <gen_flag_update_tables+0x282>
mov    $0x0,%al
call   1030 <table_end@plt>
lea    0xc3a(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    14c7 <gen_flag_update_tables+0x377>
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x8,%ecx
cmp    $0x80,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1480 <gen_flag_update_tables+0x330>
mov    $0x0,%al
call   1030 <table_end@plt>
lea    0xbea(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    152a <gen_flag_update_tables+0x3da>
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x8,%ecx
cmp    $0x7f,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    14e6 <gen_flag_update_tables+0x396>
mov    $0x0,%al
call   1030 <table_end@plt>
lea    0xb9d(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1579 <gen_flag_update_tables+0x429>
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1050 <update_zns_flags@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1070 <table_add@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1549 <gen_flag_update_tables+0x3f9>
mov    $0x0,%al
call   1030 <table_end@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_flag_update_tables>:
push   %rbp
push   %r14
push   %rbx
lea    0xf30(%rip),%rdi
call   1040 <puts@plt>
lea    0xe99(%rip),%rdi
mov    $0x2000,%esi
call   1060 <table_start@plt>
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    119a <gen_flag_update_tables+0x4a>
nopl   0x0(%rax,%rax,1)
or     $0x20,%esi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebp
cmp    $0x2000,%ebp
je     11ee <gen_flag_update_tables+0x9e>
mov    %ebp,%edi
and    $0x1ff,%edi
mov    %ebp,%eax
shr    $0xa,%eax
and    $0x1,%eax
mov    %ebp,%ecx
shr    $0x9,%ecx
and    $0x1,%ecx
mov    %ebp,%edx
shr    $0x7,%edx
and    $0x1,%edx
xor    %ebx,%ebx
cmp    %eax,%edx
setne  %bl
shl    $0x3,%ebx
cmp    %ecx,%eax
cmovne %r14d,%ebx
mov    %ebp,%esi
shr    $0x8,%esi
and    $0x1,%esi
or     %ebx,%esi
mov    %ebp,%eax
and    $0x1800,%eax
cmp    $0x1800,%eax
je     1180 <gen_flag_update_tables+0x30>
test   $0x8,%bpl
jne    1183 <gen_flag_update_tables+0x33>
test   %eax,%eax
jne    1180 <gen_flag_update_tables+0x30>
jmp    1183 <gen_flag_update_tables+0x33>
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <table_end@plt>
lea    0xe18(%rip),%rdi
mov    $0x2000,%esi
call   1060 <table_start@plt>
xor    %ebp,%ebp
jmp    122a <gen_flag_update_tables+0xda>
nopl   (%rax)
or     $0x20,%esi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebp
cmp    $0x2000,%ebp
je     127e <gen_flag_update_tables+0x12e>
mov    %ebp,%edi
and    $0x1ff,%edi
mov    %ebp,%eax
shr    $0x7,%eax
and    $0x1,%eax
mov    %ebp,%ecx
shr    $0x9,%ecx
and    $0x1,%ecx
mov    %ebp,%edx
shr    $0xa,%edx
and    $0x1,%edx
xor    %ebx,%ebx
cmp    %ecx,%edx
setne  %bl
shl    $0x3,%ebx
cmp    %ecx,%eax
cmovne %r14d,%ebx
mov    %ebp,%esi
shr    $0x8,%esi
and    $0x1,%esi
or     %ebx,%esi
mov    %ebp,%eax
and    $0x1800,%eax
cmp    $0x1800,%eax
je     1210 <gen_flag_update_tables+0xc0>
test   $0x8,%bpl
jne    1213 <gen_flag_update_tables+0xc3>
test   %eax,%eax
jne    1210 <gen_flag_update_tables+0xc0>
jmp    1213 <gen_flag_update_tables+0xc3>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <table_end@plt>
lea    0xda0(%rip),%rdi
mov    $0x200,%esi
call   1060 <table_start@plt>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
shr    %edi
mov    %ebx,%eax
and    $0x1,%eax
sete   %cl
mov    %ebx,%edx
shr    $0x8,%edx
and    $0x1,%edx
xor    %cl,%dl
lea    0x8(%rax),%esi
test   %dl,%dl
cmovne %eax,%esi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebx
cmp    $0x200,%ebx
jne    12a0 <gen_flag_update_tables+0x150>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <table_end@plt>
lea    0xd60(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
nop
xor    %esi,%esi
cmp    $0x80,%ebx
sete   %sil
shl    $0x3,%esi
mov    %ebx,%edi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    12f0 <gen_flag_update_tables+0x1a0>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <table_end@plt>
lea    0xd33(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %esi,%esi
cmp    $0x7f,%ebx
sete   %sil
shl    $0x3,%esi
mov    %ebx,%edi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1340 <gen_flag_update_tables+0x1f0>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <table_end@plt>
lea    0xcfc(%rip),%rdi
mov    $0x100,%esi
call   1060 <table_start@plt>
nop
mov    %ebx,%edi
xor    %esi,%esi
call   1050 <update_zns_flags@plt>
mov    %eax,%edi
call   1070 <table_add@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1380 <gen_flag_update_tables+0x230>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <table_end@plt>

LLVM IR (-O0):
@.str = [100 x i8] c"// Auto-generated file. Do not edit.\0A// Generated by : gen-flag-tables\0A// Included by : avrtest.c\0A\00"
@.str.1 = [23 x i8] c"flag_update_table_add8\00"
@.str.2 = [23 x i8] c"flag_update_table_sub8\00"
@.str.3 = [23 x i8] c"flag_update_table_ror8\00"
@.str.4 = [22 x i8] c"flag_update_table_inc\00"
@.str.5 = [22 x i8] c"flag_update_table_dec\00"
@.str.6 = [26 x i8] c"flag_update_table_logical\00"
define void @gen_flag_update_tables() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 8192)
store i32 0, i32* %1
br label %6
6: ; preds = %66, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 8192
br i1 %8, label %9, label %69
9: ; preds = %6
%10 = load i32, i32* %1
%11 = and i32 %10, 511
store i32 %11, i32* %2
store i32 0, i32* %3
%12 = load i32, i32* %1
%13 = and i32 %12, 1024
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
%17 = load i32, i32* %1
%18 = and i32 %17, 512
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
%22 = icmp eq i32 %16, %21
br i1 %22, label %23, label %38
23: ; preds = %9
%24 = load i32, i32* %2
%25 = and i32 %24, 128
%26 = icmp ne i32 %25, 0
%27 = xor i1 %26, true
%28 = zext i1 %27 to i32
%29 = load i32, i32* %1
%30 = and i32 %29, 1024
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = icmp ne i32 %28, %33
br i1 %34, label %35, label %38
35: ; preds = %23
%36 = load i32, i32* %3
%37 = or i32 %36, 8
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %23, %9
%39 = load i32, i32* %2
%40 = and i32 %39, 256
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %3
%44 = or i32 %43, 1
store i32 %44, i32* %3
br label %45
45: ; preds = %42, %38
%46 = load i32, i32* %1
%47 = and i32 %46, 6144
%48 = icmp eq i32 %47, 6144
br i1 %48, label %57, label %49
49: ; preds = %45
%50 = load i32, i32* %2
%51 = and i32 %50, 8
%52 = icmp eq i32 %51, 0
br i1 %52, label %53, label %60
53: ; preds = %49
%54 = load i32, i32* %1
%55 = and i32 %54, 6144
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53, %45
%58 = load i32, i32* %3
%59 = or i32 %58, 32
store i32 %59, i32* %3
br label %60
60: ; preds = %57, %53, %49
%61 = load i32, i32* %2
%62 = load i32, i32* %3
%63 = call i32 @update_zns_flags(i32 %61, i32 %62)
store i32 %63, i32* %3
%64 = load i32, i32* %3
%65 = call i32 @table_add(i32 %64)
br label %66
66: ; preds = %60
%67 = load i32, i32* %1
%68 = add nsw i32 %67, 1
store i32 %68, i32* %1
br label %6
69: ; preds = %6
%70 = call i32 (...) @table_end()
%71 = call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 8192)
store i32 0, i32* %1
br label %72
72: ; preds = %132, %69
%73 = load i32, i32* %1
%74 = icmp slt i32 %73, 8192
br i1 %74, label %75, label %135
75: ; preds = %72
%76 = load i32, i32* %1
%77 = and i32 %76, 511
store i32 %77, i32* %2
store i32 0, i32* %3
%78 = load i32, i32* %2
%79 = and i32 %78, 128
%80 = icmp ne i32 %79, 0
%81 = xor i1 %80, true
%82 = zext i1 %81 to i32
%83 = load i32, i32* %1
%84 = and i32 %83, 512
%85 = icmp ne i32 %84, 0
%86 = xor i1 %85, true
%87 = zext i1 %86 to i32
%88 = icmp eq i32 %82, %87
br i1 %88, label %89, label %104
89: ; preds = %75
%90 = load i32, i32* %1
%91 = and i32 %90, 1024
%92 = icmp ne i32 %91, 0
%93 = xor i1 %92, true
%94 = zext i1 %93 to i32
%95 = load i32, i32* %1
%96 = and i32 %95, 512
%97 = icmp ne i32 %96, 0
%98 = xor i1 %97, true
%99 = zext i1 %98 to i32
%100 = icmp ne i32 %94, %99
br i1 %100, label %101, label %104
101: ; preds = %89
%102 = load i32, i32* %3
%103 = or i32 %102, 8
store i32 %103, i32* %3
br label %104
104: ; preds = %101, %89, %75
%105 = load i32, i32* %2
%106 = and i32 %105, 256
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %104
%109 = load i32, i32* %3
%110 = or i32 %109, 1
store i32 %110, i32* %3
br label %111
111: ; preds = %108, %104
%112 = load i32, i32* %1
%113 = and i32 %112, 6144
%114 = icmp eq i32 %113, 6144
br i1 %114, label %123, label %115
115: ; preds = %111
%116 = load i32, i32* %2
%117 = and i32 %116, 8
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %126
119: ; preds = %115
%120 = load i32, i32* %1
%121 = and i32 %120, 6144
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %126
123: ; preds = %119, %111
%124 = load i32, i32* %3
%125 = or i32 %124, 32
store i32 %125, i32* %3
br label %126
126: ; preds = %123, %119, %115
%127 = load i32, i32* %2
%128 = load i32, i32* %3
%129 = call i32 @update_zns_flags(i32 %127, i32 %128)
store i32 %129, i32* %3
%130 = load i32, i32* %3
%131 = call i32 @table_add(i32 %130)
br label %132
132: ; preds = %126
%133 = load i32, i32* %1
%134 = add nsw i32 %133, 1
store i32 %134, i32* %1
br label %72
135: ; preds = %72
%136 = call i32 (...) @table_end()
%137 = call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 512)
store i32 0, i32* %1
br label %138
138: ; preds = %169, %135
%139 = load i32, i32* %1
%140 = icmp slt i32 %139, 512
br i1 %140, label %141, label %172
141: ; preds = %138
%142 = load i32, i32* %1
%143 = ashr i32 %142, 1
store i32 %143, i32* %2
store i32 0, i32* %3
%144 = load i32, i32* %1
%145 = and i32 %144, 1
%146 = icmp ne i32 %145, 0
br i1 %146, label %147, label %150
147: ; preds = %141
%148 = load i32, i32* %3
%149 = or i32 %148, 1
store i32 %149, i32* %3
br label %150
150: ; preds = %147, %141
%151 = load i32, i32* %2
%152 = and i32 %151, 128
%153 = icmp ne i32 %152, 0
%154 = zext i1 %153 to i32
%155 = load i32, i32* %3
%156 = and i32 %155, 1
%157 = icmp ne i32 %156, 0
%158 = zext i1 %157 to i32
%159 = icmp ne i32 %154, %158
br i1 %159, label %160, label %163
160: ; preds = %150
%161 = load i32, i32* %3
%162 = or i32 %161, 8
store i32 %162, i32* %3
br label %163
163: ; preds = %160, %150
%164 = load i32, i32* %2
%165 = load i32, i32* %3
%166 = call i32 @update_zns_flags(i32 %164, i32 %165)
store i32 %166, i32* %3
%167 = load i32, i32* %3
%168 = call i32 @table_add(i32 %167)
br label %169
169: ; preds = %163
%170 = load i32, i32* %1
%171 = add nsw i32 %170, 1
store i32 %171, i32* %1
br label %138
172: ; preds = %138
%173 = call i32 (...) @table_end()
%174 = call i32 @table_start(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 256)
store i32 0, i32* %1
br label %175
175: ; preds = %188, %172
%176 = load i32, i32* %1
%177 = icmp slt i32 %176, 256
br i1 %177, label %178, label %191
178: ; preds = %175
%179 = load i32, i32* %1
%180 = icmp eq i32 %179, 128
%181 = zext i1 %180 to i64
%182 = select i1 %180, i32 8, i32 0
store i32 %182, i32* %3
%183 = load i32, i32* %1
%184 = load i32, i32* %3
%185 = call i32 @update_zns_flags(i32 %183, i32 %184)
store i32 %185, i32* %3
%186 = load i32, i32* %3
%187 = call i32 @table_add(i32 %186)
br label %188
188: ; preds = %178
%189 = load i32, i32* %1
%190 = add nsw i32 %189, 1
store i32 %190, i32* %1
br label %175
191: ; preds = %175
%192 = call i32 (...) @table_end()
%193 = call i32 @table_start(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 256)
store i32 0, i32* %1
br label %194
194: ; preds = %207, %191
%195 = load i32, i32* %1
%196 = icmp slt i32 %195, 256
br i1 %196, label %197, label %210
197: ; preds = %194
%198 = load i32, i32* %1
%199 = icmp eq i32 %198, 127
%200 = zext i1 %199 to i64
%201 = select i1 %199, i32 8, i32 0
store i32 %201, i32* %3
%202 = load i32, i32* %1
%203 = load i32, i32* %3
%204 = call i32 @update_zns_flags(i32 %202, i32 %203)
store i32 %204, i32* %3
%205 = load i32, i32* %3
%206 = call i32 @table_add(i32 %205)
br label %207
207: ; preds = %197
%208 = load i32, i32* %1
%209 = add nsw i32 %208, 1
store i32 %209, i32* %1
br label %194
210: ; preds = %194
%211 = call i32 (...) @table_end()
%212 = call i32 @table_start(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 256)
store i32 0, i32* %1
br label %213
213: ; preds = %221, %210
%214 = load i32, i32* %1
%215 = icmp slt i32 %214, 256
br i1 %215, label %216, label %224
216: ; preds = %213
%217 = load i32, i32* %1
%218 = call i32 @update_zns_flags(i32 %217, i32 0)
store i32 %218, i32* %3
%219 = load i32, i32* %3
%220 = call i32 @table_add(i32 %219)
br label %221
221: ; preds = %216
%222 = load i32, i32* %1
%223 = add nsw i32 %222, 1
store i32 %223, i32* %1
br label %213
224: ; preds = %213
%225 = call i32 (...) @table_end()
ret void
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"flag_update_table_add8\00"
@.str.2 = [23 x i8] c"flag_update_table_sub8\00"
@.str.3 = [23 x i8] c"flag_update_table_ror8\00"
@.str.4 = [22 x i8] c"flag_update_table_inc\00"
@.str.5 = [22 x i8] c"flag_update_table_dec\00"
@.str.6 = [26 x i8] c"flag_update_table_logical\00"
@str = [99 x i8] c"// Auto-generated file. Do not edit.\0A// Generated by : gen-flag-tables\0A// Included by : avrtest.c\00"
define void @gen_flag_update_tables() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 8192)
br label %3
3: ; preds = %0, %28
%4 = phi i32 [ 0, %0 ], [ %32, %28 ]
%5 = and i32 %4, 511
%6 = lshr i32 %4, 10
%7 = and i32 %6, 1
%8 = lshr i32 %4, 9
%9 = and i32 %8, 1
%10 = icmp eq i32 %7, %9
%11 = lshr i32 %4, 7
%12 = and i32 %11, 1
%13 = icmp eq i32 %12, %7
%14 = select i1 %13, i32 0, i32 8
%15 = select i1 %10, i32 %14, i32 0
%16 = lshr i32 %4, 8
%17 = and i32 %16, 1
%18 = or i32 %15, %17
%19 = and i32 %4, 6144
%20 = icmp eq i32 %19, 6144
br i1 %20, label %26, label %21
21: ; preds = %3
%22 = and i32 %4, 8
%23 = icmp ne i32 %22, 0
%24 = icmp eq i32 %19, 0
%25 = or i1 %23, %24
br i1 %25, label %28, label %26
26: ; preds = %21, %3
%27 = or i32 %18, 32
br label %28
28: ; preds = %26, %21
%29 = phi i32 [ %27, %26 ], [ %18, %21 ]
%30 = tail call i32 @update_zns_flags(i32 %5, i32 %29)
%31 = tail call i32 @table_add(i32 %30)
%32 = add nuw nsw i32 %4, 1
%33 = icmp eq i32 %32, 8192
br i1 %33, label %34, label %3
34: ; preds = %28
%35 = tail call i32 (...) @table_end()
%36 = tail call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 8192)
br label %37
37: ; preds = %34, %62
%38 = phi i32 [ 0, %34 ], [ %66, %62 ]
%39 = and i32 %38, 511
%40 = lshr i32 %38, 7
%41 = and i32 %40, 1
%42 = lshr i32 %38, 9
%43 = and i32 %42, 1
%44 = icmp eq i32 %41, %43
%45 = lshr i32 %38, 10
%46 = and i32 %45, 1
%47 = icmp eq i32 %46, %43
%48 = select i1 %47, i32 0, i32 8
%49 = select i1 %44, i32 %48, i32 0
%50 = lshr i32 %38, 8
%51 = and i32 %50, 1
%52 = or i32 %49, %51
%53 = and i32 %38, 6144
%54 = icmp eq i32 %53, 6144
br i1 %54, label %60, label %55
55: ; preds = %37
%56 = and i32 %38, 8
%57 = icmp ne i32 %56, 0
%58 = icmp eq i32 %53, 0
%59 = or i1 %57, %58
br i1 %59, label %62, label %60
60: ; preds = %55, %37
%61 = or i32 %52, 32
br label %62
62: ; preds = %60, %55
%63 = phi i32 [ %61, %60 ], [ %52, %55 ]
%64 = tail call i32 @update_zns_flags(i32 %39, i32 %63)
%65 = tail call i32 @table_add(i32 %64)
%66 = add nuw nsw i32 %38, 1
%67 = icmp eq i32 %66, 8192
br i1 %67, label %68, label %37
68: ; preds = %62
%69 = tail call i32 (...) @table_end()
%70 = tail call i32 @table_start(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 512)
br label %71
71: ; preds = %68, %71
%72 = phi i32 [ 0, %68 ], [ %85, %71 ]
%73 = lshr i32 %72, 1
%74 = and i32 %72, 1
%75 = icmp eq i32 %74, 0
%76 = xor i1 %75, true
%77 = zext i1 %76 to i32
%78 = and i32 %72, 256
%79 = icmp ne i32 %78, 0
%80 = xor i1 %79, %75
%81 = or i32 %77, 8
%82 = select i1 %80, i32 %77, i32 %81
%83 = tail call i32 @update_zns_flags(i32 %73, i32 %82)
%84 = tail call i32 @table_add(i32 %83)
%85 = add nuw nsw i32 %72, 1
%86 = icmp eq i32 %85, 512
br i1 %86, label %87, label %71
87: ; preds = %71
%88 = tail call i32 (...) @table_end()
%89 = tail call i32 @table_start(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 256)
br label %90
90: ; preds = %87, %90
%91 = phi i32 [ 0, %87 ], [ %96, %90 ]
%92 = icmp eq i32 %91, 128
%93 = select i1 %92, i32 8, i32 0
%94 = tail call i32 @update_zns_flags(i32 %91, i32 %93)
%95 = tail call i32 @table_add(i32 %94)
%96 = add nuw nsw i32 %91, 1
%97 = icmp eq i32 %96, 256
br i1 %97, label %98, label %90
98: ; preds = %90
%99 = tail call i32 (...) @table_end()
%100 = tail call i32 @table_start(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 256)
br label %101
101: ; preds = %98, %101
%102 = phi i32 [ 0, %98 ], [ %107, %101 ]
%103 = icmp eq i32 %102, 127
%104 = select i1 %103, i32 8, i32 0
%105 = tail call i32 @update_zns_flags(i32 %102, i32 %104)
%106 = tail call i32 @table_add(i32 %105)
%107 = add nuw nsw i32 %102, 1
%108 = icmp eq i32 %107, 256
br i1 %108, label %109, label %101
109: ; preds = %101
%110 = tail call i32 (...) @table_end()
%111 = tail call i32 @table_start(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i32 256)
br label %112
112: ; preds = %109, %112
%113 = phi i32 [ 0, %109 ], [ %116, %112 ]
%114 = tail call i32 @update_zns_flags(i32 %113, i32 0)
%115 = tail call i32 @table_add(i32 %114)
%116 = add nuw nsw i32 %113, 1
%117 = icmp eq i32 %116, 256
br i1 %117, label %118, label %112
118: ; preds = %112
%119 = tail call i32 (...) @table_end()
ret void
}