#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 */
typedef int ushort;

/* Variables and functions */
ushort findCarry(ushort num) {
  ushort i;
  for (i = 0; i < 10; i++) {
    if ((10 * (i + 1)) > num)
      break;
  }
  return i;
}


x86 assembly (clang, -O0):
<findCarry>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1142 <findCarry+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
imul   $0xa,%eax,%eax
cmp    -0x4(%rbp),%eax
jle    112f <findCarry+0x2f>
jmp    1142 <findCarry+0x42>
jmp    1134 <findCarry+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <findCarry+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findCarry>:
xor    %eax,%eax
cmp    $0xa,%edi
jl     1162 <findCarry+0x62>
mov    $0x1,%eax
cmp    $0x14,%edi
jb     1162 <findCarry+0x62>
mov    $0x2,%eax
cmp    $0x1e,%edi
jb     1162 <findCarry+0x62>
mov    $0x3,%eax
cmp    $0x28,%edi
jb     1162 <findCarry+0x62>
mov    $0x4,%eax
cmp    $0x32,%edi
jb     1162 <findCarry+0x62>
mov    $0x5,%eax
cmp    $0x3c,%edi
jb     1162 <findCarry+0x62>
mov    $0x6,%eax
cmp    $0x46,%edi
jb     1162 <findCarry+0x62>
mov    $0x7,%eax
cmp    $0x50,%edi
jb     1162 <findCarry+0x62>
mov    $0x8,%eax
cmp    $0x5a,%edi
jb     1162 <findCarry+0x62>
cmp    $0x64,%edi
mov    $0xa,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @findCarry(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %15, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = mul nsw i32 10, %9
%11 = load i32, i32* %2
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %7
br label %18
14: ; preds = %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %13, %4
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @findCarry(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %22, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 20
br i1 %4, label %22, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 30
br i1 %6, label %22, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 40
br i1 %8, label %22, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 50
br i1 %10, label %22, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 60
br i1 %12, label %22, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 70
br i1 %14, label %22, label %15
15: ; preds = %13
%16 = icmp ult i32 %0, 80
br i1 %16, label %22, label %17
17: ; preds = %15
%18 = icmp ult i32 %0, 90
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = icmp ult i32 %0, 100
%21 = select i1 %20, i32 9, i32 10
br label %22
22: ; preds = %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%23 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 2, %5 ], [ 3, %7 ], [ 4, %9 ], [ 5, %11 ], [ 6, %13 ], [ 7, %15 ], [ 8, %17 ], [ %21, %19 ]
ret i32 %23
}