#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 atoi(char *);
void settab(int argc, char *argv[], char *tab) {
  int i, pos;
  if (argc <= 1)
    for (i = 1; i < 1000; i++)
      if (i % 8 == 0)
        tab[i] = 1;
      else
        tab[i] = 0;
  else {
    for (i = 1; i < 1000; i++)
      tab[i] = 0;
    while (--argc > 0) {
      pos = atoi(*++argv);
      if (pos > 0 && pos <= 1000)
        tab[pos] = 1;
    }
  }
}


x86 assembly (clang, -O0):
<settab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     118a <settab+0x7a>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    1185 <settab+0x75>
mov    -0x1c(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1166 <settab+0x56>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
jmp    1172 <settab+0x62>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1177 <settab+0x67>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1134 <settab+0x24>
jmp    1217 <settab+0x107>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x3e8,-0x1c(%rbp)
jge    11b8 <settab+0xa8>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1191 <settab+0x81>
jmp    11bd <settab+0xad>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jle    1212 <settab+0x102>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    120d <settab+0xfd>
cmpl   $0x3e8,-0x20(%rbp)
jg     120d <settab+0xfd>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
jmp    11bd <settab+0xad>
jmp    1217 <settab+0x107>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settab>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
cmp    $0x1,%edi
jg     12e8 <settab+0x1c8>
movdqa 0xec7(%rip),%xmm12
movdqa 0xece(%rip),%xmm13
movdqa 0xed5(%rip),%xmm14
movdqa 0xedc(%rip),%xmm15
movdqa 0xee4(%rip),%xmm2
movdqa 0xeec(%rip),%xmm5
movdqa 0xef4(%rip),%xmm3
movdqa 0xefb(%rip),%xmm10
mov    $0x11,%eax
movdqa 0xefd(%rip),%xmm8
pxor   %xmm9,%xmm9
movdqa 0xf0f(%rip),%xmm11
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa %xmm12,%xmm0
pand   %xmm8,%xmm0
movdqa %xmm2,%xmm4
pand   %xmm8,%xmm4
movdqa %xmm3,%xmm6
pand   %xmm8,%xmm6
movdqa %xmm10,%xmm7
pand   %xmm8,%xmm7
pcmpeqd %xmm9,%xmm7
pshufd $0xb1,%xmm7,%xmm1
pand   %xmm7,%xmm1
pcmpeqd %xmm9,%xmm6
pshufd $0xb1,%xmm6,%xmm7
pand   %xmm6,%xmm7
movdqa %xmm5,%xmm6
pand   %xmm8,%xmm6
packssdw %xmm7,%xmm1
pcmpeqd %xmm9,%xmm6
pshufd $0xb1,%xmm6,%xmm7
pand   %xmm6,%xmm7
pcmpeqd %xmm9,%xmm4
pshufd $0xb1,%xmm4,%xmm6
pand   %xmm4,%xmm6
movdqa %xmm14,%xmm4
pand   %xmm8,%xmm4
packssdw %xmm6,%xmm7
movdqa %xmm15,%xmm6
pand   %xmm8,%xmm6
packssdw %xmm7,%xmm1
pcmpeqd %xmm9,%xmm6
pshufd $0xb1,%xmm6,%xmm7
pand   %xmm6,%xmm7
pcmpeqd %xmm9,%xmm4
pshufd $0xb1,%xmm4,%xmm6
pand   %xmm4,%xmm6
movdqa %xmm13,%xmm4
pand   %xmm8,%xmm4
packssdw %xmm6,%xmm7
pcmpeqd %xmm9,%xmm4
pshufd $0xb1,%xmm4,%xmm6
pand   %xmm4,%xmm6
pcmpeqd %xmm9,%xmm0
pshufd $0xb1,%xmm0,%xmm4
pand   %xmm0,%xmm4
packssdw %xmm4,%xmm6
packssdw %xmm6,%xmm7
packsswb %xmm7,%xmm1
pand   0xe0f(%rip),%xmm1
movdqu %xmm1,-0x10(%r14,%rax,1)
movdqu %xmm1,(%r14,%rax,1)
paddq  %xmm11,%xmm10
paddq  %xmm11,%xmm3
paddq  %xmm11,%xmm5
paddq  %xmm11,%xmm2
paddq  %xmm11,%xmm15
paddq  %xmm11,%xmm14
paddq  %xmm11,%xmm13
paddq  %xmm11,%xmm12
add    $0x20,%rax
cmp    $0x3f1,%rax
jne    11a0 <settab+0x80>
movl   $0x0,0x3e1(%r14)
movw   $0x0,0x3e5(%r14)
movb   $0x0,0x3e7(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x1(%r14),%rdi
mov    $0x3e7,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x1,%ebp
add    $0x8,%rbx
jmp    131c <settab+0x1fc>
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
jbe    12e3 <settab+0x1c3>
mov    (%rbx),%rdi
call   1040 <atoi@plt>
lea    -0x1(%rax),%ecx
cmp    $0x3e7,%ecx
ja     1310 <settab+0x1f0>
mov    %eax,%eax
movb   $0x1,(%r14,%rax,1)
jmp    1310 <settab+0x1f0>

LLVM IR (-O0):
define void @settab(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 1
br i1 %10, label %11, label %34
11: ; preds = %3
store i32 1, i32* %7
br label %12
12: ; preds = %30, %11
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 1000
br i1 %14, label %15, label %33
15: ; preds = %12
%16 = load i32, i32* %7
%17 = srem i32 %16, 8
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i8*, i8** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 1, i8* %23
br label %29
24: ; preds = %15
%25 = load i8*, i8** %6
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
store i8 0, i8* %28
br label %29
29: ; preds = %24, %19
br label %30
30: ; preds = %29
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %12
33: ; preds = %12
br label %68
34: ; preds = %3
store i32 1, i32* %7
br label %35
35: ; preds = %43, %34
%36 = load i32, i32* %7
%37 = icmp slt i32 %36, 1000
br i1 %37, label %38, label %46
38: ; preds = %35
%39 = load i8*, i8** %6
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
br label %43
43: ; preds = %38
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %35
46: ; preds = %35
br label %47
47: ; preds = %66, %46
%48 = load i32, i32* %4
%49 = add nsw i32 %48, -1
store i32 %49, i32* %4
%50 = icmp sgt i32 %49, 0
br i1 %50, label %51, label %67
51: ; preds = %47
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i32 1
store i8** %53, i8*** %5
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
store i32 %55, i32* %8
%56 = load i32, i32* %8
%57 = icmp sgt i32 %56, 0
br i1 %57, label %58, label %66
58: ; preds = %51
%59 = load i32, i32* %8
%60 = icmp sle i32 %59, 1000
br i1 %60, label %61, label %66
61: ; preds = %58
%62 = load i8*, i8** %6
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %62, i64 %64
store i8 1, i8* %65
br label %66
66: ; preds = %61, %58, %51
br label %47
67: ; preds = %47
br label %68
68: ; preds = %67, %33
ret void
}

LLVM IR (-O2):
define void @settab(i32 %0, i8** nocapture %1, i8* nocapture writeonly %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %31
5: ; preds = %3, %5
%6 = phi i64 [ %20, %5 ], [ 0, %3 ]
%7 = phi <16 x i64> [ %21, %5 ], [ <i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15, i64 16>, %3 ]
%8 = or i64 %6, 1
%9 = and <16 x i64> %7, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
%10 = icmp eq <16 x i64> %9, zeroinitializer
%11 = zext <16 x i1> %10 to <16 x i8>
%12 = getelementptr inbounds i8, i8* %2, i64 %8
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> %11, <16 x i8>* %13
%14 = or i64 %6, 17
%15 = and <16 x i64> %7, <i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7, i64 7>
%16 = icmp eq <16 x i64> %15, zeroinitializer
%17 = zext <16 x i1> %16 to <16 x i8>
%18 = getelementptr inbounds i8, i8* %2, i64 %14
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> %17, <16 x i8>* %19
%20 = add nuw nsw i64 %6, 32
%21 = add <16 x i64> %7, <i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32, i64 32>
%22 = icmp eq i64 %20, 992
br i1 %22, label %23, label %5
23: ; preds = %5
%24 = getelementptr inbounds i8, i8* %2, i64 993
store i8 0, i8* %24
%25 = getelementptr inbounds i8, i8* %2, i64 994
store i8 0, i8* %25
%26 = getelementptr inbounds i8, i8* %2, i64 995
store i8 0, i8* %26
%27 = getelementptr inbounds i8, i8* %2, i64 996
store i8 0, i8* %27
%28 = getelementptr inbounds i8, i8* %2, i64 997
store i8 0, i8* %28
%29 = getelementptr inbounds i8, i8* %2, i64 998
store i8 0, i8* %29
%30 = getelementptr inbounds i8, i8* %2, i64 999
store i8 0, i8* %30
br label %47
31: ; preds = %3
%32 = getelementptr i8, i8* %2, i64 1
br label %33
33: ; preds = %31, %45
%34 = phi i32 [ %36, %45 ], [ %0, %31 ]
%35 = phi i8** [ %37, %45 ], [ %1, %31 ]
%36 = add nsw i32 %34, -1
%37 = getelementptr inbounds i8*, i8** %35, i64 1
%38 = load i8*, i8** %37
%39 = tail call i32 @atoi(i8* %38)
%40 = add i32 %39, -1
%41 = icmp ult i32 %40, 1000
br i1 %41, label %42, label %45
42: ; preds = %33
%43 = zext i32 %39 to i64
%44 = getelementptr inbounds i8, i8* %2, i64 %43
store i8 1, i8* %44
br label %45
45: ; preds = %42, %33
%46 = icmp ugt i32 %34, 2
br i1 %46, label %33, label %47
47: ; preds = %45, %23
ret void
}