#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 main(int argc, char *argv[]) {
  int i = 0;
  char *states[] = {"California", "Oregon", "Washington", "Texas"};
  int num_states = 4;
  argv[1] = states[1];
  states[2] = argv[2];
  if (argc == 1) {
    printf("no args\n");
  } else {
    for (i = 1; i < argc; i++) {
      printf("arg %d: %s\n", i, argv[i]);
    }
  }
  for (i = 0; i < num_states; i++) {
    printf("state %d: %s\n", i, states[i]);
  }
  printf("%s\n", NULL);
  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)
movl   $0x0,-0x14(%rbp)
mov    0x2ccc(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cc9(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cc6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc3(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1195 <main+0x85>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d8 <main+0xc8>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d3 <main+0xc3>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119c <main+0x8c>
jmp    11d8 <main+0xc8>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1213 <main+0x103>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11df <main+0xcf>
lea    0xe28(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xedc(%rip),%rax
mov    %rax,0x8(%rsi)
mov    0x10(%rsi),%r14
cmp    $0x1,%edi
jne    114a <main+0x2a>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
jmp    1199 <main+0x79>
jle    1199 <main+0x79>
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec0(%rip),%rdi
lea    0xeac(%rip),%rdx
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebp
je     1199 <main+0x79>
mov    %ebp,%r12d
mov    $0x2,%ebp
lea    0xe99(%rip),%r15
nop
mov    (%rbx,%rbp,8),%rdx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1180 <main+0x60>
lea    0xe84(%rip),%rbx
lea    0xe59(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe51(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe30(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"California\00"
@.str.1 = [7 x i8] c"Oregon\00"
@.str.2 = [11 x i8] c"Washington\00"
@.str.3 = [6 x i8] c"Texas\00"
@__const.main.states = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [9 x i8] c"no args\0A\00"
@.str.5 = [12 x i8] c"arg %d: %s\0A\00"
@.str.6 = [14 x i8] c"state %d: %s\0A\00"
@.str.7 = [4 x i8] c"%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
store i32 0, i32* %6
%9 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 1
%11 = load i8*, i8** %10
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
store i8* %11, i8** %13
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 2
store i8* %16, i8** %17
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %39
22: ; preds = %2
store i32 1, i32* %6
br label %23
23: ; preds = %35, %22
%24 = load i32, i32* %6
%25 = load i32, i32* %4
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %38
27: ; preds = %23
%28 = load i32, i32* %6
%29 = load i8**, i8*** %5
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %28, i8* %33)
br label %35
35: ; preds = %27
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %23
38: ; preds = %23
br label %39
39: ; preds = %38, %20
store i32 0, i32* %6
br label %40
40: ; preds = %51, %39
%41 = load i32, i32* %6
%42 = load i32, i32* %8
%43 = icmp slt i32 %41, %42
br i1 %43, label %44, label %54
44: ; preds = %40
%45 = load i32, i32* %6
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %45, i8* %49)
br label %51
51: ; preds = %44
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %40
54: ; preds = %40
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"California\00"
@.str.1 = [7 x i8] c"Oregon\00"
@.str.3 = [6 x i8] c"Texas\00"
@.str.5 = [12 x i8] c"arg %d: %s\0A\00"
@.str.6 = [14 x i8] c"state %d: %s\0A\00"
@str = [8 x i8] c"no args\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds i8*, i8** %1, i64 2
%5 = load i8*, i8** %4
%6 = icmp eq i32 %0, 1
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %23
9: ; preds = %7
%10 = zext i32 %0 to i64
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %0, 2
br i1 %12, label %23, label %15
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %23
15: ; preds = %9, %15
%16 = phi i64 [ %21, %15 ], [ 2, %9 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = trunc i64 %16 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %19, i8* %18)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %10
br i1 %22, label %23, label %15
23: ; preds = %15, %9, %7, %13
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 2, i8* %5)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%28 = tail call i32 @puts(i8* dereferenceable(1) null)
ret i32 0
}