// File: /workspace/github_c_makefile_star2_O0/YunyiQian[P]multitel3/./raytrace.c
// Function: model_input
int model_input(char *name,MODEL *m){
	FILE *fp;
	int error;
	int i,im1;

	if ( name==NULL ){
		fprintf(stderr,"No model name\n");
		return -1;
	}else{
		fp = fopen(name,"r");
		if ( fp == NULL ){
			fprintf(stderr,"Error in opening model file\n");
			return -1;
		}
	}

	fscanf(fp,"%d",&m->nlay);
	if ( m->nlay > MAXLAY ){
		fprintf(stderr,"Too many layers in model file\n");
		m->nlay = MAXLAY;
	}

	for (i=0;i<m->nlay;i++){
		fscanf(fp,"%lf%lf%lf%lf%lf%lf",&m->depth[i],&m->vp[i],&m->vs[i],&m->rou[i],&m->qp[i],&m->qs[i]);
	}
	
	fclose(fp);

	for (i=1,im1=0;i<m->nlay;i++,im1++){
		if (m->depth[i] < m->depth[im1]){
			fprintf(stderr,"Depth in model file is not correct\n");
			return -1;
		}
	}

	return m->nlay;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x127b
movq 0x5d9a(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x3eac(%rip), %rsi      # 0x5114
movb $0x0, %al
callq 0x10b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1449
movq -0x10(%rbp), %rdi
leaq 0x3e9d(%rip), %rsi      # 0x5123
callq 0x10d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x12ba
movq 0x5d5b(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x3e7e(%rip), %rsi      # 0x5125
movb $0x0, %al
callq 0x10b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1449
jmp 0x12bc
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x3e77(%rip), %rsi      # 0x5142
movb $0x0, %al
callq 0x1050
movq -0x18(%rbp), %rax
cmpl $0x3e8, (%rax)          # imm = 0x3E8
jle 0x1300
movq 0x5d13(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x3e56(%rip), %rsi      # 0x5145
movb $0x0, %al
callq 0x10b0
movq -0x18(%rbp), %rax
movl $0x3e8, (%rax)          # imm = 0x3E8
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x13bf
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x5dc8, %rdx           # imm = 0x5DC8
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
movq -0x18(%rbp), %rcx
addq $0x8, %rcx
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rcx
movq -0x18(%rbp), %r8
addq $0x1f48, %r8            # imm = 0x1F48
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r8
movq -0x18(%rbp), %r9
addq $0x3e88, %r9            # imm = 0x3E88
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r9
movq -0x18(%rbp), %r10
addq $0x7d08, %r10           # imm = 0x7D08
movslq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %r10
movq -0x18(%rbp), %rax
addq $0x9c48, %rax           # imm = 0x9C48
movslq -0x28(%rbp), %rsi
shlq $0x3, %rsi
addq %rsi, %rax
leaq 0x3dc3(%rip), %rsi      # 0x5164
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
movb $0x0, %al
callq 0x1050
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x1307
movq -0x20(%rbp), %rdi
callq 0x1070
movl $0x1, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x28(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x1440
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsd 0x5dc8(%rax,%rcx,8), %xmm1
movq -0x18(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsd 0x5dc8(%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x142a
movq 0x5be8(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x3d5d(%rip), %rsi      # 0x5177
movb $0x0, %al
callq 0x10b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1449
jmp 0x142c
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x13d6
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)