void something(int x, int y, int lev) {
  int item_id, item_arg;
  if (lev < 0 || lev > (16 + 5 - 1))
    return;
  do {
    item_id = newobject(lev, &item_arg);
    createitem(x, y, item_id, (long)item_arg);
  } while (((int)(rand() % (101)) + 1) < 8);
}


x86 assembly (clang, -O0):
<something>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1155 <something+0x25>
cmpl   $0x14,-0xc(%rbp)
jle    115a <something+0x2a>
jmp    119f <something+0x6f>
jmp    115f <something+0x2f>
mov    -0xc(%rbp),%edi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1030 <newobject@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%edx
movslq -0x14(%rbp),%rcx
mov    $0x0,%al
call   1040 <createitem@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x65,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
cmp    $0x8,%edx
jl     115f <something+0x2f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<something>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    $0x14,%edx
ja     1196 <something+0x66>
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
lea    0x4(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <newobject@plt>
movslq 0x4(%rsp),%rcx
mov    %ebp,%edi
mov    %r14d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <createitem@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x288df0cb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x24,%rcx
add    %edx,%ecx
imul   $0x65,%ecx,%ecx
sub    %ecx,%eax
cmp    $0x7,%eax
jl     1150 <something+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @something(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %3
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 20
br i1 %13, label %14, label %15
14: ; preds = %11, %3
br label %30
15: ; preds = %11
br label %16
16: ; preds = %25, %15
%17 = load i32, i32* %6
%18 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @newobject to i32 (i32, i32*, ...)*)(i32 %17, i32* %8)
store i32 %18, i32* %7
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = call i32 (i32, i32, i32, i64, ...) bitcast (i32 (...)* @createitem to i32 (i32, i32, i32, i64, ...)*)(i32 %19, i32 %20, i32 %21, i64 %23)
br label %25
25: ; preds = %16
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 101
%28 = add nsw i32 %27, 1
%29 = icmp slt i32 %28, 8
br i1 %29, label %16, label %30
30: ; preds = %14, %25
ret void
}

LLVM IR (-O2):
define void @something(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = icmp ugt i32 %2, 20
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @newobject to i32 (i32, i32*, ...)*)(i32 %2, i32* %4)
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = call i32 (i32, i32, i32, i64, ...) bitcast (i32 (...)* @createitem to i32 (i32, i32, i32, i64, ...)*)(i32 %0, i32 %1, i32 %8, i64 %10)
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 101
%14 = icmp slt i32 %13, 7
br i1 %14, label %7, label %15
15: ; preds = %7, %3
ret void
}