#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 count(struct node *);
int /*<<< orphan*/ display(struct node *);
int /*<<< orphan*/ insert(struct node **, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int count1, count2;
  struct node *head1 = NULL;
  struct node *head2 = NULL;
  insert(&head1, 5);
  insert(&head1, 10);
  insert(&head1, 15);
  insert(&head2, 2);
  insert(&head2, 4);
  insert(&head2, 8);
  insert(&head2, 8);
  display(head1);
  display(head2);
  count1 = count(head1);
  count2 = count(head2);
  printf("Number of elements in list 1 is %d\n", count1);
  printf("Number of elements in list 2 is %d\n", count2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
mov    $0x5,%esi
call   1060 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1060 <insert@plt>
lea    -0x18(%rbp),%rdi
mov    $0xf,%esi
call   1060 <insert@plt>
lea    -0x20(%rbp),%rdi
mov    $0x2,%esi
call   1060 <insert@plt>
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1060 <insert@plt>
lea    -0x20(%rbp),%rdi
mov    $0x8,%esi
call   1060 <insert@plt>
lea    -0x20(%rbp),%rdi
mov    $0x8,%esi
call   1060 <insert@plt>
mov    -0x18(%rbp),%rdi
call   1040 <display@plt>
mov    -0x20(%rbp),%rdi
call   1040 <display@plt>
mov    -0x18(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,-0x8(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <count@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe0b(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe20(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1060 <insert@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1060 <insert@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1060 <insert@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <insert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <insert@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1060 <insert@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1060 <insert@plt>
mov    0x10(%rsp),%rdi
call   1040 <display@plt>
mov    0x8(%rsp),%rdi
call   1040 <display@plt>
mov    0x10(%rsp),%rdi
call   1030 <count@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%rdi
call   1030 <count@plt>
mov    %eax,%ebp
lea    0xe10(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
lea    0xe26(%rip),%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [36 x i8] c"Number of elements in list 1 is %d\0A\00"
@.str.1 = [36 x i8] c"Number of elements in list 2 is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.node*
%5 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %4
store %struct.node* null, %struct.node** %5
%6 = call i32 @insert(%struct.node** %4, i32 5)
%7 = call i32 @insert(%struct.node** %4, i32 10)
%8 = call i32 @insert(%struct.node** %4, i32 15)
%9 = call i32 @insert(%struct.node** %5, i32 2)
%10 = call i32 @insert(%struct.node** %5, i32 4)
%11 = call i32 @insert(%struct.node** %5, i32 8)
%12 = call i32 @insert(%struct.node** %5, i32 8)
%13 = load %struct.node*, %struct.node** %4
%14 = call i32 @display(%struct.node* %13)
%15 = load %struct.node*, %struct.node** %5
%16 = call i32 @display(%struct.node* %15)
%17 = load %struct.node*, %struct.node** %4
%18 = call i32 @count(%struct.node* %17)
store i32 %18, i32* %2
%19 = load %struct.node*, %struct.node** %5
%20 = call i32 @count(%struct.node* %19)
store i32 %20, i32* %3
%21 = load i32, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [36 x i8] c"Number of elements in list 1 is %d\0A\00"
@.str.1 = [36 x i8] c"Number of elements in list 2 is %d\0A\00"
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 2)
%9 = call i32 @insert(%struct.node** %2, i32 4)
%10 = call i32 @insert(%struct.node** %2, i32 8)
%11 = call i32 @insert(%struct.node** %2, i32 8)
%12 = load %struct.node*, %struct.node** %1
%13 = call i32 @display(%struct.node* %12)
%14 = load %struct.node*, %struct.node** %2
%15 = call i32 @display(%struct.node* %14)
%16 = load %struct.node*, %struct.node** %1
%17 = call i32 @count(%struct.node* %16)
%18 = load %struct.node*, %struct.node** %2
%19 = call i32 @count(%struct.node* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %17)
%21 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 %19)
ret i32 0
}