	.file	"extr_mkjournal.c_ext2fs_add_journal_device.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	ext2fs_add_journal_device
	.type	ext2fs_add_journal_device, @function
ext2fs_add_journal_device:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12, rdi
	push	rbx
	.cfi_offset 3, -56
	mov	rbx, rsi
	sub	rsp, 40
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR SUPERBLOCK_SIZE[rip]
	mov	rcx, rsp
	add	rax, 15
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L3
.L26:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L26
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L27
.L4:
	mov	edi, DWORD PTR 24[rbx]
	lea	rsi, -64[rbp]
	mov	r14, rsp
	call	stat@PLT
	mov	r15d, DWORD PTR errno[rip]
	test	rax, rax
	js	.L1
	mov	edi, DWORD PTR -60[rbp]
	call	S_ISBLK@PLT
	mov	r15d, DWORD PTR EXT2_ET_JOURNAL_NOT_BLOCK[rip]
	test	eax, eax
	je	.L1
	mov	rdi, QWORD PTR 16[rbx]
	call	ext2fs_journal_sb_start@PLT
	mov	edx, DWORD PTR SUPERBLOCK_SIZE[rip]
	mov	edi, DWORD PTR 8[rbx]
	mov	rcx, rsp
	mov	esi, eax
	mov	r13d, eax
	neg	edx
	call	io_channel_read_blk64@PLT
	mov	r15d, eax
	test	eax, eax
	je	.L28
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L29
	lea	rsp, -40[rbp]
	mov	eax, r15d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L28:
	mov	edi, DWORD PTR JFS_MAGIC_NUMBER[rip]
	mov	r15d, DWORD PTR 20[rsp]
	call	ntohl@PLT
	cmp	r15d, eax
	je	.L8
.L9:
	mov	r15d, DWORD PTR EXT2_ET_NO_JOURNAL_SB[rip]
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	mov	edi, DWORD PTR JFS_SUPERBLOCK_V2[rip]
	mov	r15d, DWORD PTR 24[rsp]
	call	ntohl@PLT
	cmp	r15d, eax
	jne	.L9
	mov	edi, DWORD PTR 16[rsp]
	call	ntohl@PLT
	mov	r15d, DWORD PTR EXT2_ET_UNEXPECTED_BLOCK_SIZE[rip]
	cmp	rax, QWORD PTR 16[r12]
	jne	.L1
	mov	edi, DWORD PTR 4[rsp]
	call	ntohl@PLT
	cmp	DWORD PTR JFS_USERS_MAX[rip], eax
	mov	r15d, DWORD PTR EXT2_ET_CORRUPT_JOURNAL_SB[rip]
	mov	QWORD PTR -80[rbp], rax
	jl	.L1
	test	eax, eax
	jle	.L13
	lea	r15d, -1[rax]
	add	r15, 1
	sal	r15, 6
	mov	QWORD PTR -72[rbp], r15
	xor	r15d, r15d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L30:
	add	r15, 64
	cmp	QWORD PTR -72[rbp], r15
	je	.L13
.L15:
	mov	rax, QWORD PTR [r12]
	mov	rsi, QWORD PTR 8[r14]
	mov	edx, 16
	mov	edi, DWORD PTR 32[rax]
	add	rsi, r15
	call	memcmp@PLT
	test	rax, rax
	jne	.L30
.L14:
	mov	edx, DWORD PTR SUPERBLOCK_SIZE[rip]
	mov	edi, DWORD PTR 8[rbx]
	mov	rcx, r14
	mov	esi, r13d
	neg	edx
	call	io_channel_write_blk64@PLT
	mov	r15d, eax
	test	eax, eax
	jne	.L1
	mov	rax, QWORD PTR [r12]
	mov	edx, DWORD PTR -64[rbp]
	mov	esi, DWORD PTR [r14]
	mov	DWORD PTR 16[rax], edx
	mov	rdi, QWORD PTR 8[rax]
	mov	edx, 8
	mov	QWORD PTR 24[rax], 0
	call	memcpy@PLT
	mov	rax, QWORD PTR [r12]
	mov	edx, 4
	xor	esi, esi
	mov	edi, DWORD PTR [rax]
	call	memset@PLT
	mov	rdi, QWORD PTR [r12]
	call	ext2fs_set_feature_journal@PLT
	mov	rdi, r12
	call	ext2fs_mark_super_dirty@PLT
	jmp	.L1
.L13:
	mov	rax, QWORD PTR [r12]
	mov	r15, QWORD PTR -80[rbp]
	mov	rdx, QWORD PTR 8[r14]
	mov	esi, DWORD PTR 32[rax]
	mov	eax, r15d
	sal	eax, 4
	cdqe
	lea	rdi, [rdx+rax*4]
	mov	edx, 16
	call	memcpy@PLT
	mov	edi, r15d
	add	edi, 1
	call	htonl@PLT
	mov	DWORD PTR 4[r14], eax
	jmp	.L14
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ext2fs_add_journal_device, .-ext2fs_add_journal_device
	.comm	errno,4,4
	.comm	SUPERBLOCK_SIZE,4,4
	.comm	JFS_USERS_MAX,4,4
	.comm	JFS_SUPERBLOCK_V2,4,4
	.comm	JFS_MAGIC_NUMBER,4,4
	.comm	EXT2_ET_UNEXPECTED_BLOCK_SIZE,4,4
	.comm	EXT2_ET_NO_JOURNAL_SB,4,4
	.comm	EXT2_ET_JOURNAL_NOT_BLOCK,4,4
	.comm	EXT2_ET_CORRUPT_JOURNAL_SB,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.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:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_mkjournal.c_ext2fs_add_journal_device.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	ext2fs_add_journal_device
	.syntax unified
	.arm
	.fpu softvfp
	.type	ext2fs_add_journal_device, %function
