#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_s(char *, int *);
int /*<<< orphan*/ system(char *);
main() {
  int i, num, resultado, fallos = 0;
  printf("Con que numero quieres practicar? ");
  scanf_s("%i", &num);
  for (i = 1; i <= 10; i++) {
    printf("%i * %i= ", num, i);
    scanf_s("%i", &resultado);
    if (resultado == (num * i))
      printf("Valor correcto\n");
    else {
      printf("Lo siento se ha equivocado. La respuesta correcta era %i\n",
             num * i);
      ++fallos;
    }
  }
  printf("Has acertado %i veces de %i numeros.\n", i - 1 - fallos, i - 1);
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf_s@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     11ef <main+0xbf>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf_s@plt>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    11be <main+0x8e>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11dc <main+0xac>
mov    -0xc(%rbp),%esi
imul   -0x8(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e1 <main+0xb1>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116b <main+0x3b>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
sub    -0x14(%rbp),%esi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
call   1030 <system@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
push   %rax
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec3(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1060 <scanf_s@plt>
mov    $0x1,%ebp
lea    0xeaf(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xead(%rip),%r13
xor    %r12d,%r12d
jmp    11a6 <main+0x66>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r12d
add    $0x1,%ebp
cmp    $0xb,%ebp
je     11da <main+0x9a>
mov    (%rsp),%esi
mov    %r15,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf_s@plt>
mov    (%rsp),%esi
imul   %ebp,%esi
cmp    %esi,0x4(%rsp)
jne    1190 <main+0x50>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
jmp    119e <main+0x5e>
mov    $0xa,%esi
sub    %r12d,%esi
lea    0xe81(%rip),%rdi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Con que numero quieres practicar? \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [10 x i8] c"%i * %i= \00"
@.str.3 = [16 x i8] c"Valor correcto\0A\00"
@.str.4 = [58 x i8] c"Lo siento se ha equivocado. La respuesta correcta era %i\0A\00"
@.str.5 = [38 x i8] c"Has acertado %i veces de %i numeros.\0A\00"
@.str.6 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 1, i32* %2
br label %8
8: ; preds = %31, %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 10
br i1 %10, label %11, label %34
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = load i32, i32* %3
%18 = load i32, i32* %2
%19 = mul nsw i32 %17, %18
%20 = icmp eq i32 %16, %19
br i1 %20, label %21, label %23
21: ; preds = %11
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %30
23: ; preds = %11
%24 = load i32, i32* %3
%25 = load i32, i32* %2
%26 = mul nsw i32 %24, %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %30
30: ; preds = %23, %21
br label %31
31: ; preds = %30
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %8
34: ; preds = %8
%35 = load i32, i32* %2
%36 = sub nsw i32 %35, 1
%37 = load i32, i32* %5
%38 = sub nsw i32 %36, %37
%39 = load i32, i32* %2
%40 = sub nsw i32 %39, 1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %38, i32 %40)
%42 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Con que numero quieres practicar? \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [10 x i8] c"%i * %i= \00"
@.str.4 = [58 x i8] c"Lo siento se ha equivocado. La respuesta correcta era %i\0A\00"
@.str.5 = [38 x i8] c"Has acertado %i veces de %i numeros.\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@str = [15 x i8] c"Valor correcto\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %7
7: ; preds = %0, %22
%8 = phi i32 [ 0, %0 ], [ %23, %22 ]
%9 = phi i32 [ 1, %0 ], [ %24, %22 ]
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %9)
%12 = call i32 @scanf_s(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = load i32, i32* %1
%15 = mul nsw i32 %14, %9
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %19
17: ; preds = %7
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %22
19: ; preds = %7
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%21 = add nsw i32 %8, 1
br label %22
22: ; preds = %17, %19
%23 = phi i32 [ %8, %17 ], [ %21, %19 ]
%24 = add nuw nsw i32 %9, 1
%25 = icmp eq i32 %24, 11
br i1 %25, label %26, label %7
26: ; preds = %22
%27 = sub nsw i32 10, %23
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 %27, i32 10)
%29 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}