#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 *, ...);
scalar_t__ scanf(char *, unsigned long *, unsigned long *);
int main() {
  unsigned long int a, b, count, c;
  while (scanf("%lu %lu", &a, &b) && 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    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     1170 <main+0x50>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x29(%rbp)
je     1170 <main+0x50>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1180 <main+0x60>
jmp    1281 <main+0x161>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x2a(%rbp)
jne    11ab <main+0x8b>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x2a(%rbp)
mov    -0x2a(%rbp),%al
test   $0x1,%al
jne    11bb <main+0x9b>
jmp    1229 <main+0x109>
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    1190 <main+0x70>
cmpq   $0x0,-0x20(%rbp)
jne    1247 <main+0x127>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <main+0x15c>
cmpq   $0x1,-0x20(%rbp)
jne    1265 <main+0x145>
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x157>
mov    -0x20(%rbp),%rsi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <main+0x15c>
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>
test   %rax,%rax
je     126f <main+0x13f>
mov    0x10(%rsp),%rcx
test   %rcx,%rcx
je     126f <main+0x13f>
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     126f <main+0x13f>
movabs $0xcccccccccccccccd,%r14
cc cc cc
lea    0xe76(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
xor    %ebp,%ebp
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
mov    %rdi,%r8
mov    %rcx,%r9
mov    %rcx,%rax
mul    %r14
mov    %rdx,%rcx
shr    $0x3,%rcx
lea    (%rcx,%rcx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %r9,%rbx
sub    %rax,%rbx
mov    %rdi,%rax
mul    %r14
add    %rbp,%rbx
mov    %rdx,%rdi
shr    $0x3,%rdi
lea    (%rdi,%rdi,1),%rax
lea    (%rax,%rax,4),%rdx
mov    %r8,%rax
sub    %rdx,%rax
add    %rbx,%rax
mul    %r14
mov    %rdx,%rbp
shr    $0x3,%rbp
add    %rbp,%rsi
cmp    $0x9,%r9
ja     11a0 <main+0x70>
cmp    $0x9,%r8
ja     11a0 <main+0x70>
mov    %rcx,0x10(%rsp)
mov    %rdi,0x8(%rsp)
cmp    $0x1,%rsi
je     121e <main+0xee>
test   %rsi,%rsi
jne    122c <main+0xfc>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
jmp    123a <main+0x10a>
lea    0xdfa(%rip),%rdi
call   1030 <puts@plt>
jmp    123a <main+0x10a>
lea    0xdd5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <scanf@plt>
test   %rax,%rax
je     126f <main+0x13f>
mov    0x10(%rsp),%rcx
test   %rcx,%rcx
je     126f <main+0x13f>
mov    0x8(%rsp),%rdi
mov    $0x0,%ebp
mov    $0x0,%esi
test   %rdi,%rdi
jne    11a0 <main+0x70>
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 = %56, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %2, i64* %3)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load i64, i64* %2
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i64, i64* %3
%14 = icmp ne i64 %13, 0
br label %15
15: ; preds = %12, %9, %6
%16 = phi i1 [ false, %9 ], [ false, %6 ], [ %14, %12 ]
br i1 %16, label %17, label %57
17: ; preds = %15
store i64 0, i64* %5
store i64 0, i64* %4
br label %18
18: ; preds = %26, %17
%19 = load i64, i64* %2
%20 = icmp ne i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i64, i64* %3
%23 = icmp ne i64 %22, 0
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ true, %18 ], [ %23, %21 ]
br i1 %25, label %26, label %42
26: ; preds = %24
%27 = load i64, i64* %2
%28 = urem i64 %27, 10
%29 = load i64, i64* %3
%30 = urem i64 %29, 10
%31 = add i64 %28, %30
%32 = load i64, i64* %5
%33 = add i64 %31, %32
%34 = udiv i64 %33, 10
store i64 %34, i64* %5
%35 = load i64, i64* %2
%36 = udiv i64 %35, 10
store i64 %36, i64* %2
%37 = load i64, i64* %3
%38 = udiv i64 %37, 10
store i64 %38, i64* %3
%39 = load i64, i64* %4
%40 = load i64, i64* %5
%41 = add i64 %39, %40
store i64 %41, i64* %4
br label %18
42: ; preds = %24
%43 = load i64, i64* %4
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %56
47: ; preds = %42
%48 = load i64, i64* %4
%49 = icmp eq i64 %48, 1
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %55
52: ; preds = %47
%53 = load i64, i64* %4
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %53)
br label %55
55: ; preds = %52, %50
br label %56
56: ; preds = %55, %45
br label %6
57: ; preds = %15
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 i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%6 = icmp ne i64 %5, 0
%7 = load i64, i64* %1
%8 = icmp ne i64 %7, 0
%9 = select i1 %6, i1 %8, i1 false
%10 = load i64, i64* %2
%11 = icmp ne i64 %10, 0
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %13, label %50
13: ; preds = %0, %29
%14 = phi i64 [ %30, %29 ], [ 0, %0 ]
%15 = phi i64 [ %31, %29 ], [ 0, %0 ]
%16 = phi i64 [ %32, %29 ], [ %7, %0 ]
%17 = phi i64 [ %33, %29 ], [ %10, %0 ]
%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 %29, label %34
29: ; preds = %13, %41
%30 = phi i64 [ %22, %13 ], [ 0, %41 ]
%31 = phi i64 [ %25, %13 ], [ 0, %41 ]
%32 = phi i64 [ %23, %13 ], [ %44, %41 ]
%33 = phi i64 [ %24, %13 ], [ %47, %41 ]
br label %13
34: ; preds = %13
store i64 %23, i64* %1
store i64 %24, i64* %2
switch i64 %25, label %39 [
i64 0, label %35
i64 1, label %37
]
35: ; preds = %34
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
br label %41
37: ; preds = %34
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %41
39: ; preds = %34
%40 = 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 %41
41: ; preds = %37, %39, %35
%42 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%43 = icmp ne i64 %42, 0
%44 = load i64, i64* %1
%45 = icmp ne i64 %44, 0
%46 = select i1 %43, i1 %45, i1 false
%47 = load i64, i64* %2
%48 = icmp ne i64 %47, 0
%49 = select i1 %46, i1 %48, i1 false
br i1 %49, label %29, label %50
50: ; preds = %41, %0
ret i32 0
}