#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 /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  int i;
  char *states[] = {"California", "Texas", "Oregon", "Washington"};
  int num_states = 4;
  puts("Print arguments:");
  i = argc - 1;
  while (i >= 0) {
    printf("arg %d: %s.\n", i, argv[i]);
    i -= 1;
  }
  puts("Print states:");
  i = num_states - 1;
  while (i >= 0) {
    printf("state %d: %s.\n", i, states[i]);
    i -= 1;
  }
  i = 0;
  while (i < num_states || i < argc) {
    states[i] = argv[i];
    i += 1;
  }
  puts("Print copied arguments:");
  i = 0;
  while (i < num_states) {
    printf("state %d: %s.\n", i, states[i]);
    i += 1;
  }
  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    0x2cc3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2cc0(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2cbd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cba(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11b1 <main+0x91>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117e <main+0x5e>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11f6 <main+0xd6>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe6c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0xa6>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%al
cmp    -0x44(%rbp),%ecx
mov    %al,-0x45(%rbp)
jl     121a <main+0xfa>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    122a <main+0x10a>
jmp    124d <main+0x12d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x14(%rbp),%rax
mov    %rcx,-0x40(%rbp,%rax,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fd <main+0xdd>
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1292 <main+0x172>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xdd0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1260 <main+0x140>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r12
mov    %edi,%r14d
movaps 0x2cd7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cbb(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    118d <main+0x6d>
mov    %r14d,%ebp
lea    0xed0(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x1(%rbp),%rbx
mov    %ebx,%eax
mov    (%r12,%rax,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmp    $0x1,%rbp
mov    %rbx,%rbp
ja     1170 <main+0x50>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xeaf(%rip),%r15
lea    0xe71(%rip),%rdx
mov    %r15,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
lea    0xe56(%rip),%rdx
mov    %r15,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
lea    0xe3c(%rip),%rdx
mov    %r15,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
lea    0xe1d(%rip),%rdx
xor    %ebp,%ebp
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
movslq %r14d,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rcx
mov    (%r12,%rbp,8),%rdx
mov    %rdx,(%rsp,%rbp,8)
add    $0x1,%rbp
cmp    $0x3,%rcx
jb     1200 <main+0xe0>
cmp    %rax,%rbp
jl     1200 <main+0xe0>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
mov    (%rsp),%rdx
lea    0xe1e(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <printf@plt>
mov    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1040 <printf@plt>
mov    0x10(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <printf@plt>
mov    0x18(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"California\00"
@.str.1 = [6 x i8] c"Texas\00"
@.str.2 = [7 x i8] c"Oregon\00"
@.str.3 = [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 ([6 x i8], [6 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)]
@.str.4 = [17 x i8] c"Print arguments:\00"
@.str.5 = [13 x i8] c"arg %d: %s.\0A\00"
@.str.6 = [14 x i8] c"Print states:\00"
@.str.7 = [15 x i8] c"state %d: %s.\0A\00"
@.str.8 = [24 x i8] c"Print copied arguments:\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 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
%10 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %6
br label %13
13: ; preds = %16, %2
%14 = load i32, i32* %6
%15 = icmp sge i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %6
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %17, i8* %22)
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 1
store i32 %25, i32* %6
br label %13
26: ; preds = %13
%27 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%28 = load i32, i32* %8
%29 = sub nsw i32 %28, 1
store i32 %29, i32* %6
br label %30
30: ; preds = %33, %26
%31 = load i32, i32* %6
%32 = icmp sge i32 %31, 0
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %6
%35 = load i32, i32* %6
%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 ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %34, i8* %38)
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %6
br label %30
42: ; preds = %30
store i32 0, i32* %6
br label %43
43: ; preds = %53, %42
%44 = load i32, i32* %6
%45 = load i32, i32* %8
%46 = icmp slt i32 %44, %45
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i32, i32* %6
%49 = load i32, i32* %4
%50 = icmp slt i32 %48, %49
br label %51
51: ; preds = %47, %43
%52 = phi i1 [ true, %43 ], [ %50, %47 ]
br i1 %52, label %53, label %64
53: ; preds = %51
%54 = load i8**, i8*** %5
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %60
store i8* %58, i8** %61
%62 = load i32, i32* %6
%63 = add nsw i32 %62, 1
store i32 %63, i32* %6
br label %43
64: ; preds = %51
%65 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %6
br label %66
66: ; preds = %70, %64
%67 = load i32, i32* %6
%68 = load i32, i32* %8
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %79
70: ; preds = %66
%71 = load i32, i32* %6
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %73
%75 = load i8*, i8** %74
%76 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %71, i8* %75)
%77 = load i32, i32* %6
%78 = add nsw i32 %77, 1
store i32 %78, i32* %6
br label %66
79: ; preds = %66
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"California\00"
@.str.1 = [6 x i8] c"Texas\00"
@.str.2 = [7 x i8] c"Oregon\00"
@.str.3 = [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 ([6 x i8], [6 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)]
@.str.4 = [17 x i8] c"Print arguments:\00"
@.str.5 = [13 x i8] c"arg %d: %s.\0A\00"
@.str.6 = [14 x i8] c"Print states:\00"
@.str.7 = [15 x i8] c"state %d: %s.\0A\00"
@.str.8 = [24 x i8] c"Print copied arguments:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4 x i8*]
%4 = bitcast [4 x i8*]* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %11, %9 ]
%11 = add nsw i64 %10, -1
%12 = trunc i64 %11 to i32
%13 = and i64 %11, 4294967295
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %12, i8* %15)
%17 = icmp ugt i64 %10, 1
br i1 %17, label %9, label %18
18: ; preds = %9, %2
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
%20 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%21 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%22 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = sext i32 %0 to i64
br label %25
25: ; preds = %18, %25
%26 = phi i64 [ 0, %18 ], [ %30, %25 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %26
%28 = load i8*, i8** %27
%29 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %26
store i8* %28, i8** %29
%30 = add nuw nsw i64 %26, 1
%31 = icmp ult i64 %26, 3
%32 = icmp slt i64 %30, %24
%33 = or i1 %31, %32
br i1 %33, label %25, label %34
34: ; preds = %25
%35 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
%36 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
%37 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0))
%40 = load i8*, i8** %35
%41 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* %40)
%42 = load i8*, i8** %36
%43 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* %42)
%44 = load i8*, i8** %37
%45 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* %44)
%46 = load i8*, i8** %38
%47 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* %46)
ret i32 0
}