#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 *, unsigned long);
__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("Struct %s with bitmask: 0x%08lx\n", (is_write ? "assign" : "access"),
         bitmask);
  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    0xec9(%rip),%rsi
lea    0xebb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    0x10(%rbp),%rdx
lea    0xe88(%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,%ebp
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbx
mov    0x40(%rsp),%rdx
test   %r8d,%r8d
lea    0xedc(%rip),%rax
lea    0xece(%rip),%rsi
cmove  %rax,%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r12,%rdx
mov    %r15d,%ecx
mov    %ebp,%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 = [33 x i8] c"Struct %s with bitmask: 0x%08lx\0A\00"
@.str.1 = [7 x i8] c"assign\00"
@.str.2 = [7 x i8] c"access\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 ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%29 = load i64, i64* %19
%30 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %28, i64 %29)
%31 = load i8*, i8** %13
%32 = load i8*, i8** %14
%33 = load i8*, i8** %15
%34 = load i32, i32* %16
%35 = load i32, i32* %17
%36 = load i32, i32* %18
%37 = load i64, i64* %19
%38 = load i32*, i32** %20
%39 = load i8*, i8** %21
%40 = load i32, i32* %22
%41 = call i32 @check_report(i8* %31, i8* %32, i8* %33, i32 %34, i32 %35, i32 %36, i64 %37, i32* %38, i8* %39, i32 %40)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Struct %s with bitmask: 0x%08lx\0A\00"
@.str.1 = [7 x i8] c"assign\00"
@.str.2 = [7 x i8] c"access\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 ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %14, i64 %6)
%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
}