#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, char *);
int main(int argc, char *argv[]) {
  int i = (argc - 1);
  while (i >= 0) {
    printf("arg: %d: %s\n", i, argv[i]);
    i--;
  }
  char *states[] = {"California", "Oregon", "Washington", "Texas"};
  int num_states = 4;
  i = 0;
  while (i < num_states) {
    printf("state: %d: %s\n", i, states[i]);
    i++;
  };
  for (i = 0; i < argc; i++) {
    states[i] = argv[i];
  };
  char *newarray[4] = {};
  for (i = 0; i < num_states; i++) {
    printf("state: %d: %s\n", i, states[i]);
    newarray[i] = states[i];
  };
  for (i = 0; i < num_states; i++) {
    printf("newarray: %d: %s\n", i, newarray[i]);
  };
  states[1] = "I HAVE CHANGED!";
  for (i = 0; i < num_states; i++) {
    printf("newarray: %d: %s\n", i, newarray[i]);
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1172 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <main+0x1f>
mov    0x2c87(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c84(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c81(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c7e(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11de <main+0xbe>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ac <main+0x8c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1214 <main+0xf4>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e5 <main+0xc5>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    126f <main+0x14f>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x70(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122b <main+0x10b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    12a8 <main+0x188>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdx
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1276 <main+0x156>
lea    0xda2(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    12ec <main+0x1cc>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdx
lea    0xd66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ba <main+0x19a>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
mov    %edi,%r13d
test   %edi,%edi
jle    116d <main+0x4d>
lea    0xebe(%rip),%r12
mov    %r13,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x1(%rbx),%rbp
mov    %ebp,%eax
mov    (%r15,%rax,8),%rdx
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
cmp    $0x1,%rbx
mov    %rbp,%rbx
ja     1150 <main+0x30>
mov    %r13,0x8(%rsp)
movaps 0x2c97(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c7b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xe9f(%rip),%rbx
lea    0xe75(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xe6f(%rip),%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
call   1030 <printf@plt>
lea    0xe5f(%rip),%r12
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
lea    0xe53(%rip),%r13
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
call   1030 <printf@plt>
test   %r14d,%r14d
mov    %rbp,%r14
lea    0xe19(%rip),%rbp
jle    1220 <main+0x100>
mov    0x8(%rsp),%rdx
shl    $0x3,%rdx
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1040 <memcpy@plt>
mov    0x10(%rsp),%rbp
mov    0x18(%rsp),%r14
mov    0x20(%rsp),%r12
mov    0x28(%rsp),%r13
lea    0xe09(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
call   1030 <printf@plt>
lea    0xdd4(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"arg: %d: %s\0A\00"
@.str.1 = [11 x i8] c"California\00"
@.str.2 = [7 x i8] c"Oregon\00"
@.str.3 = [11 x i8] c"Washington\00"
@.str.4 = [6 x i8] c"Texas\00"
@__const.main.states = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [15 x i8] c"state: %d: %s\0A\00"
@.str.6 = [18 x i8] c"newarray: %d: %s\0A\00"
@.str.7 = [16 x i8] c"I HAVE CHANGED!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [4 x i8*]
%8 = alloca i32
%9 = alloca [4 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %6
br label %12
12: ; preds = %15, %2
%13 = load i32, i32* %6
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %6
%17 = load i8**, i8*** %5
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %21)
%23 = load i32, i32* %6
%24 = add nsw i32 %23, -1
store i32 %24, i32* %6
br label %12
25: ; preds = %12
%26 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
store i32 0, i32* %6
br label %27
27: ; preds = %31, %25
%28 = load i32, i32* %6
%29 = load i32, i32* %8
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %40
31: ; preds = %27
%32 = load i32, i32* %6
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %32, i8* %36)
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %27
40: ; preds = %27
store i32 0, i32* %6
br label %41
41: ; preds = %54, %40
%42 = load i32, i32* %6
%43 = load i32, i32* %4
%44 = icmp slt i32 %42, %43
br i1 %44, label %45, label %57
45: ; preds = %41
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = load i32, i32* %6
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %52
store i8* %50, i8** %53
br label %54
54: ; preds = %45
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %41
57: ; preds = %41
%58 = bitcast [4 x i8*]* %9 to i8*
store i32 0, i32* %6
br label %59
59: ; preds = %77, %57
%60 = load i32, i32* %6
%61 = load i32, i32* %8
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %80
63: ; preds = %59
%64 = load i32, i32* %6
%65 = load i32, i32* %6
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %66
%68 = load i8*, i8** %67
%69 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %64, i8* %68)
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %71
%73 = load i8*, i8** %72
%74 = load i32, i32* %6
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %75
store i8* %73, i8** %76
br label %77
77: ; preds = %63
%78 = load i32, i32* %6
%79 = add nsw i32 %78, 1
store i32 %79, i32* %6
br label %59
80: ; preds = %59
store i32 0, i32* %6
br label %81
81: ; preds = %92, %80
%82 = load i32, i32* %6
%83 = load i32, i32* %8
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %95
85: ; preds = %81
%86 = load i32, i32* %6
%87 = load i32, i32* %6
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %86, i8* %90)
br label %92
92: ; preds = %85
%93 = load i32, i32* %6
%94 = add nsw i32 %93, 1
store i32 %94, i32* %6
br label %81
95: ; preds = %81
%96 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8** %96
store i32 0, i32* %6
br label %97
97: ; preds = %108, %95
%98 = load i32, i32* %6
%99 = load i32, i32* %8
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %111
101: ; preds = %97
%102 = load i32, i32* %6
%103 = load i32, i32* %6
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [4 x i8*], [4 x i8*]* %9, i64 0, i64 %104
%106 = load i8*, i8** %105
%107 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %102, i8* %106)
br label %108
108: ; preds = %101
%109 = load i32, i32* %6
%110 = add nsw i32 %109, 1
store i32 %110, i32* %6
br label %97
111: ; preds = %97
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"arg: %d: %s\0A\00"
@.str.1 = [11 x i8] c"California\00"
@.str.2 = [7 x i8] c"Oregon\00"
@.str.3 = [11 x i8] c"Washington\00"
@.str.4 = [6 x i8] c"Texas\00"
@__const.main.states = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [15 x i8] c"state: %d: %s\0A\00"
@.str.6 = [18 x i8] c"newarray: %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = bitcast i8** %1 to i8*
%4 = alloca [4 x i8*]
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %7, %6 ], [ %10, %8 ]
%10 = add nsw i64 %9, -1
%11 = trunc i64 %10 to i32
%12 = and i64 %10, 4294967295
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %14)
%16 = icmp ugt i64 %9, 1
br i1 %16, label %8, label %17
17: ; preds = %8, %2
%18 = bitcast [4 x i8*]* %4 to i8*
%19 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%20 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br i1 %5, label %23, label %34
23: ; preds = %17
%24 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 1
%25 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 3
%26 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 2
%27 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
%28 = zext i32 %0 to i64
%29 = shl nuw nsw i64 %28, 3
%30 = load i8*, i8** %27
%31 = load i8*, i8** %24
%32 = load i8*, i8** %26
%33 = load i8*, i8** %25
br label %34
34: ; preds = %23, %17
%35 = phi i8* [ %33, %23 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %17 ]
%36 = phi i8* [ %32, %23 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %17 ]
%37 = phi i8* [ %31, %23 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %17 ]
%38 = phi i8* [ %30, %23 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %17 ]
%39 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 0, i8* %38)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* %37)
%41 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* %36)
%42 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* %35)
%43 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* %38)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 1, i8* %37)
%45 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 2, i8* %36)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 3, i8* %35)
%47 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* %38)
%48 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 1, i8* %37)
%49 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 2, i8* %36)
%50 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 3, i8* %35)
ret i32 0
}