#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 */
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, unsigned long *, unsigned long *);
int main() {
  unsigned long int a, b, count, c;
  while (scanf("%lu %lu", &a, &b) == 2 && (a != 0 || b != 0)) {
    count = c = 0;
    while (a || b) {
      c = (a % 10 + b % 10 + c) / 10;
      a = a / 10;
      b = b / 10;
      count = count + c;
    }
    if (count == 0)
      printf("No carry operation.\n");
    else if (count == 1)
      printf("1 carry operation.\n");
    else
      printf("%lu carry operations.\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
mov    %al,-0x29(%rbp)
jne    1174 <main+0x54>
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x2a(%rbp)
jne    116e <main+0x4e>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1184 <main+0x64>
jmp    1285 <main+0x165>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x2b(%rbp)
jne    11af <main+0x8f>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x2b(%rbp)
mov    -0x2b(%rbp),%al
test   $0x1,%al
jne    11bf <main+0x9f>
jmp    122d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x38(%rbp),%rax
add    %rdx,%rax
add    -0x28(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1194 <main+0x74>
cmpq   $0x0,-0x20(%rbp)
jne    124b <main+0x12b>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
cmpq   $0x1,-0x20(%rbp)
jne    1269 <main+0x149>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127b <main+0x15b>
mov    -0x20(%rbp),%rsi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x160>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    1261 <main+0x131>
movabs $0xcccccccccccccccd,%r14
cc cc cc
lea    0xe92(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
jmp    11a5 <main+0x75>
nopw   0x0(%rax,%rax,1)
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <scanf@plt>
cmp    $0x2,%eax
jne    1261 <main+0x131>
mov    0x10(%rsp),%r9
mov    0x8(%rsp),%rdi
mov    %r9,%rax
or     %rdi,%rax
je     1261 <main+0x131>
xor    %ebp,%ebp
xor    %esi,%esi
nop
mov    %rdi,%r8
mov    %r9,%rbx
mov    %r9,%rax
mul    %r14
mov    %rdx,%r9
shr    $0x3,%r9
lea    (%r9,%r9,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rbx,%rcx
sub    %rax,%rcx
mov    %rdi,%rax
mul    %r14
add    %rbp,%rcx
mov    %rdx,%rdi
shr    $0x3,%rdi
lea    (%rdi,%rdi,1),%rax
lea    (%rax,%rax,4),%rdx
mov    %r8,%rax
sub    %rdx,%rax
add    %rcx,%rax
mul    %r14
mov    %rdx,%rbp
shr    $0x3,%rbp
add    %rbp,%rsi
cmp    $0x9,%rbx
ja     11c0 <main+0x90>
cmp    $0x9,%r8
ja     11c0 <main+0x90>
mov    %r9,0x10(%rsp)
mov    %rdi,0x8(%rsp)
cmp    $0x1,%rsi
je     1250 <main+0x120>
test   %rsi,%rsi
jne    1180 <main+0x50>
lea    0xdf7(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <main+0x5e>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xdc8(%rip),%rdi
call   1030 <puts@plt>
jmp    118e <main+0x5e>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%lu %lu\00"
@.str.1 = [21 x i8] c"No carry operation.\0A\00"
@.str.2 = [20 x i8] c"1 carry operation.\0A\00"
@.str.3 = [23 x i8] c"%lu carry operations.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
br label %6
6: ; preds = %58, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = load i64, i64* %2
%11 = icmp ne i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i64, i64* %3
%14 = icmp ne i64 %13, 0
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ true, %9 ], [ %14, %12 ]
br label %17
17: ; preds = %15, %6
%18 = phi i1 [ false, %6 ], [ %16, %15 ]
br i1 %18, label %19, label %59
19: ; preds = %17
store i64 0, i64* %5
store i64 0, i64* %4
br label %20
20: ; preds = %28, %19
%21 = load i64, i64* %2
%22 = icmp ne i64 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i64, i64* %3
%25 = icmp ne i64 %24, 0
br label %26
26: ; preds = %23, %20
%27 = phi i1 [ true, %20 ], [ %25, %23 ]
br i1 %27, label %28, label %44
28: ; preds = %26
%29 = load i64, i64* %2
%30 = urem i64 %29, 10
%31 = load i64, i64* %3
%32 = urem i64 %31, 10
%33 = add i64 %30, %32
%34 = load i64, i64* %5
%35 = add i64 %33, %34
%36 = udiv i64 %35, 10
store i64 %36, i64* %5
%37 = load i64, i64* %2
%38 = udiv i64 %37, 10
store i64 %38, i64* %2
%39 = load i64, i64* %3
%40 = udiv i64 %39, 10
store i64 %40, i64* %3
%41 = load i64, i64* %4
%42 = load i64, i64* %5
%43 = add i64 %41, %42
store i64 %43, i64* %4
br label %20
44: ; preds = %26
%45 = load i64, i64* %4
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %58
49: ; preds = %44
%50 = load i64, i64* %4
%51 = icmp eq i64 %50, 1
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %57
54: ; preds = %49
%55 = load i64, i64* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %55)
br label %57
57: ; preds = %54, %52
br label %58
58: ; preds = %57, %47
br label %6
59: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%lu %lu\00"
@.str.3 = [23 x i8] c"%lu carry operations.\0A\00"
@str = [19 x i8] c"1 carry operation.\00"
@str.4 = [20 x i8] c"No carry operation.\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = bitcast i64* %1 to i8*
%4 = bitcast i64* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %39
7: ; preds = %0, %36
%8 = load i64, i64* %1
%9 = icmp ne i64 %8, 0
%10 = load i64, i64* %2
%11 = icmp ne i64 %10, 0
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %13, label %39
13: ; preds = %7, %13
%14 = phi i64 [ %22, %13 ], [ 0, %7 ]
%15 = phi i64 [ %25, %13 ], [ 0, %7 ]
%16 = phi i64 [ %23, %13 ], [ %8, %7 ]
%17 = phi i64 [ %24, %13 ], [ %10, %7 ]
%18 = urem i64 %16, 10
%19 = urem i64 %17, 10
%20 = add nuw nsw i64 %18, %14
%21 = add nuw nsw i64 %20, %19
%22 = udiv i64 %21, 10
%23 = udiv i64 %16, 10
%24 = udiv i64 %17, 10
%25 = add i64 %22, %15
%26 = icmp ugt i64 %16, 9
%27 = icmp ugt i64 %17, 9
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %13, label %29
29: ; preds = %13
store i64 %23, i64* %1
store i64 %24, i64* %2
switch i64 %25, label %34 [
i64 0, label %30
i64 1, label %32
]
30: ; preds = %29
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
br label %36
32: ; preds = %29
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %36
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %25)
br label %36
36: ; preds = %32, %34, %30
%37 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%38 = icmp eq i32 %37, 2
br i1 %38, label %7, label %39
39: ; preds = %7, %36, %0
ret i32 0
}