#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 */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ gmp_printf(char *, int /*<<< orphan*/);
scalar_t__ isprime(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
scalar_t__ mpz_cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_str(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ printf(char *);
int main(int ac, char *av[]) {
  mpz_t n, min_n, max_n;
  if (ac < 3) {
    printf("usage : gmpprime1 min_n max_n\n");
    return (1);
  }
  mpz_init_set_str(min_n, av[1], 10);
  mpz_init_set_str(max_n, av[2], 10);
  mpz_init_set(n, min_n);
  while (mpz_cmp(n, max_n) <= 0) {
    if (isprime(n))
      gmp_printf("%Zd\n", n);
    mpz_add_ui(n, n, 1);
  }
  mpz_clear(n);
  mpz_clear(max_n);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11b8 <main+0x38>
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    124f <main+0xcf>
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0xa,%edx
call   1050 <mpz_init_set_str@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    $0xa,%edx
call   1050 <mpz_init_set_str@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   10a0 <mpz_init_set@plt>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1070 <mpz_cmp@plt>
cmp    $0x0,%rax
jg     1238 <main+0xb8>
mov    -0x14(%rbp),%edi
call   1060 <isprime@plt>
cmp    $0x0,%rax
je     1223 <main+0xa3>
mov    -0x14(%rbp),%esi
lea    0xe01(%rip),%rdi
call   1090 <gmp_printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1030 <mpz_add_ui@plt>
jmp    11ed <main+0x6d>
mov    -0x14(%rbp),%edi
call   1080 <mpz_clear@plt>
mov    -0x1c(%rbp),%edi
call   1080 <mpz_clear@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jg     1199 <main+0x19>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rbx
ret
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
mov    $0xa,%edx
call   1050 <mpz_init_set_str@plt>
mov    0x10(%rbx),%rsi
mov    $0xa,%edx
call   1050 <mpz_init_set_str@plt>
call   10a0 <mpz_init_set@plt>
call   1070 <mpz_cmp@plt>
test   %rax,%rax
jle    11d5 <main+0x55>
call   1080 <mpz_clear@plt>
call   1080 <mpz_clear@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe24(%rip),%rbx
jmp    11f4 <main+0x74>
xchg   %ax,%ax
mov    $0x1,%edx
call   1040 <mpz_add_ui@plt>
call   1070 <mpz_cmp@plt>
test   %rax,%rax
jg     11c7 <main+0x47>
call   1060 <isprime@plt>
test   %rax,%rax
je     11e0 <main+0x60>
mov    %rbx,%rdi
call   1090 <gmp_printf@plt>
jmp    11e0 <main+0x60>

LLVM IR (-O0):
@.str = [31 x i8] c"usage : gmpprime1 min_n max_n\0A\00"
@.str.1 = [5 x i8] c"%Zd\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %48
13: ; preds = %2
%14 = load i32, i32* %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @mpz_init_set_str(i32 %14, i8* %17, i32 10)
%19 = load i32, i32* %8
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @mpz_init_set_str(i32 %19, i8* %22, i32 10)
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @mpz_init_set(i32 %24, i32 %25)
br label %27
27: ; preds = %39, %13
%28 = load i32, i32* %6
%29 = load i32, i32* %8
%30 = call i64 @mpz_cmp(i32 %28, i32 %29)
%31 = icmp sle i64 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %27
%33 = load i32, i32* %6
%34 = call i64 @isprime(i32 %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i32, i32* %6
%38 = call i32 @gmp_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %32
%40 = load i32, i32* %6
%41 = load i32, i32* %6
%42 = call i32 @mpz_add_ui(i32 %40, i32 %41, i32 1)
br label %27
43: ; preds = %27
%44 = load i32, i32* %6
%45 = call i32 @mpz_clear(i32 %44)
%46 = load i32, i32* %8
%47 = call i32 @mpz_clear(i32 %46)
store i32 0, i32* %3
br label %48
48: ; preds = %43, %11
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%Zd\0A\00"
@str = [30 x i8] c"usage : gmpprime1 min_n max_n\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %28
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @mpz_init_set_str(i32 undef, i8* %8, i32 10)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @mpz_init_set_str(i32 undef, i8* %11, i32 10)
%13 = tail call i32 @mpz_init_set(i32 undef, i32 undef)
%14 = tail call i64 @mpz_cmp(i32 undef, i32 undef)
%15 = icmp slt i64 %14, 1
br i1 %15, label %16, label %25
16: ; preds = %6, %21
%17 = tail call i64 @isprime(i32 undef)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 @gmp_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 undef)
br label %21
21: ; preds = %19, %16
%22 = tail call i32 @mpz_add_ui(i32 undef, i32 undef, i32 1)
%23 = tail call i64 @mpz_cmp(i32 undef, i32 undef)
%24 = icmp slt i64 %23, 1
br i1 %24, label %16, label %25
25: ; preds = %21, %6
%26 = tail call i32 @mpz_clear(i32 undef)
%27 = tail call i32 @mpz_clear(i32 undef)
br label %28
28: ; preds = %25, %4
%29 = phi i32 [ 1, %4 ], [ 0, %25 ]
ret i32 %29
}