#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 */

/* Variables and functions */
int andna_find_flood_pkt_id(int *, int);
int /*<<< orphan*/ memcpy(int *, int *, int);
int andna_add_flood_pkt_id(int *ids_array, int pkt_id) {
  int i;
  if ((i = andna_find_flood_pkt_id(ids_array, pkt_id)) < 0) {
    int tmp_array[(5 * 3 + 1) - 1];
    memcpy(tmp_array, ids_array, sizeof(int) * ((5 * 3 + 1) - 1));
    memcpy(&ids_array[1], tmp_array, sizeof(int) * ((5 * 3 + 1) - 1));
    ids_array[0] = pkt_id;
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<andna_add_flood_pkt_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <andna_find_flood_pkt_id@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    1184 <andna_add_flood_pkt_id+0x64>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    118b <andna_add_flood_pkt_id+0x6b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<andna_add_flood_pkt_id>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <andna_find_flood_pkt_id@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jns    1165 <andna_add_flood_pkt_id+0x45>
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
lea    0x4(%rbx),%rdi
mov    %r14,%rsi
mov    $0x3c,%edx
call   1030 <memcpy@plt>
mov    %ebp,(%rbx)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @andna_add_flood_pkt_id(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [15 x i32]
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = call i32 @andna_find_flood_pkt_id(i32* %8, i32 %9)
store i32 %10, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %2
%13 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i64 0, i64 0
%14 = load i32*, i32** %4
%15 = call i32 @memcpy(i32* %13, i32* %14, i32 60)
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = getelementptr inbounds [15 x i32], [15 x i32]* %7, i64 0, i64 0
%19 = call i32 @memcpy(i32* %17, i32* %18, i32 60)
%20 = load i32, i32* %5
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 0
store i32 %20, i32* %22
store i32 0, i32* %3
br label %24
23: ; preds = %2
store i32 1, i32* %3
br label %24
24: ; preds = %23, %12
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @andna_add_flood_pkt_id(i32* %0, i32 %1) {
%3 = alloca [15 x i32]
%4 = tail call i32 @andna_find_flood_pkt_id(i32* %0, i32 %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = bitcast [15 x i32]* %3 to i8*
%8 = getelementptr inbounds [15 x i32], [15 x i32]* %3, i64 0, i64 0
%9 = call i32 @memcpy(i32* %8, i32* %0, i32 60)
%10 = getelementptr inbounds i32, i32* %0, i64 1
%11 = call i32 @memcpy(i32* %10, i32* %8, i32 60)
store i32 %1, i32* %0
br label %12
12: ; preds = %2, %6
%13 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %13
}