#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 EXIT_FAILURE;
int LONG_MAX;
int LONG_MIN;
int /*<<< orphan*/ sieve(int);
int strtol(char const *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  int n;
  if (argc != 2)
    return EXIT_FAILURE;
  n = strtol(argv[1], NULL, 0);
  if (n > LONG_MIN && n < LONG_MAX)
    sieve(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   $0x2,-0x8(%rbp)
je     1151 <main+0x31>
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    119a <main+0x7a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
jle    1193 <main+0x73>
mov    -0x14(%rbp),%eax
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%eax
jge    1193 <main+0x73>
mov    -0x14(%rbp),%edi
call   1030 <sieve@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
jne    1154 <main+0x34>
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <strtol@plt>
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%eax
jle    115d <main+0x3d>
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%eax
jge    115d <main+0x3d>
mov    %eax,%edi
call   1030 <sieve@plt>
jmp    115d <main+0x3d>
mov    0x2e75(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@LONG_MIN = global i32 0
@LONG_MAX = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* @EXIT_FAILURE
store i32 %10, i32* %3
br label %27
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strtol(i8* %14, i32* null, i32 0)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = load i32, i32* @LONG_MIN
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %11
%20 = load i32, i32* %6
%21 = load i32, i32* @LONG_MAX
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %6
%25 = call i32 @sieve(i32 %24)
br label %26
26: ; preds = %23, %19, %11
store i32 0, i32* %3
br label %27
27: ; preds = %26, %9
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@LONG_MIN = global i32 0
@LONG_MAX = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = load i32, i32* @EXIT_FAILURE
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strtol(i8* nocapture %8, i32* null, i32 0)
%10 = load i32, i32* @LONG_MIN
%11 = icmp sgt i32 %9, %10
%12 = load i32, i32* @LONG_MAX
%13 = icmp slt i32 %9, %12
%14 = select i1 %11, i1 %13, i1 false
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = tail call i32 @sieve(i32 %9)
br label %17
17: ; preds = %6, %15, %4
%18 = phi i32 [ %5, %4 ], [ 0, %15 ], [ 0, %6 ]
ret i32 %18
}