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

/* Variables and functions */
int /*<<< orphan*/ animalPrintGreeting(struct Animal *);
int /*<<< orphan*/ animalPrintMenu(struct Animal *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(struct Animal *);
scalar_t__ myfactory(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  struct Animal *p1 = (struct Animal *)myfactory("parrot", "Modrobradi");
  struct Animal *p2 = (struct Animal *)myfactory("tiger", "Straško");
  if (!p1 || !p2) {
    printf("Creation of plug-in objects failed.\n");
    exit(1);
  }
  printf("pozivanje member funkcija\n");
  animalPrintGreeting(p1);
  animalPrintGreeting(p2);
  animalPrintMenu(p1);
  animalPrintMenu(p2);
  free(p1);
  free(p2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1070 <myfactory@plt>
mov    %rax,-0x8(%rbp)
lea    0xe8c(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1070 <myfactory@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ac <main+0x4c>
cmpq   $0x0,-0x10(%rbp)
jne    11c2 <main+0x62>
lea    0xe6e(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <animalPrintGreeting@plt>
mov    -0x10(%rbp),%rdi
call   1060 <animalPrintGreeting@plt>
mov    -0x8(%rbp),%rdi
call   1040 <animalPrintMenu@plt>
mov    -0x10(%rbp),%rdi
call   1040 <animalPrintMenu@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe95(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1070 <myfactory@plt>
mov    %rax,%r14
lea    0xe91(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1070 <myfactory@plt>
test   %r14,%r14
je     11e0 <main+0x80>
mov    %rax,%rbx
test   %rax,%rax
je     11e0 <main+0x80>
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <animalPrintGreeting@plt>
mov    %rbx,%rdi
call   1060 <animalPrintGreeting@plt>
mov    %r14,%rdi
call   1050 <animalPrintMenu@plt>
mov    %rbx,%rdi
call   1050 <animalPrintMenu@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe3a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.Animal = type { i32 }
@.str = [7 x i8] c"parrot\00"
@.str.1 = [11 x i8] c"Modrobradi\00"
@.str.2 = [6 x i8] c"tiger\00"
@.str.3 = [9 x i8] c"Stra\C5\A1ko\00"
@.str.4 = [37 x i8] c"Creation of plug-in objects failed.\0A\00"
@.str.5 = [27 x i8] c"pozivanje member funkcija\0A\00"
define i32 @main() {
%1 = alloca %struct.Animal*
%2 = alloca %struct.Animal*
%3 = call i64 @myfactory(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = inttoptr i64 %3 to %struct.Animal*
store %struct.Animal* %4, %struct.Animal** %1
%5 = call i64 @myfactory(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%6 = inttoptr i64 %5 to %struct.Animal*
store %struct.Animal* %6, %struct.Animal** %2
%7 = load %struct.Animal*, %struct.Animal** %1
%8 = icmp ne %struct.Animal* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load %struct.Animal*, %struct.Animal** %2
%11 = icmp ne %struct.Animal* %10, null
br i1 %11, label %15, label %12
12: ; preds = %9, %0
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%17 = load %struct.Animal*, %struct.Animal** %1
%18 = call i32 @animalPrintGreeting(%struct.Animal* %17)
%19 = load %struct.Animal*, %struct.Animal** %2
%20 = call i32 @animalPrintGreeting(%struct.Animal* %19)
%21 = load %struct.Animal*, %struct.Animal** %1
%22 = call i32 @animalPrintMenu(%struct.Animal* %21)
%23 = load %struct.Animal*, %struct.Animal** %2
%24 = call i32 @animalPrintMenu(%struct.Animal* %23)
%25 = load %struct.Animal*, %struct.Animal** %1
%26 = call i32 @free(%struct.Animal* %25)
%27 = load %struct.Animal*, %struct.Animal** %2
%28 = call i32 @free(%struct.Animal* %27)
ret i32 0
}

LLVM IR (-O2):
%struct.Animal = type { i32 }
@.str = [7 x i8] c"parrot\00"
@.str.1 = [11 x i8] c"Modrobradi\00"
@.str.2 = [6 x i8] c"tiger\00"
@.str.3 = [9 x i8] c"Stra\C5\A1ko\00"
@str = [36 x i8] c"Creation of plug-in objects failed.\00"
@str.6 = [26 x i8] c"pozivanje member funkcija\00"
define i32 @main() {
%1 = tail call i64 @myfactory(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = inttoptr i64 %1 to %struct.Animal*
%3 = tail call i64 @myfactory(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%4 = inttoptr i64 %3 to %struct.Animal*
%5 = icmp ne i64 %1, 0
%6 = icmp ne i64 %3, 0
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.6, i64 0, i64 0))
%13 = tail call i32 @animalPrintGreeting(%struct.Animal* %2)
%14 = tail call i32 @animalPrintGreeting(%struct.Animal* %4)
%15 = tail call i32 @animalPrintMenu(%struct.Animal* %2)
%16 = tail call i32 @animalPrintMenu(%struct.Animal* %4)
%17 = tail call i32 @free(%struct.Animal* %2)
%18 = tail call i32 @free(%struct.Animal* %4)
ret i32 0
}