#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 = 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)
jle    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    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11ce <main+0xbe>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    119e <main+0x8e>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     114f <main+0x3f>
mov    %rsi,%r15
mov    %edi,%ebx
lea    0xed7(%rip),%r14
nopl   0x0(%rax)
lea    -0x1(%rbx),%r12
mov    %r12d,%eax
mov    (%r15,%rax,8),%rdx
mov    %r14,%rdi
mov    %r12d,%esi
call   1030 <printf@plt>
cmp    $0x2,%rbx
mov    %r12,%rbx
ja     1130 <main+0x20>
lea    0xed9(%rip),%rbx
lea    0xecc(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xead(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xe92(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xe73(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
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
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 sgt 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 ([12 x i8], [12 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 i32, i32* %8
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %6
br label %28
28: ; preds = %31, %24
%29 = load i32, i32* %6
%30 = icmp sge i32 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %28
%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 ([14 x i8], [14 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 %28
40: ; preds = %28
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"
@.str.5 = [14 x i8] c"state %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %11
6: ; preds = %11, %2
%7 = 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))
%8 = 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))
%9 = 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))
%10 = 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))
ret i32 0
11: ; preds = %4, %11
%12 = phi i64 [ %5, %4 ], [ %13, %11 ]
%13 = add nsw i64 %12, -1
%14 = trunc i64 %13 to i32
%15 = and i64 %13, 4294967295
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %17)
%19 = icmp ugt i64 %12, 2
br i1 %19, label %11, label %6
}