#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 /*<<< orphan*/ h2o__fatal(char *);
void *memcpy(void *, void const *, size_t);
void *h2o_memcpy(void *dst, const void *src, size_t n) {
  if (src != NULL)
    return memcpy(dst, src, n);
  else if (n != 0)
    h2o__fatal("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/rayrapetyan/h2o/refs/heads/"
               "master/include/h2o/memory.h"
               ":"
               "318"
               ":"
               "null pointer passed to memcpy");
  return dst;
}


x86 assembly (clang, -O0):
<h2o_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <h2o_memcpy+0x41>
mov    -0x10(%rbp),%rdi
mov    %rdi,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1185 <h2o_memcpy+0x65>
cmpq   $0x0,-0x20(%rbp)
je     1178 <h2o_memcpy+0x58>
lea    0xe8d(%rip),%rdi
call   1030 <h2o__fatal@plt>
jmp    117d <h2o_memcpy+0x5d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h2o_memcpy>:
push   %rbx
mov    %rdi,%rbx
test   %rsi,%rsi
je     1133 <h2o_memcpy+0x13>
mov    %rbx,%rdi
call   1040 <memcpy@plt>
jmp    1144 <h2o_memcpy+0x24>
test   %rdx,%rdx
je     1144 <h2o_memcpy+0x24>
lea    0xec1(%rip),%rdi
call   1030 <h2o__fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [179 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rayrapetyan/h2o/refs/heads/master/include/h2o/memory.h:318:null pointer passed to memcpy\00"
define i8* @h2o_memcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = load i64, i64* %7
store i8* %11, i8** %4
br label %22
14: ; preds = %3
%15 = load i64, i64* %7
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @h2o__fatal(i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
br label %20
20: ; preds = %19
%21 = load i8*, i8** %5
store i8* %21, i8** %4
br label %22
22: ; preds = %20, %10
%23 = load i8*, i8** %4
ret i8* %23
}

LLVM IR (-O2):
@.str = [179 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/rayrapetyan/h2o/refs/heads/master/include/h2o/memory.h:318:null pointer passed to memcpy\00"
define i8* @h2o_memcpy(i8* returned writeonly %0, i8* %1, i64 %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %6, label %5
5: ; preds = %3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
br label %10
6: ; preds = %3
%7 = icmp eq i64 %2, 0
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @h2o__fatal(i8* getelementptr inbounds ([179 x i8], [179 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %6, %5
ret i8* %0
}