#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*/ sprintf(char *, char *, int);
int not7(int num) {
  char str[20];
  int i;
  if (num % 7 == 0) {
    return 0;
  }
  sprintf(str, "%d", num);
  for (i = 0; str[i]; i++) {
    if (str[i] == '7') {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<not7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    113b <not7+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    119c <not7+0x8c>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xeb7(%rip),%rsi
call   1030 <sprintf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmpb   $0x0,-0x20(%rbp,%rax,1)
je     1195 <not7+0x85>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x37,%eax
jne    1182 <not7+0x72>
movl   $0x0,-0x4(%rbp)
jmp    119c <not7+0x8c>
jmp    1187 <not7+0x77>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1155 <not7+0x45>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<not7>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
imul   $0xb6db6db7,%edi,%eax
add    $0x12492492,%eax
xor    %ebp,%ebp
cmp    $0x24924925,%eax
jb     1156 <not7+0x46>
mov    %edi,%edx
lea    0xecd(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
xchg   %ax,%ax
movzbl (%rbx),%eax
test   %al,%al
je     1151 <not7+0x41>
cmp    $0x37,%al
je     1156 <not7+0x46>
add    $0x1,%rbx
jmp    1140 <not7+0x30>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @not7(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = srem i32 %6, 7
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %33
10: ; preds = %1
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%12 = load i32, i32* %3
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 0, i32* %5
br label %14
14: ; preds = %29, %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %14
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 55
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 0, i32* %2
br label %33
28: ; preds = %20
br label %29
29: ; preds = %28
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %14
32: ; preds = %14
store i32 1, i32* %2
br label %33
33: ; preds = %32, %27, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @not7(i32 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = srem i32 %0, 7
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %12, %6
%9 = phi i64 [ %13, %12 ], [ 0, %6 ]
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %9
%11 = load i8, i8* %10
switch i8 %11, label %12 [
i8 0, label %15
i8 55, label %14
]
12: ; preds = %8
%13 = add nuw i64 %9, 1
br label %8
14: ; preds = %8
br label %15
15: ; preds = %8, %14, %1
%16 = phi i32 [ 0, %1 ], [ 0, %14 ], [ 1, %8 ]
ret i32 %16
}