#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 */
struct Counter {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ dispose(struct Counter *);
int get(struct Counter *);
int /*<<< orphan*/ increment(struct Counter *);
struct Counter *init(int);
int /*<<< orphan*/ swap(struct Counter *, struct Counter *);
int main() {
  struct Counter *c1 = init(0);
  struct Counter *c2 = init(5);
  increment(c1);
  swap(c1, c2);
  int tmp = get(c2);
  assert(tmp == 1);
  dispose(c1);
  dispose(c2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <init@plt>
mov    %rax,-0x10(%rbp)
mov    $0x5,%edi
call   1060 <init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <increment@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <swap@plt>
mov    -0x18(%rbp),%rdi
call   1070 <get@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <dispose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <dispose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <init@plt>
mov    %rax,%r14
mov    $0x5,%edi
call   1060 <init@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <increment@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <swap@plt>
mov    %rbx,%rdi
call   1070 <get@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1030 <dispose@plt>
mov    %rbx,%rdi
call   1030 <dispose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Counter = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.Counter*
%3 = alloca %struct.Counter*
%4 = alloca i32
store i32 0, i32* %1
%5 = call %struct.Counter* @init(i32 0)
store %struct.Counter* %5, %struct.Counter** %2
%6 = call %struct.Counter* @init(i32 5)
store %struct.Counter* %6, %struct.Counter** %3
%7 = load %struct.Counter*, %struct.Counter** %2
%8 = call i32 @increment(%struct.Counter* %7)
%9 = load %struct.Counter*, %struct.Counter** %2
%10 = load %struct.Counter*, %struct.Counter** %3
%11 = call i32 @swap(%struct.Counter* %9, %struct.Counter* %10)
%12 = load %struct.Counter*, %struct.Counter** %3
%13 = call i32 @get(%struct.Counter* %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load %struct.Counter*, %struct.Counter** %2
%19 = call i32 @dispose(%struct.Counter* %18)
%20 = load %struct.Counter*, %struct.Counter** %3
%21 = call i32 @dispose(%struct.Counter* %20)
ret i32 0
}

LLVM IR (-O2):
%struct.Counter = type { i32 }
define i32 @main() {
%1 = tail call %struct.Counter* @init(i32 0)
%2 = tail call %struct.Counter* @init(i32 5)
%3 = tail call i32 @increment(%struct.Counter* %1)
%4 = tail call i32 @swap(%struct.Counter* %1, %struct.Counter* %2)
%5 = tail call i32 @get(%struct.Counter* %2)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @dispose(%struct.Counter* %1)
%10 = tail call i32 @dispose(%struct.Counter* %2)
ret i32 0
}