Something is crashing in my asm and I cant track it down

Im modifing an assembly module to add a branch to a new C function but I cant seem to get it working right.

The original asm file is a 16 bit signed division library that just jumps to a 32 bit library to do the divide. Im trying to add a branch to a C function in here but it keeps crashing on me. Heres the original:

    .state16

    .global I$DIV
    .global I_DIV

dvs	.set	r2		; WORK COPY OF THE DIVISOR (SHIFTED)
quo	.set	r3		; WORK COPY OF THE QUOTIENT
negs	.set	r4		; SAVED COPY OF THE SIGNS

I$DIV:	
    PUSH {lr}

    NOP
    BX  pc		; Change to 32-bit state
    NOP
    .align
    .state32
    BL  I_MOD
    ADD lr, pc, #0x1
    BX  lr
    .state16
    POP {pc}
	
    .end

This is just the standard library file that comes with my TI compiler. What I want to do is add a compare and if that compare is == 0, branch to a C file. As a quick test, this works:

The C function at this point is just a stub

void foo(void){
;
}

and the modification to the asm module

I$DIV:	

    PUSH {lr}
    
    CMP R1, #0
        BEQ     asm_label
	 <same> 

asm_label:
     BL $foo
     POP {pc}

Ok, at this point it doesnt crash. It doesnt do anything, but it doesnt crash either. I now add my code to the C function which works being called with other C and asm functions and attempt to account for that in my asm code:

I$DIV:	
I$MOD:
    PUSH {lr}
    CMP R1, #0
        BEQ     asm_label             ; CHECK FOR DIVISION BY ZERO
                       
    NOP
    BX  pc		; Change to 32-bit state
    NOP

    .align
    .state32
	
    BL  I_MOD
    ADD lr, pc, #0x1
    BX  lr

    .state16

    POP {pc}
		
asm_label:
    PUSH {LR}
    BL $foo
    POP {pc}
    BX LR
	
    .end

This crashes with the only addition being the pushing of LR to the stack. What else do I need to save/restore? The listing file for the C function looks something like this:

      58 00000000           _foo:
      59 00000000 E92D4000           STMFD     sp!, {lr}
      60 00000004 E28FE001           ADD       lr, pc, #1
      61 00000008 E12FFF1E           BX        lr
      62 0000000c                   .state16
      63 0000000c F7FF'              BL        $foo
         0000000e FFF8     
      64 00000010 4778               BX        pc
      65 00000012 46C0               NOP
      66 00000014                   .state32
      67 00000014 E8BD8000           LDMFD     sp!, {pc}
      68 00000018                   .state16
      69                    
      70                    
      71 00000000                   .sect   ".text"
      72                            .clink
      73                            .global $foo
      74                    
      75                          82 00000000           $foo:
      83 00000000 B57C              PUSH      {A3, A4, V1, V2, V3, LR}

    <code stuff>

     126                            ; |1127| 
     127 0000004c BD7C              POP       {A3, A4, V1, V2, V3, PC}
     128                    
     129                    
     130                    
     131 00000000                   .sect   ".text:v$1"
     132                            .clink
     133 00000000                   .state32

Luken8r:

asm_label:
PUSH {LR}
BL $foo
POP {pc}
BX LR

.end
I would expect a C function of one parameter to take that parameter in R0, not on the stack. Also, that "BX LR" at the end is unreachable. This should do it:
asm_label:
    MOV R0, LR
    BL $foo
    POP {PC}

jasonharper:

Luken8r:

asm_label:
PUSH {LR}
BL $foo
POP {pc}
BX LR

.end
I would expect a C function of one parameter to take that parameter in R0, not on the stack. Also, that "BX LR" at the end is unreachable. This should do it:
asm_label:
MOV R0, LR
BL $foo
POP {PC}

No, I tried that too. At this point I am not passing any arguments to the function, but the final code will pass one argument to foo as an int, so I tried to save the LR to R1 here as nothing is being passed to foo, as well as saving to a regular expression register R4 (which are both used in foo). I also saved LR to some high register that is not touched in foo like:

asm_label:
   	MOV R11, LR
   	
   	BL $foo
   	
   	MOV LR, R11
        POP {PC}
; and MOV pc, lr
; and BX lr

I broke this down a little more and wrote a C function to do what I want so I can see what the listing file looks like

void brtodiv(ui16_t foo){

	if (foo == 0){
	  gohere(); // eventual target function
 	}
 	else{
 		somefunct(); // some other place
 	}
	test(foo);

}

void gohere(void){

  	volatile ui16_t addr = 272;
	volatile ui16_t foo = 0xffed;

  	Wrt2EEP(addr,foo);

}

Nice and easy

The resulting list file looks like this

     198                    ;*****************************************************************************
     199                    ;* FUNCTION NAME: $brtodiv                                                   *
     200                    ;*                                                                           *
     201                    ;*   Regs Modified     : A1,A2,A3,A4,V9,SP,LR,SR                             *
     202                    ;*   Regs Used         : A1,A2,A3,A4,V9,SP,LR,SR                             *
     203                    ;*   Local Frame Size  : 0 Args + 0 Auto + 4 Save = 4 byte                   *
     204                    ;*****************************************************************************
     205 0000002a           $brtodiv:
     206 0000002a B500              PUSH      {LR}
     207 0000002c 2800              CMP       A1, #0                ; |1155| 
     208 0000002e D101              BNE       L1                    ; |1155| 
     209                            ; |1155| 
     210 00000030 F7FF              BL        $gohere            ; |1156| 
         00000032 FFE6     
     211                            ; |1156| 
     212 00000034           L1:    
     213 00000034 F7FF              BL        $test                 ; |1161| 
         00000036 FFF1

Push the LR to stack, do the comparison, if not equal do some stub function, if equal, branch to my target routine

So I tried this in my asm file but still no dice.

I$DIV:	
    PUSH {lr}
    CMP R1, #0
    BNE L1 
	
   	BL $gohere

So as a test, I removed the call to Wrt2EEP(addr,foo); in the gohere() routine and it didnt crash on me. This function is going to write some code foo to an address in EEPROM. Anyway, because this didnt crash, its obviously killing the stack. What am I not passing to the stack from my assembly file?