#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int main() {
  int i, rem;
  FILE *fout;
  fout = fopen("notdivisible235.txt", "w");
  for (i = 1; i <= 1000; i++) {
    i = i;
    if ((i % 2 != 0) && (i % 3 != 0) && (i % 5 != 0))
      fprintf(fout, "the number is not divisible by 2,3,5 is %d\n", i);
  }
  fclose(fout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     11d2 <main+0xa2>
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11bf <main+0x8f>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11bf <main+0x8f>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11bf <main+0x8f>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11c4 <main+0x94>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115d <main+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    $0x1,%ebp
lea    0xec0(%rip),%r14
jmp    116b <main+0x3b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    $0x3e9,%ebp
je     11ad <main+0x7d>
test   $0x1,%bpl
je     1160 <main+0x30>
movzwl %bp,%eax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %ebp,%edx
sub    %ecx,%edx
test   %dx,%dx
je     1160 <main+0x30>
imul   $0xcccd,%eax,%eax
shr    $0x12,%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
test   %cx,%cx
je     1160 <main+0x30>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <fprintf@plt>
jmp    1160 <main+0x30>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"notdivisible235.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [44 x i8] c"the number is not divisible by 2,3,5 is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %5, i32** %4
store i32 1, i32* %2
br label %6
6: ; preds = %27, %0
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 1000
br i1 %8, label %9, label %30
9: ; preds = %6
%10 = load i32, i32* %2
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = srem i32 %11, 2
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %26
14: ; preds = %9
%15 = load i32, i32* %2
%16 = srem i32 %15, 3
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %2
%20 = srem i32 %19, 5
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32*, i32** %4
%24 = load i32, i32* %2
%25 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %18, %14, %9
br label %27
27: ; preds = %26
%28 = load i32, i32* %2
%29 = add nsw i32 %28, 1
store i32 %29, i32* %2
br label %6
30: ; preds = %6
%31 = load i32*, i32** %4
%32 = call i32 @fclose(i32* %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"notdivisible235.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [44 x i8] c"the number is not divisible by 2,3,5 is %d\0A\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %2
2: ; preds = %0, %15
%3 = phi i32 [ 1, %0 ], [ %16, %15 ]
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
%6 = trunc i32 %3 to i16
%7 = urem i16 %6, 3
%8 = icmp eq i16 %7, 0
%9 = or i1 %5, %8
%10 = urem i16 %6, 5
%11 = icmp eq i16 %10, 0
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %15, label %13
13: ; preds = %2
%14 = tail call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %3)
br label %15
15: ; preds = %2, %13
%16 = add nuw nsw i32 %3, 1
%17 = icmp eq i32 %16, 1001
br i1 %17, label %18, label %2
18: ; preds = %15
%19 = tail call i32 @fclose(i32* %1)
ret i32 0
}