#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ fclose(int /*<<< orphan*/ *);
scalar_t__ ferror(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
char symbolic_width(unsigned int);
void output_width_property_test(const char *filename) {
  FILE *stream;
  unsigned int interval_start, interval_end, ch;
  char interval_value;
  stream = fopen(filename, "w");
  if (stream == NULL) {
    fprintf(stderr, "cannot open '%s' for writing\n", filename);
    exit(1);
  }
  interval_value = 0;
  interval_start = interval_end = 0;
  for (ch = 0; ch < 0x110000; ch++) {
    char value = symbolic_width(ch);
    if (value != 0) {
      if (value == interval_value)
        interval_end = ch;
      else {
        if (interval_value != 0) {
          if (interval_end == interval_start)
            fprintf(stream, "%04X\t\t%c\n", interval_start, interval_value);
          else
            fprintf(stream, "%04X..%04X\t%c\n", interval_start, interval_end,
                    interval_value);
        }
        interval_start = interval_end = ch;
        interval_value = value;
      }
    }
  }
  if (interval_value != 0) {
    if (interval_end == interval_start)
      fprintf(stream, "%04X\t\t%c\n", interval_start, interval_value);
    else
      fprintf(stream, "%04X..%04X\t%c\n", interval_start, interval_end,
              interval_value);
  }
  if (ferror(stream) || fclose(stream)) {
    fprintf(stderr, "error writing to '%s'\n", filename);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<output_width_property_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b0 <output_width_property_test+0x50>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movb   $0x0,-0x1d(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x110000,-0x1c(%rbp)
jae    128d <output_width_property_test+0x12d>
mov    -0x1c(%rbp),%edi
call   1050 <symbolic_width@plt>
mov    %al,-0x1e(%rbp)
movsbl -0x1e(%rbp),%eax
cmp    $0x0,%eax
je     127a <output_width_property_test+0x11a>
movsbl -0x1e(%rbp),%eax
movsbl -0x1d(%rbp),%ecx
cmp    %ecx,%eax
jne    1209 <output_width_property_test+0xa9>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1275 <output_width_property_test+0x115>
movsbl -0x1d(%rbp),%eax
cmp    $0x0,%eax
je     1266 <output_width_property_test+0x106>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1242 <output_width_property_test+0xe2>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x14(%rbp),%edx
movsbl -0x1d(%rbp),%ecx
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1261 <output_width_property_test+0x101>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsbl -0x1d(%rbp),%r8d
lea    0xdd0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1266 <output_width_property_test+0x106>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
jmp    127a <output_width_property_test+0x11a>
jmp    127f <output_width_property_test+0x11f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11c9 <output_width_property_test+0x69>
movsbl -0x1d(%rbp),%eax
cmp    $0x0,%eax
je     12ea <output_width_property_test+0x18a>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    12c6 <output_width_property_test+0x166>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x14(%rbp),%edx
movsbl -0x1d(%rbp),%ecx
lea    0xd66(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12e5 <output_width_property_test+0x185>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
movsbl -0x1d(%rbp),%r8d
lea    0xd4c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    12ea <output_width_property_test+0x18a>
mov    -0x10(%rbp),%rdi
call   1030 <ferror@plt>
cmp    $0x0,%rax
jne    1310 <output_width_property_test+0x1b0>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
cmp    $0x0,%rax
je     1335 <output_width_property_test+0x1d5>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd15(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_width_property_test>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe8e(%rip),%rsi
mov    %rdi,(%rsp)
call   1070 <fopen@plt>
test   %rax,%rax
je     126e <output_width_property_test+0x10e>
mov    %rax,%r13
xor    %r14d,%r14d
xor    %r12d,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11b9 <output_width_property_test+0x59>
lea    0xe90(%rip),%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %ebp,%ebx
mov    %r15d,%r12d
mov    %ebp,%r14d
add    $0x1,%ebp
cmp    $0x110000,%ebp
je     11f7 <output_width_property_test+0x97>
mov    %ebp,%edi
call   1050 <symbolic_width@plt>
test   %al,%al
je     11ae <output_width_property_test+0x4e>
mov    %eax,%r15d
cmp    %r12b,%al
jne    11d0 <output_width_property_test+0x70>
mov    %ebp,%ebx
jmp    11ae <output_width_property_test+0x4e>
test   %r12b,%r12b
je     11a6 <output_width_property_test+0x46>
movsbl %r12b,%r8d
mov    %r13d,%edi
cmp    %r14d,%ebx
jne    1193 <output_width_property_test+0x33>
lea    0xe38(%rip),%rsi
mov    %r14d,%edx
mov    %r8d,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11a6 <output_width_property_test+0x46>
test   %r12b,%r12b
je     1233 <output_width_property_test+0xd3>
movsbl %r12b,%r8d
cmp    %r14d,%ebx
jne    121d <output_width_property_test+0xbd>
lea    0xe14(%rip),%rsi
mov    %r13d,%edi
mov    %ebx,%edx
mov    %r8d,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    1233 <output_width_property_test+0xd3>
lea    0xe06(%rip),%rsi
mov    %r13d,%edi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    %r13,%rdi
call   1030 <ferror@plt>
test   %rax,%rax
jne    125c <output_width_property_test+0xfc>
mov    %r13,%rdi
call   1040 <fclose@plt>
test   %rax,%rax
jne    125c <output_width_property_test+0xfc>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
jmp    127e <output_width_property_test+0x11e>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"cannot open '%s' for writing\0A\00"
@.str.2 = [10 x i8] c"%04X\09\09%c\0A\00"
@.str.3 = [15 x i8] c"%04X..%04X\09%c\0A\00"
@.str.4 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_width_property_test(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %2
%9 = load i8*, i8** %2
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %1
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %2
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %1
store i8 0, i8* %7
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %6
br label %19
19: ; preds = %65, %18
%20 = load i32, i32* %6
%21 = icmp ult i32 %20, 1114112
br i1 %21, label %22, label %68
22: ; preds = %19
%23 = load i32, i32* %6
%24 = call signext i8 @symbolic_width(i32 %23)
store i8 %24, i8* %8
%25 = load i8, i8* %8
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %64
28: ; preds = %22
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %30, %32
br i1 %33, label %34, label %36
34: ; preds = %28
%35 = load i32, i32* %6
store i32 %35, i32* %5
br label %63
36: ; preds = %28
%37 = load i8, i8* %7
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %60
40: ; preds = %36
%41 = load i32, i32* %5
%42 = load i32, i32* %4
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %51
44: ; preds = %40
%45 = load i32*, i32** %3
%46 = ptrtoint i32* %45 to i32
%47 = load i32, i32* %4
%48 = load i8, i8* %7
%49 = sext i8 %48 to i32
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %47, i32 %49)
br label %59
51: ; preds = %40
%52 = load i32*, i32** %3
%53 = ptrtoint i32* %52 to i32
%54 = load i32, i32* %4
%55 = load i32, i32* %5
%56 = load i8, i8* %7
%57 = sext i8 %56 to i32
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %54, i32 %55, i32 %57)
br label %59
59: ; preds = %51, %44
br label %60
60: ; preds = %59, %36
%61 = load i32, i32* %6
store i32 %61, i32* %5
store i32 %61, i32* %4
%62 = load i8, i8* %8
store i8 %62, i8* %7
br label %63
63: ; preds = %60, %34
br label %64
64: ; preds = %63, %22
br label %65
65: ; preds = %64
%66 = load i32, i32* %6
%67 = add i32 %66, 1
store i32 %67, i32* %6
br label %19
68: ; preds = %19
%69 = load i8, i8* %7
%70 = sext i8 %69 to i32
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %92
72: ; preds = %68
%73 = load i32, i32* %5
%74 = load i32, i32* %4
%75 = icmp eq i32 %73, %74
br i1 %75, label %76, label %83
76: ; preds = %72
%77 = load i32*, i32** %3
%78 = ptrtoint i32* %77 to i32
%79 = load i32, i32* %4
%80 = load i8, i8* %7
%81 = sext i8 %80 to i32
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %79, i32 %81)
br label %91
83: ; preds = %72
%84 = load i32*, i32** %3
%85 = ptrtoint i32* %84 to i32
%86 = load i32, i32* %4
%87 = load i32, i32* %5
%88 = load i8, i8* %7
%89 = sext i8 %88 to i32
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %86, i32 %87, i32 %89)
br label %91
91: ; preds = %83, %76
br label %92
92: ; preds = %91, %68
%93 = load i32*, i32** %3
%94 = call i64 @ferror(i32* %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %100, label %96
96: ; preds = %92
%97 = load i32*, i32** %3
%98 = call i64 @fclose(i32* %97)
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %96, %92
%101 = load i32, i32* @stderr
%102 = load i8*, i8** %2
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %102)
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %96
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"cannot open '%s' for writing\0A\00"
@.str.2 = [10 x i8] c"%04X\09\09%c\0A\00"
@.str.3 = [15 x i8] c"%04X..%04X\09%c\0A\00"
@.str.4 = [23 x i8] c"error writing to '%s'\0A\00"
define void @output_width_property_test(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = ptrtoint i32* %2 to i64
%6 = trunc i64 %5 to i32
br label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4, %29
%12 = phi i32 [ 0, %4 ], [ %32, %29 ]
%13 = phi i8 [ 0, %4 ], [ %31, %29 ]
%14 = phi i32 [ 0, %4 ], [ %33, %29 ]
%15 = phi i32 [ 0, %4 ], [ %30, %29 ]
%16 = tail call signext i8 @symbolic_width(i32 %14)
%17 = icmp eq i8 %16, 0
br i1 %17, label %29, label %18
18: ; preds = %11
%19 = sext i8 %13 to i32
%20 = icmp eq i8 %16, %13
br i1 %20, label %29, label %21
21: ; preds = %18
%22 = icmp eq i8 %13, 0
br i1 %22, label %29, label %23
23: ; preds = %21
%24 = icmp eq i32 %15, %12
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %19)
br label %29
27: ; preds = %23
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %12, i32 %15, i32 %19)
br label %29
29: ; preds = %21, %27, %25, %18, %11
%30 = phi i32 [ %15, %11 ], [ %14, %18 ], [ %14, %25 ], [ %14, %27 ], [ %14, %21 ]
%31 = phi i8 [ %13, %11 ], [ %13, %18 ], [ %16, %25 ], [ %16, %27 ], [ %16, %21 ]
%32 = phi i32 [ %12, %11 ], [ %12, %18 ], [ %14, %25 ], [ %14, %27 ], [ %14, %21 ]
%33 = add nuw nsw i32 %14, 1
%34 = icmp eq i32 %33, 1114112
br i1 %34, label %35, label %11
35: ; preds = %29
%36 = sext i8 %31 to i32
%37 = icmp eq i8 %31, 0
br i1 %37, label %44, label %38
38: ; preds = %35
%39 = icmp eq i32 %30, %32
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %36)
br label %44
42: ; preds = %38
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %32, i32 %30, i32 %36)
br label %44
44: ; preds = %40, %42, %35
%45 = tail call i64 @ferror(i32* %2)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = tail call i64 @fclose(i32* %2)
%49 = icmp eq i64 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %47, %44
%51 = load i32, i32* @stderr
%52 = tail call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%53 = tail call i32 @exit(i32 1)
unreachable
54: ; preds = %47
ret void
}