#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*/ debug_out(char *, int);
int /*<<< orphan*/ debug_outf(char *, char const *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
void set_point(int *table, char *arg, const char *desc) {
  int c;
  if (*arg) {
    for (c = 0; c < 8; c++) {
      if (table[c] == -1) {
        sscanf(arg, "%X", &table[c]);
        debug_outf("    %s %i set to %04X\n", desc, c, table[c]);
        return;
      }
    }
    debug_outf("    unable to set %s breakpoint, table full\n", desc);
  } else
    debug_out("    missing parameter\n!", 24);
}


x86 assembly (clang, -O0):
<set_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e2 <set_point+0xb2>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11cb <set_point+0x9b>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    11b8 <set_point+0x88>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xe72(%rip),%rsi
call   1040 <sscanf@plt>
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <debug_outf@plt>
jmp    11f3 <set_point+0xc3>
jmp    11bd <set_point+0x8d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1158 <set_point+0x28>
mov    -0x18(%rbp),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <debug_outf@plt>
jmp    11f3 <set_point+0xc3>
lea    0xe5e(%rip),%rdi
mov    $0x18,%esi
call   1030 <debug_out@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_point>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rsi)
je     118c <set_point+0x5c>
mov    %rdx,%r14
mov    %rdi,%rbx
cmpl   $0xffffffff,(%rdi)
je     11a7 <set_point+0x77>
cmpl   $0xffffffff,0x4(%rbx)
je     11ac <set_point+0x7c>
cmpl   $0xffffffff,0x8(%rbx)
je     11b4 <set_point+0x84>
cmpl   $0xffffffff,0xc(%rbx)
je     11bc <set_point+0x8c>
cmpl   $0xffffffff,0x10(%rbx)
je     11c4 <set_point+0x94>
cmpl   $0xffffffff,0x14(%rbx)
je     11cc <set_point+0x9c>
cmpl   $0xffffffff,0x18(%rbx)
je     11d4 <set_point+0xa4>
cmpl   $0xffffffff,0x1c(%rbx)
je     11dc <set_point+0xac>
lea    0xea2(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <debug_outf@plt>
lea    0xeb4(%rip),%rdi
mov    $0x18,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <debug_out@plt>
xor    %r15d,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x1,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x2,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x3,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x4,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x5,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x6,%r15d
jmp    11e2 <set_point+0xb2>
mov    $0x7,%r15d
mov    %r15d,%ebp
lea    (%rbx,%rbp,4),%rdx
lea    0xe10(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1040 <sscanf@plt>
mov    (%rbx,%rbp,4),%ecx
lea    0xdfe(%rip),%rdi
mov    %r14,%rsi
mov    %r15d,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <debug_outf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%X\00"
@.str.1 = [23 x i8] c" %s %i set to %04X\0A\00"
@.str.2 = [45 x i8] c" unable to set %s breakpoint, table full\0A\00"
@.str.3 = [24 x i8] c" missing parameter\0A!\00"
define void @set_point(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %44
11: ; preds = %3
store i32 0, i32* %7
br label %12
12: ; preds = %38, %11
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %41
15: ; preds = %12
%16 = load i32*, i32** %4
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %37
22: ; preds = %15
%23 = load i8*, i8** %5
%24 = load i32*, i32** %4
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %27)
%29 = load i8*, i8** %6
%30 = load i32, i32* %7
%31 = load i32*, i32** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = call i32 (i8*, i8*, ...) @debug_outf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 %30, i32 %35)
br label %46
37: ; preds = %15
br label %38
38: ; preds = %37
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
store i32 %40, i32* %7
br label %12
41: ; preds = %12
%42 = load i8*, i8** %6
%43 = call i32 (i8*, i8*, ...) @debug_outf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %46
44: ; preds = %3
%45 = call i32 @debug_out(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 24)
br label %46
46: ; preds = %22, %44, %41
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%X\00"
@.str.1 = [23 x i8] c" %s %i set to %04X\0A\00"
@.str.2 = [45 x i8] c" unable to set %s breakpoint, table full\0A\00"
@.str.3 = [24 x i8] c" missing parameter\0A!\00"
define void @set_point(i32* %0, i8* nocapture %1, i8* %2) {
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 0
br i1 %5, label %46, label %6
6: ; preds = %3
%7 = load i32, i32* %0
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %16
9: ; preds = %40, %36, %32, %28, %24, %20, %16, %6
%10 = phi i32 [ 0, %6 ], [ 1, %16 ], [ 2, %20 ], [ 3, %24 ], [ 4, %28 ], [ 5, %32 ], [ 6, %36 ], [ 7, %40 ]
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = tail call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = tail call i32 (i8*, i8*, ...) @debug_outf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %10, i32 %14)
br label %48
16: ; preds = %6
%17 = getelementptr inbounds i32, i32* %0, i64 1
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, -1
br i1 %19, label %9, label %20
20: ; preds = %16
%21 = getelementptr inbounds i32, i32* %0, i64 2
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, -1
br i1 %23, label %9, label %24
24: ; preds = %20
%25 = getelementptr inbounds i32, i32* %0, i64 3
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, -1
br i1 %27, label %9, label %28
28: ; preds = %24
%29 = getelementptr inbounds i32, i32* %0, i64 4
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, -1
br i1 %31, label %9, label %32
32: ; preds = %28
%33 = getelementptr inbounds i32, i32* %0, i64 5
%34 = load i32, i32* %33
%35 = icmp eq i32 %34, -1
br i1 %35, label %9, label %36
36: ; preds = %32
%37 = getelementptr inbounds i32, i32* %0, i64 6
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, -1
br i1 %39, label %9, label %40
40: ; preds = %36
%41 = getelementptr inbounds i32, i32* %0, i64 7
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, -1
br i1 %43, label %9, label %44
44: ; preds = %40
%45 = tail call i32 (i8*, i8*, ...) @debug_outf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %2)
br label %48
46: ; preds = %3
%47 = tail call i32 @debug_out(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 24)
br label %48
48: ; preds = %44, %46, %9
ret void
}