#include <unistd.h>
#include <sys/stat.h>
#include <string.h>

int main(int argc, char **argv)
{
	unsigned short newmode;
	int i, er=0;

	newmode = 0666 & ~umask(0);
	for (i = 1; i < argc; i++)
	{
		// The first line below mith mkfifo is used in the GNU version but there is no mkfifo call in elks libc yet
		/*if (mkfifo (argv[i],newmode))*/
		if (mknod(argv[i], newmode | S_IFIFO, 0))
		{
			write(STDERR_FILENO,"mkfifo: cannot make fifo ",25);
			write(STDERR_FILENO,argv[i], strlen(argv[i]));
			write(STDERR_FILENO,"\n",1);
			er &= 1;
		}
	}
	exit(er);
}

	.file	"tmpxft_003452db_00000000-6_dmkfifo.cudafe1.cpp"
	.text
#APP

#NO_APP
	.type	_ZL26__cudaUnregisterBinaryUtilv, @function
_ZL26__cudaUnregisterBinaryUtilv:
.LFB2024:
	.cfi_startproc
	endbr64
	movq	_ZL20__cudaFatCubinHandle(%rip), %rdi
	jmp	__cudaUnregisterFatBinary@PLT
	.cfi_endproc
.LFE2024:
	.size	_ZL26__cudaUnregisterBinaryUtilv, .-_ZL26__cudaUnregisterBinaryUtilv
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"mkfifo: cannot make fifo "
.LC1:
	.string	"\n"
	.section	.text.startup,"ax",@progbits
	.globl	main
	.type	main, @function
main:
.LFB2021:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movl	%edi, %r13d
	xorl	%edi, %edi
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rsi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	$1, %ebx
	pushq	%rax
	.cfi_def_cfa_offset 64
	call	umask@PLT
	movl	%eax, %ebp
	notl	%ebp
	andw	$438, %bp
.L3:
	cmpl	%ebx, %r13d
	jle	.L11
	movl	%ebp, %esi
	movq	(%r12,%rbx,8), %rdi
	xorl	%edx, %edx
	orw	$4096, %si
	movzwl	%si, %esi
	call	mknod@PLT
	testl	%eax, %eax
	je	.L4
	movl	$25, %edx
	movq	%r14, %rsi
	movl	$2, %edi
	call	write@PLT
	movq	(%r12,%rbx,8), %r15
	movq	%r15, %rdi
	call	strlen@PLT
	movq	%r15, %rsi
	movl	$2, %edi
	movq	%rax, %rdx
	call	write@PLT
	movl	$1, %edx
	movl	$2, %edi
	leaq	.LC1(%rip), %rsi
	call	write@PLT
.L4:
	incq	%rbx
	jmp	.L3
.L11:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE2021:
	.size	main, .-main
	.type	_ZL24__sti____cudaRegisterAllv, @function
_ZL24__sti____cudaRegisterAllv:
.LFB2047:
	.cfi_startproc
	endbr64
	pushq	%rax
	.cfi_def_cfa_offset 16
	leaq	_ZL15__fatDeviceText(%rip), %rdi
	call	__cudaRegisterFatBinary@PLT
	movq	%rax, %rdi
	movq	%rax, _ZL20__cudaFatCubinHandle(%rip)
	call	__cudaRegisterFatBinaryEnd@PLT
	leaq	_ZL26__cudaUnregisterBinaryUtilv(%rip), %rdi
	popq	%rdx
	.cfi_def_cfa_offset 8
	jmp	atexit@PLT
	.cfi_endproc
.LFE2047:
	.size	_ZL24__sti____cudaRegisterAllv, .-_ZL24__sti____cudaRegisterAllv
	.section	.init_array,"aw"
	.align 8
	.quad	_ZL24__sti____cudaRegisterAllv
	.section	.nvFatBinSegment,"aw"
	.align 8
	.type	_ZL15__fatDeviceText, @object
	.size	_ZL15__fatDeviceText, 24
_ZL15__fatDeviceText:
	.long	1180844977
	.long	1
	.quad	fatbinData
	.quad	0
	.local	_ZL20__cudaFatCubinHandle
	.comm	_ZL20__cudaFatCubinHandle,8,8
	.ident	"GCC: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <hip/hip_runtime.h>
