#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*/ dbg_trace_point(int /*<<< orphan*/);
int /*<<< orphan*/ dbg_write_char(char);
int /*<<< orphan*/ dbg_write_str(char *);
int /*<<< orphan*/ dbg_write_u16(unsigned short const *, int);
int /*<<< orphan*/ dbg_write_u32(unsigned long *, int);
int /*<<< orphan*/ dbg_write_u8(unsigned char const *, int);
int main(void) {
  dbg_write_str("hello world");
  dbg_write_char('t');
  dbg_write_char('e');
  dbg_write_char('s');
  dbg_write_char('t');
  dbg_write_char('\n');
  unsigned long test_u32 = 0x01234567;
  dbg_write_u32(&test_u32, 1);
  static const unsigned short test_u16[] = {0x0123, 0x4567, 0x89AB, 0xCDEF,
                                            0x0123, 0x4567, 0x89AB, 0xCDEF};
  dbg_write_u16(test_u16, 8);
  static const unsigned char test_u8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
                                          0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB,
                                          0xCC, 0XDD, 0xEE, 0xFF};
  dbg_write_u8(test_u8, 16);
  while (1) {
    dbg_trace_point(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1040 <dbg_write_str@plt>
mov    $0x74,%edi
call   1060 <dbg_write_char@plt>
mov    $0x65,%edi
call   1060 <dbg_write_char@plt>
mov    $0x73,%edi
call   1060 <dbg_write_char@plt>
mov    $0x74,%edi
call   1060 <dbg_write_char@plt>
mov    $0xa,%edi
call   1060 <dbg_write_char@plt>
movq   $0x1234567,-0x10(%rbp)
01
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1070 <dbg_write_u32@plt>
lea    0xe46(%rip),%rdi
mov    $0x8,%esi
call   1050 <dbg_write_u16@plt>
lea    0xe45(%rip),%rdi
mov    $0x10,%esi
call   1030 <dbg_write_u8@plt>
xor    %edi,%edi
call   1080 <dbg_trace_point@plt>
jmp    11e5 <main+0x85>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1040 <dbg_write_str@plt>
mov    $0x74,%edi
call   1060 <dbg_write_char@plt>
mov    $0x65,%edi
call   1060 <dbg_write_char@plt>
mov    $0x73,%edi
call   1060 <dbg_write_char@plt>
mov    $0x74,%edi
call   1060 <dbg_write_char@plt>
mov    $0xa,%edi
call   1060 <dbg_write_char@plt>
movq   $0x1234567,(%rsp)
01
mov    %rsp,%rdi
mov    $0x1,%esi
call   1070 <dbg_write_u32@plt>
lea    0xe55(%rip),%rdi
mov    $0x8,%esi
call   1050 <dbg_write_u16@plt>
lea    0xe54(%rip),%rdi
mov    $0x10,%esi
call   1030 <dbg_write_u8@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
call   1080 <dbg_trace_point@plt>
jmp    11e0 <main+0x80>

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
@main.test_u16 = internal constant [8 x i16] [i16 291, i16 17767, i16 -30293, i16 -12817, i16 291, i16 17767, i16 -30293, i16 -12817]
@main.test_u8 = internal constant [16 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = call i32 @dbg_write_str(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @dbg_write_char(i8 signext 116)
%5 = call i32 @dbg_write_char(i8 signext 101)
%6 = call i32 @dbg_write_char(i8 signext 115)
%7 = call i32 @dbg_write_char(i8 signext 116)
%8 = call i32 @dbg_write_char(i8 signext 10)
store i64 19088743, i64* %2
%9 = call i32 @dbg_write_u32(i64* %2, i32 1)
%10 = call i32 @dbg_write_u16(i16* getelementptr inbounds ([8 x i16], [8 x i16]* @main.test_u16, i64 0, i64 0), i32 8)
%11 = call i32 @dbg_write_u8(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @main.test_u8, i64 0, i64 0), i32 16)
br label %12
12: ; preds = %0, %12
%13 = call i32 @dbg_trace_point(i32 0)
br label %12
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@main.test_u16 = internal constant [8 x i16] [i16 291, i16 17767, i16 -30293, i16 -12817, i16 291, i16 17767, i16 -30293, i16 -12817]
@main.test_u8 = internal constant [16 x i8] c"\00\11\223DUfw\88\99\AA\BB\CC\DD\EE\FF"
define i32 @main() {
%1 = alloca i64
%2 = tail call i32 @dbg_write_str(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @dbg_write_char(i8 signext 116)
%4 = tail call i32 @dbg_write_char(i8 signext 101)
%5 = tail call i32 @dbg_write_char(i8 signext 115)
%6 = tail call i32 @dbg_write_char(i8 signext 116)
%7 = tail call i32 @dbg_write_char(i8 signext 10)
%8 = bitcast i64* %1 to i8*
store i64 19088743, i64* %1
%9 = call i32 @dbg_write_u32(i64* %1, i32 1)
%10 = call i32 @dbg_write_u16(i16* getelementptr inbounds ([8 x i16], [8 x i16]* @main.test_u16, i64 0, i64 0), i32 8)
%11 = call i32 @dbg_write_u8(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @main.test_u8, i64 0, i64 0), i32 16)
br label %12
12: ; preds = %12, %0
%13 = call i32 @dbg_trace_point(i32 0)
br label %12
}