#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 *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned long long int i, j;
  int *primes;
  primes = malloc(sizeof(int) * 100);
  for (i = 2; i < 100; i++)
    primes[i] = 1;
  for (i = 2; i < 100; i++)
    if (primes[i])
      for (j = i; i * j < 100; j++)
        primes[i * j] = 0;
  printf("\nPrime numbers in range 1 to 100 are: \n");
  for (i = 2; i < 100; i++)
    if (primes[i])
      printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x190,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
movq   $0x2,-0x10(%rbp)
cmpq   $0x64,-0x10(%rbp)
jae    1170 <main+0x50>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1145 <main+0x25>
movq   $0x2,-0x10(%rbp)
cmpq   $0x64,-0x10(%rbp)
jae    11f0 <main+0xd0>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11da <main+0xba>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
cmp    $0x64,%rax
jae    11d5 <main+0xb5>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    119d <main+0x7d>
jmp    11da <main+0xba>
jmp    11df <main+0xbf>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1178 <main+0x58>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x2,-0x10(%rbp)
cmpq   $0x64,-0x10(%rbp)
jae    124b <main+0x12b>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1235 <main+0x115>
mov    -0x10(%rbp),%rsi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123a <main+0x11a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1206 <main+0xe6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x190,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
movaps 0xeb7(%rip),%xmm0
movups %xmm0,0x8(%rax)
movups %xmm0,0x18(%rax)
movups %xmm0,0x28(%rax)
movups %xmm0,0x38(%rax)
movups %xmm0,0x48(%rax)
movups %xmm0,0x58(%rax)
movups %xmm0,0x68(%rax)
movups %xmm0,0x78(%rax)
movups %xmm0,0x88(%rax)
movups %xmm0,0x98(%rax)
movups %xmm0,0xa8(%rax)
movups %xmm0,0xb8(%rax)
movups %xmm0,0xc8(%rax)
movups %xmm0,0xd8(%rax)
movups %xmm0,0xe8(%rax)
movups %xmm0,0xf8(%rax)
movups %xmm0,0x108(%rax)
movups %xmm0,0x118(%rax)
movups %xmm0,0x128(%rax)
movups %xmm0,0x138(%rax)
movups %xmm0,0x148(%rax)
movups %xmm0,0x158(%rax)
movups %xmm0,0x168(%rax)
movups %xmm0,0x178(%rax)
movabs $0x100000001,%rax
mov    %rax,0x188(%r14)
mov    %r14,%r8
add    $0x10,%r8
mov    $0x2,%ecx
mov    $0x14,%edx
mov    $0x8,%esi
mov    $0x5,%edi
mov    $0x4,%r9d
jmp    122c <main+0xfc>
nopl   (%rax)
add    $0x1,%rcx
add    %rdx,%r8
add    $0x8,%rdx
add    $0x4,%rsi
add    %rdi,%r9
add    $0x2,%rdi
cmp    $0x64,%rcx
je     1264 <main+0x134>
cmpl   $0x0,(%r14,%rcx,4)
je     1210 <main+0xe0>
mov    %rcx,%rax
imul   %rcx,%rax
cmp    $0x63,%rax
ja     1210 <main+0xe0>
mov    %r9,%rbx
mov    %r8,%rax
cs nopw 0x0(%rax,%rax,1)
movl   $0x0,(%rax)
add    %rsi,%rax
add    %rcx,%rbx
cmp    $0x64,%rbx
jb     1250 <main+0x120>
jmp    1210 <main+0xe0>
lea    0xda9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%ebx
lea    0xd94(%rip),%r15
jmp    128a <main+0x15a>
xchg   %ax,%ax
add    $0x1,%rbx
cmp    $0x64,%rbx
je     12a0 <main+0x170>
cmpl   $0x0,(%r14,%rbx,4)
je     1280 <main+0x150>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1280 <main+0x150>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [40 x i8] c"\0APrime numbers in range 1 to 100 are: \0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @malloc(i32 400)
store i32* %5, i32** %4
store i64 2, i64* %2
br label %6
6: ; preds = %13, %0
%7 = load i64, i64* %2
%8 = icmp ult i64 %7, 100
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32*, i32** %4
%11 = load i64, i64* %2
%12 = getelementptr inbounds i32, i32* %10, i64 %11
store i32 1, i32* %12
br label %13
13: ; preds = %9
%14 = load i64, i64* %2
%15 = add i64 %14, 1
store i64 %15, i64* %2
br label %6
16: ; preds = %6
store i64 2, i64* %2
br label %17
17: ; preds = %44, %16
%18 = load i64, i64* %2
%19 = icmp ult i64 %18, 100
br i1 %19, label %20, label %47
20: ; preds = %17
%21 = load i32*, i32** %4
%22 = load i64, i64* %2
%23 = getelementptr inbounds i32, i32* %21, i64 %22
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %43
26: ; preds = %20
%27 = load i64, i64* %2
store i64 %27, i64* %3
br label %28
28: ; preds = %39, %26
%29 = load i64, i64* %2
%30 = load i64, i64* %3
%31 = mul i64 %29, %30
%32 = icmp ult i64 %31, 100
br i1 %32, label %33, label %42
33: ; preds = %28
%34 = load i32*, i32** %4
%35 = load i64, i64* %2
%36 = load i64, i64* %3
%37 = mul i64 %35, %36
%38 = getelementptr inbounds i32, i32* %34, i64 %37
store i32 0, i32* %38
br label %39
39: ; preds = %33
%40 = load i64, i64* %3
%41 = add i64 %40, 1
store i64 %41, i64* %3
br label %28
42: ; preds = %28
br label %43
43: ; preds = %42, %20
br label %44
44: ; preds = %43
%45 = load i64, i64* %2
%46 = add i64 %45, 1
store i64 %46, i64* %2
br label %17
47: ; preds = %17
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i64 2, i64* %2
br label %49
49: ; preds = %62, %47
%50 = load i64, i64* %2
%51 = icmp ult i64 %50, 100
br i1 %51, label %52, label %65
52: ; preds = %49
%53 = load i32*, i32** %4
%54 = load i64, i64* %2
%55 = getelementptr inbounds i32, i32* %53, i64 %54
%56 = load i32, i32* %55
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %52
%59 = load i64, i64* %2
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %59)
br label %61
61: ; preds = %58, %52
br label %62
62: ; preds = %61
%63 = load i64, i64* %2
%64 = add i64 %63, 1
store i64 %64, i64* %2
br label %49
65: ; preds = %49
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d\0A\00"
@str = [39 x i8] c"\0APrime numbers in range 1 to 100 are: \00"
define i32 @main() {
%1 = tail call i32* @malloc(i32 400)
%2 = getelementptr inbounds i32, i32* %1, i64 2
%3 = bitcast i32* %2 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %3
%4 = getelementptr inbounds i32, i32* %1, i64 6
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %5
%6 = getelementptr inbounds i32, i32* %1, i64 10
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %7
%8 = getelementptr inbounds i32, i32* %1, i64 14
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %9
%10 = getelementptr inbounds i32, i32* %1, i64 18
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %11
%12 = getelementptr inbounds i32, i32* %1, i64 22
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %13
%14 = getelementptr inbounds i32, i32* %1, i64 26
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %15
%16 = getelementptr inbounds i32, i32* %1, i64 30
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %17
%18 = getelementptr inbounds i32, i32* %1, i64 34
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %19
%20 = getelementptr inbounds i32, i32* %1, i64 38
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %21
%22 = getelementptr inbounds i32, i32* %1, i64 42
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %23
%24 = getelementptr inbounds i32, i32* %1, i64 46
%25 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %25
%26 = getelementptr inbounds i32, i32* %1, i64 50
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %1, i64 54
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %1, i64 58
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %1, i64 62
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %33
%34 = getelementptr inbounds i32, i32* %1, i64 66
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %35
%36 = getelementptr inbounds i32, i32* %1, i64 70
%37 = bitcast i32* %36 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %37
%38 = getelementptr inbounds i32, i32* %1, i64 74
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %39
%40 = getelementptr inbounds i32, i32* %1, i64 78
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %41
%42 = getelementptr inbounds i32, i32* %1, i64 82
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %43
%44 = getelementptr inbounds i32, i32* %1, i64 86
%45 = bitcast i32* %44 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %45
%46 = getelementptr inbounds i32, i32* %1, i64 90
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %1, i64 94
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32>* %49
%50 = getelementptr inbounds i32, i32* %1, i64 98
store i32 1, i32* %50
%51 = getelementptr inbounds i32, i32* %1, i64 99
store i32 1, i32* %51
br label %52
52: ; preds = %0, %67
%53 = phi i64 [ %68, %67 ], [ 2, %0 ]
%54 = getelementptr inbounds i32, i32* %1, i64 %53
%55 = load i32, i32* %54
%56 = icmp ne i32 %55, 0
%57 = mul i64 %53, %53
%58 = icmp ult i64 %57, 100
%59 = select i1 %56, i1 %58, i1 false
br i1 %59, label %60, label %67
60: ; preds = %52, %60
%61 = phi i64 [ %65, %60 ], [ %57, %52 ]
%62 = phi i64 [ %64, %60 ], [ %53, %52 ]
%63 = getelementptr inbounds i32, i32* %1, i64 %61
store i32 0, i32* %63
%64 = add nuw nsw i64 %62, 1
%65 = mul i64 %64, %53
%66 = icmp ult i64 %65, 100
br i1 %66, label %60, label %67
67: ; preds = %60, %52
%68 = add nuw nsw i64 %53, 1
%69 = icmp eq i64 %68, 100
br i1 %69, label %70, label %52
70: ; preds = %67
%71 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
br label %72
72: ; preds = %70, %79
%73 = phi i64 [ 2, %70 ], [ %80, %79 ]
%74 = getelementptr inbounds i32, i32* %1, i64 %73
%75 = load i32, i32* %74
%76 = icmp eq i32 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %72
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %73)
br label %79
79: ; preds = %72, %77
%80 = add nuw nsw i64 %73, 1
%81 = icmp eq i64 %80, 100
br i1 %81, label %82, label %72
82: ; preds = %79
ret i32 0
}