#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 *, 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) {
  int i = *((int *)record_ptr);
  printf("Access reported with foo.a = %d\n", i);
  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    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xe98(%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,%r12d
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rdi),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r13,%rdx
mov    %r12d,%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 = [33 x i8] c"Access reported with foo.a = %d\0A\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
%25 = 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
%26 = load i8*, i8** %13
%27 = bitcast i8* %26 to i32*
%28 = load i32, i32* %27
store i32 %28, i32* %25
%29 = load i32, i32* %25
%30 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %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"Access reported with foo.a = %d\0A\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 = bitcast i8* %0 to i32*
%14 = load i32, i32* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %14)
%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
}