#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*/ check_report(void *, char const *, char const *, int, int,
                                int, unsigned long, int *, char const *, int);
int /*<<< orphan*/ printf(char *, char *, char const *, int);
__attribute__((hcos_noinstrument)) void
__report_field_access(void *record_ptr, const char *record, const char *field,
                      int field_index, int is_write, int is_marked,
                      unsigned long bitmask, int *scratch, const char *filename,
                      int lineno, int index, int struct_index) {
  printf("%s reported for field %s (index: %d)\n",
         (is_write ? "Write" : "Read"), field, field_index);
  check_report(record_ptr, record, field, field_index, is_write, is_marked,
               bitmask, scratch, filename, lineno);
}


x86 assembly (clang, -O0):
<__report_field_access>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x28(%rbp),%ecx
lea    0xecd(%rip),%rsi
lea    0xec0(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x2c(%rbp),%r9d
mov    0x10(%rbp),%rbx
mov    0x18(%rbp),%r11
mov    0x20(%rbp),%r10
mov    0x28(%rbp),%eax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %eax,0x18(%rsp)
call   1040 <check_report@plt>
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__report_field_access>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r15d
mov    %ecx,%ebx
mov    %rdx,%rbp
mov    %rsi,%r12
mov    %rdi,%r13
test   %r8d,%r8d
lea    0xee6(%rip),%rax
lea    0xed9(%rip),%rsi
cmove  %rax,%rsi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %ebx,%ecx
mov    %r15d,%r8d
mov    %r14d,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <check_report@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"%s reported for field %s (index: %d)\0A\00"
@.str.1 = [6 x i8] c"Write\00"
@.str.2 = [5 x i8] c"Read\00"
define void @__report_field_access(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i64 %6, i32* %7, i8* %8, i32 %9, i32 %10, i32 %11) {
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i64
%20 = alloca i32*
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i8* %0, i8** %13
store i8* %1, i8** %14
store i8* %2, i8** %15
store i32 %3, i32* %16
store i32 %4, i32* %17
store i32 %5, i32* %18
store i64 %6, i64* %19
store i32* %7, i32** %20
store i8* %8, i8** %21
store i32 %9, i32* %22
store i32 %10, i32* %23
store i32 %11, i32* %24
%25 = load i32, i32* %17
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%29 = load i8*, i8** %15
%30 = load i32, i32* %16
%31 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %28, i8* %29, i32 %30)
%32 = load i8*, i8** %13
%33 = load i8*, i8** %14
%34 = load i8*, i8** %15
%35 = load i32, i32* %16
%36 = load i32, i32* %17
%37 = load i32, i32* %18
%38 = load i64, i64* %19
%39 = load i32*, i32** %20
%40 = load i8*, i8** %21
%41 = load i32, i32* %22
%42 = call i32 @check_report(i8* %32, i8* %33, i8* %34, i32 %35, i32 %36, i32 %37, i64 %38, i32* %39, i8* %40, i32 %41)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"%s reported for field %s (index: %d)\0A\00"
@.str.1 = [6 x i8] c"Write\00"
@.str.2 = [5 x i8] c"Read\00"
define void @__report_field_access(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i64 %6, i32* %7, i8* %8, i32 %9, i32 %10, i32 %11) {
%13 = icmp eq i32 %4, 0
%14 = select i1 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %2, i32 %3)
%16 = tail call i32 @check_report(i8* %0, i8* %1, i8* %2, i32 %3, i32 %4, i32 %5, i64 %6, i32* %7, i8* %8, i32 %9)
ret void
}