#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 check_weird(void) {
  int known_weird = 0;
  int char_bit, char_min = 0, char_max = 0;
  {
    char x1 = 0, x2 = 0, x3 = 1;
    for (char_bit = 0; char_bit < 256; char_bit++) {
      x1 = x2;
      x2 = x2 * 2 + 1;
      x3 = (x3 << 1);
      if (x2 == x1 || (x2 + 1) == x2)
        break;
      if (char_min > x2)
        char_min = x2;
      if (char_min > x3)
        char_min = x3;
      if (char_max < x2)
        char_max = x2;
    }
  }
  if (!known_weird) {
    int x, flg = sizeof(int) * char_bit + 2;
    for (x = 1; x + 1 > x && --flg; x = (x | (x << 1)))
      ;
    x = sizeof(int) * char_bit + 3 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(A): Signed integers are insane (too big for their bit "
             "size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(A): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
  if (!known_weird) {
    int x, y = 0, flg = sizeof(int) * char_bit * 2;
    for (x = 1; x > y && --flg; y = x, x = (x << 1))
      ;
    x = sizeof(int) * char_bit * 2 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(B): Signed integers are insane (too big for their bit "
             "size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(B): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
  if (!known_weird) {
    int x, flg = sizeof(int) * char_bit + 2;
    for (x = 1; x + 2 >= x && --flg; x = (x | (x << 1)))
      ;
    x = sizeof(int) * char_bit + 3 - flg;
    known_weird = 1;
    if (x >= (int)(sizeof(int) * char_bit))
      printf("WARNING(C): Signed integers are insane (too big for their bit "
             "size).\n");
    else if (x != sizeof(int) * char_bit - 1)
      printf("WARNING(C): Signed integers have %d magnitude bits.\n", x);
    else
      known_weird = 0;
  }
}


x86 assembly (clang, -O0):
<check_weird>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movb   $0x1,-0x13(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11e7 <check_weird+0xd7>
mov    -0x12(%rbp),%al
mov    %al,-0x11(%rbp)
movsbl -0x12(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
mov    %al,-0x12(%rbp)
movsbl -0x13(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x13(%rbp)
movsbl -0x12(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
je     118d <check_weird+0x7d>
movsbl -0x12(%rbp),%eax
add    $0x1,%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jne    1192 <check_weird+0x82>
jmp    11e7 <check_weird+0xd7>
mov    -0xc(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jle    11a8 <check_weird+0x98>
movsbl -0x12(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl -0x13(%rbp),%ecx
cmp    %ecx,%eax
jle    11be <check_weird+0xae>
movsbl -0x13(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    11d4 <check_weird+0xc4>
movsbl -0x12(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11d9 <check_weird+0xc9>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1140 <check_weird+0x30>
cmpl   $0x0,-0x4(%rbp)
jne    12d8 <check_weird+0x1c8>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    $0x2,%rax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x31(%rbp)
jle    122d <check_weird+0x11d>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    123d <check_weird+0x12d>
jmp    1255 <check_weird+0x145>
jmp    1242 <check_weird+0x132>
mov    -0x18(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    1207 <check_weird+0xf7>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    $0x3,%rax
movslq -0x1c(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x18(%rbp),%eax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
cmp    %ecx,%eax
jl     1298 <check_weird+0x188>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d3 <check_weird+0x1c3>
movslq -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
je     12c7 <check_weird+0x1b7>
mov    -0x18(%rbp),%esi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ce <check_weird+0x1be>
movl   $0x0,-0x4(%rbp)
jmp    12d3 <check_weird+0x1c3>
jmp    12d8 <check_weird+0x1c8>
cmpl   $0x0,-0x4(%rbp)
jne    13ce <check_weird+0x2be>
movl   $0x0,-0x24(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
shl    $0x1,%rax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%ecx
xor    %eax,%eax
cmp    -0x24(%rbp),%ecx
mov    %al,-0x32(%rbp)
jle    1322 <check_weird+0x212>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x32(%rbp)
mov    -0x32(%rbp),%al
test   $0x1,%al
jne    1332 <check_weird+0x222>
jmp    134b <check_weird+0x23b>
jmp    1337 <check_weird+0x227>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12ff <check_weird+0x1ef>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
shl    $0x1,%rax
movslq -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x20(%rbp),%eax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
cmp    %ecx,%eax
jl     138e <check_weird+0x27e>
lea    0xcf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c9 <check_weird+0x2b9>
movslq -0x20(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
je     13bd <check_weird+0x2ad>
mov    -0x20(%rbp),%esi
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c4 <check_weird+0x2b4>
movl   $0x0,-0x4(%rbp)
jmp    13c9 <check_weird+0x2b9>
jmp    13ce <check_weird+0x2be>
cmpl   $0x0,-0x4(%rbp)
jne    14bf <check_weird+0x3af>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    $0x2,%rax
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
add    $0x2,%ecx
xor    %eax,%eax
cmp    -0x2c(%rbp),%ecx
mov    %al,-0x33(%rbp)
jl     1414 <check_weird+0x304>
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x33(%rbp)
mov    -0x33(%rbp),%al
test   $0x1,%al
jne    1424 <check_weird+0x314>
jmp    143c <check_weird+0x32c>
jmp    1429 <check_weird+0x319>
mov    -0x2c(%rbp),%eax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0x2c(%rbp)
jmp    13ee <check_weird+0x2de>
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    $0x3,%rax
movslq -0x30(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x2c(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x2c(%rbp),%eax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
cmp    %ecx,%eax
jl     147f <check_weird+0x36f>
lea    0xc83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14ba <check_weird+0x3aa>
movslq -0x2c(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x2,%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
je     14ae <check_weird+0x39e>
mov    -0x2c(%rbp),%esi
lea    0xc9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14b5 <check_weird+0x3a5>
movl   $0x0,-0x4(%rbp)
jmp    14ba <check_weird+0x3aa>
jmp    14bf <check_weird+0x3af>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_weird>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"WARNING(A): Signed integers are insane (too big for their bit size).\0A\00"
@.str.1 = [53 x i8] c"WARNING(A): Signed integers have %d magnitude bits.\0A\00"
@.str.2 = [70 x i8] c"WARNING(B): Signed integers are insane (too big for their bit size).\0A\00"
@.str.3 = [53 x i8] c"WARNING(B): Signed integers have %d magnitude bits.\0A\00"
@.str.4 = [70 x i8] c"WARNING(C): Signed integers are insane (too big for their bit size).\0A\00"
@.str.5 = [53 x i8] c"WARNING(C): Signed integers have %d magnitude bits.\0A\00"
define void @check_weird() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
store i8 0, i8* %5
store i8 0, i8* %6
store i8 1, i8* %7
store i32 0, i32* %2
br label %15
15: ; preds = %67, %0
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 256
br i1 %17, label %18, label %70
18: ; preds = %15
%19 = load i8, i8* %6
store i8 %19, i8* %5
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = mul nsw i32 %21, 2
%23 = add nsw i32 %22, 1
%24 = trunc i32 %23 to i8
store i8 %24, i8* %6
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = shl i32 %26, 1
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %6
%30 = sext i8 %29 to i32
%31 = load i8, i8* %5
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %30, %32
br i1 %33, label %41, label %34
34: ; preds = %18
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = add nsw i32 %36, 1
%38 = load i8, i8* %6
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %37, %39
br i1 %40, label %41, label %42
41: ; preds = %34, %18
br label %70
42: ; preds = %34
%43 = load i32, i32* %3
%44 = load i8, i8* %6
%45 = sext i8 %44 to i32
%46 = icmp sgt i32 %43, %45
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8, i8* %6
%49 = sext i8 %48 to i32
store i32 %49, i32* %3
br label %50
50: ; preds = %47, %42
%51 = load i32, i32* %3
%52 = load i8, i8* %7
%53 = sext i8 %52 to i32
%54 = icmp sgt i32 %51, %53
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i8, i8* %7
%57 = sext i8 %56 to i32
store i32 %57, i32* %3
br label %58
58: ; preds = %55, %50
%59 = load i32, i32* %4
%60 = load i8, i8* %6
%61 = sext i8 %60 to i32
%62 = icmp slt i32 %59, %61
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = load i8, i8* %6
%65 = sext i8 %64 to i32
store i32 %65, i32* %4
br label %66
66: ; preds = %63, %58
br label %67
67: ; preds = %66
%68 = load i32, i32* %2
%69 = add nsw i32 %68, 1
store i32 %69, i32* %2
br label %15
70: ; preds = %41, %15
%71 = load i32, i32* %1
%72 = icmp ne i32 %71, 0
br i1 %72, label %127, label %73
73: ; preds = %70
%74 = load i32, i32* %2
%75 = sext i32 %74 to i64
%76 = mul i64 4, %75
%77 = add i64 %76, 2
%78 = trunc i64 %77 to i32
store i32 %78, i32* %9
store i32 1, i32* %8
br label %79
79: ; preds = %91, %73
%80 = load i32, i32* %8
%81 = add nsw i32 %80, 1
%82 = load i32, i32* %8
%83 = icmp sgt i32 %81, %82
br i1 %83, label %84, label %88
84: ; preds = %79
%85 = load i32, i32* %9
%86 = add nsw i32 %85, -1
store i32 %86, i32* %9
%87 = icmp ne i32 %86, 0
br label %88
88: ; preds = %84, %79
%89 = phi i1 [ false, %79 ], [ %87, %84 ]
br i1 %89, label %90, label %96
90: ; preds = %88
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = load i32, i32* %8
%94 = shl i32 %93, 1
%95 = or i32 %92, %94
store i32 %95, i32* %8
br label %79
96: ; preds = %88
%97 = load i32, i32* %2
%98 = sext i32 %97 to i64
%99 = mul i64 4, %98
%100 = add i64 %99, 3
%101 = load i32, i32* %9
%102 = sext i32 %101 to i64
%103 = sub i64 %100, %102
%104 = trunc i64 %103 to i32
store i32 %104, i32* %8
store i32 1, i32* %1
%105 = load i32, i32* %8
%106 = load i32, i32* %2
%107 = sext i32 %106 to i64
%108 = mul i64 4, %107
%109 = trunc i64 %108 to i32
%110 = icmp sge i32 %105, %109
br i1 %110, label %111, label %113
111: ; preds = %96
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %126
113: ; preds = %96
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = load i32, i32* %2
%117 = sext i32 %116 to i64
%118 = mul i64 4, %117
%119 = sub i64 %118, 1
%120 = icmp ne i64 %115, %119
br i1 %120, label %121, label %124
121: ; preds = %113
%122 = load i32, i32* %8
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i32 %122)
br label %125
124: ; preds = %113
store i32 0, i32* %1
br label %125
125: ; preds = %124, %121
br label %126
126: ; preds = %125, %111
br label %127
127: ; preds = %126, %70
%128 = load i32, i32* %1
%129 = icmp ne i32 %128, 0
br i1 %129, label %182, label %130
130: ; preds = %127
store i32 0, i32* %11
%131 = load i32, i32* %2
%132 = sext i32 %131 to i64
%133 = mul i64 4, %132
%134 = mul i64 %133, 2
%135 = trunc i64 %134 to i32
store i32 %135, i32* %12
store i32 1, i32* %10
br label %136
136: ; preds = %147, %130
%137 = load i32, i32* %10
%138 = load i32, i32* %11
%139 = icmp sgt i32 %137, %138
br i1 %139, label %140, label %144
140: ; preds = %136
%141 = load i32, i32* %12
%142 = add nsw i32 %141, -1
store i32 %142, i32* %12
%143 = icmp ne i32 %142, 0
br label %144
144: ; preds = %140, %136
%145 = phi i1 [ false, %136 ], [ %143, %140 ]
br i1 %145, label %146, label %151
146: ; preds = %144
br label %147
147: ; preds = %146
%148 = load i32, i32* %10
store i32 %148, i32* %11
%149 = load i32, i32* %10
%150 = shl i32 %149, 1
store i32 %150, i32* %10
br label %136
151: ; preds = %144
%152 = load i32, i32* %2
%153 = sext i32 %152 to i64
%154 = mul i64 4, %153
%155 = mul i64 %154, 2
%156 = load i32, i32* %12
%157 = sext i32 %156 to i64
%158 = sub i64 %155, %157
%159 = trunc i64 %158 to i32
store i32 %159, i32* %10
store i32 1, i32* %1
%160 = load i32, i32* %10
%161 = load i32, i32* %2
%162 = sext i32 %161 to i64
%163 = mul i64 4, %162
%164 = trunc i64 %163 to i32
%165 = icmp sge i32 %160, %164
br i1 %165, label %166, label %168
166: ; preds = %151
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0))
br label %181
168: ; preds = %151
%169 = load i32, i32* %10
%170 = sext i32 %169 to i64
%171 = load i32, i32* %2
%172 = sext i32 %171 to i64
%173 = mul i64 4, %172
%174 = sub i64 %173, 1
%175 = icmp ne i64 %170, %174
br i1 %175, label %176, label %179
176: ; preds = %168
%177 = load i32, i32* %10
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i32 %177)
br label %180
179: ; preds = %168
store i32 0, i32* %1
br label %180
180: ; preds = %179, %176
br label %181
181: ; preds = %180, %166
br label %182
182: ; preds = %181, %127
%183 = load i32, i32* %1
%184 = icmp ne i32 %183, 0
br i1 %184, label %239, label %185
185: ; preds = %182
%186 = load i32, i32* %2
%187 = sext i32 %186 to i64
%188 = mul i64 4, %187
%189 = add i64 %188, 2
%190 = trunc i64 %189 to i32
store i32 %190, i32* %14
store i32 1, i32* %13
br label %191
191: ; preds = %203, %185
%192 = load i32, i32* %13
%193 = add nsw i32 %192, 2
%194 = load i32, i32* %13
%195 = icmp sge i32 %193, %194
br i1 %195, label %196, label %200
196: ; preds = %191
%197 = load i32, i32* %14
%198 = add nsw i32 %197, -1
store i32 %198, i32* %14
%199 = icmp ne i32 %198, 0
br label %200
200: ; preds = %196, %191
%201 = phi i1 [ false, %191 ], [ %199, %196 ]
br i1 %201, label %202, label %208
202: ; preds = %200
br label %203
203: ; preds = %202
%204 = load i32, i32* %13
%205 = load i32, i32* %13
%206 = shl i32 %205, 1
%207 = or i32 %204, %206
store i32 %207, i32* %13
br label %191
208: ; preds = %200
%209 = load i32, i32* %2
%210 = sext i32 %209 to i64
%211 = mul i64 4, %210
%212 = add i64 %211, 3
%213 = load i32, i32* %14
%214 = sext i32 %213 to i64
%215 = sub i64 %212, %214
%216 = trunc i64 %215 to i32
store i32 %216, i32* %13
store i32 1, i32* %1
%217 = load i32, i32* %13
%218 = load i32, i32* %2
%219 = sext i32 %218 to i64
%220 = mul i64 4, %219
%221 = trunc i64 %220 to i32
%222 = icmp sge i32 %217, %221
br i1 %222, label %223, label %225
223: ; preds = %208
%224 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0))
br label %238
225: ; preds = %208
%226 = load i32, i32* %13
%227 = sext i32 %226 to i64
%228 = load i32, i32* %2
%229 = sext i32 %228 to i64
%230 = mul i64 4, %229
%231 = sub i64 %230, 1
%232 = icmp ne i64 %227, %231
br i1 %232, label %233, label %236
233: ; preds = %225
%234 = load i32, i32* %13
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i32 %234)
br label %237
236: ; preds = %225
store i32 0, i32* %1
br label %237
237: ; preds = %236, %233
br label %238
238: ; preds = %237, %223
br label %239
239: ; preds = %238, %182
ret void
}

LLVM IR (-O2):
@str.7 = [69 x i8] c"WARNING(A): Signed integers are insane (too big for their bit size).\00"
define void @check_weird() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0))
ret void
}