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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2cd3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2ccd(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x34(%rbp)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a1 <main+0x91>
mov    -0x38(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    116c <main+0x5c>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jg     11da <main+0xca>
mov    -0x3c(%rbp),%esi
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11a8 <main+0x98>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeed(%rip),%rax
mov    %rax,0x8(%rsi)
cmp    $0x2,%edi
jl     1177 <main+0x67>
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xeea(%rip),%rdi
lea    0xed1(%rip),%rdx
mov    $0x1,%esi
call   1030 <printf@plt>
cmp    $0x2,%ebp
je     1177 <main+0x67>
mov    %ebp,%ebx
mov    $0x2,%ebp
lea    0xec6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rdx
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <main+0x50>
lea    0xeab(%rip),%rbx
lea    0xe7b(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xe75(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xe68(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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"
@__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* null]
@.str.3 = [12 x i8] c"arg %d: %s\0A\00"
@.str.4 = [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 [4 x i8*]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [4 x i8*]* %6 to i8*
store i32 4, i32* %7
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 1
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* %12, i8** %14
store i32 1, i32* %8
br label %15
15: ; preds = %27, %2
%16 = load i32, i32* %8
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32, i32* %8
%21 = load i8**, i8*** %5
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %20, i8* %25)
br label %27
27: ; preds = %19
%28 = load i32, i32* %8
%29 = add nsw i32 %28, 1
store i32 %29, i32* %8
br label %15
30: ; preds = %15
store i32 0, i32* %9
br label %31
31: ; preds = %42, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %7
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %45
35: ; preds = %31
%36 = load i32, i32* %9
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [4 x i8*], [4 x i8*]* %6, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %36, i8* %40)
br label %42
42: ; preds = %35
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %31
45: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.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 = [12 x i8] c"arg %d: %s\0A\00"
@.str.4 = [14 x i8] c"state %d: %s\0A\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 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = zext i32 %0 to i64
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %0, 2
br i1 %8, label %9, label %15
9: ; preds = %15, %5, %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 3, i8* null)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 4, i8* undef)
ret i32 0
15: ; preds = %5, %15
%16 = phi i64 [ %21, %15 ], [ 2, %5 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = trunc i64 %16 to i32
%20 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %19, i8* %18)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %6
br i1 %22, label %9, label %15
}