#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*/ strcat(char *, char *);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void main() {
  char s1[20] = "Hello World!";
  char s2[20] = "Computer ";
  char s3[20] = "Programming";
  int length;
  int a;
  length = strlen(s1);
  printf("The length of s1 is %d\n", length);
  strcat(s2, s3);
  printf("\n%s", s2);
  strcat(s2, " Rocks!");
  printf("\n%s", s2);
  strcpy(s1, "wicked");
  printf("\n%s", s1);
  strncpy(s3, s2, 4);
  printf("\n%s", s3);
  a = strcmp(s1, "wicked");
  printf("\n%d", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0xe91(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe8e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe8c(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xe92(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe8f(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe8d(%rip),%eax
mov    %eax,-0x30(%rbp)
mov    0xe93(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe90(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xe8e(%rip),%eax
mov    %eax,-0x50(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x40(%rbp),%rsi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x40(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe4a(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    -0x60(%rbp),%rsi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1070 <strcmp@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x60,%rsp
movaps 0xe8c(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movl   $0x0,0x50(%rsp)
movaps 0xe98(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x40(%rsp),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0xe98(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
lea    0xe8d(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe7d(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe69(%rip),%r13
mov    %r14,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   1070 <strcmp@plt>
lea    0xe29(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.s1 = [20 x i8] c"Hello World!\00\00\00\00\00\00\00\00"
@__const.main.s2 = [20 x i8] c"Computer \00\00\00\00\00\00\00\00\00\00\00"
@__const.main.s3 = [20 x i8] c"Programming\00\00\00\00\00\00\00\00\00"
@.str = [24 x i8] c"The length of s1 is %d\0A\00"
@.str.1 = [4 x i8] c"\0A%s\00"
@.str.2 = [8 x i8] c" Rocks!\00"
@.str.3 = [7 x i8] c"wicked\00"
@.str.4 = [4 x i8] c"\0A%d\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [20 x i8]* %1 to i8*
%7 = bitcast [20 x i8]* %2 to i8*
%8 = bitcast [20 x i8]* %3 to i8*
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcat(i8* %13, i8* %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%23 = call i32 @strcpy(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%28 = call i32 @strncpy(i8* %26, i8* %27, i32 4)
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 %32, i32* %5
%33 = load i32, i32* %5
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %33)
ret void
}

LLVM IR (-O2):
@__const.main.s1 = [20 x i8] c"Hello World!\00\00\00\00\00\00\00\00"
@__const.main.s2 = [20 x i8] c"Computer \00\00\00\00\00\00\00\00\00\00\00"
@__const.main.s3 = [20 x i8] c"Programming\00\00\00\00\00\00\00\00\00"
@.str = [24 x i8] c"The length of s1 is %d\0A\00"
@.str.1 = [4 x i8] c"\0A%s\00"
@.str.2 = [8 x i8] c" Rocks!\00"
@.str.3 = [7 x i8] c"wicked\00"
@.str.4 = [4 x i8] c"\0A%d\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i32 @strlen(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 @strcat(i8* %5, i8* %6)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%13 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%15 = call i32 @strncpy(i8* %6, i8* %5, i32 4)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%17 = call i32 @strcmp(i8* %4, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %17)
ret void
}