#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 ShoppingCart {
  int dummy;
};
struct CartItem {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addItemToCart(struct ShoppingCart *, struct CartItem *);
int containsItem(struct ShoppingCart *, struct CartItem *);
struct ShoppingCart *createCart(int);
struct CartItem *createItem(char *, double);
int /*<<< orphan*/ freeCart(struct ShoppingCart *);
int getNumItems(struct ShoppingCart *);
int getTotalPrice(struct ShoppingCart *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ removeItemFromCart(struct ShoppingCart *, struct CartItem *);
int main() {
  printf("Creating a shopping cart...\n");
  struct ShoppingCart *cart = createCart(2);
  printf("Shopping cart should be empty: ");
  if (getNumItems(cart) == 0)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("Total Price should be zero:");
  if (getTotalPrice(cart) == 0)
    printf("success.\n");
  else
    printf("FAIL.\n");
  struct CartItem *milk = createItem("milk", 3.00);
  struct CartItem *coffee = createItem("coffee", 10.00);
  addItemToCart(cart, milk);
  addItemToCart(cart, coffee);
  printf("Shopping cart should contain 'milk': ");
  if (containsItem(cart, milk) > -1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("Shopping cart should contain 'coffee': ");
  if (containsItem(cart, coffee) > -1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("There should be two items: ");
  if (getNumItems(cart) == 2)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("The total should be $13: ");
  if (getTotalPrice(cart) == 13)
    printf("success.\n");
  else
    printf("FAIL.\n");
  removeItemFromCart(cart, milk);
  printf("Shopping cart should not contain 'milk': ");
  if (containsItem(cart, milk) == -1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("Shopping cart should contain 'coffee': ");
  if (containsItem(cart, coffee) > -1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("Shopping cart only contain one item: ");
  if (getNumItems(cart) == 1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("The total should be $10: ");
  if (getTotalPrice(cart) == 10)
    printf("success.\n");
  else
    printf("FAIL.\n");
  addItemToCart(cart, milk);
  struct CartItem *avacado = createItem("avacado", 2.00);
  addItemToCart(cart, avacado);
  printf("Shopping cart should not contain 'avacado': ");
  if (containsItem(cart, avacado) > -1)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("Shopping cart should have two items: ");
  if (getNumItems(cart) == 2)
    printf("success.\n");
  else
    printf("FAIL.\n");
  printf("The total price should be $13: ");
  if (getTotalPrice(cart) == 13)
    printf("success.\n");
  else
    printf("FAIL.\n");
  freeCart(cart);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe72(%rip),%rdi
call   1050 <printf@plt>
mov    $0x2,%edi
call   1060 <createCart@plt>
mov    %rax,-0x10(%rbp)
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getNumItems@plt>
cmp    $0x0,%eax
jne    11e8 <main+0x58>
lea    0xe77(%rip),%rdi
call   1050 <printf@plt>
jmp    11f4 <main+0x64>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <getTotalPrice@plt>
cmp    $0x0,%eax
jne    1223 <main+0x93>
lea    0xe3c(%rip),%rdi
call   1050 <printf@plt>
jmp    122f <main+0x9f>
lea    0xe35(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4c(%rip),%rdi
movsd  0xdca(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,-0x18(%rbp)
lea    0xe39(%rip),%rdi
movsd  0xdaa(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <addItemToCart@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <addItemToCart@plt>
lea    0xe0e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <containsItem@plt>
cmp    $0xffffffff,%eax
jle    12ac <main+0x11c>
lea    0xdb3(%rip),%rdi
call   1050 <printf@plt>
jmp    12b8 <main+0x128>
lea    0xdac(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <containsItem@plt>
cmp    $0xffffffff,%eax
jle    12eb <main+0x15b>
lea    0xd74(%rip),%rdi
call   1050 <printf@plt>
jmp    12f7 <main+0x167>
lea    0xd6d(%rip),%rdi
call   1050 <printf@plt>
lea    0xdde(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getNumItems@plt>
cmp    $0x2,%eax
jne    1326 <main+0x196>
lea    0xd39(%rip),%rdi
call   1050 <printf@plt>
jmp    1332 <main+0x1a2>
lea    0xd32(%rip),%rdi
call   1050 <printf@plt>
lea    0xdbf(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <getTotalPrice@plt>
cmp    $0xd,%eax
jne    1361 <main+0x1d1>
lea    0xcfe(%rip),%rdi
call   1050 <printf@plt>
jmp    136d <main+0x1dd>
lea    0xcf7(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <removeItemFromCart@plt>
lea    0xd91(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <containsItem@plt>
cmp    $0xffffffff,%eax
jne    13ad <main+0x21d>
lea    0xcb2(%rip),%rdi
call   1050 <printf@plt>
jmp    13b9 <main+0x229>
lea    0xcab(%rip),%rdi
call   1050 <printf@plt>
lea    0xcf4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10a0 <containsItem@plt>
cmp    $0xffffffff,%eax
jle    13ec <main+0x25c>
lea    0xc73(%rip),%rdi
call   1050 <printf@plt>
jmp    13f8 <main+0x268>
lea    0xc6c(%rip),%rdi
call   1050 <printf@plt>
lea    0xd3d(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getNumItems@plt>
cmp    $0x1,%eax
jne    1427 <main+0x297>
lea    0xc38(%rip),%rdi
call   1050 <printf@plt>
jmp    1433 <main+0x2a3>
lea    0xc31(%rip),%rdi
call   1050 <printf@plt>
lea    0xd28(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <getTotalPrice@plt>
cmp    $0xa,%eax
jne    1462 <main+0x2d2>
lea    0xbfd(%rip),%rdi
call   1050 <printf@plt>
jmp    146e <main+0x2de>
lea    0xbf6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <addItemToCart@plt>
lea    0xcfa(%rip),%rdi
movsd  0xb86(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1090 <addItemToCart@plt>
lea    0xcdd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10a0 <containsItem@plt>
cmp    $0xffffffff,%eax
jle    14d3 <main+0x343>
lea    0xb8c(%rip),%rdi
call   1050 <printf@plt>
jmp    14df <main+0x34f>
lea    0xb85(%rip),%rdi
call   1050 <printf@plt>
lea    0xccb(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1070 <getNumItems@plt>
cmp    $0x2,%eax
jne    150e <main+0x37e>
lea    0xb51(%rip),%rdi
call   1050 <printf@plt>
jmp    151a <main+0x38a>
lea    0xb4a(%rip),%rdi
call   1050 <printf@plt>
lea    0xcb6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <getTotalPrice@plt>
cmp    $0xd,%eax
jne    1549 <main+0x3b9>
lea    0xb16(%rip),%rdi
call   1050 <printf@plt>
jmp    1555 <main+0x3c5>
lea    0xb0f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <freeCart@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0x1017(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%edi
call   1070 <createCart@plt>
mov    %rax,%rbp
lea    0xe4d(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1080 <getNumItems@plt>
test   %eax,%eax
lea    0x100a(%rip),%r13
lea    0xffd(%rip),%r14
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
lea    0xe3d(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   10c0 <getTotalPrice@plt>
test   %eax,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
movsd  0xddb(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,%r15
lea    0xe25(%rip),%rdi
movsd  0xdcc(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,%r12
mov    %rbp,%rdi
mov    %r15,%rsi
call   10a0 <addItemToCart@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10a0 <addItemToCart@plt>
lea    0xdff(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10b0 <containsItem@plt>
test   %eax,%eax
mov    %r14,%rdi
cmovns %r13,%rdi
call   1040 <puts@plt>
lea    0xe00(%rip),%rbx
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10b0 <containsItem@plt>
test   %eax,%eax
mov    %r14,%rdi
cmovns %r13,%rdi
call   1040 <puts@plt>
lea    0xe00(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1080 <getNumItems@plt>
cmp    $0x2,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   10c0 <getTotalPrice@plt>
cmp    $0xd,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1050 <removeItemFromCart@plt>
lea    0xde5(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10b0 <containsItem@plt>
cmp    $0xffffffff,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10b0 <containsItem@plt>
test   %eax,%eax
mov    %r14,%rdi
cmovns %r13,%rdi
call   1040 <puts@plt>
lea    0xdc8(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1080 <getNumItems@plt>
cmp    $0x1,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
lea    0xdcb(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   10c0 <getTotalPrice@plt>
cmp    $0xa,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   10a0 <addItemToCart@plt>
lea    0xdb7(%rip),%rdi
movsd  0xc71(%rip),%xmm0
call   1030 <createItem@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %rax,%rsi
call   10a0 <addItemToCart@plt>
lea    0xd9d(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10b0 <containsItem@plt>
test   %eax,%eax
mov    %r14,%rdi
cmovns %r13,%rdi
call   1040 <puts@plt>
lea    0xda5(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   1080 <getNumItems@plt>
cmp    $0x2,%eax
mov    %r14,%rdi
cmove  %r13,%rdi
call   1040 <puts@plt>
lea    0xda8(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%rdi
call   10c0 <getTotalPrice@plt>
cmp    $0xd,%eax
cmove  %r13,%r14
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1090 <freeCart@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ShoppingCart = type { i32 }
%struct.CartItem = type { i32 }
@.str = [29 x i8] c"Creating a shopping cart...\0A\00"
@.str.1 = [32 x i8] c"Shopping cart should be empty: \00"
@.str.2 = [10 x i8] c"success.\0A\00"
@.str.3 = [7 x i8] c"FAIL.\0A\00"
@.str.4 = [28 x i8] c"Total Price should be zero:\00"
@.str.5 = [5 x i8] c"milk\00"
@.str.6 = [7 x i8] c"coffee\00"
@.str.7 = [38 x i8] c"Shopping cart should contain 'milk': \00"
@.str.8 = [40 x i8] c"Shopping cart should contain 'coffee': \00"
@.str.9 = [28 x i8] c"There should be two items: \00"
@.str.10 = [26 x i8] c"The total should be $13: \00"
@.str.11 = [42 x i8] c"Shopping cart should not contain 'milk': \00"
@.str.12 = [38 x i8] c"Shopping cart only contain one item: \00"
@.str.13 = [26 x i8] c"The total should be $10: \00"
@.str.14 = [8 x i8] c"avacado\00"
@.str.15 = [45 x i8] c"Shopping cart should not contain 'avacado': \00"
@.str.16 = [38 x i8] c"Shopping cart should have two items: \00"
@.str.17 = [32 x i8] c"The total price should be $13: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.ShoppingCart*
%3 = alloca %struct.CartItem*
%4 = alloca %struct.CartItem*
%5 = alloca %struct.CartItem*
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call %struct.ShoppingCart* @createCart(i32 2)
store %struct.ShoppingCart* %7, %struct.ShoppingCart** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%9 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%10 = call i32 @getNumItems(%struct.ShoppingCart* %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%18 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%19 = call i32 @getTotalPrice(%struct.ShoppingCart* %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %25
23: ; preds = %16
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
%26 = call %struct.CartItem* @createItem(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double 3.000000e+00)
store %struct.CartItem* %26, %struct.CartItem** %3
%27 = call %struct.CartItem* @createItem(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double 1.000000e+01)
store %struct.CartItem* %27, %struct.CartItem** %4
%28 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%29 = load %struct.CartItem*, %struct.CartItem** %3
%30 = call i32 @addItemToCart(%struct.ShoppingCart* %28, %struct.CartItem* %29)
%31 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%32 = load %struct.CartItem*, %struct.CartItem** %4
%33 = call i32 @addItemToCart(%struct.ShoppingCart* %31, %struct.CartItem* %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%35 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%36 = load %struct.CartItem*, %struct.CartItem** %3
%37 = call i32 @containsItem(%struct.ShoppingCart* %35, %struct.CartItem* %36)
%38 = icmp sgt i32 %37, -1
br i1 %38, label %39, label %41
39: ; preds = %25
%40 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %43
41: ; preds = %25
%42 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
%44 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%45 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%46 = load %struct.CartItem*, %struct.CartItem** %4
%47 = call i32 @containsItem(%struct.ShoppingCart* %45, %struct.CartItem* %46)
%48 = icmp sgt i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %53
51: ; preds = %43
%52 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %53
53: ; preds = %51, %49
%54 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%55 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%56 = call i32 @getNumItems(%struct.ShoppingCart* %55)
%57 = icmp eq i32 %56, 2
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %62
60: ; preds = %53
%61 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %62
62: ; preds = %60, %58
%63 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%64 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%65 = call i32 @getTotalPrice(%struct.ShoppingCart* %64)
%66 = icmp eq i32 %65, 13
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %71
69: ; preds = %62
%70 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %71
71: ; preds = %69, %67
%72 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%73 = load %struct.CartItem*, %struct.CartItem** %3
%74 = call i32 @removeItemFromCart(%struct.ShoppingCart* %72, %struct.CartItem* %73)
%75 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%76 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%77 = load %struct.CartItem*, %struct.CartItem** %3
%78 = call i32 @containsItem(%struct.ShoppingCart* %76, %struct.CartItem* %77)
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %82
80: ; preds = %71
%81 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %84
82: ; preds = %71
%83 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %82, %80
%85 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%86 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%87 = load %struct.CartItem*, %struct.CartItem** %4
%88 = call i32 @containsItem(%struct.ShoppingCart* %86, %struct.CartItem* %87)
%89 = icmp sgt i32 %88, -1
br i1 %89, label %90, label %92
90: ; preds = %84
%91 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %94
92: ; preds = %84
%93 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %94
94: ; preds = %92, %90
%95 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
%96 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%97 = call i32 @getNumItems(%struct.ShoppingCart* %96)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %101
99: ; preds = %94
%100 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %103
101: ; preds = %94
%102 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %103
103: ; preds = %101, %99
%104 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%105 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%106 = call i32 @getTotalPrice(%struct.ShoppingCart* %105)
%107 = icmp eq i32 %106, 10
br i1 %107, label %108, label %110
108: ; preds = %103
%109 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %112
110: ; preds = %103
%111 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %112
112: ; preds = %110, %108
%113 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%114 = load %struct.CartItem*, %struct.CartItem** %3
%115 = call i32 @addItemToCart(%struct.ShoppingCart* %113, %struct.CartItem* %114)
%116 = call %struct.CartItem* @createItem(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double 2.000000e+00)
store %struct.CartItem* %116, %struct.CartItem** %5
%117 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%118 = load %struct.CartItem*, %struct.CartItem** %5
%119 = call i32 @addItemToCart(%struct.ShoppingCart* %117, %struct.CartItem* %118)
%120 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%121 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%122 = load %struct.CartItem*, %struct.CartItem** %5
%123 = call i32 @containsItem(%struct.ShoppingCart* %121, %struct.CartItem* %122)
%124 = icmp sgt i32 %123, -1
br i1 %124, label %125, label %127
125: ; preds = %112
%126 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %129
127: ; preds = %112
%128 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %129
129: ; preds = %127, %125
%130 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.16, i64 0, i64 0))
%131 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%132 = call i32 @getNumItems(%struct.ShoppingCart* %131)
%133 = icmp eq i32 %132, 2
br i1 %133, label %134, label %136
134: ; preds = %129
%135 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %138
136: ; preds = %129
%137 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %138
138: ; preds = %136, %134
%139 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
%140 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%141 = call i32 @getTotalPrice(%struct.ShoppingCart* %140)
%142 = icmp eq i32 %141, 13
br i1 %142, label %143, label %145
143: ; preds = %138
%144 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %147
145: ; preds = %138
%146 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %147
147: ; preds = %145, %143
%148 = load %struct.ShoppingCart*, %struct.ShoppingCart** %2
%149 = call i32 @freeCart(%struct.ShoppingCart* %148)
ret i32 0
}

LLVM IR (-O2):
%struct.ShoppingCart = type { i32 }
%struct.CartItem = type { i32 }
@.str.1 = [32 x i8] c"Shopping cart should be empty: \00"
@.str.4 = [28 x i8] c"Total Price should be zero:\00"
@.str.5 = [5 x i8] c"milk\00"
@.str.6 = [7 x i8] c"coffee\00"
@.str.7 = [38 x i8] c"Shopping cart should contain 'milk': \00"
@.str.8 = [40 x i8] c"Shopping cart should contain 'coffee': \00"
@.str.9 = [28 x i8] c"There should be two items: \00"
@.str.10 = [26 x i8] c"The total should be $13: \00"
@.str.11 = [42 x i8] c"Shopping cart should not contain 'milk': \00"
@.str.12 = [38 x i8] c"Shopping cart only contain one item: \00"
@.str.13 = [26 x i8] c"The total should be $10: \00"
@.str.14 = [8 x i8] c"avacado\00"
@.str.15 = [45 x i8] c"Shopping cart should not contain 'avacado': \00"
@.str.16 = [38 x i8] c"Shopping cart should have two items: \00"
@.str.17 = [32 x i8] c"The total price should be $13: \00"
@str = [28 x i8] c"Creating a shopping cart...\00"
@str.30 = [6 x i8] c"FAIL.\00"
@str.43 = [9 x i8] c"success.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call %struct.ShoppingCart* @createCart(i32 2)
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @getNumItems(%struct.ShoppingCart* %2)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%9 = tail call i32 @getTotalPrice(%struct.ShoppingCart* %2)
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
%13 = tail call %struct.CartItem* @createItem(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), double 3.000000e+00)
%14 = tail call %struct.CartItem* @createItem(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), double 1.000000e+01)
%15 = tail call i32 @addItemToCart(%struct.ShoppingCart* %2, %struct.CartItem* %13)
%16 = tail call i32 @addItemToCart(%struct.ShoppingCart* %2, %struct.CartItem* %14)
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%18 = tail call i32 @containsItem(%struct.ShoppingCart* %2, %struct.CartItem* %13)
%19 = icmp sgt i32 %18, -1
%20 = select i1 %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%21 = tail call i32 @puts(i8* dereferenceable(1) %20)
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%23 = tail call i32 @containsItem(%struct.ShoppingCart* %2, %struct.CartItem* %14)
%24 = icmp sgt i32 %23, -1
%25 = select i1 %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%26 = tail call i32 @puts(i8* dereferenceable(1) %25)
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%28 = tail call i32 @getNumItems(%struct.ShoppingCart* %2)
%29 = icmp eq i32 %28, 2
%30 = select i1 %29, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%31 = tail call i32 @puts(i8* dereferenceable(1) %30)
%32 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
%33 = tail call i32 @getTotalPrice(%struct.ShoppingCart* %2)
%34 = icmp eq i32 %33, 13
%35 = select i1 %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%36 = tail call i32 @puts(i8* dereferenceable(1) %35)
%37 = tail call i32 @removeItemFromCart(%struct.ShoppingCart* %2, %struct.CartItem* %13)
%38 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.11, i64 0, i64 0))
%39 = tail call i32 @containsItem(%struct.ShoppingCart* %2, %struct.CartItem* %13)
%40 = icmp eq i32 %39, -1
%41 = select i1 %40, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%42 = tail call i32 @puts(i8* dereferenceable(1) %41)
%43 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%44 = tail call i32 @containsItem(%struct.ShoppingCart* %2, %struct.CartItem* %14)
%45 = icmp sgt i32 %44, -1
%46 = select i1 %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%47 = tail call i32 @puts(i8* dereferenceable(1) %46)
%48 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0))
%49 = tail call i32 @getNumItems(%struct.ShoppingCart* %2)
%50 = icmp eq i32 %49, 1
%51 = select i1 %50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%52 = tail call i32 @puts(i8* dereferenceable(1) %51)
%53 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%54 = tail call i32 @getTotalPrice(%struct.ShoppingCart* %2)
%55 = icmp eq i32 %54, 10
%56 = select i1 %55, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%57 = tail call i32 @puts(i8* dereferenceable(1) %56)
%58 = tail call i32 @addItemToCart(%struct.ShoppingCart* %2, %struct.CartItem* %13)
%59 = tail call %struct.CartItem* @createItem(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), double 2.000000e+00)
%60 = tail call i32 @addItemToCart(%struct.ShoppingCart* %2, %struct.CartItem* %59)
%61 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%62 = tail call i32 @containsItem(%struct.ShoppingCart* %2, %struct.CartItem* %59)
%63 = icmp sgt i32 %62, -1
%64 = select i1 %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%65 = tail call i32 @puts(i8* dereferenceable(1) %64)
%66 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.16, i64 0, i64 0))
%67 = tail call i32 @getNumItems(%struct.ShoppingCart* %2)
%68 = icmp eq i32 %67, 2
%69 = select i1 %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%70 = tail call i32 @puts(i8* dereferenceable(1) %69)
%71 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.17, i64 0, i64 0))
%72 = tail call i32 @getTotalPrice(%struct.ShoppingCart* %2)
%73 = icmp eq i32 %72, 13
%74 = select i1 %73, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.43, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.30, i64 0, i64 0)
%75 = tail call i32 @puts(i8* dereferenceable(1) %74)
%76 = tail call i32 @freeCart(%struct.ShoppingCart* %2)
ret i32 0
}