// File: bastelfreak[P]erp-system/articlesearch.cpp
// Function: ArtikelSuche(TArticle*)
void ArtikelSuche (TArticle MeineArtikel[])
{
  //TArtikel MeineArtikel[1000];

	int Auswahl1 = 0;
	int ArtikelNummer = 0;
  std::string ArtikelName = "";
	double ArtikelPreis = 0.0;

	//cout << " Bitte w�hlen Sie das Atribut, wonach Sie suchen m�chten " <<endl;
  std::cout << " Please choose an Atribute which you want to search  " << std::endl;
  std::cout << " 1 for Articel Number" << std::endl;
  std::cout << " 2 for Articel Name" << std::endl;
  std::cout << " 3 for Articel Price" << std::endl;

  std::cin >> Auswahl1;

	switch (Auswahl1)
	{
	case 1: ArtikelNummer = ArtikelNummerSuche();
		break;

	case 2: ArtikelName = ArtikelNameSuche ();
		break;

	case 3: ArtikelPreis = ArtikelPreisSuche();
		break;


	default:
    std::cout << "Error, please try again!" << std::endl;
	}


	for (int i=0; i<=1000;i++)
	{ 
		if ((MeineArtikel[i].id == ArtikelNummer && ArtikelNummer != 0) || (MeineArtikel[i].name == ArtikelName && ArtikelName != "") || (MeineArtikel[i].price == ArtikelPreis  && ArtikelPreis != 0))
		{
      std::cout << "Article Number: " << MeineArtikel[i].id << std::endl;
      std::cout << "Article Name:   " <<MeineArtikel[i].name << std::endl;
      std::cout << "Article Price:  " << MeineArtikel[i].price << "Euro" << std::endl;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x2320
movq -0x80(%rbp), %rdx
leaq 0x1d2b(%rip), %rsi      # 0x4310
leaq -0x30(%rbp), %rdi
callq 0x2b30
jmp 0x25f0
leaq -0x31(%rbp), %rdi
callq 0x21d0
movq $0x0, -0x50(%rbp)
movq 0x39c0(%rip), %rdi      # 0x5fc8
leaq 0x19f5(%rip), %rsi      # 0x4004
callq 0x21a0
movq %rax, -0x88(%rbp)
jmp 0x261d
movq -0x88(%rbp), %rdi
movq 0x398d(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x2632
movq 0x398f(%rip), %rdi      # 0x5fc8
leaq 0x19fa(%rip), %rsi      # 0x403a
callq 0x21a0
movq %rax, -0x90(%rbp)
jmp 0x264e
movq -0x90(%rbp), %rdi
movq 0x395c(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x2663
movq 0x395e(%rip), %rdi      # 0x5fc8
leaq 0x19df(%rip), %rsi      # 0x4050
callq 0x21a0
movq %rax, -0x98(%rbp)
jmp 0x267f
movq -0x98(%rbp), %rdi
movq 0x392b(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x2694
movq 0x392d(%rip), %rdi      # 0x5fc8
leaq 0x19c2(%rip), %rsi      # 0x4064
callq 0x21a0
movq %rax, -0xa0(%rbp)
jmp 0x26b0
movq -0xa0(%rbp), %rdi
movq 0x38fa(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x26c5
movq 0x390c(%rip), %rdi      # 0x5fd8
leaq -0xc(%rbp), %rsi
callq 0x20d0
jmp 0x26d7
movl -0xc(%rbp), %eax
movl %eax, -0xa4(%rbp)
subl $0x1, %eax
je 0x2738
jmp 0x26e7
movl -0xa4(%rbp), %eax
subl $0x2, %eax
je 0x2750
jmp 0x26f4
movl -0xa4(%rbp), %eax
subl $0x3, %eax
je 0x2773
jmp 0x2791
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x21d0
jmp 0x29e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x20e0
jmp 0x29e0
callq 0x29f0
movl %eax, -0xa8(%rbp)
jmp 0x2745
movl -0xa8(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x27c4
leaq -0x70(%rbp), %rdi
callq 0x2a40
jmp 0x275b
leaq -0x30(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2220
leaq -0x70(%rbp), %rdi
callq 0x20e0
jmp 0x27c4
callq 0x2ae0
movsd %xmm0, -0xb0(%rbp)
jmp 0x2782
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
jmp 0x27c4
movq 0x3830(%rip), %rdi      # 0x5fc8
leaq 0x18da(%rip), %rsi      # 0x4079
callq 0x21a0
movq %rax, -0xb8(%rbp)
jmp 0x27ad
movq -0xb8(%rbp), %rdi
movq 0x37fd(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x27c2
jmp 0x27c4
movl $0x0, -0x74(%rbp)
cmpl $0x3e8, -0x74(%rbp)     # imm = 0x3E8
jg 0x29ce
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movl (%rax), %eax
cmpl -0x10(%rbp), %eax
jne 0x27fb
cmpl $0x0, -0x10(%rbp)
jne 0x2890
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
leaq 0x4(%rax,%rcx), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2be0
movb %al, -0xb9(%rbp)
jmp 0x2820
movb -0xb9(%rbp), %al
testb $0x1, %al
jne 0x282c
jmp 0x2850
leaq 0x1add(%rip), %rsi      # 0x4310
leaq -0x30(%rbp), %rdi
callq 0x2c10
movb %al, -0xba(%rbp)
jmp 0x2844
movb -0xba(%rbp), %al
testb $0x1, %al
jne 0x2890
jmp 0x2850
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
addq %rcx, %rax
movsd 0x108(%rax), %xmm0
ucomisd -0x50(%rbp), %xmm0
jne 0x29be
jp 0x29be
movsd -0x50(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2890
jp 0x2890
jmp 0x29be
movq 0x3731(%rip), %rdi      # 0x5fc8
leaq 0x17f4(%rip), %rsi      # 0x4092
callq 0x21a0
movq %rax, -0xc8(%rbp)
jmp 0x28ac
movq -0xc8(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
movl (%rax,%rcx), %esi
callq 0x2300
movq %rax, -0xd0(%rbp)
jmp 0x28d3
movq -0xd0(%rbp), %rdi
movq 0x36d7(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x28e8
movq 0x36d9(%rip), %rdi      # 0x5fc8
leaq 0x17ad(%rip), %rsi      # 0x40a3
callq 0x21a0
movq %rax, -0xd8(%rbp)
jmp 0x2904
movq -0xd8(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
leaq 0x4(%rax,%rcx), %rsi
callq 0x21a0
movq %rax, -0xe0(%rbp)
jmp 0x292d
movq -0xe0(%rbp), %rdi
movq 0x367d(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x2942
movq 0x367f(%rip), %rdi      # 0x5fc8
leaq 0x1764(%rip), %rsi      # 0x40b4
callq 0x21a0
movq %rax, -0xe8(%rbp)
jmp 0x295e
movq -0xe8(%rbp), %rdi
movq -0x8(%rbp), %rax
movslq -0x74(%rbp), %rcx
imulq $0x110, %rcx, %rcx      # imm = 0x110
movsd 0x108(%rax,%rcx), %xmm0
callq 0x2350
movq %rax, -0xf0(%rbp)
jmp 0x298b
movq -0xf0(%rbp), %rdi
leaq 0x172c(%rip), %rsi      # 0x40c5
callq 0x21a0
movq %rax, -0xf8(%rbp)
jmp 0x29a7
movq -0xf8(%rbp), %rdi
movq 0x3603(%rip), %rsi      # 0x5fb8
callq 0x21b0
jmp 0x29bc
jmp 0x29be
jmp 0x29c0
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x27cb
leaq -0x30(%rbp), %rdi
callq 0x20e0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x40(%rbp), %rdi
callq 0x2310
nopl (%rax)