void *allocate_array(size, element_size)
int size, element_size;
{
  register void *mem;
  if (element_size * size <= 0)
    flexfatal("request for < 1 byte in allocate_array()");
  mem = yy_flex_alloc(element_size * size);
  if (mem == ((void *)0))
    flexfatal("memory allocation failed in allocate_array()");
  return mem;
}


x86 assembly (clang, -O0):
<allocate_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x4(%rbp),%eax
cmp    $0x0,%eax
jg     114c <allocate_array+0x2c>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1040 <flexfatal@plt>
mov    -0x8(%rbp),%edi
imul   -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <yy_flex_alloc@plt>
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1179 <allocate_array+0x59>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <flexfatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate_array>:
push   %rbx
mov    %edi,%ebx
imul   %esi,%ebx
test   %ebx,%ebx
jg     1138 <allocate_array+0x18>
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <flexfatal@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <yy_flex_alloc@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1155 <allocate_array+0x35>
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1040 <flexfatal@plt>
movslq %ebx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"request for < 1 byte in allocate_array()\00"
@.str.1 = [45 x i8] c"memory allocation failed in allocate_array()\00"
define i8* @allocate_array(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = mul nsw i32 %6, %7
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @flexfatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = mul nsw i32 %13, %14
%16 = call i32 (i32, ...) bitcast (i32 (...)* @yy_flex_alloc to i32 (i32, ...)*)(i32 %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %5
%19 = load i8*, i8** %5
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = call i32 (i8*, ...) bitcast (i32 (...)* @flexfatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %12
%24 = load i8*, i8** %5
ret i8* %24
}

LLVM IR (-O2):
@.str = [41 x i8] c"request for < 1 byte in allocate_array()\00"
@.str.1 = [45 x i8] c"memory allocation failed in allocate_array()\00"
define i8* @allocate_array(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @flexfatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @yy_flex_alloc to i32 (i32, ...)*)(i32 %3)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @flexfatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = sext i32 %8 to i64
%14 = inttoptr i64 %13 to i8*
ret i8* %14
}