#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 strlen(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  char buf[] = "algjdlksajgldksjg";
  int i = 0;
  int n = strlen(buf);
  char *p = NULL;
  for (i = 0; i < n; i++) {
    printf("%c", buf[i]);
  }
  printf("\n");
  p = buf;
  for (i = 0; i < n; i++) {
    printf("%c", p[i]);
  }
  printf("\n");
  for (i = 0; i < n; i++) {
    printf("%c", *(p + i));
  }
  printf("\n");
  for (i = 0; i < n; i++) {
    printf("%c", *(buf + i));
  }
  printf("\n");
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb4(%rip),%ax
mov    %ax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    11b3 <main+0x83>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1182 <main+0x52>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1204 <main+0xd4>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d0 <main+0xa0>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    124d <main+0x11d>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1219 <main+0xe9>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1293 <main+0x163>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%esi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1262 <main+0x132>
lea    0xd7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd61(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x67,0x10(%rsp)
mov    %rsp,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1214 <main+0xe4>
mov    %eax,%r14d
mov    %eax,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    121e <main+0xee>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11a0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1228 <main+0xf8>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11d0 <main+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   %r14d,%r14d
jle    1232 <main+0x102>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1200 <main+0xd0>
jmp    1232 <main+0x102>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc5(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.buf = [18 x i8] c"algjdlksajgldksjg\00"
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 0, i32* %1
%6 = bitcast [18 x i8]* %2 to i8*
store i32 0, i32* %3
%7 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %4
store i8* null, i8** %5
store i32 0, i32* %3
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %13
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %9
23: ; preds = %9
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
store i8* %25, i8** %5
store i32 0, i32* %3
br label %26
26: ; preds = %38, %23
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = load i8*, i8** %5
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %30
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %26
41: ; preds = %26
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %43
43: ; preds = %55, %41
%44 = load i32, i32* %3
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %58
47: ; preds = %43
%48 = load i8*, i8** %5
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %47
%56 = load i32, i32* %3
%57 = add nsw i32 %56, 1
store i32 %57, i32* %3
br label %43
58: ; preds = %43
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %60
60: ; preds = %72, %58
%61 = load i32, i32* %3
%62 = load i32, i32* %4
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %75
64: ; preds = %60
%65 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%66 = load i32, i32* %3
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %70)
br label %72
72: ; preds = %64
%73 = load i32, i32* %3
%74 = add nsw i32 %73, 1
store i32 %74, i32* %3
br label %60
75: ; preds = %60
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%78 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.buf = [18 x i8] c"algjdlksajgldksjg\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [18 x i8]
%2 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @putchar(i32 10)
br label %29
7: ; preds = %0
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %15, %9 ]
%11 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = call i32 @putchar(i32 %13)
%15 = add nuw nsw i64 %10, 1
%16 = icmp eq i64 %15, %8
br i1 %16, label %17, label %9
17: ; preds = %9
%18 = call i32 @putchar(i32 10)
br i1 %4, label %19, label %29
19: ; preds = %17
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %27, %21 ]
%23 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 @putchar(i32 %25)
%27 = add nuw nsw i64 %22, 1
%28 = icmp eq i64 %27, %20
br i1 %28, label %31, label %21
29: ; preds = %5, %17
%30 = call i32 @putchar(i32 10)
br label %43
31: ; preds = %21
%32 = call i32 @putchar(i32 10)
br i1 %4, label %33, label %43
33: ; preds = %31
%34 = zext i32 %3 to i64
br label %35
35: ; preds = %33, %35
%36 = phi i64 [ 0, %33 ], [ %41, %35 ]
%37 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = call i32 @putchar(i32 %39)
%41 = add nuw nsw i64 %36, 1
%42 = icmp eq i64 %41, %34
br i1 %42, label %45, label %35
43: ; preds = %29, %31
%44 = call i32 @putchar(i32 10)
br label %57
45: ; preds = %35
%46 = call i32 @putchar(i32 10)
br i1 %4, label %47, label %57
47: ; preds = %45
%48 = zext i32 %3 to i64
br label %49
49: ; preds = %47, %49
%50 = phi i64 [ 0, %47 ], [ %55, %49 ]
%51 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = call i32 @putchar(i32 %53)
%55 = add nuw nsw i64 %50, 1
%56 = icmp eq i64 %55, %48
br i1 %56, label %57, label %49
57: ; preds = %49, %43, %45
%58 = call i32 @putchar(i32 10)
%59 = call i32 @putchar(i32 10)
%60 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}