#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*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ swap(char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i;
  for (i = 0; i < argc; i++) {
    swap(argv[i], strlen(argv[i]));
    fprintf(stdout, "%d %s\n", i, argv[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b7 <main+0x87>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1050 <swap@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1190 <main+0x60>
mov    %rsi,%r14
mov    %edi,%r13d
xor    %ebx,%ebx
mov    0x2e92(%rip),%rbp
lea    0xeab(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
call   1050 <swap@plt>
mov    0x0(%rbp),%edi
mov    (%r14,%rbx,8),%rcx
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [7 x i8] c"%d %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %32, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %35
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%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 @strlen(i8* %21)
%23 = call i32 @swap(i8* %16, i32 %22)
%24 = load i32, i32* @stdout
%25 = load i32, i32* %6
%26 = load i8**, i8*** %5
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %25, i8* %30)
br label %32
32: ; preds = %11
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %7
35: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"%d %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %16, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @strlen(i8* %9)
%11 = tail call i32 @swap(i8* %9, i32 %10)
%12 = load i32, i32* @stdout
%13 = load i8*, i8** %8
%14 = trunc i64 %7 to i32
%15 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %13)
%16 = add nuw nsw i64 %7, 1
%17 = icmp eq i64 %16, %5
br i1 %17, label %18, label %6
18: ; preds = %6, %2
ret i32 0
}