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

/* Variables and functions */
int /*<<< orphan*/ display(struct node *);
int /*<<< orphan*/ insert(struct node **, int);
struct node *intersection(struct node *, struct node *);
int main(void) {
  struct node *head1 = NULL;
  struct node *head2 = NULL;
  struct node *head3 = NULL;
  int count1, count2, count;
  insert(&head1, 5);
  insert(&head1, 10);
  insert(&head1, 15);
  insert(&head2, 6);
  insert(&head2, 10);
  insert(&head2, 15);
  insert(&head2, 25);
  head3 = intersection(head1, head2);
  display(head1);
  display(head2);
  display(head3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x5,%esi
call   1050 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
lea    -0x10(%rbp),%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0x6,%esi
call   1050 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0x19,%esi
call   1050 <insert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <intersection@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <display@plt>
mov    -0x18(%rbp),%rdi
call   1030 <display@plt>
mov    -0x20(%rbp),%rdi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1050 <insert@plt>
mov    0x8(%rsp),%rdi
mov    (%rsp),%rsi
call   1040 <intersection@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1030 <display@plt>
mov    (%rsp),%rdi
call   1030 <display@plt>
mov    %rbx,%rdi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca %struct.node*
%2 = alloca %struct.node*
%3 = bitcast %struct.node** %1 to i8*
store %struct.node* null, %struct.node** %1
%4 = bitcast %struct.node** %2 to i8*
store %struct.node* null, %struct.node** %2
%5 = call i32 @insert(%struct.node** %1, i32 5)
%6 = call i32 @insert(%struct.node** %1, i32 10)
%7 = call i32 @insert(%struct.node** %1, i32 15)
%8 = call i32 @insert(%struct.node** %2, i32 6)
%9 = call i32 @insert(%struct.node** %2, i32 10)
%10 = call i32 @insert(%struct.node** %2, i32 15)
%11 = call i32 @insert(%struct.node** %2, i32 25)
%12 = load %struct.node*, %struct.node** %1
%13 = load %struct.node*, %struct.node** %2
%14 = call %struct.node* @intersection(%struct.node* %12, %struct.node* %13)
%15 = load %struct.node*, %struct.node** %1
%16 = call i32 @display(%struct.node* %15)
%17 = load %struct.node*, %struct.node** %2
%18 = call i32 @display(%struct.node* %17)
%19 = call i32 @display(%struct.node* %14)
ret i32 0
}