#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 *, char *, char *);
int /*<<< orphan*/ swap(char **, char **, int);
int main() {
  double a = 5.01, b = 10.11;
  char *s1 = "abcde\0";
  char *s2 = "bdeft\0";
  printf("%s %s\n", s1, s2);
  swap(&s1, &s2, 1);
  printf("%s %s\n", s1, s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xec0(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1040 <swap@plt>
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
mov    %rsi,0x8(%rsp)
lea    0xecf(%rip),%rdx
mov    %rdx,(%rsp)
lea    0xecb(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x1,%edx
call   1040 <swap@plt>
mov    0x8(%rsp),%rsi
mov    (%rsp),%rdx
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"abcde\00\00"
@.str.1 = [7 x i8] c"bdeft\00\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8*
store i32 0, i32* %1
store double 5.010000e+00, double* %2
store double 1.011000e+01, double* %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7)
%9 = call i32 @swap(i8** %4, i8** %5, i32 1)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %10, i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"abcde\00\00"
@.str.1 = [7 x i8] c"bdeft\00\00"
@.str.2 = [7 x i8] c"%s %s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = bitcast i8** %2 to i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @swap(i8** %1, i8** %2, i32 1)
%7 = load i8*, i8** %1
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %8)
ret i32 0
}