_Bool parse_layout_coordinate(const char *fmt, int *val, const int max) {
  long v;
  const char *e = fmt;
  if (!strcasecmp(fmt, "FILL")) {
    *val = (-1);
    return 1;
  }
  v = strtol(fmt, (char **)&e, 10);
  if (e == fmt)
    return 0;
  if (*e == '%')
    *val = xround(max * v / 100.0);
  else
    *val = v;
  if (!((*val) >= (0) && (*val) <= (max))) {
    internal_logit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                   "outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/"
                   "heads/lyrics/interface_elements.c",
                   875, __FUNCTION__,
                   "Coordinate out of range - %d is not in (0, %d)", *val, max);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<parse_layout_coordinate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1187 <parse_layout_coordinate+0x47>
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
movb   $0x1,-0x1(%rbp)
jmp    1253 <parse_layout_coordinate+0x113>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11b4 <parse_layout_coordinate+0x74>
movb   $0x0,-0x1(%rbp)
jmp    1253 <parse_layout_coordinate+0x113>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    11f2 <parse_layout_coordinate+0xb2>
movslq -0x1c(%rbp),%rax
imul   -0x28(%rbp),%rax
cvtsi2sd %rax,%xmm0
movsd  0xe26(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x1,%al
call   1040 <xround@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11fe <parse_layout_coordinate+0xbe>
mov    -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jl     121a <parse_layout_coordinate+0xda>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jle    124f <parse_layout_coordinate+0x10f>
mov    -0x18(%rbp),%rax
mov    (%rax),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xde1(%rip),%rdi
mov    $0x36b,%esi
lea    0xe69(%rip),%rdx
lea    0xe7a(%rip),%rcx
mov    $0x0,%al
call   1060 <internal_logit@plt>
movb   $0x0,-0x1(%rbp)
jmp    1253 <parse_layout_coordinate+0x113>
movb   $0x1,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_layout_coordinate>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rdi,0x8(%rsp)
lea    0xeab(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11da <parse_layout_coordinate+0x9a>
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    0x8(%rsp),%rcx
cmp    %rbp,%rcx
je     11e4 <parse_layout_coordinate+0xa4>
cmpb   $0x25,(%rcx)
jne    11a2 <parse_layout_coordinate+0x62>
movslq %r14d,%rcx
imul   %rcx,%rax
cvtsi2sd %rax,%xmm0
divsd  0xe65(%rip),%xmm0
mov    $0x1,%al
call   1040 <xround@plt>
mov    %eax,(%rbx)
test   %eax,%eax
js     11af <parse_layout_coordinate+0x6f>
mov    $0x1,%bl
cmp    %r14d,%eax
jle    11e6 <parse_layout_coordinate+0xa6>
lea    0xe57(%rip),%rdi
lea    0xee4(%rip),%rdx
lea    0xef5(%rip),%rcx
xor    %ebx,%ebx
mov    $0x36b,%esi
mov    %eax,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1060 <internal_logit@plt>
jmp    11e6 <parse_layout_coordinate+0xa6>
movl   $0xffffffff,(%rbx)
mov    $0x1,%bl
jmp    11e6 <parse_layout_coordinate+0xa6>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"FILL\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/interface_elements.c\00"
@__FUNCTION__.parse_layout_coordinate = [24 x i8] c"parse_layout_coordinate\00"
@.str.2 = [47 x i8] c"Coordinate out of range - %d is not in (0, %d)\00"
define zeroext i1 @parse_layout_coordinate(i8* %0, i32* %1, i32 %2) {
%4 = alloca i1
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %5
store i8* %10, i8** %9
%11 = load i8*, i8** %5
%12 = call i32 @strcasecmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %3
%15 = load i32*, i32** %6
store i32 -1, i32* %15
store i1 true, i1* %4
br label %56
16: ; preds = %3
%17 = load i8*, i8** %5
%18 = call i64 @strtol(i8* %17, i8** %9, i32 10)
store i64 %18, i64* %8
%19 = load i8*, i8** %9
%20 = load i8*, i8** %5
%21 = icmp eq i8* %19, %20
br i1 %21, label %22, label %23
22: ; preds = %16
store i1 false, i1* %4
br label %56
23: ; preds = %16
%24 = load i8*, i8** %9
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 37
br i1 %27, label %28, label %37
28: ; preds = %23
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = load i64, i64* %8
%32 = mul nsw i64 %30, %31
%33 = sitofp i64 %32 to double
%34 = fdiv double %33, 1.000000e+02
%35 = call i32 (double, ...) bitcast (i32 (...)* @xround to i32 (double, ...)*)(double %34)
%36 = load i32*, i32** %6
store i32 %35, i32* %36
br label %41
37: ; preds = %23
%38 = load i64, i64* %8
%39 = trunc i64 %38 to i32
%40 = load i32*, i32** %6
store i32 %39, i32* %40
br label %41
41: ; preds = %37, %28
%42 = load i32*, i32** %6
%43 = load i32, i32* %42
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i32*, i32** %6
%47 = load i32, i32* %46
%48 = load i32, i32* %7
%49 = icmp sle i32 %47, %48
br i1 %49, label %55, label %50
50: ; preds = %45, %41
%51 = load i32*, i32** %6
%52 = load i32, i32* %51
%53 = load i32, i32* %7
%54 = call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 875, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__FUNCTION__.parse_layout_coordinate, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %52, i32 %53)
store i1 false, i1* %4
br label %56
55: ; preds = %45
store i1 true, i1* %4
br label %56
56: ; preds = %55, %50, %22, %14
%57 = load i1, i1* %4
ret i1 %57
}

LLVM IR (-O2):
@.str = [5 x i8] c"FILL\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/christophgysin/moc/refs/heads/lyrics/interface_elements.c\00"
@__FUNCTION__.parse_layout_coordinate = [24 x i8] c"parse_layout_coordinate\00"
@.str.2 = [47 x i8] c"Coordinate out of range - %d is not in (0, %d)\00"
define zeroext i1 @parse_layout_coordinate(i8* %0, i32* nocapture %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
store i8* %0, i8** %4
%6 = tail call i32 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %3
store i32 -1, i32* %1
br label %31
9: ; preds = %3
%10 = call i64 @strtol(i8* %0, i8** %4, i32 10)
%11 = load i8*, i8** %4
%12 = icmp eq i8* %11, %0
br i1 %12, label %31, label %13
13: ; preds = %9
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 37
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = sext i32 %2 to i64
%18 = mul nsw i64 %10, %17
%19 = sitofp i64 %18 to double
%20 = fdiv double %19, 1.000000e+02
%21 = tail call i32 (double, ...) bitcast (i32 (...)* @xround to i32 (double, ...)*)(double %20)
br label %24
22: ; preds = %13
%23 = trunc i64 %10 to i32
br label %24
24: ; preds = %22, %16
%25 = phi i32 [ %23, %22 ], [ %21, %16 ]
store i32 %25, i32* %1
%26 = icmp slt i32 %25, 0
%27 = icmp sgt i32 %25, %2
%28 = or i1 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %24
%30 = tail call i32 (i8*, i32, i8*, i8*, i32, i32, ...) bitcast (i32 (...)* @internal_logit to i32 (i8*, i32, i8*, i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 875, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @__FUNCTION__.parse_layout_coordinate, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %2)
br label %31
31: ; preds = %24, %9, %29, %8
%32 = phi i1 [ false, %29 ], [ true, %8 ], [ false, %9 ], [ true, %24 ]
ret i1 %32
}