int calculation(int input, int *a_hundred, int *a_fifty, int *a_twenty,
                int *a_ten) {
  if (input % 10 == 0) {
    *a_hundred = input / 100;
    *a_fifty = (input % 100) / 50;
    *a_twenty = ((input % 100) % 50) / 20;
    *a_ten = (((input % 100) % 50) % 20) / 10;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<calculation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b8 <calculation+0xb8>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    11bf <calculation+0xbf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculation>:
imul   $0xcccccccd,%edi,%eax
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
jbe    1117 <calculation+0x17>
xor    %eax,%eax
ret
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%r9
shr    $0x3f,%r9
sar    $0x25,%rax
add    %r9d,%eax
mov    %eax,(%rsi)
imul   $0x64,%eax,%eax
sub    %eax,%edi
movsbl %dil,%eax
lea    (%rax,%rax,4),%esi
lea    (%rax,%rsi,8),%eax
movzwl %ax,%eax
movswl %ax,%esi
shr    $0xf,%eax
shr    $0xb,%esi
add    %al,%sil
movsbl %sil,%eax
mov    %eax,(%rdx)
movzbl %al,%eax
imul   $0x32,%eax,%eax
sub    %al,%dil
movsbl %dil,%eax
imul   $0x67,%eax,%edx
movzwl %dx,%esi
shr    $0xb,%edx
shr    $0xf,%esi
add    %dl,%sil
movsbl %sil,%edx
mov    %edx,(%rcx)
movzbl %dl,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%eax
imul   $0x67,%eax,%eax
movzwl %ax,%ecx
shr    $0xa,%eax
shr    $0xf,%ecx
add    %al,%cl
movsbl %cl,%eax
mov    %eax,(%r8)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @calculation(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
store i32 %0, i32* %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
%12 = load i32, i32* %7
%13 = srem i32 %12, 10
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %5
%16 = load i32, i32* %7
%17 = sdiv i32 %16, 100
%18 = load i32*, i32** %8
store i32 %17, i32* %18
%19 = load i32, i32* %7
%20 = srem i32 %19, 100
%21 = sdiv i32 %20, 50
%22 = load i32*, i32** %9
store i32 %21, i32* %22
%23 = load i32, i32* %7
%24 = srem i32 %23, 100
%25 = srem i32 %24, 50
%26 = sdiv i32 %25, 20
%27 = load i32*, i32** %10
store i32 %26, i32* %27
%28 = load i32, i32* %7
%29 = srem i32 %28, 100
%30 = srem i32 %29, 50
%31 = srem i32 %30, 20
%32 = sdiv i32 %31, 10
%33 = load i32*, i32** %11
store i32 %32, i32* %33
br label %35
34: ; preds = %5
store i32 0, i32* %6
br label %35
35: ; preds = %34, %15
%36 = load i32, i32* %6
ret i32 %36
}

LLVM IR (-O2):
define i32 @calculation(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = srem i32 %0, 10
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = sdiv i32 %0, 100
store i32 %9, i32* %1
%10 = srem i32 %0, 100
%11 = trunc i32 %10 to i8
%12 = sdiv i8 %11, 50
%13 = sext i8 %12 to i32
store i32 %13, i32* %2
%14 = srem i8 %11, 50
%15 = sdiv i8 %14, 20
%16 = sext i8 %15 to i32
store i32 %16, i32* %3
%17 = srem i8 %14, 20
%18 = sdiv i8 %17, 10
%19 = sext i8 %18 to i32
store i32 %19, i32* %4
br label %20
20: ; preds = %5, %8
ret i32 0
}