void readlen(a, b, p) int *a, *b;
char **p;
{
  int t;
  *a = readnump(p);
  if (*a == 0) {
    *a = 1;
  };
  *b = 1;
  if (**p == '/') {
    *p = *p + 1;
    *b = readnump(p);
    if (*b == 0) {
      *b = 2;
      while (**p == '/') {
        *b = *b * 2;
        *p = *p + 1;
      };
    };
  };
  t = *b;
  while (t > 1) {
    if (t % 2 != 0) {
      event_warning("divisor not a power of 2");
      t = 1;
    } else {
      t = t / 2;
    };
  };
}


x86 assembly (clang, -O0):
<readlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <readnump@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    115e <readlen+0x3e>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11fa <readlen+0xda>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <readnump@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11f5 <readlen+0xd5>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    11f0 <readlen+0xd0>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    11b7 <readlen+0x97>
jmp    11f5 <readlen+0xd5>
jmp    11fa <readlen+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jle    124e <readlen+0x12e>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     123b <readlen+0x11b>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1040 <event_warning@plt>
movl   $0x1,-0x1c(%rbp)
jmp    1249 <readlen+0x129>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    1203 <readlen+0xe3>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readlen>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
xor    %eax,%eax
call   1030 <readnump@plt>
test   %eax,%eax
mov    $0x1,%ecx
cmovne %eax,%ecx
mov    %ecx,(%r15)
movl   $0x1,(%r14)
mov    (%rbx),%rax
cmpb   $0x2f,(%rax)
jne    11bf <readlen+0x9f>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <readnump@plt>
mov    %eax,(%r14)
test   %eax,%eax
jne    11a1 <readlen+0x81>
movl   $0x2,(%r14)
mov    (%rbx),%rcx
mov    $0x2,%eax
cmpb   $0x2f,(%rcx)
jne    11b0 <readlen+0x90>
add    $0x1,%rcx
mov    $0x2,%eax
nopl   0x0(%rax)
add    %eax,%eax
mov    %eax,(%r14)
mov    %rcx,(%rbx)
cmpb   $0x2f,(%rcx)
lea    0x1(%rcx),%rcx
je     1190 <readlen+0x70>
cmp    $0x2,%eax
jl     11bf <readlen+0x9f>
cs nopw 0x0(%rax,%rax,1)
test   $0x1,%al
jne    11c5 <readlen+0xa5>
mov    %eax,%ecx
shr    %ecx
cmp    $0x3,%eax
mov    %ecx,%eax
ja     11b0 <readlen+0x90>
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe34(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <event_warning@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"divisor not a power of 2\00"
define void @readlen(i32* %0, i32* %1, i8** %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8** %2, i8*** %6
%8 = load i8**, i8*** %6
%9 = call i32 (i8**, ...) bitcast (i32 (...)* @readnump to i32 (i8**, ...)*)(i8** %8)
%10 = load i32*, i32** %4
store i32 %9, i32* %10
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i32*, i32** %4
store i32 1, i32* %15
br label %16
16: ; preds = %14, %3
%17 = load i32*, i32** %5
store i32 1, i32* %17
%18 = load i8**, i8*** %6
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 47
br i1 %22, label %23, label %53
23: ; preds = %16
%24 = load i8**, i8*** %6
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8**, i8*** %6
store i8* %26, i8** %27
%28 = load i8**, i8*** %6
%29 = call i32 (i8**, ...) bitcast (i32 (...)* @readnump to i32 (i8**, ...)*)(i8** %28)
%30 = load i32*, i32** %5
store i32 %29, i32* %30
%31 = load i32*, i32** %5
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %52
34: ; preds = %23
%35 = load i32*, i32** %5
store i32 2, i32* %35
br label %36
36: ; preds = %42, %34
%37 = load i8**, i8*** %6
%38 = load i8*, i8** %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 47
br i1 %41, label %42, label %51
42: ; preds = %36
%43 = load i32*, i32** %5
%44 = load i32, i32* %43
%45 = mul nsw i32 %44, 2
%46 = load i32*, i32** %5
store i32 %45, i32* %46
%47 = load i8**, i8*** %6
%48 = load i8*, i8** %47
%49 = getelementptr inbounds i8, i8* %48, i64 1
%50 = load i8**, i8*** %6
store i8* %49, i8** %50
br label %36
51: ; preds = %36
br label %52
52: ; preds = %51, %23
br label %53
53: ; preds = %52, %16
%54 = load i32*, i32** %5
%55 = load i32, i32* %54
store i32 %55, i32* %7
br label %56
56: ; preds = %68, %53
%57 = load i32, i32* %7
%58 = icmp sgt i32 %57, 1
br i1 %58, label %59, label %69
59: ; preds = %56
%60 = load i32, i32* %7
%61 = srem i32 %60, 2
%62 = icmp ne i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %7
br label %68
65: ; preds = %59
%66 = load i32, i32* %7
%67 = sdiv i32 %66, 2
store i32 %67, i32* %7
br label %68
68: ; preds = %65, %63
br label %56
69: ; preds = %56
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"divisor not a power of 2\00"
define void @readlen(i32* nocapture writeonly %0, i32* nocapture %1, i8** %2) {
%4 = tail call i32 (i8**, ...) bitcast (i32 (...)* @readnump to i32 (i8**, ...)*)(i8** %2)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 1, i32 %4
store i32 %6, i32* %0
store i32 1, i32* %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 47
br i1 %9, label %10, label %39
10: ; preds = %3
%11 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %11, i8** %2
%12 = tail call i32 (i8**, ...) bitcast (i32 (...)* @readnump to i32 (i8**, ...)*)(i8** %2)
store i32 %12, i32* %1
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %10
store i32 2, i32* %1
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 47
br i1 %17, label %18, label %28
18: ; preds = %14, %18
%19 = phi i32 [ %21, %18 ], [ 2, %14 ]
%20 = phi i8* [ %22, %18 ], [ %15, %14 ]
%21 = shl nsw i32 %19, 1
store i32 %21, i32* %1
%22 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %22, i8** %2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 47
br i1 %24, label %18, label %25
25: ; preds = %18, %10
%26 = phi i32 [ %12, %10 ], [ %21, %18 ]
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %39
28: ; preds = %14, %25
%29 = phi i32 [ 2, %14 ], [ %26, %25 ]
br label %30
30: ; preds = %28, %36
%31 = phi i32 [ %37, %36 ], [ %29, %28 ]
%32 = and i32 %31, 1
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = tail call i32 (i8*, ...) bitcast (i32 (...)* @event_warning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %39
36: ; preds = %30
%37 = lshr i32 %31, 1
%38 = icmp ugt i32 %31, 3
br i1 %38, label %30, label %39
39: ; preds = %36, %3, %34, %25
ret void
}