#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 */
typedef struct ebt_mac_wormhash {
  int poolsize;
} const ebt_mac_wormhash;

/* Variables and functions */
int ebt_mac_wormhash_size(struct ebt_mac_wormhash const *);
int /*<<< orphan*/ memcpy(struct ebt_mac_wormhash const *,
                          struct ebt_mac_wormhash const *, int);
void copy_wormhash(struct ebt_mac_wormhash *d,
                   const struct ebt_mac_wormhash *s) {
  int dpoolsize = d->poolsize;
  int dsize, ssize, amount;
  dsize = ebt_mac_wormhash_size(d);
  ssize = ebt_mac_wormhash_size(s);
  amount = dsize < ssize ? dsize : ssize;
  memcpy(d, s, amount);
  d->poolsize = dpoolsize;
}


x86 assembly (clang, -O0):
<copy_wormhash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1168 <copy_wormhash+0x48>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    116e <copy_wormhash+0x4e>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_wormhash>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%r15d
call   1030 <ebt_mac_wormhash_size@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1030 <ebt_mac_wormhash_size@plt>
cmp    %eax,%ebp
cmovge %eax,%ebp
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %r15d,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ebt_mac_wormhash = type { i32 }
define void @copy_wormhash(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1) {
%3 = alloca %struct.ebt_mac_wormhash*
%4 = alloca %struct.ebt_mac_wormhash*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash** %3
store %struct.ebt_mac_wormhash* %1, %struct.ebt_mac_wormhash** %4
%9 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %3
%10 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %9, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %5
%12 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %3
%13 = call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %12)
store i32 %13, i32* %6
%14 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %4
%15 = call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %14)
store i32 %15, i32* %7
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = load i32, i32* %6
br label %23
21: ; preds = %2
%22 = load i32, i32* %7
br label %23
23: ; preds = %21, %19
%24 = phi i32 [ %20, %19 ], [ %22, %21 ]
store i32 %24, i32* %8
%25 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %3
%26 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %4
%27 = load i32, i32* %8
%28 = call i32 @memcpy(%struct.ebt_mac_wormhash* %25, %struct.ebt_mac_wormhash* %26, i32 %27)
%29 = load i32, i32* %5
%30 = load %struct.ebt_mac_wormhash*, %struct.ebt_mac_wormhash** %3
%31 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %30, i32 0, i32 0
store i32 %29, i32* %31
ret void
}

LLVM IR (-O2):
%struct.ebt_mac_wormhash = type { i32 }
define void @copy_wormhash(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1) {
%3 = getelementptr inbounds %struct.ebt_mac_wormhash, %struct.ebt_mac_wormhash* %0, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %0)
%6 = tail call i32 @ebt_mac_wormhash_size(%struct.ebt_mac_wormhash* %1)
%7 = icmp slt i32 %5, %6
%8 = select i1 %7, i32 %5, i32 %6
%9 = tail call i32 @memcpy(%struct.ebt_mac_wormhash* %0, %struct.ebt_mac_wormhash* %1, i32 %8)
store i32 %4, i32* %3
ret void
}