#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(void) {
  int n, i, num, lim;
  printf("Informe o número desejado: ");
  scanf("%d", &n);
  printf("Informe o limite: ");
  scanf("%d", &lim);
  for (i = 1; i < lim; i++) {
    if (i % n == 0) {
      num = i;
    }
  }
  printf("O maior é %d\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a7 <main+0x87>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1194 <main+0x74>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1199 <main+0x79>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1172 <main+0x52>
mov    -0x10(%rbp),%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
mov    0xc(%rsp),%r10d
lea    -0x1(%rax),%r8d
cmp    $0x2,%eax
jne    11a0 <main+0x80>
mov    $0x1,%ecx
test   $0x1,%r8b
je     118a <main+0x6a>
mov    %ecx,%eax
cltd
idiv   %r10d
test   %edx,%edx
cmove  %ecx,%esi
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
mov    $0x1,%ecx
jmp    11c8 <main+0xa8>
xchg   %ax,%ax
lea    0x1(%rcx),%edi
mov    %edi,%eax
cltd
idiv   %r10d
test   %edx,%edx
mov    %ebx,%esi
cmove  %edi,%esi
add    $0x2,%ecx
cmp    %r9d,%edi
je     1179 <main+0x59>
mov    %ecx,%eax
cltd
idiv   %r10d
mov    %ecx,%ebx
test   %edx,%edx
je     11b0 <main+0x90>
mov    %esi,%ebx
jmp    11b0 <main+0x90>

LLVM IR (-O0):
@.str = [29 x i8] c"Informe o n\C3\BAmero desejado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Informe o limite: \00"
@.str.3 = [15 x i8] c"O maior \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
store i32 1, i32* %3
br label %10
10: ; preds = %22, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %5
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %25
14: ; preds = %10
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = srem i32 %15, %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = load i32, i32* %3
store i32 %20, i32* %4
br label %21
21: ; preds = %19, %14
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %10
25: ; preds = %10
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Informe o n\C3\BAmero desejado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [19 x i8] c"Informe o limite: \00"
@.str.3 = [15 x i8] c"O maior \C3\A9 %d\0A\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 ([29 x i8], [29 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* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 1
%11 = load i32, i32* %1
%12 = add nsw i32 %9, -1
%13 = and i32 %12, 1
%14 = icmp eq i32 %9, 2
br i1 %14, label %31, label %15
15: ; preds = %0
%16 = and i32 %12, -2
br label %17
17: ; preds = %17, %15
%18 = phi i32 [ undef, %15 ], [ %27, %17 ]
%19 = phi i32 [ 1, %15 ], [ %28, %17 ]
%20 = phi i32 [ 0, %15 ], [ %29, %17 ]
%21 = srem i32 %19, %11
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i32 %19, i32 %18
%24 = add nuw nsw i32 %19, 1
%25 = srem i32 %24, %11
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i32 %24, i32 %23
%28 = add nuw nsw i32 %19, 2
%29 = add i32 %20, 2
%30 = icmp eq i32 %29, %16
br i1 %30, label %31, label %17
31: ; preds = %17, %0
%32 = phi i32 [ undef, %0 ], [ %27, %17 ]
%33 = phi i32 [ 1, %0 ], [ %28, %17 ]
%34 = icmp eq i32 %13, 0
br i1 %34, label %39, label %35
35: ; preds = %31
%36 = srem i32 %33, %11
%37 = icmp eq i32 %36, 0
%38 = select i1 %37, i32 %33, i32 %32
br label %39
39: ; preds = %31, %35
%40 = phi i32 [ %32, %31 ], [ %38, %35 ]
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %40)
ret i32 0
}