#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 */
typedef int /*<<< orphan*/ states;

/* 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 = (int)(sizeof(states) / sizeof(char *));
  states[0] = argv[1];
  states[1] = argv[2];
  i = 1;
  while (i < argc && i <= num_states) {
    states[i - 1] = argv[i];
    i++;
  }
  i = num_states - 1;
  while (i >= 0) {
    printf("state %d: %s\n", i, states[i]);
    i--;
  }
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x45(%rbp)
jge    11d1 <main+0xc1>
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
setle  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    11e1 <main+0xd1>
jmp    1208 <main+0xf8>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %rcx,-0x40(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b4 <main+0xa4>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1241 <main+0x131>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1211 <main+0x101>
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    $0x28,%rsp
mov    %rsi,%r13
mov    %edi,%r12d
test   %edi,%edi
jle    116e <main+0x4e>
mov    %r12d,%ebp
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%rbp),%rbx
mov    %ebx,%eax
mov    0x0(%r13,%rax,8),%rdx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
cmp    $0x1,%rbp
mov    %rbx,%rbp
ja     1150 <main+0x30>
movaps 0x2c9b(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2c7f(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x8(%r13),%r14
mov    %r14,(%rsp)
mov    0x10(%r13),%r15
mov    %r15,0x8(%rsp)
cmp    $0x2,%r12d
jl     11d8 <main+0xb8>
add    $0x8,%r13
add    $0xfffffffe,%r12d
cmp    $0x3,%r12d
mov    $0x3,%eax
cmovb  %r12d,%eax
lea    0x8(,%rax,8),%edx
mov    %rsp,%rdi
mov    %r13,%rsi
call   1040 <memcpy@plt>
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rbx
mov    (%rsp),%r14
mov    0x8(%rsp),%r15
jmp    11e6 <main+0xc6>
lea    0xe49(%rip),%rdx
lea    0xe37(%rip),%rbx
lea    0xe41(%rip),%rbp
mov    %rbp,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x2,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %r15,%rdx
call   1030 <printf@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %6
br label %11
11: ; preds = %14, %2
%12 = load i32, i32* %6
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %11
%15 = load i32, i32* %6
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %20)
%22 = load i32, i32* %6
%23 = add nsw i32 %22, -1
store i32 %23, i32* %6
br label %11
24: ; preds = %11
%25 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
store i8* %28, i8** %29
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 1
store i8* %32, i8** %33
store i32 1, i32* %6
br label %34
34: ; preds = %44, %24
%35 = load i32, i32* %6
%36 = load i32, i32* %4
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load i32, i32* %6
%40 = load i32, i32* %8
%41 = icmp sle i32 %39, %40
br label %42
42: ; preds = %38, %34
%43 = phi i1 [ false, %34 ], [ %41, %38 ]
br i1 %43, label %44, label %56
44: ; preds = %42
%45 = load i8**, i8*** %5
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %45, i64 %47
%49 = load i8*, i8** %48
%50 = load i32, i32* %6
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %52
store i8* %49, i8** %53
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %34
56: ; preds = %42
%57 = load i32, i32* %8
%58 = sub nsw i32 %57, 1
store i32 %58, i32* %6
br label %59
59: ; preds = %62, %56
%60 = load i32, i32* %6
%61 = icmp sge i32 %60, 0
br i1 %61, label %62, label %71
62: ; preds = %59
%63 = load i32, i32* %6
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %65
%67 = load i8*, i8** %66
%68 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %63, i8* %67)
%69 = load i32, i32* %6
%70 = add nsw i32 %69, -1
store i32 %70, i32* %6
br label %59
71: ; preds = %59
ret i32 0
}

LLVM IR (-O2):
@.str = [11 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 = alloca [4 x i8*]
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ %6, %5 ], [ %9, %7 ]
%9 = add nsw i64 %8, -1
%10 = trunc i64 %9 to i32
%11 = and i64 %9, 4294967295
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %13)
%15 = icmp ugt i64 %8, 1
br i1 %15, label %7, label %16
16: ; preds = %7, %2
%17 = bitcast [4 x i8*]* %3 to i8*
%18 = getelementptr i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
store i8* %19, i8** %20
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
store i8* %22, i8** %23
%24 = icmp sgt i32 %0, 1
br i1 %24, label %25, label %38
25: ; preds = %16
%26 = bitcast i8** %18 to i8*
%27 = add nsw i32 %0, -2
%28 = call i32 @llvm.umin.i32(i32 %27, i32 3)
%29 = shl nuw nsw i32 %28, 3
%30 = add nuw nsw i32 %29, 8
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
%33 = load i8*, i8** %32
%34 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
%35 = load i8*, i8** %34
%36 = load i8*, i8** %23
%37 = load i8*, i8** %20
br label %38
38: ; preds = %25, %16
%39 = phi i8* [ %37, %25 ], [ %19, %16 ]
%40 = phi i8* [ %36, %25 ], [ %22, %16 ]
%41 = phi i8* [ %35, %25 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), %16 ]
%42 = phi i8* [ %33, %25 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), %16 ]
%43 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 3, i8* %42)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 2, i8* %41)
%45 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* %40)
%46 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 0, i8* %39)
ret i32 0
}