#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, i = 0;
  printf("Please enter a number£º");
  scanf("%d", &a);
  b = a;
  if (a == 0)
    printf("The number 0 has 1 seat(s).\n");
  else {
    while (a != 0) {
      if (a == 0)
        break;
      else {
        a /= 10;
        i++;
      }
    }
    printf("The number %d has %d seat(s).\n", b, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1177 <main+0x57>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c5 <main+0xa5>
jmp    117c <main+0x5c>
cmpl   $0x0,-0x8(%rbp)
je     11b1 <main+0x91>
cmpl   $0x0,-0x8(%rbp)
jne    1195 <main+0x75>
jmp    11b1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117c <main+0x5c>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1198 <main+0x68>
mov    %esi,%eax
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    $0x1,%ebx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1160 <main+0x30>
mov    %eax,0xc(%rsp)
lea    0xe90(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a4 <main+0x74>
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please enter a number\C2\A3\C2\BA\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"The number 0 has 1 seat(s).\0A\00"
@.str.3 = [31 x i8] c"The number %d has %d seat(s).\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %30
12: ; preds = %0
br label %13
13: ; preds = %25, %12
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %16
br label %26
20: ; preds = %16
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 10
store i32 %22, i32* %2
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %25
25: ; preds = %20
br label %13
26: ; preds = %19, %13
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28)
br label %30
30: ; preds = %26, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please enter a number\C2\A3\C2\BA\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [31 x i8] c"The number %d has %d seat(s).\0A\00"
@str = [28 x i8] c"The number 0 has 1 seat(s).\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %18
9: ; preds = %0, %9
%10 = phi i32 [ %13, %9 ], [ 0, %0 ]
%11 = phi i32 [ %12, %9 ], [ %5, %0 ]
%12 = sdiv i32 %11, 10
%13 = add nuw nsw i32 %10, 1
%14 = add i32 %11, 9
%15 = icmp ult i32 %14, 19
br i1 %15, label %16, label %9
16: ; preds = %9
store i32 %12, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %5, i32 %13)
br label %18
18: ; preds = %16, %7
ret i32 0
}