#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*/ assert(int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ swap(char **, int /*<<< orphan*/, int);
int main(int argc, char *argv[]) {
  char *s1 = "one";
  char *s2 = "two";
  char *s3 = "three";
  char *s[] = {s1, s2, s3};
  swap(s, 0, 2);
  assert(!strcmp(s[0], "three"));
  assert(!strcmp(s[2], "one"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xeb3(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1050 <swap@plt>
mov    -0x40(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x30(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%r14
mov    %r14,(%rsp)
lea    0xebb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeb3(%rip),%rbx
mov    %rbx,0x10(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1050 <swap@plt>
mov    (%rsp),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"one\00"
@.str.1 = [4 x i8] c"two\00"
@.str.2 = [6 x i8] c"three\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca [3 x i8*]
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %7
%9 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
%10 = load i8*, i8** %5
store i8* %10, i8** %9
%11 = getelementptr inbounds i8*, i8** %9, i64 1
%12 = load i8*, i8** %6
store i8* %12, i8** %11
%13 = getelementptr inbounds i8*, i8** %11, i64 1
%14 = load i8*, i8** %7
store i8* %14, i8** %13
%15 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
%16 = call i32 @swap(i8** %15, i32 0, i32 2)
%17 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
%28 = xor i1 %27, true
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"one\00"
@.str.1 = [4 x i8] c"two\00"
@.str.2 = [6 x i8] c"three\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8*]
%4 = bitcast [3 x i8*]* %3 to i8*
%5 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [3 x i8*], [3 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = call i32 @swap(i8** %5, i32 0, i32 2)
%9 = load i8*, i8** %5
%10 = call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i8*, i8** %7
%15 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
ret i32 0
}