void validate_lease_params(int lease_ms, int op_max_ms) {
  if (lease_ms <= 0 || op_max_ms <= 0 || lease_ms < op_max_ms ||
      op_max_ms < 1000 || op_max_ms % 1000 != 0)
    panic(__FUNCTION__, "bad lease/op max timeouts");
}


x86 assembly (clang, -O0):
<validate_lease_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    115f <validate_lease_params+0x4f>
cmpl   $0x0,-0x8(%rbp)
jle    115f <validate_lease_params+0x4f>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     115f <validate_lease_params+0x4f>
cmpl   $0x3e8,-0x8(%rbp)
jl     115f <validate_lease_params+0x4f>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1174 <validate_lease_params+0x64>
lea    0xe9a(%rip),%rdi
lea    0xea9(%rip),%rsi
mov    $0x0,%al
call   1030 <panic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_lease_params>:
test   %edi,%edi
jle    113c <validate_lease_params+0x2c>
test   %esi,%esi
jle    113c <validate_lease_params+0x2c>
cmp    %esi,%edi
jb     113c <validate_lease_params+0x2c>
cmp    $0x3e8,%esi
jb     113c <validate_lease_params+0x2c>
mov    %esi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
imul   $0x3e8,%eax,%eax
sub    %eax,%esi
jne    113c <validate_lease_params+0x2c>
ret
lea    0xebd(%rip),%rdi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
jmp    1030 <panic@plt>

LLVM IR (-O0):
@__FUNCTION__.validate_lease_params = [22 x i8] c"validate_lease_params\00"
@.str = [26 x i8] c"bad lease/op max timeouts\00"
define void @validate_lease_params(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 0
br i1 %6, label %21, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp sle i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %21, label %14
14: ; preds = %10
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 1000
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = srem i32 %18, 1000
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %17, %14, %10, %7, %2
%22 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @panic to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.validate_lease_params, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
@__FUNCTION__.validate_lease_params = [22 x i8] c"validate_lease_params\00"
@.str = [26 x i8] c"bad lease/op max timeouts\00"
define void @validate_lease_params(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
%4 = icmp slt i32 %1, 1
%5 = or i1 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = icmp uge i32 %0, %1
%8 = icmp ugt i32 %1, 999
%9 = and i1 %7, %8
%10 = urem i32 %1, 1000
%11 = icmp eq i32 %10, 0
%12 = and i1 %9, %11
br i1 %12, label %15, label %13
13: ; preds = %6, %2
%14 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @panic to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__FUNCTION__.validate_lease_params, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %6, %13
ret void
}