#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 *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
int main() {
  char str[] = "你好你好你好你好";
  printf("%s\n", str);
  printf("%d\n", strlen(str));
  char str_log[1000], *filename = "/a/vb/d/s/哈哈哈.txt";
  sprintf(str_log, "{\"type\":\"receive\",\"path\":\"%s\",\"result\":0}",
          filename);
  printf("%s\n", str_log);
  printf("%d\n", strlen(str_log));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x8(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe83(%rip),%rax
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
lea    0xe7f(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
movups 0xeb8(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xea3(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe9e(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea7(%rip),%rsi
lea    0xe88(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str = [25 x i8] c"\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"/a/vb/d/s/\E5\93\88\E5\93\88\E5\93\88.txt\00"
@.str.3 = [42 x i8] c"{\22type\22:\22receive\22,\22path\22:\22%s\22,\22result\22:0}\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [25 x i8]
%3 = alloca [1000 x i8]
%4 = alloca i8*
store i32 0, i32* %1
%5 = bitcast [25 x i8]* %2 to i8*
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8** %4
%11 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%17 = call i32 @strlen(i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [25 x i8] c"\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\E4\BD\A0\E5\A5\BD\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [24 x i8] c"/a/vb/d/s/\E5\93\88\E5\93\88\E5\93\88.txt\00"
@.str.3 = [42 x i8] c"{\22type\22:\22receive\22,\22path\22:\22%s\22,\22result\22:0}\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%4 = call i32 @puts(i8* %3)
%5 = call i32 @strlen(i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @puts(i8* %7)
%10 = call i32 @strlen(i8* %7)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}