#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;
  int y = 0;
  while (y < num_states) {
    printf("state %d: %s\n", y, states[y]);
    y++;
  }
  int copies = 0;
  while (copies < argc) {
    if (copies == 3) {
      break;
    }
    states[copies] = argv[copies];
    copies++;
  }
  int r = 0;
  while (r < num_states) {
    printf("state %d: %s\n", r, states[r]);
    r++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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     1162 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <main+0x1f>
mov    0x2c97(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c94(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c91(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c8e(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11ce <main+0xbe>
mov    -0x48(%rbp),%esi
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    119c <main+0x8c>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1213 <main+0x103>
cmpl   $0x3,-0x4c(%rbp)
jne    11f0 <main+0xe0>
jmp    1213 <main+0x103>
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x4c(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    11d5 <main+0xc5>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    124c <main+0x13c>
mov    -0x50(%rbp),%esi
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xdf6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    121a <main+0x10a>
xor    %eax,%eax
add    $0x50,%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
test   %edi,%edi
jle    116d <main+0x4d>
mov    %r14d,%ebx
lea    0xebe(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
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>
movaps 0x2c9c(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2c80(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xea3(%rip),%rbp
lea    0xe79(%rip),%rdx
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xe73(%rip),%rdx
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %rdx,0x8(%rsp)
call   1030 <printf@plt>
lea    0xe61(%rip),%r12
mov    $0x2,%ebx
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
lea    0xe50(%rip),%r13
mov    %rbp,%rdi
mov    $0x3,%esi
mov    %r13,%rdx
call   1030 <printf@plt>
lea    0xe1c(%rip),%rdx
test   %r14d,%r14d
jle    122e <main+0x10e>
add    $0xffffffff,%r14d
cmp    $0x2,%r14d
cmovb  %r14d,%ebx
lea    0x8(,%rbx,8),%edx
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1040 <memcpy@plt>
mov    0x10(%rsp),%rdx
mov    0x18(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    0x20(%rsp),%r12
mov    0x28(%rsp),%r13
lea    0xdfa(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    0x8(%rsp),%rdx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %r12,%rdx
call   1030 <printf@plt>
mov    %rbp,%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 = [12 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 = [14 x i8] c"state %d: %s\0A\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 i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %6
br label %14
14: ; preds = %17, %2
%15 = load i32, i32* %6
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %6
%19 = load i8**, i8*** %5
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %18, i8* %23)
%25 = load i32, i32* %6
%26 = add nsw i32 %25, -1
store i32 %26, i32* %6
br label %14
27: ; preds = %14
%28 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
store i32 0, i32* %9
br label %29
29: ; preds = %33, %27
%30 = load i32, i32* %9
%31 = load i32, i32* %8
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i32, i32* %9
%35 = load i32, i32* %9
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %34, i8* %38)
%40 = load i32, i32* %9
%41 = add nsw i32 %40, 1
store i32 %41, i32* %9
br label %29
42: ; preds = %29
store i32 0, i32* %10
br label %43
43: ; preds = %51, %42
%44 = load i32, i32* %10
%45 = load i32, i32* %4
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %62
47: ; preds = %43
%48 = load i32, i32* %10
%49 = icmp eq i32 %48, 3
br i1 %49, label %50, label %51
50: ; preds = %47
br label %62
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = load i32, i32* %10
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %52, i64 %54
%56 = load i8*, i8** %55
%57 = load i32, i32* %10
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %58
store i8* %56, i8** %59
%60 = load i32, i32* %10
%61 = add nsw i32 %60, 1
store i32 %61, i32* %10
br label %43
62: ; preds = %50, %43
store i32 0, i32* %11
br label %63
63: ; preds = %67, %62
%64 = load i32, i32* %11
%65 = load i32, i32* %8
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %76
67: ; preds = %63
%68 = load i32, i32* %11
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %68, i8* %72)
%74 = load i32, i32* %11
%75 = add nsw i32 %74, 1
store i32 %75, i32* %11
br label %63
76: ; preds = %63
ret i32 0
}

LLVM IR (-O2):
@.str = [12 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 = [14 x i8] c"state %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 ([12 x i8], [12 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 ([14 x i8], [14 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 ([14 x i8], [14 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 ([14 x i8], [14 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 ([14 x i8], [14 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))
%23 = icmp slt i32 %0, 1
br i1 %23, label %38, label %24
24: ; preds = %17
%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 1
%28 = getelementptr inbounds [4 x i8*], [4 x i8*]* %4, i64 0, i64 0
%29 = add nsw i32 %0, -1
%30 = call i32 @llvm.umin.i32(i32 %29, i32 2)
%31 = shl nuw nsw i32 %30, 3
%32 = add nuw nsw i32 %31, 8
%33 = zext i32 %32 to i64
%34 = load i8*, i8** %28
%35 = load i8*, i8** %27
%36 = load i8*, i8** %26
%37 = load i8*, i8** %25
br label %38
38: ; preds = %24, %17
%39 = phi i8* [ %37, %24 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %17 ]
%40 = phi i8* [ %36, %24 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %17 ]
%41 = phi i8* [ %35, %24 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %17 ]
%42 = phi i8* [ %34, %24 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %17 ]
%43 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 0, i8* %42)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* %41)
%45 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* %40)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* %39)
ret i32 0
}