void stm_wait(void) {
  int i;
  for (i = 0; i < 50; i++) {
    asm("nop" ::: "memory");
  }
}


x86 assembly (clang, -O0):
<stm_wait>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    1124 <stm_wait+0x24>
nop
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <stm_wait+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stm_wait>:
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
ret

LLVM IR (-O0):
define void @stm_wait() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 50
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @stm_wait() {
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}