#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 *, char const *, ...);
int /*<<< orphan*/ show_context(char *, int, int, int);
void print_utf8_error(const char *file_path, int error_line, int error_column,
                      int byte_no, char *str, int str_length,
                      int err_pos_in_str, const char *message, int faulty_bytes,
                      int quiet, int verbose, int list_only, int invert) {
  if (quiet)
    return;
  if (message && !invert) {
    if (list_only)
      printf("%s\n", file_path);
    else
      printf("%s: line %d, char %d, byte %d: %s\n", file_path, error_line,
             error_column, byte_no, message);
    if (verbose && !list_only) {
      show_context(str, str_length, err_pos_in_str, faulty_bytes);
    }
  }
  if (!message && invert) {
    printf("%s\n", file_path);
  }
}


x86 assembly (clang, -O0):
<print_utf8_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
cmpl   $0x0,0x28(%rbp)
je     1162 <print_utf8_error+0x42>
jmp    120a <print_utf8_error+0xea>
cmpq   $0x0,0x18(%rbp)
je     11e3 <print_utf8_error+0xc3>
cmpl   $0x0,0x40(%rbp)
jne    11e3 <print_utf8_error+0xc3>
cmpl   $0x0,0x38(%rbp)
je     1198 <print_utf8_error+0x78>
mov    -0x8(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b8 <print_utf8_error+0x98>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    0x18(%rbp),%r9
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,0x30(%rbp)
je     11de <print_utf8_error+0xbe>
cmpl   $0x0,0x38(%rbp)
jne    11de <print_utf8_error+0xbe>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    0x10(%rbp),%edx
mov    0x20(%rbp),%ecx
call   1030 <show_context@plt>
jmp    11e3 <print_utf8_error+0xc3>
cmpq   $0x0,0x18(%rbp)
jne    120a <print_utf8_error+0xea>
cmpl   $0x0,0x40(%rbp)
je     120a <print_utf8_error+0xea>
mov    -0x8(%rbp),%rsi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_utf8_error>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmpl   $0x0,0x58(%rsp)
je     1141 <print_utf8_error+0x21>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdi,%r14
mov    0x70(%rsp),%r12d
mov    0x48(%rsp),%rbx
test   %rbx,%rbx
je     11be <print_utf8_error+0x9e>
test   %r12d,%r12d
jne    11be <print_utf8_error+0x9e>
cmpl   $0x0,0x68(%rsp)
je     1172 <print_utf8_error+0x52>
lea    0xeb9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11be <print_utf8_error+0x9e>
mov    %r9d,%r15d
mov    %r8,%rbp
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    0x60(%rsp),%r13d
mov    0x50(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    0x40(%rsp),%eax
mov    %eax,(%rsp)
lea    0xe66(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%r9
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
je     11be <print_utf8_error+0x9e>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    (%rsp),%edx
mov    0x4(%rsp),%ecx
call   1030 <show_context@plt>
test   %rbx,%rbx
jne    1132 <print_utf8_error+0x12>
test   %r12d,%r12d
je     1132 <print_utf8_error+0x12>
lea    0xe48(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [35 x i8] c"%s: line %d, char %d, byte %d: %s\0A\00"
define void @print_utf8_error(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6, i8* %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i8* %0, i8** %14
store i32 %1, i32* %15
store i32 %2, i32* %16
store i32 %3, i32* %17
store i8* %4, i8** %18
store i32 %5, i32* %19
store i32 %6, i32* %20
store i8* %7, i8** %21
store i32 %8, i32* %22
store i32 %9, i32* %23
store i32 %10, i32* %24
store i32 %11, i32* %25
store i32 %12, i32* %26
%27 = load i32, i32* %23
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %13
br label %71
30: ; preds = %13
%31 = load i8*, i8** %21
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %62
33: ; preds = %30
%34 = load i32, i32* %26
%35 = icmp ne i32 %34, 0
br i1 %35, label %62, label %36
36: ; preds = %33
%37 = load i32, i32* %25
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i8*, i8** %14
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %40)
br label %49
42: ; preds = %36
%43 = load i8*, i8** %14
%44 = load i32, i32* %15
%45 = load i32, i32* %16
%46 = load i32, i32* %17
%47 = load i8*, i8** %21
%48 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %43, i32 %44, i32 %45, i32 %46, i8* %47)
br label %49
49: ; preds = %42, %39
%50 = load i32, i32* %24
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = load i32, i32* %25
%54 = icmp ne i32 %53, 0
br i1 %54, label %61, label %55
55: ; preds = %52
%56 = load i8*, i8** %18
%57 = load i32, i32* %19
%58 = load i32, i32* %20
%59 = load i32, i32* %22
%60 = call i32 @show_context(i8* %56, i32 %57, i32 %58, i32 %59)
br label %61
61: ; preds = %55, %52, %49
br label %62
62: ; preds = %61, %33, %30
%63 = load i8*, i8** %21
%64 = icmp ne i8* %63, null
br i1 %64, label %71, label %65
65: ; preds = %62
%66 = load i32, i32* %26
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i8*, i8** %14
%70 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %69)
br label %71
71: ; preds = %29, %68, %65, %62
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [35 x i8] c"%s: line %d, char %d, byte %d: %s\0A\00"
define void @print_utf8_error(i8* %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5, i32 %6, i8* %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
%14 = icmp eq i32 %9, 0
br i1 %14, label %15, label %32
15: ; preds = %13
%16 = icmp eq i8* %7, null
%17 = icmp ne i32 %12, 0
%18 = or i1 %16, %17
br i1 %18, label %28, label %19
19: ; preds = %15
%20 = icmp eq i32 %11, 0
br i1 %20, label %23, label %21
21: ; preds = %19
%22 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %28
23: ; preds = %19
%24 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1, i32 %2, i32 %3, i8* %7)
%25 = icmp eq i32 %10, 0
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = tail call i32 @show_context(i8* %4, i32 %5, i32 %6, i32 %8)
br label %28
28: ; preds = %21, %23, %26, %15
%29 = and i1 %16, %17
br i1 %29, label %30, label %32
30: ; preds = %28
%31 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %32
32: ; preds = %13, %30, %28
ret void
}