#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*/ errx(int, char *, char *);
scalar_t__ querycns(int, int, int, int /*<<< orphan*/, int /*<<< orphan*/ *);
int strtol(char *, char **, int);
int unwatch_oids(int argc, char **argv) {
  int oid;
  char *end;
  int i;
  for (i = 0; i < argc; i++) {
    oid = strtol(argv[i], &end, 16);
    if (end != argv[i] + 4 || *end)
      errx(5, "4-digit hex number expected, got %s", argv[i]);
    if (querycns((1 << 1), oid, 0x08, 0, NULL) < 0)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<unwatch_oids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fb <unwatch_oids+0xcb>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
add    $0x4,%rcx
cmp    %rcx,%rax
jne    119c <unwatch_oids+0x6c>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b9 <unwatch_oids+0x89>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
mov    $0x5,%edi
lea    0xe4c(%rip),%rsi
call   1030 <errx@plt>
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
mov    $0x8,%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <querycns@plt>
cmp    $0x0,%rax
jge    11e8 <unwatch_oids+0xb8>
movl   $0xffffffff,-0x4(%rbp)
jmp    1202 <unwatch_oids+0xd2>
jmp    11ed <unwatch_oids+0xbd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1146 <unwatch_oids+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unwatch_oids>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11bc <unwatch_oids+0x8c>
mov    %rsi,%r13
mov    %edi,%r12d
xor    %ebx,%ebx
mov    %rsp,%r14
lea    0xeaf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbx,8),%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1040 <strtol@plt>
mov    %eax,%ebp
mov    (%rsp),%rax
mov    0x0(%r13,%rbx,8),%rdx
lea    0x4(%rdx),%rcx
cmp    %rcx,%rax
jne    118b <unwatch_oids+0x5b>
cmpb   $0x0,(%rax)
je     1198 <unwatch_oids+0x68>
mov    $0x5,%edi
mov    %r15,%rsi
call   1030 <errx@plt>
mov    $0x2,%edi
mov    %ebp,%esi
mov    $0x8,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <querycns@plt>
test   %rax,%rax
js     11c0 <unwatch_oids+0x90>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1160 <unwatch_oids+0x30>
xor    %eax,%eax
jmp    11c5 <unwatch_oids+0x95>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"4-digit hex number expected, got %s\00"
define i32 @unwatch_oids(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
br label %9
9: ; preds = %46, %2
%10 = load i32, i32* %8
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %49
13: ; preds = %9
%14 = load i8**, i8*** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @strtol(i8* %18, i8** %7, i32 16)
store i32 %19, i32* %6
%20 = load i8*, i8** %7
%21 = load i8**, i8*** %5
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8, i8* %25, i64 4
%27 = icmp ne i8* %20, %26
br i1 %27, label %33, label %28
28: ; preds = %13
%29 = load i8*, i8** %7
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %28, %13
%34 = load i8**, i8*** %5
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @errx(i32 5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %33, %28
%41 = load i32, i32* %6
%42 = call i64 @querycns(i32 2, i32 %41, i32 8, i32 0, i32* null)
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %40
store i32 -1, i32* %3
br label %50
45: ; preds = %40
br label %46
46: ; preds = %45
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
br label %9
49: ; preds = %9
store i32 0, i32* %3
br label %50
50: ; preds = %49, %44
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@.str = [36 x i8] c"4-digit hex number expected, got %s\00"
define i32 @unwatch_oids(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %28
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %10
8: ; preds = %24
%9 = icmp eq i64 %27, %7
br i1 %9, label %28, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %27, %8 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = call i32 @strtol(i8* %13, i8** %3, i32 16)
%15 = load i8*, i8** %3
%16 = load i8*, i8** %12
%17 = getelementptr inbounds i8, i8* %16, i64 4
%18 = icmp eq i8* %15, %17
br i1 %18, label %19, label %22
19: ; preds = %10
%20 = load i8, i8* %15
%21 = icmp eq i8 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %19, %10
%23 = tail call i32 @errx(i32 5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %24
24: ; preds = %22, %19
%25 = tail call i64 @querycns(i32 2, i32 %14, i32 8, i32 0, i32* null)
%26 = icmp slt i64 %25, 0
%27 = add nuw nsw i64 %11, 1
br i1 %26, label %28, label %8
28: ; preds = %24, %8, %2
%29 = phi i32 [ 0, %2 ], [ 0, %8 ], [ -1, %24 ]
ret i32 %29
}