#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;
  char *temp;
  temp = argv[1];
  argv[1] = states[0];
  states[0] = temp;
  printf("nombre del programa: %s\n", argv[0]);
  printf("numero de argumentos: %d\n", argc - 1);
  for (i = 1; i < argc; i++) {
    printf("argumento %d: %s\n", i, argv[i]);
  }
  for (i = 0; i < num_states; i++) {
    printf("Estado %d: %s\n", i, states[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)
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    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x50(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e7 <main+0xd7>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0xa0>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1222 <main+0x112>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ee <main+0xde>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%r15d
mov    (%rsi),%rsi
mov    0x8(%r12),%r14
lea    0xed2(%rip),%rax
mov    %rax,0x8(%r12)
lea    0xee9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    -0x1(%r15),%esi
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%r15d
jl     1189 <main+0x79>
mov    %r15d,%r13d
mov    $0x1,%ebx
lea    0xeee(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <main+0x60>
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe65(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe56(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4b(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
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 = [25 x i8] c"nombre del programa: %s\0A\00"
@.str.5 = [26 x i8] c"numero de argumentos: %d\0A\00"
@.str.6 = [18 x i8] c"argumento %d: %s\0A\00"
@.str.7 = [15 x i8] c"Estado %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
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%10 = bitcast [4 x i8*]* %7 to i8*
store i32 4, i32* %8
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %9
%14 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
store i8* %15, i8** %17
%18 = load i8*, i8** %9
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 0
store i8* %18, i8** %19
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %25)
store i32 1, i32* %6
br label %27
27: ; preds = %39, %2
%28 = load i32, i32* %6
%29 = load i32, i32* %4
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %42
31: ; preds = %27
%32 = load i32, i32* %6
%33 = load i8**, i8*** %5
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %32, i8* %37)
br label %39
39: ; preds = %31
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %27
42: ; preds = %27
store i32 0, i32* %6
br label %43
43: ; preds = %54, %42
%44 = load i32, i32* %6
%45 = load i32, i32* %8
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %57
47: ; preds = %43
%48 = load i32, i32* %6
%49 = load i32, i32* %6
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [4 x i8*], [4 x i8*]* %7, i64 0, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %48, i8* %52)
br label %54
54: ; preds = %47
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %43
57: ; preds = %43
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 = [6 x i8] c"Texas\00"
@.str.4 = [25 x i8] c"nombre del programa: %s\0A\00"
@.str.5 = [26 x i8] c"numero de argumentos: %d\0A\00"
@.str.6 = [18 x i8] c"argumento %d: %s\0A\00"
@.str.7 = [15 x i8] c"Estado %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %5)
%7 = add nsw i32 %0, -1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %7)
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = zext i32 %0 to i64
br label %17
12: ; preds = %17, %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* %4)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
17: ; preds = %10, %17
%18 = phi i64 [ 1, %10 ], [ %23, %17 ]
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = trunc i64 %18 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %21, i8* %20)
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, %11
br i1 %24, label %12, label %17
}