#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, ...);
int main(int argc, char *argv[]) {
  int i = 0;
  printf("Number of args : %d\n", argc);
  for (i = 1; i < argc; i++) {
    printf("arg %d: %s\n", i, argv[i]);
  }
  char *states[] = {"California", "oregon", "Washington", "Texas"};
  int num_states = 4;
  for (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    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    117c <main+0x6c>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <main+0x35>
mov    0x2c7d(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c7a(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c77(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c74(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x4,-0x44(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11ea <main+0xda>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdx
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b6 <main+0xa6>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xedc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x2,%ebx
jl     1169 <main+0x59>
mov    %ebx,%r12d
mov    $0x1,%ebx
lea    0xed4(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <main+0x40>
lea    0xed4(%rip),%rbx
lea    0xeaa(%rip),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe93(%rip),%rdx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe88(%rip),%rdx
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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