ext2fs_add_journal_device:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	ldr	r6, .L23
	mov	r4, r1
	ldr	r3, [r6]
	mov	r7, r0
	add	r3, r3, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	ldr	r3, .L23+4
	ldr	r0, [r1, #12]
	sub	r1, fp, #48
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	bl	stat
	cmp	r0, #0
	blt	.L20
	ldr	r0, [fp, #-44]
	bl	S_ISBLK
	cmp	r0, #0
	bne	.L4
	ldr	r3, .L23+8
	ldr	r5, [r3]
.L1:
	ldr	r3, .L23+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L21
	mov	r0, r5
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	ldr	r0, [r4, #8]
	bl	ext2fs_journal_sb_start
	ldr	r2, [r6]
	mov	r1, r0
	mov	r9, r0
	mov	r3, sp
	ldr	r0, [r4, #4]
	rsb	r2, r2, #0
	bl	io_channel_read_blk64
	subs	r5, r0, #0
	bne	.L1
	ldr	r3, .L23+12
	ldr	r10, [sp, #16]
	ldr	r0, [r3]
	bl	ntohl
	cmp	r10, r0
	beq	.L5
.L6:
	ldr	r3, .L23+16
	ldr	r5, [r3]
	b	.L1
.L20:
	ldr	r3, .L23+20
	ldr	r5, [r3]
	b	.L1
.L5:
	ldr	r3, .L23+24
	ldr	r10, [sp, #20]
	ldr	r0, [r3]
	bl	ntohl
	cmp	r10, r0
	bne	.L6
	ldr	r0, [sp, #12]
	bl	ntohl
	ldr	r3, [r7, #8]
	cmp	r0, r3
	ldrne	r3, .L23+28
	ldrne	r5, [r3]
	bne	.L1
.L7:
	ldr	r0, [sp, #4]
	bl	ntohl
	ldr	r3, .L23+32
	mov	r10, r0
	ldr	r3, [r3]
	cmp	r3, r0
	blt	.L8
	cmp	r0, #0
	mov	r8, sp
	bgt	.L9
	b	.L10
.L22:
	add	r5, r5, #1
	cmp	r10, r5
	beq	.L10
.L9:
	ldr	r1, [r8, #8]
	ldr	r3, [r7]
	mov	r2, #16
	ldr	r0, [r3, #16]
	add	r1, r1, r5, lsl #6
	bl	memcmp
	cmp	r0, #0
	bne	.L22
.L11:
	ldr	r2, [r6]
	mov	r1, r9
	mov	r3, r8
	ldr	r0, [r4, #4]
	rsb	r2, r2, #0
	bl	io_channel_write_blk64
	subs	r5, r0, #0
	bne	.L1
	ldr	r3, [r7]
	ldr	r2, [fp, #-48]
	ldr	r1, [r8]
	ldr	r0, [r3, #4]
	str	r5, [r3, #12]
	str	r2, [r3, #8]
	mov	r2, #4
	bl	memcpy
	ldr	r3, [r7]
	mov	r2, #4
	mov	r1, r5
	ldr	r0, [r3]
	bl	memset
	ldr	r0, [r7]
	bl	ext2fs_set_feature_journal
	mov	r0, r7
	bl	ext2fs_mark_super_dirty
	b	.L1
.L10:
	ldr	r3, [r7]
	ldr	r0, [r8, #8]
	mov	r2, #16
	ldr	r1, [r3, #16]
	add	r0, r0, r10, lsl #6
	bl	memcpy
	add	r0, r10, #1
	bl	htonl
	str	r0, [r8, #4]
	b	.L11
.L8:
	ldr	r3, .L23+36
	ldr	r5, [r3]
	b	.L1
.L21:
	bl	__stack_chk_fail
.L24:
	.align	2
.L23:
	.word	SUPERBLOCK_SIZE
	.word	.LC0
	.word	EXT2_ET_JOURNAL_NOT_BLOCK
	.word	JFS_MAGIC_NUMBER
	.word	EXT2_ET_NO_JOURNAL_SB
	.word	errno
	.word	JFS_SUPERBLOCK_V2
	.word	EXT2_ET_UNEXPECTED_BLOCK_SIZE
	.word	JFS_USERS_MAX
	.word	EXT2_ET_CORRUPT_JOURNAL_SB
	.size	ext2fs_add_journal_device, .-ext2fs_add_journal_device
	.comm	errno,4,4
	.comm	SUPERBLOCK_SIZE,4,4
	.comm	JFS_USERS_MAX,4,4
	.comm	JFS_SUPERBLOCK_V2,4,4
	.comm	JFS_MAGIC_NUMBER,4,4
	.comm	EXT2_ET_UNEXPECTED_BLOCK_SIZE,4,4
	.comm	EXT2_ET_NO_JOURNAL_SB,4,4
	.comm	EXT2_ET_JOURNAL_NOT_BLOCK,4,4
	.comm	EXT2_ET_CORRUPT_JOURNAL_SB,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
