#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 quantosVaiMaisUm(int, int, int /*<<< orphan*/);
int scanf(char *, int *, int *);
int main(void) {
  int a, b, r;
  while (scanf("%d %d\n", &a, &b), a != 0 || b != 0) {
    r = quantosVaiMaisUm(a, b, 0);
    if (r == 0) {
      printf("No carry operation.\n");
    } else if (r == 1) {
      printf("1 carry operation.\n");
    } else {
      printf("%d carry operations.\n", r);
    }
  }
  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>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jne    116c <main+0x3c>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    117c <main+0x4c>
jmp    11e1 <main+0xb1>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
call   1040 <quantosVaiMaisUm@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11a9 <main+0x79>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <main+0xac>
cmpl   $0x1,-0x10(%rbp)
jne    11c6 <main+0x96>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d7 <main+0xa7>
mov    -0x10(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <main+0xac>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xeae(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %edi,%eax
or     %esi,%eax
je     11fa <main+0xba>
lea    0xea6(%rip),%r14
lea    0xe82(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
lea    0xea3(%rip),%r13
lea    0xe73(%rip),%rbp
jmp    11c7 <main+0x87>
cs nopw 0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
mov    %edi,%eax
or     %esi,%eax
je     11fa <main+0xba>
xor    %edx,%edx
call   1050 <quantosVaiMaisUm@plt>
cmp    $0x1,%eax
je     11f0 <main+0xb0>
test   %eax,%eax
jne    11a0 <main+0x60>
mov    %r13,%rdi
call   1030 <puts@plt>
jmp    11ac <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
jmp    11ac <main+0x6c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\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 = [22 x i8] c"%d carry operations.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %31, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ true, %5 ], [ %11, %9 ]
br i1 %13, label %14, label %32
14: ; preds = %12
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @quantosVaiMaisUm(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %31
22: ; preds = %14
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %30
27: ; preds = %22
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %25
br label %31
31: ; preds = %30, %20
br label %5
32: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
@.str.3 = [22 x i8] c"%d 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 i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %28
11: ; preds = %0, %21
%12 = phi i32 [ %25, %21 ], [ %8, %0 ]
%13 = phi i32 [ %23, %21 ], [ %6, %0 ]
%14 = call i32 @quantosVaiMaisUm(i32 %13, i32 %12, i32 0)
switch i32 %14, label %19 [
i32 0, label %15
i32 1, label %17
]
15: ; preds = %11
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.4, i64 0, i64 0))
br label %21
17: ; preds = %11
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %21
19: ; preds = %11
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %21
21: ; preds = %17, %19, %15
%22 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%23 = load i32, i32* %1
%24 = icmp ne i32 %23, 0
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 0
%27 = select i1 %24, i1 true, i1 %26
br i1 %27, label %11, label %28
28: ; preds = %21, %0
ret i32 0
}