#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() {
  int n = 0, i = 0, j = 0, a = 0, final = 0;
  printf("N: ");
  scanf("%d", &n);
  printf("i: ");
  scanf("%d", &i);
  printf("j: ");
  scanf("%d", &j);
  while (a < n) {
    if (final % i == 0 || final % j == 0) {
      printf("%d ", final);
      a++;
    }
    final++;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1200 <main+0xe0>
mov    -0x18(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
je     11d8 <main+0xb8>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    11f2 <main+0xd2>
mov    -0x18(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ac <main+0x8c>
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x4(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe77(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
test   %ecx,%ecx
jle    11f2 <main+0xc2>
lea    0xe58(%rip),%r14
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    11da <main+0xaa>
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebx
mov    0x4(%rsp),%ecx
add    $0x1,%ebp
cmp    %ecx,%ebx
jge    11f2 <main+0xc2>
mov    %ebp,%eax
cltd
idivl  0xc(%rsp)
test   %edx,%edx
je     11c0 <main+0x90>
mov    %ebp,%eax
cltd
idivl  0x8(%rsp)
test   %edx,%edx
jne    11d3 <main+0xa3>
jmp    11c0 <main+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"i: \00"
@.str.3 = [4 x i8] c"j: \00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\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
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 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* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 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* %3)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 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* %4)
br label %13
13: ; preds = %32, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = load i32, i32* %6
%19 = load i32, i32* %3
%20 = srem i32 %18, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %27, label %22
22: ; preds = %17
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = srem i32 %23, %24
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %32
27: ; preds = %22, %17
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %32
32: ; preds = %27, %22
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %13
35: ; preds = %13
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"N: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"i: \00"
@.str.3 = [4 x i8] c"j: \00"
@.str.4 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 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* %1
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %35
15: ; preds = %0, %30
%16 = phi i32 [ %31, %30 ], [ %13, %0 ]
%17 = phi i32 [ %33, %30 ], [ 0, %0 ]
%18 = phi i32 [ %32, %30 ], [ 0, %0 ]
%19 = load i32, i32* %2
%20 = srem i32 %17, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %15
%23 = load i32, i32* %3
%24 = srem i32 %17, %23
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %22, %15
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%28 = add nsw i32 %18, 1
%29 = load i32, i32* %1
br label %30
30: ; preds = %26, %22
%31 = phi i32 [ %29, %26 ], [ %16, %22 ]
%32 = phi i32 [ %28, %26 ], [ %18, %22 ]
%33 = add nuw nsw i32 %17, 1
%34 = icmp slt i32 %32, %31
br i1 %34, label %15, label %35
35: ; preds = %30, %0
%36 = call i32 @putchar(i32 10)
ret i32 0
}