#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*/ printf(char *, ...);
unsigned int strlen(char *);
int main(int argc, char *argv[]) {
  char message[] = "{\"text\": \"This is a native message\"}";
  unsigned int len = strlen(message);
  printf("%c%c%c%c", (char)(len & 0xFF), (char)((len >> 8) & 0xFF),
         (char)((len >> 16) & 0xFF), (char)((len >> 24) & 0xFF));
  printf("%s", message);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x25,%edx
call   1050 <memcpy@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
and    $0xff,%eax
movsbl %al,%esi
mov    -0x44(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
movsbl %al,%edx
mov    -0x44(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
movsbl %al,%ecx
mov    -0x44(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
movsbl %al,%r8d
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x7d226567617373,%rax
mov    %rax,0x1d(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
movsbl %al,%esi
mov    %eax,%ecx
shr    $0x8,%ecx
movsbl %cl,%edx
mov    %eax,%ecx
shr    $0x10,%ecx
movsbl %cl,%ecx
sar    $0x18,%eax
lea    0xeb2(%rip),%rdi
mov    %eax,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.message = [37 x i8] c"{\22text\22: \22This is a native message\22}\00"
@.str = [9 x i8] c"%c%c%c%c\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [37 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [37 x i8]* %6 to i8*
%9 = getelementptr inbounds [37 x i8], [37 x i8]* %6, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = sext i8 %13 to i32
%15 = load i32, i32* %7
%16 = lshr i32 %15, 8
%17 = and i32 %16, 255
%18 = trunc i32 %17 to i8
%19 = sext i8 %18 to i32
%20 = load i32, i32* %7
%21 = lshr i32 %20, 16
%22 = and i32 %21, 255
%23 = trunc i32 %22 to i8
%24 = sext i8 %23 to i32
%25 = load i32, i32* %7
%26 = lshr i32 %25, 24
%27 = and i32 %26, 255
%28 = trunc i32 %27 to i8
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %19, i32 %24, i32 %29)
%31 = getelementptr inbounds [37 x i8], [37 x i8]* %6, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %31)
ret i32 0
}

LLVM IR (-O2):
@__const.main.message = [37 x i8] c"{\22text\22: \22This is a native message\22}\00"
@.str = [9 x i8] c"%c%c%c%c\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [37 x i8]
%4 = getelementptr inbounds [37 x i8], [37 x i8]* %3, i64 0, i64 0
%5 = call i32 @strlen(i8* %4)
%6 = shl i32 %5, 24
%7 = ashr exact i32 %6, 24
%8 = shl i32 %5, 16
%9 = ashr i32 %8, 24
%10 = shl i32 %5, 8
%11 = ashr i32 %10, 24
%12 = ashr i32 %5, 24
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9, i32 %11, i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}