// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ramfs_smoke_test.c
// Function: test_read_write
static void test_read_write(void)
{
	const char *file_path = RAMFS_FILE_PATH;
	const char *test_string = "ramfs test string";
	struct fs_file file;
	int rc = vfs_open(file_path, &file);
	char buffer[256];
	
	if (!rc) {
		DBG_INFO("vfs_open(%s) succeeded", file_path);

		rc = vfs_write(&file, test_string, strlen(test_string) + 1);
		if (rc < 0)
			DBG_ERR("vfs_write failed with error: %s",
				errstr(rc));
		else
			DBG_INFO("vfs_write wrote %d bytes", rc);

		rc = vfs_seek(&file, 0, FSS_END);
		if (rc < 0) {
			DBG_ERR("vfs_seek failed with error: %s",
				errstr(rc));
		} else {
			DBG_INFO("vfs_seek reports file size %d", rc);
			if ((size_t)rc != strlen(test_string) + 1)
				DBG_ERR("vfs_seek returned wrong file size");
		}

		rc = vfs_seek(&file, 0, FSS_SET);
		if (rc < 0)
			DBG_ERR("vfs_seek failed with error: %s",
				errstr(rc));
		else
			DBG_INFO("vfs_seek set offset to %d", rc);
	
		memset(buffer, 0, sizeof(buffer));
		rc = vfs_read(&file, buffer, strlen(test_string) + 1);
		if (rc < 0)
			DBG_ERR("vfs_read failed with error: %s",
				errstr(rc));
		else
			DBG_INFO("vfs_read read %d bytes", rc);

		if (strcmp(test_string, buffer)) {
			DBG_ERR("read data doesn't match written data");
			DBG_ERR("written: %s", test_string);
			DBG_ERR("read: %s", buffer);
		} else {
			DBG_INFO("read data matches written data");
		}

		rc = vfs_release(&file);
		if (!rc)
			DBG_INFO("vfs_release succeeded");
		else
			DBG_ERR("vfs_release failed with error: %s",
				errstr(rc));
	} else {
		DBG_ERR("vfs_open(%s) failed with error: %s",
			file_path, errstr(rc));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
leaq 0x5352(%rip), %rax      # 0xffffffff80112a24
movq %rax, -0x8(%rbp)
leaq 0x5476(%rip), %rax      # 0xffffffff80112b53
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xffffffff80109ab0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xffffffff8010da6c
movq -0x8(%rbp), %r8
leaq 0x4a3e(%rip), %rdi      # 0xffffffff80112144
leaq 0x52a5(%rip), %rsi      # 0xffffffff801129b2
movl $0x6d, %edx
leaq 0x539d(%rip), %rcx      # 0xffffffff80112ab6
movb $0x0, %al
callq 0xffffffff80101e60
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x10(%rbp), %rdi
callq 0xffffffff801018d0
movq -0x148(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
leaq -0x30(%rbp), %rdi
callq 0xffffffff80109c10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0xffffffff8010d782
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x4a13(%rip), %rdi      # 0xffffffff80112179
leaq 0x5245(%rip), %rsi      # 0xffffffff801129b2
movl $0x72, %edx
leaq 0x53ec(%rip), %rcx      # 0xffffffff80112b65
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010d7a7
movl -0x34(%rbp), %r8d
leaq 0x49b7(%rip), %rdi      # 0xffffffff80112144
leaq 0x521e(%rip), %rsi      # 0xffffffff801129b2
movl $0x74, %edx
leaq 0x53e5(%rip), %rcx      # 0xffffffff80112b85
movb $0x0, %al
callq 0xffffffff80101e60
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xffffffff80109d10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0xffffffff8010d7ee
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x49a7(%rip), %rdi      # 0xffffffff80112179
leaq 0x51d9(%rip), %rsi      # 0xffffffff801129b2
movl $0x79, %edx
leaq 0x53b9(%rip), %rcx      # 0xffffffff80112b9e
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010d85d
movl -0x34(%rbp), %r8d
leaq 0x494b(%rip), %rdi      # 0xffffffff80112144
leaq 0x51b2(%rip), %rsi      # 0xffffffff801129b2
movl $0x7b, %edx
leaq 0x53b1(%rip), %rcx      # 0xffffffff80112bbd
movb $0x0, %al
callq 0xffffffff80101e60
movslq -0x34(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x10(%rbp), %rdi
callq 0xffffffff801018d0
movq %rax, %rcx
movq -0x150(%rbp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
je 0xffffffff8010d85b
leaq 0x4938(%rip), %rdi      # 0xffffffff80112179
leaq 0x516a(%rip), %rsi      # 0xffffffff801129b2
movl $0x7d, %edx
leaq 0x5387(%rip), %rcx      # 0xffffffff80112bdb
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010d85d
leaq -0x30(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0xffffffff80109d10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0xffffffff8010d8a1
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x48f4(%rip), %rdi      # 0xffffffff80112179
leaq 0x5126(%rip), %rsi      # 0xffffffff801129b2
movl $0x83, %edx
leaq 0x5306(%rip), %rcx      # 0xffffffff80112b9e
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010d8c6
movl -0x34(%rbp), %r8d
leaq 0x4898(%rip), %rdi      # 0xffffffff80112144
leaq 0x50ff(%rip), %rsi      # 0xffffffff801129b2
movl $0x85, %edx
leaq 0x533e(%rip), %rcx      # 0xffffffff80112bfd
movb $0x0, %al
callq 0xffffffff80101e60
leaq -0x140(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xffffffff801017e0
leaq -0x140(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x10(%rbp), %rdi
callq 0xffffffff801018d0
movq -0x158(%rbp), %rsi
movq %rax, %rdx
addq $0x1, %rdx
leaq -0x30(%rbp), %rdi
callq 0xffffffff80109bb0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0xffffffff8010d93e
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x4857(%rip), %rdi      # 0xffffffff80112179
leaq 0x5089(%rip), %rsi      # 0xffffffff801129b2
movl $0x8b, %edx
leaq 0x52e2(%rip), %rcx      # 0xffffffff80112c17
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010d963
movl -0x34(%rbp), %r8d
leaq 0x47fb(%rip), %rdi      # 0xffffffff80112144
leaq 0x5062(%rip), %rsi      # 0xffffffff801129b2
movl $0x8d, %edx
leaq 0x52da(%rip), %rcx      # 0xffffffff80112c36
movb $0x0, %al
callq 0xffffffff80101e60
movq -0x10(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xffffffff80101980
cmpl $0x0, %eax
je 0xffffffff8010d9e8
leaq 0x47fa(%rip), %rdi      # 0xffffffff80112179
leaq 0x502c(%rip), %rsi      # 0xffffffff801129b2
movl $0x90, %edx
leaq 0x52bb(%rip), %rcx      # 0xffffffff80112c4d
movb $0x0, %al
callq 0xffffffff80101e60
movq -0x10(%rbp), %r8
leaq 0x47d5(%rip), %rdi      # 0xffffffff80112179
leaq 0x5007(%rip), %rsi      # 0xffffffff801129b2
movl $0x91, %edx
leaq 0x52bb(%rip), %rcx      # 0xffffffff80112c72
movb $0x0, %al
callq 0xffffffff80101e60
leaq -0x140(%rbp), %r8
leaq 0x47ad(%rip), %rdi      # 0xffffffff80112179
leaq 0x4fdf(%rip), %rsi      # 0xffffffff801129b2
movl $0x92, %edx
leaq 0x529f(%rip), %rcx      # 0xffffffff80112c7e
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010da09
leaq 0x4755(%rip), %rdi      # 0xffffffff80112144
leaq 0x4fbc(%rip), %rsi      # 0xffffffff801129b2
movl $0x94, %edx
leaq 0x5285(%rip), %rcx      # 0xffffffff80112c87
movb $0x0, %al
callq 0xffffffff80101e60
leaq -0x30(%rbp), %rdi
callq 0xffffffff80109ae0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0xffffffff8010da3e
leaq 0x4722(%rip), %rdi      # 0xffffffff80112144
leaq 0x4f89(%rip), %rsi      # 0xffffffff801129b2
movl $0x99, %edx
leaq 0x5024(%rip), %rcx      # 0xffffffff80112a59
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010da6a
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x4729(%rip), %rdi      # 0xffffffff80112179
leaq 0x4f5b(%rip), %rsi      # 0xffffffff801129b2
movl $0x9c, %edx
leaq 0x500c(%rip), %rcx      # 0xffffffff80112a6f
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010daaa
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movl -0x34(%rbp), %edi
callq 0xffffffff8010d240
movq -0x160(%rbp), %r8
movq %rax, %r9
leaq 0x46e9(%rip), %rdi      # 0xffffffff80112179
leaq 0x4f1b(%rip), %rsi      # 0xffffffff801129b2
movl $0x9f, %edx
leaq 0x502a(%rip), %rcx      # 0xffffffff80112acd
movb $0x0, %al
callq 0xffffffff80101e60
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
nopw %cs:(%rax,%rax)