#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 i, j, n;
  printf("Digite o valor de n: ");
  scanf("%d", &n);
  printf("Digite o valor de i: ");
  scanf("%d", &i);
  printf("Digite o valor de j: ");
  scanf("%d", &j);
  printf("Os %d primeiros multiplos de %d e %d sao : ", n, i, j);
  for (int c = 0, k = 0; k < n; c++) {
    if (c % (i * j) == 0) {
      printf("%d \t", c);
      k++;
    }
  }
}


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    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11fd <main+0xdd>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ea <main+0xca>
mov    -0x14(%rbp),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ef <main+0xcf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <main+0x8e>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    11de <main+0xbe>
lea    0xec8(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    11b7 <main+0x97>
nop
add    $0x1,%ebp
cmp    %ecx,%ebx
jge    11de <main+0xbe>
mov    0x8(%rsp),%esi
imul   0xc(%rsp),%esi
mov    %ebp,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    11b0 <main+0x90>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%ecx
jmp    11b0 <main+0x90>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Digite o valor de n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Digite o valor de i: \00"
@.str.3 = [22 x i8] c"Digite o valor de j: \00"
@.str.4 = [44 x i8] c"Os %d primeiros multiplos de %d e %d sao : \00"
@.str.5 = [5 x i8] c"%d \09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
store i32 0, i32* %5
store i32 0, i32* %6
br label %17
17: ; preds = %34, %0
%18 = load i32, i32* %6
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %37
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = mul nsw i32 %23, %24
%26 = srem i32 %22, %25
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %21
%29 = load i32, i32* %5
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %33
33: ; preds = %28, %21
br label %34
34: ; preds = %33
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %17
37: ; preds = %17
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [22 x i8] c"Digite o valor de n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"Digite o valor de i: \00"
@.str.3 = [22 x i8] c"Digite o valor de j: \00"
@.str.4 = [44 x i8] c"Os %d primeiros multiplos de %d e %d sao : \00"
@.str.5 = [5 x i8] c"%d \09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %3
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %33, %0
ret i32 0
20: ; preds = %0, %33
%21 = phi i32 [ %34, %33 ], [ %17, %0 ]
%22 = phi i32 [ %35, %33 ], [ 0, %0 ]
%23 = phi i32 [ %36, %33 ], [ 0, %0 ]
%24 = load i32, i32* %1
%25 = load i32, i32* %2
%26 = mul nsw i32 %25, %24
%27 = srem i32 %23, %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %20
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %23)
%31 = add nsw i32 %22, 1
%32 = load i32, i32* %3
br label %33
33: ; preds = %20, %29
%34 = phi i32 [ %32, %29 ], [ %21, %20 ]
%35 = phi i32 [ %31, %29 ], [ %22, %20 ]
%36 = add nuw nsw i32 %23, 1
%37 = icmp slt i32 %35, %34
br i1 %37, label %20, label %19
}