#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 */
typedef int /*<<< orphan*/ visual_annotation;
typedef int /*<<< orphan*/ length;

/* Variables and functions */
int /*<<< orphan*/ kannotate_write(char const *, unsigned int);
int strlen(char const *);
void gator_annotate_visual(const char *data, unsigned int length,
                           const char *str) {
  int str_size = strlen(str) & 0xffff;
  int visual_annotation = 0x1c | (0x04 << 8) | (str_size << 16);
  kannotate_write((char *)&visual_annotation, sizeof(visual_annotation));
  kannotate_write(str, str_size);
  kannotate_write((char *)&length, sizeof(length));
  kannotate_write(data, length);
}


x86 assembly (clang, -O0):
<gator_annotate_visual>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
and    $0xffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x10,%eax
or     $0x41c,%eax
mov    %eax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1040 <kannotate_write@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <kannotate_write@plt>
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
call   1040 <kannotate_write@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <kannotate_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gator_annotate_visual>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %esi,0x8(%rsp)
mov    %rdx,%rdi
call   1030 <strlen@plt>
movzwl %ax,%ebp
shl    $0x10,%eax
or     $0x41c,%eax
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x4,%esi
call   1040 <kannotate_write@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <kannotate_write@plt>
lea    0x8(%rsp),%rdi
mov    $0x4,%esi
call   1040 <kannotate_write@plt>
mov    0x8(%rsp),%esi
mov    %r14,%rdi
call   1040 <kannotate_write@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @gator_annotate_visual(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
%11 = and i32 %10, 65535
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = shl i32 %12, 16
%14 = or i32 1052, %13
store i32 %14, i32* %8
%15 = bitcast i32* %8 to i8*
%16 = call i32 @kannotate_write(i8* %15, i32 4)
%17 = load i8*, i8** %6
%18 = load i32, i32* %7
%19 = call i32 @kannotate_write(i8* %17, i32 %18)
%20 = bitcast i32* %5 to i8*
%21 = call i32 @kannotate_write(i8* %20, i32 4)
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = call i32 @kannotate_write(i8* %22, i32 %23)
ret void
}

LLVM IR (-O2):
define void @gator_annotate_visual(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %1, i32* %4
%6 = tail call i32 @strlen(i8* %2)
%7 = and i32 %6, 65535
%8 = bitcast i32* %5 to i8*
%9 = shl i32 %6, 16
%10 = or i32 %9, 1052
store i32 %10, i32* %5
%11 = call i32 @kannotate_write(i8* %8, i32 4)
%12 = call i32 @kannotate_write(i8* %2, i32 %7)
%13 = bitcast i32* %4 to i8*
%14 = call i32 @kannotate_write(i8* %13, i32 4)
%15 = load i32, i32* %4
%16 = call i32 @kannotate_write(i8* %0, i32 %15)
ret void
}