main(argc, argv) int argc;
char *argv[];
{
  double i, j;
  int f;
  if (argc < 2) {
    exit(1);
  }
  i = atoi(argv[1]);
  while (i++) {
    f = 1;
    for (j = 2; j < i; j++) {
      if ((i / j) == floor(i / j)) {
        f = 0;
        break;
      }
    }
    if (f) {
      printf("%.0f\n", i);
      exit(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)
cmpl   $0x2,-0x8(%rbp)
jge    116a <main+0x2a>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1040 <atoi@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe71(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b3 <main+0x73>
jp     11b3 <main+0x73>
jmp    1262 <main+0x122>
movl   $0x1,-0x24(%rbp)
movsd  0xe46(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1239 <main+0xf9>
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1060 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jne    121d <main+0xdd>
jp     121d <main+0xdd>
movl   $0x0,-0x24(%rbp)
jmp    1239 <main+0xf9>
jmp    1222 <main+0xe2>
movsd  0xdd6(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11c7 <main+0x87>
cmpl   $0x0,-0x24(%rbp)
je     125d <main+0x11d>
movsd  -0x18(%rbp),%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1182 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
cmp    $0x1,%edi
jle    11f8 <main+0xb8>
mov    0x8(%rsi),%rdi
xor    %eax,%eax
call   1040 <atoi@plt>
test   %eax,%eax
je     11f1 <main+0xb1>
cvtsi2sd %eax,%xmm0
jmp    1181 <main+0x41>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
ucomisd 0xe93(%rip),%xmm0
jne    1181 <main+0x41>
jnp    11f1 <main+0xb1>
addsd  0xe77(%rip),%xmm0
ucomisd 0xe77(%rip),%xmm0
jbe    11dc <main+0x9c>
movsd  0xe6d(%rip),%xmm1
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1060 <floor@plt>
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jne    11c3 <main+0x83>
jnp    1170 <main+0x30>
movsd  0x8(%rsp),%xmm1
addsd  0xe2f(%rip),%xmm1
movsd  (%rsp),%xmm0
ucomisd %xmm1,%xmm0
ja     11a0 <main+0x60>
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%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, 2
br i1 %10, label %11, label %12
11: ; preds = %2
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %15)
%17 = sitofp i32 %16 to double
store double %17, double* %6
br label %18
18: ; preds = %47, %12
%19 = load double, double* %6
%20 = fadd double %19, 1.000000e+00
store double %20, double* %6
%21 = fcmp une double %19, 0.000000e+00
br i1 %21, label %22, label %48
22: ; preds = %18
store i32 1, i32* %8
store double 2.000000e+00, double* %7
br label %23
23: ; preds = %38, %22
%24 = load double, double* %7
%25 = load double, double* %6
%26 = fcmp olt double %24, %25
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load double, double* %6
%29 = load double, double* %7
%30 = fdiv double %28, %29
%31 = load double, double* %6
%32 = load double, double* %7
%33 = fdiv double %31, %32
%34 = call double @llvm.floor.f64(double %33)
%35 = fcmp oeq double %30, %34
br i1 %35, label %36, label %37
36: ; preds = %27
store i32 0, i32* %8
br label %41
37: ; preds = %27
br label %38
38: ; preds = %37
%39 = load double, double* %7
%40 = fadd double %39, 1.000000e+00
store double %40, double* %7
br label %23
41: ; preds = %36, %23
%42 = load i32, i32* %8
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load double, double* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %45)
unreachable
47: ; preds = %41
br label %18
48: ; preds = %18
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %5
4: ; preds = %2
tail call void @exit(i32 1)
unreachable
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %28, label %10
10: ; preds = %5
%11 = sitofp i32 %8 to double
br label %14
12: ; preds = %18
%13 = fcmp une double %16, 0.000000e+00
br i1 %13, label %14, label %28
14: ; preds = %10, %12
%15 = phi double [ %16, %12 ], [ %11, %10 ]
%16 = fadd double %15, 1.000000e+00
%17 = fcmp ogt double %16, 2.000000e+00
br i1 %17, label %18, label %26
18: ; preds = %14, %23
%19 = phi double [ %24, %23 ], [ 2.000000e+00, %14 ]
%20 = fdiv double %16, %19
%21 = tail call double @llvm.floor.f64(double %20)
%22 = fcmp oeq double %20, %21
br i1 %22, label %12, label %23
23: ; preds = %18
%24 = fadd double %19, 1.000000e+00
%25 = fcmp olt double %24, %16
br i1 %25, label %18, label %26
26: ; preds = %14, %23
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16)
tail call void @exit(i32 0)
unreachable
28: ; preds = %12, %5
ret i32 0
}