void get_chunk_info(int ndata, int *nchunks, int *chunksize) {
  static const int chunksize_min = 100, nchunks_max = 10;
  *chunksize = (((chunksize_min) > ((ndata + nchunks_max - 1) / nchunks_max))
                    ? (chunksize_min)
                    : ((ndata + nchunks_max - 1) / nchunks_max));
  if ((*chunksize) & 1)
    ++(*chunksize);
  *nchunks = (ndata + *chunksize - 1) / *chunksize;
}


x86 assembly (clang, -O0):
<get_chunk_info>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa,%eax
sub    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %ecx,%eax
jle    113c <get_chunk_info+0x3c>
mov    $0x64,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <get_chunk_info+0x50>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
sub    $0x1,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1176 <get_chunk_info+0x76>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
add    (%rcx),%eax
sub    $0x1,%eax
mov    -0x18(%rbp),%rcx
cltd
idivl  (%rcx)
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_chunk_info>:
mov    $0x64,%eax
cmp    $0x3df,%edi
jl     111d <get_chunk_info+0x1d>
lea    0x9(%rdi),%ecx
mov    $0xcccccccd,%eax
imul   %rcx,%rax
shr    $0x23,%rax
mov    %eax,%ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %ecx,(%rdx)
lea    (%rdi,%rcx,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %ecx
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
@get_chunk_info.chunksize_min = internal constant i32 100
@get_chunk_info.nchunks_max = internal constant i32 10
define void @get_chunk_info(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 10
%9 = sub nsw i32 %8, 1
%10 = sdiv i32 %9, 10
%11 = icmp sgt i32 100, %10
br i1 %11, label %12, label %13
12: ; preds = %3
br label %18
13: ; preds = %3
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 10
%16 = sub nsw i32 %15, 1
%17 = sdiv i32 %16, 10
br label %18
18: ; preds = %13, %12
%19 = phi i32 [ 100, %12 ], [ %17, %13 ]
%20 = load i32*, i32** %6
store i32 %19, i32* %20
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = and i32 %22, 1
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = load i32*, i32** %6
%27 = load i32, i32* %26
%28 = add nsw i32 %27, 1
store i32 %28, i32* %26
br label %29
29: ; preds = %25, %18
%30 = load i32, i32* %4
%31 = load i32*, i32** %6
%32 = load i32, i32* %31
%33 = add nsw i32 %30, %32
%34 = sub nsw i32 %33, 1
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = sdiv i32 %34, %36
%38 = load i32*, i32** %5
store i32 %37, i32* %38
ret void
}

LLVM IR (-O2):
define void @get_chunk_info(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = icmp slt i32 %0, 991
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = add nuw nsw i32 %0, 9
%7 = udiv i32 %6, 10
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %7, %5 ], [ 100, %3 ]
%10 = and i32 %9, 1
%11 = add nuw nsw i32 %10, %9
store i32 %11, i32* %2
%12 = add i32 %0, -1
%13 = add i32 %12, %11
%14 = sdiv i32 %13, %11
store i32 %14, i32* %1
ret void
}