#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(void) {
  int ix, iy;
  double dx, dy;
  char *px, *py;
  ix = 42;
  iy = 69;
  printf("integers before swap: %d and %d\n", ix, iy);
  do {
    int safeixiy;
    safeixiy = ix;
    ix = iy;
    iy = safeixiy;
  } while (0);
  printf("integers after swap: %d and %d\n", ix, iy);
  dx = 123.0;
  dy = 321.0;
  printf("doubles before swap: %g and %g\n", dx, dy);
  do {
    double safedxdy;
    safedxdy = dx;
    dx = dy;
    dy = safedxdy;
  } while (0);
  printf("integers after swap: %g and %g\n", dx, dy);
  px = "hello";
  py = "world";
  printf("pointers before swap: %s and %s\n", px, py);
  do {
    char *safepxpy;
    safepxpy = px;
    px = py;
    py = safepxpy;
  } while (0);
  printf("integers after swap: %s and %s\n", px, py);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2a,-0x8(%rbp)
movl   $0x45,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xebf(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xea9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xef5(%rip),%rdi
mov    $0x2a,%esi
mov    $0x45,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x45,%esi
mov    $0x2a,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
movsd  0xead(%rip),%xmm0
movsd  0xead(%rip),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
movsd  0xe97(%rip),%xmm0
movsd  0xe87(%rip),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
lea    0xf03(%rip),%r14
lea    0xf02(%rip),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"integers before swap: %d and %d\0A\00"
@.str.1 = [32 x i8] c"integers after swap: %d and %d\0A\00"
@.str.2 = [32 x i8] c"doubles before swap: %g and %g\0A\00"
@.str.3 = [32 x i8] c"integers after swap: %g and %g\0A\00"
@.str.4 = [6 x i8] c"hello\00"
@.str.5 = [6 x i8] c"world\00"
@.str.6 = [33 x i8] c"pointers before swap: %s and %s\0A\00"
@.str.7 = [32 x i8] c"integers after swap: %s and %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca double
%10 = alloca i8*
store i32 0, i32* %1
store i32 42, i32* %2
store i32 69, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
br label %14
14: ; preds = %0
%15 = load i32, i32* %2
store i32 %15, i32* %8
%16 = load i32, i32* %3
store i32 %16, i32* %2
%17 = load i32, i32* %8
store i32 %17, i32* %3
br label %18
18: ; preds = %14
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20)
store double 1.230000e+02, double* %4
store double 3.210000e+02, double* %5
%22 = load double, double* %4
%23 = load double, double* %5
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double %22, double %23)
br label %25
25: ; preds = %18
%26 = load double, double* %4
store double %26, double* %9
%27 = load double, double* %5
store double %27, double* %4
%28 = load double, double* %9
store double %28, double* %5
br label %29
29: ; preds = %25
%30 = load double, double* %4
%31 = load double, double* %5
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), double %30, double %31)
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8** %7
%33 = load i8*, i8** %6
%34 = load i8*, i8** %7
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %33, i8* %34)
br label %36
36: ; preds = %29
%37 = load i8*, i8** %6
store i8* %37, i8** %10
%38 = load i8*, i8** %7
store i8* %38, i8** %6
%39 = load i8*, i8** %10
store i8* %39, i8** %7
br label %40
40: ; preds = %36
%41 = load i8*, i8** %6
%42 = load i8*, i8** %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %41, i8* %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"integers before swap: %d and %d\0A\00"
@.str.1 = [32 x i8] c"integers after swap: %d and %d\0A\00"
@.str.2 = [32 x i8] c"doubles before swap: %g and %g\0A\00"
@.str.3 = [32 x i8] c"integers after swap: %g and %g\0A\00"
@.str.4 = [6 x i8] c"hello\00"
@.str.5 = [6 x i8] c"world\00"
@.str.6 = [33 x i8] c"pointers before swap: %s and %s\0A\00"
@.str.7 = [32 x i8] c"integers after swap: %s and %s\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 42, i32 69)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 69, i32 42)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), double 1.230000e+02, double 3.210000e+02)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), double 3.210000e+02, double 1.230000e+02)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}