#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
long long calculate(int, int);
int /*<<< orphan*/ printf(char *, int, int, long long);
scalar_t__ scanf(char *, int *, int *);
int main() {
  int n, m;
  while (scanf("%i %i", &n, &m)) {
    if (n == 0 && m == 0) {
      break;
    }
    long long int c = calculate(n, m);
    printf("%i things taken %i at a time is %lld exactly.\n", n, m, c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x0,%rax
je     11a0 <main+0x70>
cmpl   $0x0,-0x8(%rbp)
jne    1176 <main+0x46>
cmpl   $0x0,-0xc(%rbp)
jne    1176 <main+0x46>
jmp    11a0 <main+0x70>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <calculate@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xec1(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
test   %rax,%rax
je     11a7 <main+0x77>
lea    0xeae(%rip),%r14
lea    0xea1(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %edi,%eax
or     %esi,%eax
je     11a7 <main+0x77>
call   1040 <calculate@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
mov    %r14,%rdi
mov    %rax,%rcx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
test   %rax,%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [47 x i8] c"%i things taken %i at a time is %lld exactly.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
br label %5
5: ; preds = %15, %0
%6 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
br label %23
15: ; preds = %11, %8
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = call i64 @calculate(i32 %16, i32 %17)
store i64 %18, i64* %4
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = load i64, i64* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i64 %21)
br label %5
23: ; preds = %14, %5
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [47 x i8] c"%i things taken %i at a time is %lld exactly.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %0, %13
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %20, label %13
13: ; preds = %7
%14 = call i64 @calculate(i32 %8, i32 %10)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16, i64 %14)
%18 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %7
20: ; preds = %13, %7, %0
ret i32 0
}