static void __lll_mutex_lock(int *futex) { int lws_errno = 14; int lws_ret; asm ( "0: \n\t" "copy %3, %%r26 \n\t" "copy %4, %%r25 \n\t" "copy %5, %%r24 \n\t" "ble " "0xb0" "(%%sr2, %%r0) \n\t" "ldi " "0" ", %%r20 \n\t" "cmpib,=,n " "11" ",%%r21,0b \n\t" "nop \n\t" "copy %%r28, %0 /* here */ \n\t" "sub %%r0, %%r21, %%r21 \n\t" "copy %%r21, %1 /* here */ \n\t" : "=r" (lws_ret), "=r"(lws_errno), "=m"(*futex) : "r"(futex), "r"(0), "r"(1) :"r1", "r26", "r25", "r24", "r23", "r22", "r21", "r20", "r28", "r31", "memory" ); } typedef struct { char *_IO_write_end; int lock; } _IO_FILE; __attribute__ ((__nothrow__)) __attribute__ ((noinline)) static int buffered_vfprintf(_IO_FILE *s) { char buf[8192]; _IO_FILE *hp; hp->_IO_write_end = buf; __lll_mutex_lock(&s->lock); } void foo(_IO_FILE *s) { buffered_vfprintf(s); }