#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 *, char *);
int strlen(char *);
int main() {
  char cpf[10];
  int i, dig1 = 0, dig2 = 0;
  printf("Digite o CPF(sem pontos ou espaços):");
  scanf("%s", cpf);
  for (i = 1; i <= 9; i++) {
    dig2 += (cpf[i - 1] - '0') * (10 - i);
    dig1 += (cpf[i - 1] - '0') * i;
  }
  dig1 %= 11;
  dig2 %= 11;
  printf("CPF + código verificador:");
  for (i = 0; i < strlen(cpf); i++) {
    if (i % 3 == 0 && i != 0) {
      printf(".");
    }
    printf("%c", cpf[i]);
  }
  printf("-");
  dig2 == 10 ? printf("X") : printf("%d", dig1);
  dig1 == 10 ? printf("X") : printf("%d", dig2);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x9,-0x14(%rbp)
jg     11c5 <main+0x95>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
sub    $0x30,%eax
mov    $0xa,%ecx
sub    -0x14(%rbp),%ecx
imul   %ecx,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
sub    $0x30,%eax
imul   -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1172 <main+0x42>
mov    -0x18(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1263 <main+0x133>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    123e <main+0x10e>
cmpl   $0x0,-0x14(%rbp)
je     123e <main+0x10e>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x14(%rbp),%rax
movsbl -0xe(%rbp,%rax,1),%esi
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f6 <main+0xc6>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xa,-0x1c(%rbp)
jne    128e <main+0x15e>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    129f <main+0x16f>
mov    -0x18(%rbp),%esi
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0xa,-0x18(%rbp)
jne    12bc <main+0x18c>
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12cd <main+0x19d>
mov    -0x1c(%rbp),%esi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
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
sub    $0x18,%rsp
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
lea    0xe(%rsp),%r15
mov    %r15,%rsi
call   1060 <scanf@plt>
movsbl 0xe(%rsp),%eax
lea    (%rax,%rax,8),%ecx
add    $0xfffffe50,%ecx
movsbl 0xf(%rsp),%edx
lea    -0x180(%rcx,%rdx,8),%ecx
lea    -0x90(%rax,%rdx,2),%eax
movsbl 0x10(%rsp),%edx
lea    -0x180(,%rdx,8),%esi
add    $0xffffffd0,%edx
sub    %edx,%esi
add    %ecx,%esi
lea    (%rdx,%rdx,2),%ecx
add    %eax,%ecx
movsbl 0x11(%rsp),%eax
lea    (%rax,%rax,2),%edx
add    $0xffffff70,%edx
lea    (%rsi,%rdx,2),%edx
lea    (%rcx,%rax,4),%eax
add    $0xffffff40,%eax
movsbl 0x12(%rsp),%ecx
lea    (%rcx,%rcx,4),%ecx
add    $0xffffff10,%ecx
add    %ecx,%edx
add    %ecx,%eax
movsbl 0x13(%rsp),%ecx
lea    (%rdx,%rcx,4),%edx
add    $0xffffff40,%edx
lea    -0x90(%rcx,%rcx,2),%ecx
lea    (%rax,%rcx,2),%eax
movsbl 0x14(%rsp),%ecx
lea    -0x30(%rcx),%esi
lea    (%rsi,%rsi,2),%edi
add    %edx,%edi
lea    -0x180(,%rcx,8),%ecx
sub    %esi,%ecx
add    %eax,%ecx
movsbl 0x15(%rsp),%eax
lea    (%rdi,%rax,2),%edx
add    $0xffffffa0,%edx
lea    -0x180(%rcx,%rax,8),%eax
movsbl 0x16(%rsp),%ecx
add    %ecx,%edx
add    $0xffffffd0,%edx
lea    (%rcx,%rcx,8),%r13d
add    $0xfffffe50,%r13d
add    %eax,%r13d
movslq %r13d,%rax
imul   $0x2e8ba2e9,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%r12d
movslq %edx,%r14
imul   $0x2e8ba2e9,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
sub    %eax,%r14d
lea    0xdb6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12e1 <main+0x1a1>
xor    %ebp,%ebp
mov    $0xaaaaaaab,%r15d
lea    0xe(%rsp),%rbx
jmp    12bd <main+0x17d>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0xe(%rsp,%rbp,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    12e1 <main+0x1a1>
test   %rbp,%rbp
je     12a0 <main+0x160>
mov    %ebp,%eax
imul   %r15,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
jne    12a0 <main+0x160>
mov    $0x2e,%edi
call   1030 <putchar@plt>
jmp    12a0 <main+0x160>
sub    %r12d,%r13d
mov    $0x2d,%edi
call   1030 <putchar@plt>
cmp    $0xa,%r14d
jne    1317 <main+0x1d7>
mov    $0x58,%edi
call   1030 <putchar@plt>
cmp    $0xa,%r13d
je     132e <main+0x1ee>
lea    0xd39(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1338 <main+0x1f8>
lea    0xd26(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xa,%r13d
jne    1304 <main+0x1c4>
mov    $0x58,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Digite o CPF(sem pontos ou espa\C3\A7os):\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [27 x i8] c"CPF + c\C3\B3digo verificador:\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"-\00"
@.str.6 = [2 x i8] c"X\00"
@.str.7 = [3 x i8] c"%d\00"
@.str.8 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
store i32 1, i32* %3
br label %9
9: ; preds = %36, %0
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 9
br i1 %11, label %12, label %39
12: ; preds = %9
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 48
%20 = load i32, i32* %3
%21 = sub nsw i32 10, %20
%22 = mul nsw i32 %19, %21
%23 = load i32, i32* %5
%24 = add nsw i32 %23, %22
store i32 %24, i32* %5
%25 = load i32, i32* %3
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
%32 = load i32, i32* %3
%33 = mul nsw i32 %31, %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, %33
store i32 %35, i32* %4
br label %36
36: ; preds = %12
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %9
39: ; preds = %9
%40 = load i32, i32* %4
%41 = srem i32 %40, 11
store i32 %41, i32* %4
%42 = load i32, i32* %5
%43 = srem i32 %42, 11
store i32 %43, i32* %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %45
45: ; preds = %66, %39
%46 = load i32, i32* %3
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%48 = call i32 @strlen(i8* %47)
%49 = icmp slt i32 %46, %48
br i1 %49, label %50, label %69
50: ; preds = %45
%51 = load i32, i32* %3
%52 = srem i32 %51, 3
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = load i32, i32* %3
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %54, %50
%60 = load i32, i32* %3
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %64)
br label %66
66: ; preds = %59
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
store i32 %68, i32* %3
br label %45
69: ; preds = %45
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* %5
%72 = icmp eq i32 %71, 10
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %78
75: ; preds = %69
%76 = load i32, i32* %4
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %75, %73
%79 = phi i32 [ %74, %73 ], [ %77, %75 ]
%80 = load i32, i32* %4
%81 = icmp eq i32 %80, 10
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %87
84: ; preds = %78
%85 = load i32, i32* %5
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %85)
br label %87
87: ; preds = %84, %82
%88 = phi i32 [ %83, %82 ], [ %86, %84 ]
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Digite o CPF(sem pontos ou espa\C3\A7os):\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [27 x i8] c"CPF + c\C3\B3digo verificador:\00"
@.str.7 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 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), i8* %2)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = add nsw i32 %6, -48
%8 = mul nsw i32 %7, 9
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %11, -48
%13 = shl nsw i32 %12, 3
%14 = add nsw i32 %13, %8
%15 = shl nsw i32 %12, 1
%16 = add nsw i32 %15, %7
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = add nsw i32 %19, -48
%21 = mul nsw i32 %20, 7
%22 = add nsw i32 %21, %14
%23 = mul nsw i32 %20, 3
%24 = add nsw i32 %23, %16
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = add nsw i32 %27, -48
%29 = mul nsw i32 %28, 6
%30 = add nsw i32 %29, %22
%31 = shl nsw i32 %28, 2
%32 = add nsw i32 %31, %24
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = mul nsw i32 %35, 5
%37 = add nsw i32 %36, -240
%38 = add nsw i32 %37, %30
%39 = add nsw i32 %37, %32
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = add nsw i32 %42, -48
%44 = shl nsw i32 %43, 2
%45 = add nsw i32 %44, %38
%46 = mul nsw i32 %43, 6
%47 = add nsw i32 %46, %39
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = add nsw i32 %50, -48
%52 = mul nsw i32 %51, 3
%53 = add nsw i32 %52, %45
%54 = mul nsw i32 %51, 7
%55 = add nsw i32 %54, %47
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = add nsw i32 %58, -48
%60 = shl nsw i32 %59, 1
%61 = add nsw i32 %60, %53
%62 = shl nsw i32 %59, 3
%63 = add nsw i32 %62, %55
%64 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = add nsw i32 %66, -48
%68 = add nsw i32 %67, %61
%69 = mul nsw i32 %67, 9
%70 = add nsw i32 %69, %63
%71 = srem i32 %70, 11
%72 = srem i32 %68, 11
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%74 = call i32 @strlen(i8* %2)
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %94
76: ; preds = %0, %85
%77 = phi i64 [ %90, %85 ], [ 0, %0 ]
%78 = trunc i64 %77 to i32
%79 = urem i32 %78, 3
%80 = icmp eq i32 %79, 0
%81 = icmp ne i64 %77, 0
%82 = and i1 %81, %80
br i1 %82, label %83, label %85
83: ; preds = %76
%84 = call i32 @putchar(i32 46)
br label %85
85: ; preds = %83, %76
%86 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %77
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = call i32 @putchar(i32 %88)
%90 = add nuw nsw i64 %77, 1
%91 = call i32 @strlen(i8* %2)
%92 = sext i32 %91 to i64
%93 = icmp slt i64 %90, %92
br i1 %93, label %76, label %94
94: ; preds = %85, %0
%95 = call i32 @putchar(i32 45)
%96 = icmp eq i32 %72, 10
br i1 %96, label %97, label %99
97: ; preds = %94
%98 = call i32 @putchar(i32 88)
br label %101
99: ; preds = %94
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %71)
br label %101
101: ; preds = %99, %97
%102 = icmp eq i32 %71, 10
br i1 %102, label %103, label %105
103: ; preds = %101
%104 = call i32 @putchar(i32 88)
br label %107
105: ; preds = %101
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 %72)
br label %107
107: ; preds = %105, %103
%108 = call i32 @putchar(i32 10)
ret i32 0
}