#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s1[] = {'H', 'e', 'l', 'l', 'o'};
  char s2[] = {'H', 'e', 'l', 'l', 'o', '\0'};
  char *s3 = "Hello";
  char *s4 = (char *)malloc(100 * sizeof(char));
  memset(s4 + 5, 'c', 100);
  s4[0] = 'H';
  s4[1] = 'e';
  s4[2] = 'l';
  s4[3] = 'l';
  s4[4] = 'o';
  printf("%s\n", s4);
  free(s4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xea6(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xe9e(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xe98(%rip),%ax
mov    %ax,-0xb(%rbp)
lea    0xe89(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
add    $0x5,%rdi
mov    $0x63,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
mov    -0x20(%rbp),%rax
movb   $0x48,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x65,0x1(%rax)
mov    -0x20(%rbp),%rax
movb   $0x6c,0x2(%rax)
mov    -0x20(%rbp),%rax
movb   $0x6c,0x3(%rax)
mov    -0x20(%rbp),%rax
movb   $0x6f,0x4(%rax)
mov    -0x20(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0x5(%rax),%rdi
mov    $0x63,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movl   $0x6c6c6548,(%rbx)
movb   $0x6f,0x4(%rbx)
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s1 = [5 x i8] c"Hello"
@__const.main.s2 = [6 x i8] c"Hello\00"
@.str = [6 x i8] c"Hello\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [6 x i8]
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [5 x i8]* %2 to i8*
%7 = bitcast [6 x i8]* %3 to i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
%8 = call i64 @malloc(i32 100)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = getelementptr inbounds i8, i8* %10, i64 5
%12 = call i32 @memset(i8* %11, i8 signext 99, i32 100)
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 72, i8* %14
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 101, i8* %16
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 2
store i8 108, i8* %18
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 3
store i8 108, i8* %20
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 4
store i8 111, i8* %22
%23 = load i8*, i8** %5
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %5
%26 = call i32 @free(i8* %25)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 100)
%2 = inttoptr i64 %1 to i8*
%3 = getelementptr inbounds i8, i8* %2, i64 5
%4 = tail call i32 @memset(i8* %3, i8 signext 99, i32 100)
store i8 72, i8* %2
%5 = getelementptr inbounds i8, i8* %2, i64 1
store i8 101, i8* %5
%6 = getelementptr inbounds i8, i8* %2, i64 2
store i8 108, i8* %6
%7 = getelementptr inbounds i8, i8* %2, i64 3
store i8 108, i8* %7
%8 = getelementptr inbounds i8, i8* %2, i64 4
store i8 111, i8* %8
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%10 = tail call i32 @free(i8* %2)
ret i32 0
}