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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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,-0x21(%rbp)
je     1176 <main+0x56>
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x22(%rbp)
jne    1170 <main+0x50>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1186 <main+0x66>
jmp    1292 <main+0x172>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x23(%rbp)
jne    11af <main+0x8f>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x23(%rbp)
mov    -0x23(%rbp),%al
test   $0x1,%al
jne    11bf <main+0x9f>
jmp    123d <main+0x11d>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    -0x30(%rbp),%rdx
add    %rax,%rdx
movslq -0x1c(%rbp),%rax
add    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x9,%rdx
cmovg  %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1214 <main+0xf4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
jmp    1194 <main+0x74>
cmpl   $0x1,-0x20(%rbp)
jne    125a <main+0x13a>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128d <main+0x16d>
cmpl   $0x0,-0x20(%rbp)
je     127a <main+0x15a>
mov    -0x20(%rbp),%esi
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1288 <main+0x168>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    128d <main+0x16d>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x30,%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     1273 <main+0x143>
movabs $0x6666666666666667,%r14
66 66 66
lea    0xe92(%rip),%r15
lea    0x10(%rsp),%r12
lea    0x8(%rsp),%r13
jmp    11a3 <main+0x73>
nopw   0x0(%rax,%rax,1)
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <scanf@plt>
test   %rax,%rax
je     1273 <main+0x143>
mov    0x10(%rsp),%rbp
mov    0x8(%rsp),%rdi
mov    %rbp,%rax
or     %rdi,%rax
je     1273 <main+0x143>
xor    %esi,%esi
xor    %r8d,%r8d
xchg   %ax,%ax
mov    %rbp,%rbx
mov    %rbp,%rax
imul   %r14
mov    %rdi,%r9
mov    %rdx,%rbp
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rbp
add    %rax,%rbp
mov    %rbp,%rax
add    %rbp,%rax
lea    (%rax,%rax,4),%rax
mov    %rbx,%rcx
sub    %rax,%rcx
add    %r8,%rcx
mov    %rdi,%rax
imul   %r14
mov    %rdx,%rdi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdi
add    %rax,%rdi
lea    (%rdi,%rdi,1),%rax
lea    (%rax,%rax,4),%rax
mov    %r9,%rdx
sub    %rax,%rdx
add    %rcx,%rdx
xor    %r8d,%r8d
cmp    $0xa,%rdx
setge  %r8b
add    %r8d,%esi
add    $0xfffffffffffffff6,%rbx
add    $0xfffffffffffffff6,%r9
cmp    $0xffffffffffffffed,%rbx
jb     11c0 <main+0x90>
cmp    $0xffffffffffffffed,%r9
jb     11c0 <main+0x90>
mov    %rbp,0x10(%rsp)
mov    %rdi,0x8(%rsp)
test   %esi,%esi
je     1180 <main+0x50>
cmp    $0x1,%esi
jne    1260 <main+0x130>
lea    0xdda(%rip),%rdi
jmp    1187 <main+0x57>
nopl   (%rax)
lea    0xda1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    118c <main+0x5c>
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"%ld %ld\00"
@.str.1 = [20 x i8] c"1 carry operation.\0A\00"
@.str.2 = [22 x i8] c"%d carry operations.\0A\00"
@.str.3 = [21 x i8] c"No carry operation.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %64, %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 %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 %65
19: ; preds = %17
store i32 0, i32* %4
store i32 0, i32* %5
br label %20
20: ; preds = %45, %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 %50
28: ; preds = %26
%29 = load i64, i64* %2
%30 = srem i64 %29, 10
%31 = load i64, i64* %3
%32 = srem i64 %31, 10
%33 = add nsw i64 %30, %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = add nsw i64 %33, %35
%37 = icmp sgt i64 %36, 9
%38 = zext i1 %37 to i64
%39 = select i1 %37, i32 1, i32 0
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %28
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %45
45: ; preds = %42, %28
%46 = load i64, i64* %2
%47 = sdiv i64 %46, 10
store i64 %47, i64* %2
%48 = load i64, i64* %3
%49 = sdiv i64 %48, 10
store i64 %49, i64* %3
br label %20
50: ; preds = %26
%51 = load i32, i32* %5
%52 = icmp eq i32 %51, 1
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %64
55: ; preds = %50
%56 = load i32, i32* %5
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %55
%59 = load i32, i32* %5
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %59)
br label %63
61: ; preds = %55
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
br label %64
64: ; preds = %63, %53
br label %6
65: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%ld %ld\00"
@.str.2 = [22 x i8] c"%d carry operations.\0A\00"
@str = [20 x i8] c"No carry operation.\00"
@str.4 = [19 x i8] c"1 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 eq i64 %5, 0
br i1 %6, label %43, label %7
7: ; preds = %0, %40
%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 %43
13: ; preds = %7, %13
%14 = phi i32 [ %25, %13 ], [ 0, %7 ]
%15 = phi i64 [ %23, %13 ], [ 0, %7 ]
%16 = phi i64 [ %26, %13 ], [ %8, %7 ]
%17 = phi i64 [ %27, %13 ], [ %10, %7 ]
%18 = srem i64 %16, 10
%19 = srem i64 %17, 10
%20 = add nsw i64 %18, %15
%21 = add nsw i64 %20, %19
%22 = icmp sgt i64 %21, 9
%23 = zext i1 %22 to i64
%24 = zext i1 %22 to i32
%25 = add nuw nsw i32 %14, %24
%26 = sdiv i64 %16, 10
%27 = sdiv i64 %17, 10
%28 = add i64 %16, -10
%29 = icmp ult i64 %28, -19
%30 = add i64 %17, -10
%31 = icmp ult i64 %30, -19
%32 = select i1 %29, i1 true, i1 %31
br i1 %32, label %13, label %33
33: ; preds = %13
store i64 %26, i64* %1
store i64 %27, i64* %2
switch i32 %25, label %36 [
i32 1, label %34
i32 0, label %38
]
34: ; preds = %33
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
br label %40
36: ; preds = %33
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %25)
br label %40
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %40
40: ; preds = %36, %38, %34
%41 = call i64 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64* %1, i64* %2)
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %7
43: ; preds = %7, %40, %0
ret i32 0
}