#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*/ prime(int *, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int i = 1, m;
  scanf("%d", &m);
  int p[m + 1];
  prime(p, m);
  while (p[i] != 0)
    printf("%d\n", p[i++]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%esi
call   1050 <prime@plt>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11c7 <main+0x97>
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
jmp    118f <main+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeba(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    %rsp,%r15
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%r12
and    $0xfffffffffffffff0,%r12
mov    %r14,%rbx
sub    %r12,%rbx
mov    %rbx,%rsp
mov    -0x24(%rbp),%esi
mov    %rbx,%rdi
call   1050 <prime@plt>
neg    %r12
mov    0x4(%r14,%r12,1),%esi
test   %esi,%esi
je     11b2 <main+0x82>
add    $0x8,%rbx
lea    0xe71(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%esi
add    $0x4,%rbx
test   %esi,%esi
jne    11a0 <main+0x70>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%11 = load i32, i32* %7
%12 = add nsw i32 %11, 1
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca i32, i64 %13
store i64 %13, i64* %9
%16 = load i32, i32* %7
%17 = call i32 @prime(i32* %15, i32 %16)
br label %18
18: ; preds = %24, %2
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %15, i64 %20
%22 = load i32, i32* %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %18
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i32, i32* %15, i64 %27
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %18
31: ; preds = %18
store i32 0, i32* %3
%32 = load i8*, i8** %8
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i32, i64 %8
%11 = load i32, i32* %3
%12 = call i32 @prime(i32* %10, i32 %11)
%13 = getelementptr inbounds i32, i32* %10, i64 1
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %24, label %16
16: ; preds = %2, %16
%17 = phi i64 [ %19, %16 ], [ 1, %2 ]
%18 = phi i32 [ %22, %16 ], [ %14, %2 ]
%19 = add nuw i64 %17, 1
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%21 = getelementptr inbounds i32, i32* %10, i64 %19
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %16
24: ; preds = %16, %2
ret i32 0
}