#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*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
int /*<<< orphan*/ write(int, char *, int);
int mkfifo(const char *pathname, int mode) {
  size_t plen = strlen(pathname) + 1;
  char buf[4 + 4 + 255];
  (void)mode;
  *((unsigned int *)buf) = 0;
  *((unsigned int *)(buf + 4)) = plen;
  memcpy(buf + 4 + 4, pathname, plen);
  write((10 + 3), buf, 4 + 4 + plen);
  return 0;
}


x86 assembly (clang, -O0):
<mkfifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x120(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x11c(%rbp)
lea    -0x120(%rbp),%rdi
add    $0x4,%rdi
add    $0x4,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <memcpy@plt>
lea    -0x120(%rbp),%rsi
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %eax,%edx
mov    $0xd,%edi
call   1030 <write@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfifo>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%eax
movslq %eax,%rdx
movl   $0x0,(%rsp)
mov    %edx,0x4(%rsp)
lea    0x8(%rsp),%rdi
mov    %r14,%rsi
call   1050 <memcpy@plt>
add    $0x9,%ebx
mov    %rsp,%rsi
mov    $0xd,%edi
mov    %ebx,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @mkfifo(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i64
%6 = alloca [263 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
store i64 %10, i64* %5
%11 = load i32, i32* %4
%12 = getelementptr inbounds [263 x i8], [263 x i8]* %6, i64 0, i64 0
%13 = bitcast i8* %12 to i32*
store i32 0, i32* %13
%14 = load i64, i64* %5
%15 = trunc i64 %14 to i32
%16 = getelementptr inbounds [263 x i8], [263 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 4
%18 = bitcast i8* %17 to i32*
store i32 %15, i32* %18
%19 = getelementptr inbounds [263 x i8], [263 x i8]* %6, i64 0, i64 0
%20 = getelementptr inbounds i8, i8* %19, i64 4
%21 = getelementptr inbounds i8, i8* %20, i64 4
%22 = load i8*, i8** %3
%23 = load i64, i64* %5
%24 = call i32 @memcpy(i8* %21, i8* %22, i64 %23)
%25 = getelementptr inbounds [263 x i8], [263 x i8]* %6, i64 0, i64 0
%26 = load i64, i64* %5
%27 = add i64 8, %26
%28 = trunc i64 %27 to i32
%29 = call i32 @write(i32 13, i8* %25, i32 %28)
ret i32 0
}

LLVM IR (-O2):
define i32 @mkfifo(i8* %0, i32 %1) {
%3 = alloca [263 x i8]
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [263 x i8], [263 x i8]* %3, i64 0, i64 0
%8 = bitcast [263 x i8]* %3 to i32*
store i32 0, i32* %8
%9 = getelementptr inbounds [263 x i8], [263 x i8]* %3, i64 0, i64 4
%10 = bitcast i8* %9 to i32*
store i32 %5, i32* %10
%11 = getelementptr inbounds [263 x i8], [263 x i8]* %3, i64 0, i64 8
%12 = call i32 @memcpy(i8* %11, i8* %0, i64 %6)
%13 = add i32 %4, 9
%14 = call i32 @write(i32 13, i8* %7, i32 %13)
ret i32 0
}