#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*/ fwrite(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int main(void) {
  char *str1 = "Hello";
  char str2[] = {'w', 'o', 'r', 'l', 'd', '\0'};
  char str3[] = {'w', 'o', 'r', 'l', 'd'};
  printf("%s\n", str1);
  printf("%s\n", str2);
  printf("%s\n", str3);
  printf("strlen(str2)=%zu\n", strlen(str2));
  printf("strlen(str3)=%zu\n", strlen(str3));
  char twoNull[] = {'h', 'i', '\0', 'w', 'o', 'r', 'l', 'd', '\0'};
  printf("%s\n", twoNull);
  fwrite(twoNull, 9, 1, stdout);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeb0(%rip),%ax
mov    %ax,-0x12(%rbp)
mov    0xed0(%rip),%eax
mov    %eax,-0x1b(%rbp)
mov    0xecb(%rip),%al
mov    %al,-0x17(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x16(%rbp),%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1b(%rbp),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x16(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0xe5a(%rip),%rax
mov    %rax,-0x24(%rbp)
mov    0xe58(%rip),%al
mov    %al,-0x1c(%rbp)
lea    -0x24(%rbp),%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rdi
mov    0x2dd7(%rip),%rax
mov    (%rax),%ecx
mov    $0x9,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movw   $0x64,0x14(%rsp)
movl   $0x6c726f77,0x10(%rsp)
6c
movb   $0x64,0xc(%rsp)
movl   $0x6c726f77,0x8(%rsp)
6c
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xe5e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movabs $0x646c726f77006968,%rax
72 6c 64
mov    %rax,0x18(%rsp)
movb   $0x0,0x20(%rsp)
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%edx
call   1070 <fwrite@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@__const.main.str2 = [6 x i8] c"world\00"
@__const.main.str3 = [5 x i8] c"world"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [18 x i8] c"strlen(str2)=%zu\0A\00"
@.str.3 = [18 x i8] c"strlen(str3)=%zu\0A\00"
@__const.main.twoNull = [9 x i8] c"hi\00world\00"
@stdout = global i32 0
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [6 x i8]
%4 = alloca [5 x i8]
%5 = alloca [9 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
%6 = bitcast [6 x i8]* %3 to i8*
%7 = bitcast [5 x i8]* %4 to i8*
%8 = load i8*, i8** %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = bitcast [9 x i8]* %5 to i8*
%21 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%24 = load i32, i32* @stdout
%25 = call i32 @fwrite(i8* %23, i32 9, i32 1, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@__const.main.str2 = [6 x i8] c"world\00"
@__const.main.str3 = [5 x i8] c"world"
@.str.2 = [18 x i8] c"strlen(str2)=%zu\0A\00"
@.str.3 = [18 x i8] c"strlen(str3)=%zu\0A\00"
@__const.main.twoNull = [9 x i8] c"hi\00world\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [5 x i8]
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @puts(i8* %4)
%8 = call i32 @puts(i8* %5)
%9 = call i32 @strlen(i8* %4)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = call i32 @strlen(i8* %5)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = load i32, i32* @stdout
%16 = call i32 @fwrite(i8* %13, i32 9, i32 1, i32 %15)
%17 = call i32 @putchar(i32 10)
ret i32 0
}