#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*/ asprintf(char **, char *, char const *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ parse_error_at(char const *, int, char *, char *);
void parse_error_at_expected(const char const *buffer, int index,
                             const char *expected, const char *assumed) {
  char *warning_text, *text_at_position;
  if (assumed)
    asprintf(&warning_text, "Assumed '%s' at marked location:", assumed);
  else
    warning_text = "Warning: Parser error at marked location:";
  asprintf(&text_at_position, "expected %s", expected);
  parse_error_at(buffer, index, warning_text, text_at_position);
  if (assumed)
    free(warning_text);
  free(text_at_position);
}


x86 assembly (clang, -O0):
<parse_error_at_expected>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     116b <parse_error_at_expected+0x3b>
mov    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <asprintf@plt>
jmp    1176 <parse_error_at_expected+0x46>
lea    0xeaf(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    0xec6(%rip),%rsi
call   1040 <asprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1050 <parse_error_at@plt>
cmpq   $0x0,-0x20(%rbp)
je     11b2 <parse_error_at_expected+0x82>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_error_at_expected>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %rdi,%r15
test   %rcx,%rcx
je     1161 <parse_error_at_expected+0x31>
lea    0xeae(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rbx,%rdx
call   1040 <asprintf@plt>
jmp    116d <parse_error_at_expected+0x3d>
lea    0xeb9(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xed7(%rip),%rsi
lea    0x10(%rsp),%rdi
mov    %rbp,%rdx
call   1040 <asprintf@plt>
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    %r15,%rdi
mov    %r14d,%esi
call   1050 <parse_error_at@plt>
test   %rbx,%rbx
je     11a5 <parse_error_at_expected+0x75>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Assumed '%s' at marked location:\00"
@.str.1 = [42 x i8] c"Warning: Parser error at marked location:\00"
@.str.2 = [12 x i8] c"expected %s\00"
define void @parse_error_at_expected(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i8*, i8** %8
%15 = call i32 @asprintf(i8** %9, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %17
16: ; preds = %4
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8** %9
br label %17
17: ; preds = %16, %13
%18 = load i8*, i8** %7
%19 = call i32 @asprintf(i8** %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load i8*, i8** %5
%21 = load i32, i32* %6
%22 = load i8*, i8** %9
%23 = load i8*, i8** %10
%24 = call i32 @parse_error_at(i8* %20, i32 %21, i8* %22, i8* %23)
%25 = load i8*, i8** %8
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %30
27: ; preds = %17
%28 = load i8*, i8** %9
%29 = call i32 @free(i8* %28)
br label %30
30: ; preds = %27, %17
%31 = load i8*, i8** %10
%32 = call i32 @free(i8* %31)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Assumed '%s' at marked location:\00"
@.str.1 = [42 x i8] c"Warning: Parser error at marked location:\00"
@.str.2 = [12 x i8] c"expected %s\00"
define void @parse_error_at_expected(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = bitcast i8** %5 to i8*
%8 = bitcast i8** %6 to i8*
%9 = icmp eq i8* %3, null
br i1 %9, label %12, label %10
10: ; preds = %4
%11 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %13
12: ; preds = %4
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %13
13: ; preds = %12, %10
%14 = call i32 @asprintf(i8** %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = call i32 @parse_error_at(i8* %0, i32 %1, i8* %15, i8* %16)
br i1 %9, label %21, label %18
18: ; preds = %13
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
br label %21
21: ; preds = %18, %13
%22 = load i8*, i8** %6
%23 = call i32 @free(i8* %22)
ret void
}