#include <unistd.h>
#include <sys/stat.h>
#include <string.h>

int main(int argc, char **argv)
{
	unsigned short newmode;
	int i, er=0;

	newmode = 0666 & ~umask(0);
	for (i = 1; i < argc; i++)
	{
		// The first line below mith mkfifo is used in the GNU version but there is no mkfifo call in elks libc yet
		/*if (mkfifo (argv[i],newmode))*/
		if (mknod(argv[i], newmode | S_IFIFO, 0))
		{
			write(STDERR_FILENO,"mkfifo: cannot make fifo ",25);
			write(STDERR_FILENO,argv[i], strlen(argv[i]));
			write(STDERR_FILENO,"\n",1);
			er &= 1;
		}
	}
	exit(er);
}

	.text
	.file	"dmkfifo.hip"
	.globl	main                            # -- Begin function main
	.type	main,@function
main:                                   # @main
	.cfi_startproc
# %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	pushq	%r15
	.cfi_def_cfa_offset 24
	pushq	%r14
	.cfi_def_cfa_offset 32
	pushq	%r12
	.cfi_def_cfa_offset 40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	.cfi_offset %rbp, -16
	movq	%rsi, %rbx
	movl	%edi, %r14d
	xorl	%edi, %edi
	callq	umask
	cmpl	$2, %r14d
	jl	.LBB0_5
# %bb.1:                                # %.lr.ph
	movl	%eax, %ebp
	andl	$438, %ebp                      # imm = 0x1B6
	xorl	$4534, %ebp                     # imm = 0x11B6
	movl	%r14d, %r15d
	movl	$1, %r12d
.LBB0_2:                                # =>This Inner Loop Header: Depth=1
	movq	(%rbx,%r12,8), %rdi
	movl	%ebp, %esi
	xorl	%edx, %edx
	callq	mknod
	testl	%eax, %eax
	je	.LBB0_4
# %bb.3:                                #   in Loop: Header=BB0_2 Depth=1
	movl	$.L.str, %esi
	movl	$25, %edx
	movl	$2, %edi
	callq	write
	movq	(%rbx,%r12,8), %r14
	movq	%r14, %rdi
	callq	strlen
	movl	$2, %edi
	movq	%r14, %rsi
	movq	%rax, %rdx
	callq	write
	movl	$.L.str.1, %esi
	movl	$1, %edx
	movl	$2, %edi
	callq	write
.LBB0_4:                                #   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	cmpq	%r12, %r15
	jne	.LBB0_2
.LBB0_5:                                # %._crit_edge
	xorl	%edi, %edi
	callq	exit
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.cfi_endproc
                                        # -- End function
	.type	.L.str,@object                  # @.str
	.section	.rodata.str1.1,"aMS",@progbits,1
.L.str:
	.asciz	"mkfifo: cannot make fifo "
	.size	.L.str, 26

	.type	.L.str.1,@object                # @.str.1
.L.str.1:
	.asciz	"\n"
	.size	.L.str.1, 2

	.type	__hip_cuid_,@object             # @__hip_cuid_
	.bss
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               # 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_

	.text
	.p2alignl 7, 3214868480
	.fill 96, 4, 3214868480
	.type	__hip_cuid_,@object             ; @__hip_cuid_
	.section	.bss,"aw",@nobits
	.globl	__hip_cuid_
__hip_cuid_:
	.byte	0                               ; 0x0
	.size	__hip_cuid_, 1

	.ident	"AMD clang version 18.0.0git (https://github.com/RadeonOpenCompute/llvm-project roc-6.3.2 25012 e5bf7e55c91490b07c49d8960fa7983d864936c4)"
	.section	".note.GNU-stack","",@progbits
	.addrsig
	.addrsig_sym __hip_cuid_
	.amdgcn_target "amdgcn-amd-amdhsa--gfx1100"
	.amdgpu_metadata
---
amdhsa.kernels:  []
amdhsa.target:   amdgcn-amd-amdhsa--gfx1100
amdhsa.version:
  - 1
  - 2
...

	.end_amdgpu_metadata
