#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 *, char);
int /*<<< orphan*/ puts(char *const);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char a[100] = {'w', 's', '\0', 'l', 'd'};
  puts(a);
  puts("hello");
  char *p = a;
  printf("%c\n", *p);
  *p = 'm';
  puts(a);
  p = "world";
  printf("%c\n", *p);
  const char *q = NULL;
  q = "ok";
  puts(q);
  p = a;
  strcpy(a, "NB");
  puts(p);
  q = a + 3;
  puts(q);
  char *const r = a + 1;
  *r = 'A';
  puts(r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
movb   $0x77,-0x70(%rbp)
movb   $0x73,-0x6f(%rbp)
movb   $0x6c,-0x6d(%rbp)
movb   $0x64,-0x6c(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
lea    0xe6c(%rip),%rdi
movsbl (%rax),%esi
call   1050 <printf@plt>
mov    -0x78(%rbp),%rax
movb   $0x6d,(%rax)
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
lea    0xe51(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
lea    0xe3e(%rip),%rdi
movsbl (%rax),%esi
call   1050 <printf@plt>
movq   $0x0,-0x80(%rbp)
lea    0xe31(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x78(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movb   $0x41,(%rax)
mov    -0x88(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x60(%rsp)
movw   $0x7377,(%rsp)
lea    0x1(%rsp),%r14
lea    0x3(%rsp),%r15
movw   $0x646c,0x3(%rsp)
mov    %rsp,%r12
mov    %r12,%rdi
call   1040 <puts@plt>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6e(%rip),%rbx
mov    %rbx,%rdi
mov    $0x77,%esi
call   1050 <printf@plt>
movb   $0x6d,(%rsp)
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x77,%esi
call   1050 <printf@plt>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3c(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
movb   $0x41,0x1(%rsp)
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"hello\00"
@.str.1 = [4 x i8] c"%c\0A\00"
@.str.2 = [6 x i8] c"world\00"
@.str.3 = [3 x i8] c"ok\00"
@.str.4 = [3 x i8] c"NB\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [100 x i8]* %2 to i8*
%7 = bitcast i8* %6 to <{ i8, i8, i8, i8, i8, [95 x i8] }>*
%8 = getelementptr inbounds <{ i8, i8, i8, i8, i8, [95 x i8] }>, <{ i8, i8, i8, i8, i8, [95 x i8] }>* %7, i32 0, i32 0
store i8 119, i8* %8
%9 = getelementptr inbounds <{ i8, i8, i8, i8, i8, [95 x i8] }>, <{ i8, i8, i8, i8, i8, [95 x i8] }>* %7, i32 0, i32 1
store i8 115, i8* %9
%10 = getelementptr inbounds <{ i8, i8, i8, i8, i8, [95 x i8] }>, <{ i8, i8, i8, i8, i8, [95 x i8] }>* %7, i32 0, i32 3
store i8 108, i8* %10
%11 = getelementptr inbounds <{ i8, i8, i8, i8, i8, [95 x i8] }>, <{ i8, i8, i8, i8, i8, [95 x i8] }>* %7, i32 0, i32 4
store i8 100, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i32 @puts(i8* %12)
%14 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %17)
%19 = load i8*, i8** %3
store i8 109, i8* %19
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%21 = call i32 @puts(i8* %20)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %3
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %23)
store i8* null, i8** %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %4
%25 = load i8*, i8** %4
%26 = call i32 @puts(i8* %25)
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8* %27, i8** %3
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%30 = load i8*, i8** %3
%31 = call i32 @puts(i8* %30)
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%33 = getelementptr inbounds i8, i8* %32, i64 3
store i8* %33, i8** %4
%34 = load i8*, i8** %4
%35 = call i32 @puts(i8* %34)
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%37 = getelementptr inbounds i8, i8* %36, i64 1
store i8* %37, i8** %5
%38 = load i8*, i8** %5
store i8 65, i8* %38
%39 = load i8*, i8** %5
%40 = call i32 @puts(i8* %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [4 x i8] c"%c\0A\00"
@.str.3 = [3 x i8] c"ok\00"
@.str.4 = [3 x i8] c"NB\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
store i8 119, i8* %2
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 1
store i8 115, i8* %3
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 3
store i8 108, i8* %4
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 4
store i8 100, i8* %5
%6 = call i32 @puts(i8* %2)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext 119)
store i8 109, i8* %2
%9 = call i32 @puts(i8* %2)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext 119)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 @puts(i8* %2)
%14 = call i32 @puts(i8* %4)
store i8 65, i8* %3
%15 = call i32 @puts(i8* %3)
ret i32 0
}