#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(int argc, char **argv) {
  int a = 1;
  int b = 2;
  printf("a=%d, b=%d\n", a, b);
  {
    int z = (a);
    (a) = (b);
    (b) = z;
  };
  printf("a=%d, b=%d\n", a, b);
  char c1 = 'a';
  char c2 = 'b';
  printf("c1=%c, c2=%c\n", c1, c2);
  {
    char z = (c1);
    (c1) = (c2);
    (c2) = z;
  };
  printf("c1=%c, c2=%c\n", c1, c2);
  char *s1 = "abcd";
  char *s2 = "0123";
  printf("s1=%s, s2=%s\n", s1, s2);
  {
    char *z = (s1);
    (s1) = (s2);
    (s2) = z;
  };
  printf("s1=%s, s2=%s\n", s1, s2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x61,-0x1d(%rbp)
movb   $0x62,-0x1e(%rbp)
movsbl -0x1d(%rbp),%esi
movsbl -0x1e(%rbp),%edx
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1d(%rbp),%al
mov    %al,-0x1f(%rbp)
mov    -0x1e(%rbp),%al
mov    %al,-0x1d(%rbp)
mov    -0x1f(%rbp),%al
mov    %al,-0x1e(%rbp)
movsbl -0x1d(%rbp),%esi
movsbl -0x1e(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe66(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xee4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
mov    $0x62,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x62,%esi
mov    $0x61,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%r15
lea    0xe99(%rip),%r14
lea    0xe97(%rip),%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
@.str.1 = [14 x i8] c"c1=%c, c2=%c\0A\00"
@.str.2 = [5 x i8] c"abcd\00"
@.str.3 = [5 x i8] c"0123\00"
@.str.4 = [14 x i8] c"s1=%s, s2=%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1, i32* %5
store i32 2, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %15)
%17 = load i32, i32* %5
store i32 %17, i32* %7
%18 = load i32, i32* %6
store i32 %18, i32* %5
%19 = load i32, i32* %7
store i32 %19, i32* %6
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
store i8 97, i8* %8
store i8 98, i8* %9
%23 = load i8, i8* %8
%24 = sext i8 %23 to i32
%25 = load i8, i8* %9
%26 = sext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %24, i32 %26)
%28 = load i8, i8* %8
store i8 %28, i8* %10
%29 = load i8, i8* %9
store i8 %29, i8* %8
%30 = load i8, i8* %10
store i8 %30, i8* %9
%31 = load i8, i8* %8
%32 = sext i8 %31 to i32
%33 = load i8, i8* %9
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %32, i32 %34)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8** %12
%36 = load i8*, i8** %11
%37 = load i8*, i8** %12
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %36, i8* %37)
%39 = load i8*, i8** %11
store i8* %39, i8** %13
%40 = load i8*, i8** %12
store i8* %40, i8** %11
%41 = load i8*, i8** %13
store i8* %41, i8** %12
%42 = load i8*, i8** %11
%43 = load i8*, i8** %12
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %42, i8* %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, b=%d\0A\00"
@.str.1 = [14 x i8] c"c1=%c, c2=%c\0A\00"
@.str.2 = [5 x i8] c"abcd\00"
@.str.3 = [5 x i8] c"0123\00"
@.str.4 = [14 x i8] c"s1=%s, s2=%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 1, i32 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 97, i32 98)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 98, i32 97)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}