#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*/ printf(char *, int);
void check_display(int n) {
  int i, flag = 0;
  for (i = 2; i <= n / 2; ++i) {
    if (n % i == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    printf("%d is not prime", n);
  else
    printf("%d is prime", n);
}


x86 assembly (clang, -O0):
<check_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     1176 <check_display+0x66>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1163 <check_display+0x53>
movl   $0x1,-0xc(%rbp)
jmp    1176 <check_display+0x66>
jmp    1168 <check_display+0x58>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <check_display+0x19>
cmpl   $0x1,-0xc(%rbp)
jne    1194 <check_display+0x84>
mov    -0x4(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <check_display+0x93>
mov    -0x4(%rbp),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_display>:
mov    %edi,%r9d
lea    0xef6(%rip),%rdi
cmp    $0x4,%r9d
jl     115c <check_display+0x4c>
mov    %r9d,%ecx
shr    %ecx
neg    %ecx
mov    $0x2,%esi
lea    0xecd(%rip),%r8
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r9d,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1164 <check_display+0x54>
lea    (%rcx,%rsi,1),%eax
add    $0x1,%eax
mov    %esi,%edx
add    $0x1,%edx
mov    %edx,%esi
cmp    $0x1,%eax
jne    1140 <check_display+0x30>
mov    %r9d,%esi
jmp    1030 <printf@plt>
mov    %r8,%rdi
mov    %r9d,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%d is not prime\00"
@.str.1 = [12 x i8] c"%d is prime\00"
define void @check_display(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 2, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 2
%9 = icmp sle i32 %6, %8
br i1 %9, label %10, label %20
10: ; preds = %5
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = srem i32 %11, %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 1, i32* %4
br label %20
16: ; preds = %10
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %15, %5
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %29
26: ; preds = %20
%27 = load i32, i32* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %23
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%d is not prime\00"
@.str.1 = [12 x i8] c"%d is prime\00"
define void @check_display(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %8
5: ; preds = %8
%6 = add nuw nsw i32 %9, 1
%7 = icmp eq i32 %9, %4
br i1 %7, label %12, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %6, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %8, %1
%13 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %1 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %5 ]
%14 = tail call i32 @printf(i8* %13, i32 %0)
ret void
}