#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 person {
  int dummy;
};

/* Variables and functions */
struct person *create_person();
int /*<<< orphan*/ die(struct person *);
int /*<<< orphan*/ divorce(struct person *);
int /*<<< orphan*/ marry(struct person *, struct person *);
int main() {
  struct person *alice = create_person();
  struct person *bob = create_person();
  struct person *eve = 0;
  marry(alice, bob);
  eve = create_person();
  divorce(bob);
  marry(bob, eve);
  die(alice);
  die(bob);
  die(eve);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <create_person@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <create_person@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <marry@plt>
mov    $0x0,%al
call   1060 <create_person@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <divorce@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <marry@plt>
mov    -0x10(%rbp),%rdi
call   1050 <die@plt>
mov    -0x18(%rbp),%rdi
call   1050 <die@plt>
mov    -0x20(%rbp),%rdi
call   1050 <die@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <create_person@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1060 <create_person@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <marry@plt>
xor    %eax,%eax
call   1060 <create_person@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1030 <divorce@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <marry@plt>
mov    %r14,%rdi
call   1050 <die@plt>
mov    %rbx,%rdi
call   1050 <die@plt>
mov    %r15,%rdi
call   1050 <die@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.person = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.person*
%3 = alloca %struct.person*
%4 = alloca %struct.person*
store i32 0, i32* %1
%5 = call %struct.person* (...) @create_person()
store %struct.person* %5, %struct.person** %2
%6 = call %struct.person* (...) @create_person()
store %struct.person* %6, %struct.person** %3
store %struct.person* null, %struct.person** %4
%7 = load %struct.person*, %struct.person** %2
%8 = load %struct.person*, %struct.person** %3
%9 = call i32 @marry(%struct.person* %7, %struct.person* %8)
%10 = call %struct.person* (...) @create_person()
store %struct.person* %10, %struct.person** %4
%11 = load %struct.person*, %struct.person** %3
%12 = call i32 @divorce(%struct.person* %11)
%13 = load %struct.person*, %struct.person** %3
%14 = load %struct.person*, %struct.person** %4
%15 = call i32 @marry(%struct.person* %13, %struct.person* %14)
%16 = load %struct.person*, %struct.person** %2
%17 = call i32 @die(%struct.person* %16)
%18 = load %struct.person*, %struct.person** %3
%19 = call i32 @die(%struct.person* %18)
%20 = load %struct.person*, %struct.person** %4
%21 = call i32 @die(%struct.person* %20)
ret i32 0
}

LLVM IR (-O2):
%struct.person = type { i32 }
define i32 @main() {
%1 = tail call %struct.person* (...) @create_person()
%2 = tail call %struct.person* (...) @create_person()
%3 = tail call i32 @marry(%struct.person* %1, %struct.person* %2)
%4 = tail call %struct.person* (...) @create_person()
%5 = tail call i32 @divorce(%struct.person* %2)
%6 = tail call i32 @marry(%struct.person* %2, %struct.person* %4)
%7 = tail call i32 @die(%struct.person* %1)
%8 = tail call i32 @die(%struct.person* %2)
%9 = tail call i32 @die(%struct.person* %4)
ret i32 0
}