int main() {
  char str[50] = "lovec";
  for (int i = 0; i < sizeof(str); i++) {
    printf("%c", str[i]);
  }
  printf("%d\n", sizeof(str));
  memmove(str + 5, " learnc", 8);
  printf("%s\n", str);
  strcat(str, " enjoyc");
  printf("%s\n", str);
  printf("%s\n", strchr(str, 'c'));
  printf("%d\n", strchr(str, 'c') - str);
  printf("%d\n", strlen(str));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1060 <memset@plt>
movb   $0x6c,-0x40(%rbp)
movb   $0x6f,-0x3f(%rbp)
movb   $0x76,-0x3e(%rbp)
movb   $0x65,-0x3d(%rbp)
movb   $0x63,-0x3c(%rbp)
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
cmp    $0x32,%rax
jae    11bd <main+0x6d>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    118a <main+0x3a>
lea    0xe3f(%rip),%rdi
mov    $0x32,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rax
add    $0x5,%rax
mov    0xe28(%rip),%rcx
mov    %rcx,(%rax)
lea    -0x40(%rbp),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    0xe14(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x40(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x63,%esi
call   1040 <strchr@plt>
mov    %rax,%rsi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x63,%esi
call   1040 <strchr@plt>
mov    %rax,%rsi
lea    -0x40(%rbp),%rax
sub    %rax,%rsi
lea    0xdaf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x30(%rsp)
movl   $0x65766f6c,(%rsp)
movb   $0x63,0x4(%rsp)
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1190 <main+0x40>
lea    0xe56(%rip),%r14
mov    $0x32,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movabs $0x636e7261656c20,%rax
mov    %rax,0x5(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
movabs $0x63796f6a6e6520,%rcx
mov    %rcx,(%rsp,%rax,1)
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
call   1060 <strchr@plt>
mov    %rax,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
call   1060 <strchr@plt>
sub    %rbx,%rax
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [8 x i8] c" learnc\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [8 x i8] c" enjoyc\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [50 x i8]* %2 to i8*
%5 = bitcast i8* %4 to [50 x i8]*
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i32 0, i32 0
store i8 108, i8* %6
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i32 0, i32 1
store i8 111, i8* %7
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i32 0, i32 2
store i8 118, i8* %8
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i32 0, i32 3
store i8 101, i8* %9
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i32 0, i32 4
store i8 99, i8* %10
store i32 0, i32* %3
br label %11
11: ; preds = %22, %0
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = icmp ult i64 %13, 50
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %15
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %11
25: ; preds = %11
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 50)
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%28 = getelementptr inbounds i8, i8* %27, i64 5
%29 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%32 = call i8* @strcat(i8* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%36 = call i8* @strchr(i8* %35, i32 99)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%39 = call i8* @strchr(i8* %38, i32 99)
%40 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%41 = ptrtoint i8* %39 to i64
%42 = ptrtoint i8* %40 to i64
%43 = sub i64 %41, %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %43)
%45 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%46 = call i64 @strlen(i8* %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %46)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
store i8 108, i8* %2
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 1
store i8 111, i8* %3
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 2
store i8 118, i8* %4
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 3
store i8 101, i8* %5
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 4
store i8 99, i8* %6
%7 = tail call i32 @putchar(i32 108)
br label %26
8: ; preds = %26
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 50)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 5
%11 = bitcast i8* %10 to i64*
store i64 27987460233718816, i64* %11
%12 = call i32 @puts(i8* %2)
%13 = call i64 @strlen(i8* %2)
%14 = getelementptr [50 x i8], [50 x i8]* %1, i64 0, i64 %13
%15 = bitcast i8* %14 to i64*
store i64 27999542128305440, i64* %15
%16 = call i32 @puts(i8* %2)
%17 = call i8* @strchr(i8* %2, i32 99)
%18 = call i32 @puts(i8* dereferenceable(1) %17)
%19 = call i8* @strchr(i8* %2, i32 99)
%20 = ptrtoint i8* %19 to i64
%21 = ptrtoint [50 x i8]* %1 to i64
%22 = sub i64 %20, %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %22)
%24 = call i64 @strlen(i8* %2)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %24)
ret i32 0
26: ; preds = %0, %26
%27 = phi i64 [ 1, %0 ], [ %32, %26 ]
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = tail call i32 @putchar(i32 %30)
%32 = add nuw nsw i64 %27, 1
%33 = icmp eq i64 %32, 50
br i1 %33, label %8, label %26
}