#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*/ main();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int divis() {
  int max, num, resto;
  printf("Este programa imprime los numeros divisibles\n");
  printf("por 7 menores que numero dado.\n\n");
  printf("Introduzca el numero: ");
  scanf("%d", &max);
  if (max <= 0) {
    printf("El numero debe ser positivo!!\n");
  } else {
    for (num = 1; num <= max; num++) {
      resto = num % 7;
      if (resto == 0)
        printf("%d es divisible por 7\n", num);
    }
  }
  system("pause");
  system("cls");
  main();
}


x86 assembly (clang, -O0):
<divis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jg     119f <divis+0x5f>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f3 <divis+0xb3>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ee <divis+0xae>
mov    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    11db <divis+0x9b>
mov    -0xc(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11e0 <divis+0xa0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <divis+0x66>
jmp    11f3 <divis+0xb3>
lea    0xea5(%rip),%rdi
call   1030 <system@plt>
lea    0xe9f(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1050 <main@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divis>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11f1 <divis+0xa1>
mov    $0x1,%ebx
lea    0xe77(%rip),%r14
xor    %ebp,%ebp
jmp    11b7 <divis+0x67>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    %eax,%ebp
jge    11fd <divis+0xad>
mov    %ebp,%ecx
lea    0x1(%rcx),%ebp
mov    %ebx,%edx
imul   $0x24924925,%rdx,%rdx
shr    $0x20,%rdx
mov    %ebx,%esi
sub    %edx,%esi
shr    %esi
add    %edx,%esi
shr    $0x2,%esi
mov    %esi,%edx
not    %edx
lea    (%rdx,%rsi,8),%edx
cmp    %ecx,%edx
jne    11b0 <divis+0x60>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0xc(%rsp),%eax
jmp    11b0 <divis+0x60>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
lea    0xe2d(%rip),%rdi
call   1040 <system@plt>
lea    0xe27(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1060 <main@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Este programa imprime los numeros divisibles\0A\00"
@.str.1 = [33 x i8] c"por 7 menores que numero dado.\0A\0A\00"
@.str.2 = [23 x i8] c"Introduzca el numero: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [31 x i8] c"El numero debe ser positivo!!\0A\00"
@.str.5 = [23 x i8] c"%d es divisible por 7\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@.str.7 = [4 x i8] c"cls\00"
define i32 @divis() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
br label %31
13: ; preds = %0
store i32 1, i32* %3
br label %14
14: ; preds = %27, %13
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %30
18: ; preds = %14
%19 = load i32, i32* %3
%20 = srem i32 %19, 7
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23, %18
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %14
30: ; preds = %14
br label %31
31: ; preds = %30, %11
%32 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%34 = call i32 (...) @main()
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"Introduzca el numero: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [23 x i8] c"%d es divisible por 7\0A\00"
@.str.6 = [6 x i8] c"pause\00"
@.str.7 = [4 x i8] c"cls\00"
@str = [45 x i8] c"Este programa imprime los numeros divisibles\00"
@str.8 = [32 x i8] c"por 7 menores que numero dado.\0A\00"
@str.9 = [30 x i8] c"El numero debe ser positivo!!\00"
define i32 @divis() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
br label %23
11: ; preds = %0, %19
%12 = phi i32 [ %20, %19 ], [ %7, %0 ]
%13 = phi i32 [ %21, %19 ], [ 1, %0 ]
%14 = urem i32 %13, 7
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%18 = load i32, i32* %1
br label %19
19: ; preds = %11, %16
%20 = phi i32 [ %12, %11 ], [ %18, %16 ]
%21 = add nuw nsw i32 %13, 1
%22 = icmp slt i32 %13, %20
br i1 %22, label %11, label %23
23: ; preds = %19, %9
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%26 = call i32 (...) @main()
ret i32 undef
}