LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/stack.c
// Function: stack_create
Stack stack_create(int size)
{
    Stack s;
    s=(Stack)malloc(sizeof(StackNode));
    if(s==NULL)
    {
        fatal("stack malloc failed.");
    }
    s->next=NULL;
    return s;

}

// Assembly:
pushq %rax
pushq $0x10
popq %rdi
callq 0x10a0
testq %rax, %rax
je 0x17c9
andq $0x0, 0x8(%rax)
popq %rcx
retq
leaq 0x927(%rip), %rdi       # 0x20f7
callq 0x17d5
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/stack.c
// Function: stack_push
void stack_push(void *data, Stack s)
{
	PStackNode newNode;
    newNode=(PStackNode)malloc(sizeof(StackNode));
    if(newNode==NULL)
    {
        fatal("new node malloc failed");
    }
    newNode->data=data;
    newNode->next=s->next;
    s->next=newNode;

}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
pushq $0x10
popq %rdi
callq 0x10a0
testq %rax, %rax
je 0x18a9
movq %r14, (%rax)
movq 0x8(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x886(%rip), %rdi       # 0x2136
callq 0x17d5
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/stack.c
// Function: stack_print
void stack_print(Stack s){
    assert(s!=NULL);
    if(stack_isEmpty(s)){
        printf("stack is empty.\n");
        return;
    }
    
    printf("stack: ");
    PStackNode node=s->next;
    while(node!=NULL){
        printf("%d ", node->data);
        node=node->next;
    }
    printf("\n");
    
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1931
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x191e
leaq 0x89e(%rip), %rdi       # 0x2187
xorl %eax, %eax
callq 0x1060
leaq 0x898(%rip), %r14       # 0x218f
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x190f
movq (%rbx), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1060
jmp 0x18f7
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1040
leaq 0x87e(%rip), %rdi       # 0x21a3
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1050
leaq 0x7d4(%rip), %rdi       # 0x210c
leaq 0x7d5(%rip), %rsi       # 0x2114
leaq 0x829(%rip), %rcx       # 0x216f
pushq $0x53
popq %rdx
callq 0x1070
nop
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/queue.c
// Function: queue_clear
void queue_clear(Queue q) {
	assert(q!=NULL);
	q->size = 0;
	q->front = 1;
	q->end = 0;
}

// Assembly:
testq %rdi, %rdi
je 0x1987
andl $0x0, 0xc(%rdi)
movq $0x1, 0x4(%rdi)
retq
pushq %rax
leaq 0x824(%rip), %rdi       # 0x21b3
leaq 0x825(%rip), %rsi       # 0x21bb
leaq 0x826(%rip), %rcx       # 0x21c3
pushq $0x19
popq %rdx
callq 0x1070
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/queue.c
// Function: queue_create
Queue queue_create(int maxSize) {
	Queue q;
	q = (Queue) malloc(sizeof(struct QueueRecord));
	if (q == NULL ) {
		queue_fatal("queue malloc failed.");
	}
	q->data = malloc(sizeof(void*) * maxSize);
	q->capacity = maxSize;
	if (q->data == NULL ) {
		queue_fatal("data array malloc failed.");
	}
	queue_clear(q);
	return q;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
pushq $0x18
popq %rdi
callq 0x10a0
testq %rax, %rax
je 0x19eb
movq %rax, %rbx
movslq %ebp, %r14
leaq (,%r14,8), %rdi
callq 0x10a0
movq %rax, 0x10(%rbx)
movl %r14d, (%rbx)
testq %rax, %rax
je 0x19f7
andl $0x0, 0xc(%rbx)
movq $0x1, 0x4(%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x7e9(%rip), %rdi       # 0x21db
callq 0x1950
leaq 0x7f2(%rip), %rdi       # 0x21f0
callq 0x1950
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/queue.c
// Function: queue_print
void queue_print(Queue q) {
	assert(q!=NULL);
	if (queue_isEmpty(q)) {
		printf("queue is empty.\n");
		return;
	}
	for (int i = q->front; i < (q->front + q->size); i++) {

		int cursor = i;
		if (cursor >= q->capacity) {
			cursor = i - q->capacity;
		}
		printf("%d ", q->data[cursor]);
	}

	printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1abd
movq %rdi, %rbx
movl 0xc(%rdi), %eax
testl %eax, %eax
je 0x1aa7
movl 0x4(%rbx), %ecx
movslq %ecx, %r15
xorl %ebp, %ebp
leaq 0x72f(%rip), %r14       # 0x218f
addl %ecx, %eax
cmpl %eax, %r15d
jge 0x1a95
movl (%rbx), %eax
cmpl %eax, %r15d
cmovll %ebp, %eax
movq 0x10(%rbx), %rcx
cltq
shlq $0x3, %rax
subq %rax, %rcx
movq (%rcx,%r15,8), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x1060
movl 0x4(%rbx), %ecx
movl 0xc(%rbx), %eax
incq %r15
jmp 0x1a60
pushq $0xa
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1040
leaq 0x7f3(%rip), %rdi       # 0x22a1
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1050
leaq 0x6ef(%rip), %rdi       # 0x21b3
leaq 0x6f0(%rip), %rsi       # 0x21bb
leaq 0x752(%rip), %rcx       # 0x2224
pushq $0x35
popq %rdx
callq 0x1070
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/queue.c
// Function: queue_enqueue
void queue_enqueue(void* value, Queue q) {
	assert(q!=NULL);
	if (queue_isFull(q)) {
		queue_fatal("queue is full.");
	}
	q->size++;
	if (++q->end == q->capacity) {
		q->end = 0;
	}
	q->data[q->end] = value;
//	BST t= (BST)q->data[q->end];
//	printf("[queue_enqueue %d]\n", t->value);
}

// Assembly:
pushq %rax
testq %rsi, %rsi
je 0x1b0a
movl (%rsi), %eax
movl 0xc(%rsi), %ecx
cmpl %eax, %ecx
je 0x1b27
incl %ecx
movl %ecx, 0xc(%rsi)
movl 0x8(%rsi), %ecx
incl %ecx
xorl %edx, %edx
cmpl %eax, %ecx
cmovnel %ecx, %edx
movl %edx, 0x8(%rsi)
movq 0x10(%rsi), %rax
movslq %edx, %rcx
movq %rdi, (%rax,%rcx,8)
popq %rax
retq
leaq 0x6a2(%rip), %rdi       # 0x21b3
leaq 0x6a3(%rip), %rsi       # 0x21bb
leaq 0x71d(%rip), %rcx       # 0x223c
pushq $0x47
popq %rdx
callq 0x1070
leaq 0x730(%rip), %rdi       # 0x225e
callq 0x1950
// File: /workspace/github_c_makefile_star2_O2/mcxiaoke[P]dsaac/ch4/bst/queue.c
// Function: queue_dequeue
void* queue_dequeue(Queue q) {
	assert(q!=NULL);
	if (queue_isEmpty(q)) {
		queue_fatal("queue is empty.");
	}
	q->size--;
	void* tmp = q->data[q->front];
	if (++q->front == q->capacity) {
		q->front = 0;
	}
	return tmp;
}

// Assembly:
pushq %rax
testq %rdi, %rdi
je 0x1b5f
movl 0xc(%rdi), %eax
testl %eax, %eax
je 0x1b7c
decl %eax
movl %eax, 0xc(%rdi)
movq 0x10(%rdi), %rax
movslq 0x4(%rdi), %rcx
movq (%rax,%rcx,8), %rax
incl %ecx
xorl %edx, %edx
cmpl (%rdi), %ecx
cmovnel %ecx, %edx
movl %edx, 0x4(%rdi)
popq %rcx
retq
leaq 0x64d(%rip), %rdi       # 0x21b3
leaq 0x64e(%rip), %rsi       # 0x21bb
leaq 0x6f9(%rip), %rcx       # 0x226d
pushq $0x55
popq %rdx
callq 0x1070
leaq 0x71e(%rip), %rdi       # 0x22a1
callq 0x1950
// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/ch3/eatyguy3.c
// Function: getkey
int getkey(int *is_end_of_seq) {

  // Make reading from stdin non-blocking.
  int flags = fcntl(STDIN_FILENO, F_GETFL);
  fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK);

  // We care about two cases:
  // Case 1: A sequence of the form 27, 91, X; return X.
  // Case 2: For any other sequence, return each int separately.

  *is_end_of_seq = 0;
  int ch = getchar();
  if (ch == 27) {
    int next = getchar();
    if (next == 91) {
      *is_end_of_seq = 1;
      ch = getchar();
      goto end;
    }
    // If we get here, then we're not in a 27, 91, X sequence.
    ungetc(next, stdin);
  }

end:

  // Turn off non-blocking I/O. On some systems, leaving stdin
  // non-blocking will also leave stdout non-blocking, which
  // can cause printing errors.
  fcntl(STDIN_FILENO, F_SETFL, flags);
  return ch;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x3
popq %rsi
xorl %edi, %edi
xorl %eax, %eax
callq 0x4100
movl %eax, %ebx
movl %eax, %edx
orl $0x800, %edx            # imm = 0x800
pushq $0x4
popq %rsi
xorl %edi, %edi
xorl %eax, %eax
callq 0x4100
andl $0x0, (%r14)
callq 0x4280
movl %eax, %r15d
cmpl $0x1b, %eax
jne 0x46d1
callq 0x4280
cmpl $0x5b, %eax
jne 0x46bc
movl $0x1, (%r14)
callq 0x4280
movl %eax, %r15d
jmp 0x46d1
movq 0x2990d(%rip), %rcx     # 0x2dfd0
movq (%rcx), %rsi
movl %eax, %edi
callq 0x4360
pushq $0x1b
popq %r15
pushq $0x4
popq %rsi
xorl %edi, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x4100
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/ch3/eatyguy3.c
// Function: set_color
int set_color(lua_State *L) {
  const char *b_or_f = lua_tostring(L, 1);
  int color = lua_tonumber(L, 2);
  char cmd[1024];
  snprintf(cmd, 1024, "tput seta%s %d", b_or_f, color);
  system(cmd);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4ff2
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4f33
cvttsd2si %xmm0, %r8d
leaq 0x1987a(%rip), %rdx     # 0x1e081
leaq -0x410(%rbp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x4180
movq %rbx, %rdi
callq 0x4150
xorl %eax, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/ch3/eatyguy3.c
// Function: set_pos
int set_pos(lua_State *L) {
  int x = lua_tonumber(L, 1);
  int y = lua_tonumber(L, 2);
  char cmd[1024];
  // The 'tput cup' command accepts y before x; not a typo.
  snprintf(cmd, 1024, "tput cup %d %d", y, x);
  system(cmd);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %rbx
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x4f33
cvttsd2si %xmm0, %r14d
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4f33
cvttsd2si %xmm0, %ecx
leaq 0x19822(%rip), %rdx     # 0x1e090
leaq -0x410(%rbp), %rbx
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
movl %r14d, %r8d
xorl %eax, %eax
callq 0x4180
movq %rbx, %rdi
callq 0x4150
xorl %eax, %eax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/tylerneylon[P]APIsWithLua/ch3/eatyguy3.c
// Function: main
int main() {

  start();

  // Create a Lua state and load the module.
  lua_State *L = luaL_newstate();
  luaL_openlibs(L);

  // Make our Lua-callable functions visible to Lua.
  lua_register(L, "set_color", set_color);
  lua_register(L, "set_pos",   set_pos);
  lua_register(L, "timestamp", timestamp);

  // Load eatyguy3 and run the init() function.
  luaL_dofile(L, "eatyguy3.lua");
  lua_setglobal(L, "eatyguy");
  lua_settop(L, 0);

  lua_getglobal(L, "eatyguy");
  lua_getfield(L, -1, "init");  // -1 means stack top.
  lua_call(L, 0, 0);            // 0, 0 = #args, #retvals

  lua_getglobal(L, "eatyguy");
  while (1) {
    int is_end_of_seq;
    int key = getkey(&is_end_of_seq);
    if (key == ESC_KEY || key == 'q' || key == 'Q') done();

    // Call eatyguy.loop(<key>).
    lua_getfield(L, -1, "loop");
    push_keypress(L, key, is_end_of_seq);
    lua_call(L, 1, 0);

    sleephires(0.016);  // Sleep for 16ms.
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x4742
callq 0x12f12
movq %rax, %rbx
movq %rax, %rdi
callq 0x13138
leaq -0x117(%rip), %rsi      # 0x47d0
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5332
leaq 0x197a7(%rip), %rsi     # 0x1e09f
movq %rbx, %rdi
callq 0x5771
leaq -0xd1(%rip), %rsi       # 0x4836
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5332
leaq 0x19791(%rip), %rsi     # 0x1e0a9
movq %rbx, %rdi
callq 0x5771
leaq -0x8a(%rip), %rsi       # 0x489d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x5332
leaq 0x19779(%rip), %rsi     # 0x1e0b1
movq %rbx, %rdi
callq 0x5771
leaq 0x19774(%rip), %rsi     # 0x1e0bb
movq %rbx, %rdi
xorl %edx, %edx
callq 0x126e3
testl %eax, %eax
jne 0x496a
pushq $-0x1
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x5c40
leaq 0x19757(%rip), %r15     # 0x1e0c8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5771
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4b59
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5400
leaq 0x19738(%rip), %rdx     # 0x1e0d0
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x551c
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5bd8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5400
leaq -0x2c(%rbp), %r15
leaq 0x1a1e1(%rip), %r12     # 0x1ebab
pushq $0x1
popq %r13
movq %r15, %rdi
callq 0x4661
cmpl $0x1b, %eax
je 0x4a26
movl %eax, %r14d
cmpl $0x71, %eax
je 0x4a26
cmpl $0x51, %r14d
je 0x4a26
movq %rbx, %rdi
pushq $-0x1
popq %rsi
movq %r12, %rdx
callq 0x551c
movl -0x2c(%rbp), %edx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x479a
movq %rbx, %rdi
movl %r13d, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x5bd8
movsd 0x195f9(%rip), %xmm0    # 0x1e018
callq 0x46ed
jmp 0x49ce
callq 0x4777
nop
// File: /workspace/github_c_makefile_star2_O2/nh13[P]ksw/src/parasail/apps/parasail_stats.c
// Function: main
int main(int argc, char **argv) {
    parasail_sequences_t *sequences = NULL;
    const char *progname = "parasail_stats";

    /* Check arguments. */
    if (argc > 2) {
        fprintf(stderr, "Too many arguments.\n");
        print_help(progname, EXIT_FAILURE);
    }
    else if (argc < 2) {
        fprintf(stderr, "Missing input file.\n");
        print_help(progname, EXIT_FAILURE);
    }

    /* open file */
    sequences = parasail_sequences_from_file(argv[1]);
    if (NULL == sequences) {
        fprintf(stderr, "parasail_sequences_from_file(%s) failed\n", argv[1]);
        print_help(progname, EXIT_FAILURE);
    }

    /* print the stats */
    fprintf(stdout,
            "%25s: %lu\n"
            "%25s: %lu\n"
            "%25s: %lu\n"
            "%25s: %lu\n"
            "%25s: %f\n"
            "%25s: %f\n",
            "sequence count", (long unsigned)sequences->l,
            "character count", (long unsigned)sequences->characters,
            "shortest sequence", (long unsigned)sequences->shortest,
            "longest sequence", (long unsigned)sequences->longest,
            "sequence length mean", sequences->mean,
            "sequence length stddev", sequences->stddev
            );

    parasail_sequences_free(sequences);

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0x3, %edi
jge 0x12f1
cmpl $0x2, %edi
jne 0x1304
movq %rsi, %r14
movq 0x8(%rsi), %rdi
callq 0x1370
testq %rax, %rax
je 0x1325
movq %rax, %rbx
movq 0x2d4e(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %r9
cvtss2sd 0x28(%rbx), %xmm0
cvtss2sd 0x2c(%rbx), %xmm1
leaq 0xe5a(%rip), %r10       # 0x20f8
leaq 0xe3e(%rip), %r11       # 0x20e3
leaq 0xe26(%rip), %r14       # 0x20d2
leaq 0xe0d(%rip), %r15       # 0x20c0
leaq 0xdac(%rip), %rsi       # 0x2066
leaq 0xde0(%rip), %rdx       # 0x20a1
leaq 0xde8(%rip), %r8        # 0x20b0
movb $0x2, %al
pushq %r10
pushq %r11
pushq 0x20(%rbx)
pushq %r14
pushq 0x18(%rbx)
pushq %r15
callq 0x10a0
addq $0x30, %rsp
movq %rbx, %rdi
callq 0x1b60
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x2d00(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xd11(%rip), %rdi       # 0x2013
jmp 0x1315
movq 0x2ced(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xd13(%rip), %rdi       # 0x2028
pushq $0x14
popq %rsi
pushq $0x1
popq %rdx
callq 0x1120
callq 0x1346
movq 0x2ccc(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq 0x8(%r14), %rdx
leaq 0xd03(%rip), %rsi       # 0x203d
xorl %eax, %eax
callq 0x10a0
callq 0x1346
// File: /workspace/github_c_makefile_star2_O2/millimat[P]Soft-Heap/epsilon-timing.c
// Function: main
int main(int argc, char *argv[]) {
  int n = 10000;
  int tries = 10;

  srand(time(NULL));

  time_insert_extract(tries, n);
  time_meld(tries, n);

  return 0;
}

// Assembly:
pushq %rbx
xorl %edi, %edi
callq 0x1090
movl %eax, %edi
callq 0x1080
pushq $0xa
popq %rbx
movl %ebx, %edi
movl $0x2710, %esi           # imm = 0x2710
callq 0x11dc
movl %ebx, %edi
movl $0x2710, %esi           # imm = 0x2710
callq 0x144d
xorl %eax, %eax
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/i2c.c
// Function: i2c_close
static port_err_t i2c_close(struct port_interface *port)
{
	struct i2c_priv *h;

	h = (struct i2c_priv *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;
	close(h->fd);
	free(h);
	port->private = NULL;
	return PORT_ERR_OK;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x50(%rdi), %r14
testq %r14, %r14
je 0x2597
movq %rdi, %rbx
movl (%r14), %edi
callq 0x2120
movq %r14, %rdi
callq 0x2030
andq $0x0, 0x50(%rbx)
xorl %eax, %eax
jmp 0x259a
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/i2c.c
// Function: i2c_read
static port_err_t i2c_read(struct port_interface *port, void *buf,
			   size_t nbyte)
{
	struct i2c_priv *h;
	int ret;

	h = (struct i2c_priv *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;
	ret = read(h->fd, buf, nbyte);
	if (ret != (int)nbyte)
		return PORT_ERR_UNKNOWN;
	return PORT_ERR_OK;
}

// Assembly:
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0x25c5
pushq %rbx
movq %rdx, %rbx
movl (%rax), %edi
callq 0x2140
xorl %ecx, %ecx
cmpl %ebx, %eax
setne %cl
leal (%rcx,%rcx,2), %eax
popq %rbx
retq
pushq $0x3
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/i2c.c
// Function: i2c_write
static port_err_t i2c_write(struct port_interface *port, void *buf,
			    size_t nbyte)
{
	struct i2c_priv *h;
	int ret;

	h = (struct i2c_priv *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;
	ret = write(h->fd, buf, nbyte);
	if (ret != (int)nbyte)
		return PORT_ERR_UNKNOWN;
	return PORT_ERR_OK;
}

// Assembly:
movq 0x50(%rdi), %rax
testq %rax, %rax
je 0x25e9
pushq %rbx
movq %rdx, %rbx
movl (%rax), %edi
callq 0x2090
xorl %ecx, %ecx
cmpl %ebx, %eax
setne %cl
leal (%rcx,%rcx,2), %eax
popq %rbx
retq
pushq $0x3
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/init.c
// Function: gpio_bl_exit
int gpio_bl_exit(struct port_interface *port, const char *seq)
{
	char *s;

	if (seq == NULL)
		return 1;

	s = strchr(seq, ':');
	if (s == NULL || s[1] == '\0')
		return 1;

	return gpio_sequence(port, s + 1, strlen(s + 1));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x266c
movq %rdi, %rbx
pushq $0x3a
popq %rax
movq %rsi, %rdi
movl %eax, %esi
callq 0x20d0
testq %rax, %rax
je 0x266c
movq %rax, %r14
cmpb $0x0, 0x1(%rax)
je 0x266c
incq %r14
movq %r14, %rdi
callq 0x20b0
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2677
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/init.c
// Function: write_to
static int write_to(const char *filename, const char *value)
{
	int fd, ret;

	fd = open(filename, O_WRONLY);
	if (fd < 0) {
		fprintf(stderr, "Cannot open file \"%s\"\n", filename);
		return 0;
	}
	ret = write(fd, value, strlen(value));
	if (ret < 0) {
		fprintf(stderr, "Error writing in file \"%s\"\n", filename);
		close(fd);
		return 0;
	}
	close(fd);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r12
movq %rdi, %rbx
xorl %ebp, %ebp
pushq $0x1
popq %r15
movl %r15d, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
js 0x2cb8
movl %eax, %r14d
movq %r12, %rdi
callq 0x20b0
movl %r14d, %edi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2090
testl %eax, %eax
js 0x2cd5
movl %r14d, %edi
callq 0x2120
movl %r15d, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0xa331(%rip), %rax      # 0xcff0
movq (%rax), %rdi
leaq 0x48f7(%rip), %rsi      # 0x75c0
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2170
jmp 0x2cad
movq 0xa314(%rip), %rax      # 0xcff0
movq (%rax), %rdi
leaq 0x48f1(%rip), %rsi      # 0x75d7
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2170
movl %r14d, %edi
callq 0x2120
jmp 0x2cad
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/main.c
// Function: flash_addr_to_page_ceil
int flash_addr_to_page_ceil(uint32_t addr)
{
	int page;
	uint32_t *psize;

	if (!(addr >= stm->dev->fl_start && addr <= stm->dev->fl_end))
		return 0;

	page = 0;
	addr -= stm->dev->fl_start;
	psize = stm->dev->fl_ps;

	while (addr >= psize[0]) {
		addr -= psize[0];
		page++;
		if (psize[1])
			psize++;
	}

	return addr ? page + 1 : page;
}

// Assembly:
movq 0xa6ad(%rip), %rax      # 0xd3b0
movq 0x20(%rax), %rcx
xorl %eax, %eax
movl %edi, %esi
subl 0x18(%rcx), %esi
jb 0x2d3f
cmpl %edi, 0x1c(%rcx)
jb 0x2d3f
movq 0x28(%rcx), %rcx
movl (%rcx), %edx
xorl %eax, %eax
movl %esi, %edi
subl %edx, %edi
jb 0x2d39
incl %eax
movl 0x4(%rcx), %esi
testl %esi, %esi
cmovnel %esi, %edx
leaq 0x4(%rcx), %rsi
cmovneq %rsi, %rcx
movl %edi, %esi
jmp 0x2d1f
cmpl $0x1, %esi
sbbl $-0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/main.c
// Function: sighandler
void sighandler(int s){
	fprintf(stderr, "\nCaught signal %d\n",s);
	if (p_st &&  parser ) parser->close(p_st);
	if (stm  ) stm32_close  (stm);
	if (port) port->close(port);
	exit(1);
}

// Assembly:
pushq %rax
movl %edi, %edx
movq 0xa2a6(%rip), %rax      # 0xcff0
movq (%rax), %rdi
leaq 0x49fc(%rip), %rsi      # 0x7750
xorl %eax, %eax
callq 0x2170
movq 0xa656(%rip), %rdi      # 0xd3b8
testq %rdi, %rdi
setne %cl
movq 0xa651(%rip), %rax      # 0xd3c0
testq %rax, %rax
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x2d7f
callq *0x18(%rax)
movq 0xa62a(%rip), %rdi      # 0xd3b0
testq %rdi, %rdi
je 0x2d90
callq 0x5139
movq 0xa631(%rip), %rdi      # 0xd3c8
testq %rdi, %rdi
je 0x2d9f
callq *0x18(%rdi)
pushq $0x1
popq %rdi
callq 0x22a0
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/main.c
// Function: flash_page_to_addr
static uint32_t flash_page_to_addr(int page)
{
	int i;
	uint32_t addr, *psize;

	addr = stm->dev->fl_start;
	psize = stm->dev->fl_ps;

	for (i = 0; i < page; i++) {
		addr += psize[0];
		if (psize[1])
			psize++;
	}

	return addr;
}

// Assembly:
movq 0x90a2(%rip), %rax      # 0xd3b0
movq 0x20(%rax), %rcx
movl 0x18(%rcx), %eax
movq 0x28(%rcx), %rcx
xorl %edx, %edx
testl %edi, %edi
cmovgl %edi, %edx
subl $0x1, %edx
jb 0x4335
addl (%rcx), %eax
leaq 0x4(%rcx), %rsi
cmpl $0x0, 0x4(%rcx)
cmovneq %rsi, %rcx
jmp 0x4320
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/port.c
// Function: port_open
port_err_t port_open(struct port_options *ops, struct port_interface **outport)
{
	int ret;
	static struct port_interface **port;

	for (port = ports; *port; port++) {
		ret = (*port)->open(*port, ops);
		if (ret == PORT_ERR_NODEV)
			continue;
		if (ret == PORT_ERR_OK)
			break;
		fprintf(stderr, "Error probing interface \"%s\"\n",
			(*port)->name);
	}
	if (*port == NULL) {
		fprintf(stderr, "Cannot handle device \"%s\"\n",
			ops->device);
		return PORT_ERR_UNKNOWN;
	}

	*outport = *port;
	return PORT_ERR_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x8edf(%rip), %rax      # 0xd2c0
movq 0x8c08(%rip), %r12      # 0xcff0
leaq 0x455d(%rip), %r15      # 0x894c
movq %rax, 0x901a(%rip)      # 0xd410
movq (%rax), %rdi
testq %rdi, %rdi
je 0x4457
movq %rbx, %rsi
callq *0x10(%rdi)
cmpl $0x1, %eax
jne 0x4416
movq 0x9000(%rip), %rax      # 0xd410
addq $0x8, %rax
jmp 0x43ef
testl %eax, %eax
je 0x4437
movq (%r12), %rdi
movq 0x8feb(%rip), %rax      # 0xd410
movq (%rax), %rax
movq (%rax), %rdx
movq %r15, %rsi
xorl %eax, %eax
callq 0x2170
jmp 0x4409
movq 0x8fd2(%rip), %rax      # 0xd410
movq (%rax), %rax
testq %rax, %rax
je 0x4457
movq %rax, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq (%r12), %rdi
movq (%rbx), %rdx
leaq 0x4505(%rip), %rsi      # 0x896a
xorl %eax, %eax
callq 0x2170
pushq $0x3
popq %rax
jmp 0x444b
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/./serial_posix.c
// Function: serial_posix_close
static port_err_t serial_posix_close(struct port_interface *port)
{
	serial_t *h;

	h = (serial_t *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;

	serial_close(h);
	port->private = NULL;
	return PORT_ERR_OK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x50(%rdi), %rdi
testq %rdi, %rdi
je 0x4997
callq 0x4b03
andq $0x0, 0x50(%rbx)
xorl %eax, %eax
jmp 0x499a
pushq $0x3
popq %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/./serial_posix.c
// Function: serial_posix_read
static port_err_t serial_posix_read(struct port_interface *port, void *buf,
				     size_t nbyte)
{
	serial_t *h;
	ssize_t r;
	uint8_t *pos = (uint8_t *)buf;

	h = (serial_t *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;

	while (nbyte) {
		r = read(h->fd, pos, nbyte);
		if (r == 0)
			return PORT_ERR_TIMEDOUT;
		if (r < 0)
			return PORT_ERR_UNKNOWN;

		nbyte -= r;
		pos += r;
	}
	return PORT_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x50(%rdi), %r12
pushq $0x3
popq %rbx
testq %r12, %r12
je 0x49fc
movq %rdx, %r14
movq %rsi, %r15
pushq $0x2
popq %rbp
testq %r14, %r14
je 0x49f6
movl (%r12), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2140
testq %rax, %rax
je 0x49fa
js 0x49fc
subq %rax, %r14
addq %rax, %r15
jmp 0x49d3
xorl %ebx, %ebx
jmp 0x49fc
movl %ebp, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/./serial_posix.c
// Function: serial_posix_write
static port_err_t serial_posix_write(struct port_interface *port, void *buf,
				      size_t nbyte)
{
	serial_t *h;
	ssize_t r;
	const uint8_t *pos = (const uint8_t *)buf;

	h = (serial_t *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;

	while (nbyte) {
		r = write(h->fd, pos, nbyte);
		if (r < 1)
			return PORT_ERR_UNKNOWN;

		nbyte -= r;
		pos += r;
	}
	return PORT_ERR_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x50(%rdi), %r12
pushq $0x3
popq %rbx
testq %r12, %r12
je 0x4a44
movq %rdx, %r14
movq %rsi, %r15
testq %r14, %r14
je 0x4a42
movl (%r12), %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2090
testq %rax, %rax
jle 0x4a44
subq %rax, %r14
addq %rax, %r15
jmp 0x4a21
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/./serial_posix.c
// Function: serial_posix_gpio
static port_err_t serial_posix_gpio(struct port_interface *port,
				    serial_gpio_t n, int level)
{
	serial_t *h;
	int bit, lines;

	h = (serial_t *)port->private;
	if (h == NULL)
		return PORT_ERR_UNKNOWN;

	switch (n) {
	case GPIO_RTS:
		bit = TIOCM_RTS;
		break;

	case GPIO_DTR:
		bit = TIOCM_DTR;
		break;

	case GPIO_BRK:
		if (level == 0)
			return PORT_ERR_OK;
		if (tcsendbreak(h->fd, 1))
			return PORT_ERR_UNKNOWN;
		return PORT_ERR_OK;

	default:
		return PORT_ERR_UNKNOWN;
	}

	/* handle RTS/DTR */
	if (ioctl(h->fd, TIOCMGET, &lines))
		return PORT_ERR_UNKNOWN;
	lines = level ? lines | bit : lines & ~bit;
	if (ioctl(h->fd, TIOCMSET, &lines))
		return PORT_ERR_UNKNOWN;

	return PORT_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x50(%rdi), %r14
pushq $0x3
popq %rbx
testq %r14, %r14
je 0x4adf
movl %edx, %ebp
cmpl $0x1, %esi
je 0x4a8b
cmpl $0x3, %esi
je 0x4a7a
cmpl $0x2, %esi
jne 0x4adf
pushq $0x2
jmp 0x4a8d
testl %ebp, %ebp
je 0x4add
movl (%r14), %edi
pushq $0x1
popq %rsi
callq 0x2160
jmp 0x4ad1
pushq $0x4
popq %r15
movl (%r14), %edi
leaq 0x4(%rsp), %rdx
movl $0x5415, %esi           # imm = 0x5415
xorl %eax, %eax
callq 0x2110
testl %eax, %eax
jne 0x4adf
leaq 0x4(%rsp), %rdx
movl (%rdx), %eax
movl %eax, %ecx
orl %r15d, %ecx
notl %r15d
andl %eax, %r15d
testl %ebp, %ebp
cmovnel %ecx, %r15d
movl %r15d, (%rdx)
movl (%r14), %edi
movl $0x5418, %esi           # imm = 0x5418
xorl %eax, %eax
callq 0x2110
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
leal (%rcx,%rcx,2), %ebx
jmp 0x4adf
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/./serial_posix.c
// Function: serial_close
static void serial_close(serial_t *h)
{
	serial_flush(h);
	tcsetattr(h->fd, TCSANOW, &h->oldtio);
	lockf(h->fd, F_ULOCK, 0);
	close(h->fd);
	free(h);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x4b34
movl (%rbx), %edi
leaq 0x4(%rbx), %rdx
xorl %esi, %esi
callq 0x2220
movl (%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x20f0
movl (%rbx), %edi
callq 0x2120
movq %rbx, %rdi
popq %rbx
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_guess_len_cmd
static stm32_err_t stm32_guess_len_cmd(const stm32_t *stm, uint8_t cmd,
				       uint8_t *data, unsigned int len)
{
	struct port_interface *port = stm->port;
	port_err_t p_err;

	if (stm32_send_command(stm, cmd) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;
	if (port->flags & PORT_BYTE) {
		/* interface is UART-like */
		p_err = port->read(port, data, 1);
		if (p_err != PORT_ERR_OK)
			return STM32_ERR_UNKNOWN;
		len = data[0];
		p_err = port->read(port, data + 1, len + 1);
		if (p_err != PORT_ERR_OK)
			return STM32_ERR_UNKNOWN;
		return STM32_ERR_OK;
	}

	p_err = port->read(port, data, len + 2);
	if (p_err == PORT_ERR_OK && len == data[0])
		return STM32_ERR_OK;
	if (p_err != PORT_ERR_OK) {
		/* restart with only one byte */
		if (stm32_resync(stm) != STM32_ERR_OK)
			return STM32_ERR_UNKNOWN;
		if (stm32_send_command(stm, cmd) != STM32_ERR_OK)
			return STM32_ERR_UNKNOWN;
		p_err = port->read(port, data, 1);
		if (p_err != PORT_ERR_OK)
			return STM32_ERR_UNKNOWN;
	}

	fprintf(stderr, "Re sync (len = %d)\n", data[0]);
	if (stm32_resync(stm) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	len = data[0];
	if (stm32_send_command(stm, cmd) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;
	p_err = port->read(port, data, len + 2);
	if (p_err != PORT_ERR_OK)
		return STM32_ERR_UNKNOWN;
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r12d
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movq 0x8(%rdi), %rbx
callq 0x5132
movb $0x1, %r13b
testl %eax, %eax
je 0x5194
movzbl %r13b, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testb $0x1, 0x8(%rbx)
movq 0x28(%rbx), %rax
jne 0x51e3
leal 0x2(%r12), %edx
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movzbl %bpl, %ebp
testl %eax, %eax
je 0x5210
movq %r15, %rdi
callq 0x62a5
testl %eax, %eax
jne 0x5181
movq %r15, %rdi
movl %ebp, %esi
callq 0x5132
testl %eax, %eax
jne 0x5181
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x28(%rbx)
testl %eax, %eax
jne 0x5181
movzbl (%r14), %edx
jmp 0x5221
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
testl %eax, %eax
jne 0x5181
movzbl (%r14), %edx
incq %r14
incq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x28(%rbx)
testl %eax, %eax
setne %r13b
jmp 0x5181
movzbl (%r14), %edx
cmpl %r12d, %edx
jne 0x5221
xorl %r13d, %r13d
jmp 0x5181
movq 0x7dc8(%rip), %rax      # 0xcff0
movq (%rax), %rdi
leaq 0x3dbb(%rip), %rsi      # 0x8fed
xorl %eax, %eax
callq 0x2170
movq %r15, %rdi
callq 0x62a5
testl %eax, %eax
jne 0x5181
movzbl (%r14), %r12d
movq %r15, %rdi
movl %ebp, %esi
callq 0x5132
testl %eax, %eax
jne 0x5181
addq $0x2, %r12
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
jmp 0x5202
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_read_memory
stm32_err_t stm32_read_memory(const stm32_t *stm, uint32_t address,
			      uint8_t data[], unsigned int len)
{
	struct port_interface *port = stm->port;
	uint8_t buf[5];

	if (!len)
		return STM32_ERR_OK;

	if (len > 256) {
		fprintf(stderr, "Error: READ length limit at 256 bytes\n");
		return STM32_ERR_UNKNOWN;
	}

	if (stm->cmd->rm == STM32_CMD_ERR) {
		fprintf(stderr, "Error: READ command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->rm) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	buf[0] = address >> 24;
	buf[1] = (address >> 16) & 0xFF;
	buf[2] = (address >> 8) & 0xFF;
	buf[3] = address & 0xFF;
	buf[4] = buf[0] ^ buf[1] ^ buf[2] ^ buf[3];
	if (port->write(port, buf, 5) != PORT_ERR_OK)
		return STM32_ERR_UNKNOWN;
	if (stm32_get_ack(stm) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	if (stm32_send_command(stm, len - 1) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	if (port->read(port, data, len) != PORT_ERR_OK)
		return STM32_ERR_UNKNOWN;

	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %ecx, %ecx
je 0x5330
movl %ecx, %r14d
cmpl $0x101, %ecx            # imm = 0x101
jae 0x5343
movq %rdi, %r12
movq 0x18(%rdi), %rax
movb 0x3(%rax), %al
cmpb $-0x1, %al
je 0x5363
movq %rdx, %rbx
movl %esi, %r13d
movq 0x8(%r12), %r15
movzbl %al, %esi
movq %r12, %rdi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
jne 0x5332
movl %r13d, %eax
shrl $0x18, %eax
leaq 0x3(%rsp), %rsi
movb %al, (%rsi)
movl %r13d, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rsi)
movl %r13d, %edx
shrl $0x8, %edx
movb %dl, 0x2(%rsi)
movb %r13b, 0x3(%rsi)
xorb %r13b, %cl
xorb %dl, %al
xorb %cl, %al
movb %al, 0x4(%rsi)
pushq $0x5
popq %rdx
movq %r15, %rdi
callq *0x30(%r15)
testl %eax, %eax
jne 0x5332
movq %r12, %rdi
callq 0x5154
testl %eax, %eax
jne 0x5332
leal -0x1(%r14), %eax
movzbl %al, %esi
movq %r12, %rdi
callq 0x5132
testl %eax, %eax
jne 0x5332
movl %r14d, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq *0x28(%r15)
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
jmp 0x5332
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7ca6(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x382d(%rip), %rdi      # 0x8b81
pushq $0x26
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x1
jmp 0x5381
movq 0x7c86(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3834(%rip), %rdi      # 0x8ba8
pushq $0x33
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rbp
jmp 0x5332
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_get_ack_timeout
static stm32_err_t stm32_get_ack_timeout(const stm32_t *stm, time_t timeout)
{
	struct port_interface *port = stm->port;
	uint8_t byte;
	port_err_t p_err;
	time_t t0, t1;

	if (!(port->flags & PORT_RETRY))
		timeout = 0;

	if (timeout)
		time(&t0);

	do {
		p_err = port->read(port, &byte, 1);
		if (p_err == PORT_ERR_TIMEDOUT && timeout) {
			time(&t1);
			if (t1 < t0 + timeout)
				continue;
		}

		if (p_err != PORT_ERR_OK) {
			fprintf(stderr, "Failed to read ACK byte\n");
			return STM32_ERR_UNKNOWN;
		}

		if (byte == STM32_ACK)
			return STM32_ERR_OK;
		if (byte == STM32_NACK)
			return STM32_ERR_NACK;
		if (byte != STM32_BUSY) {
			fprintf(stderr, "Got byte 0x%02x instead of ACK\n",
				byte);
			return STM32_ERR_UNKNOWN;
		}
	} while (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x8(%rdi), %rbx
xorl %r13d, %r13d
testb $0x8, 0x8(%rbx)
cmovneq %rsi, %r13
testq %r13, %r13
je 0x554a
leaq 0x10(%rsp), %rdi
callq 0x21b0
leaq 0x7(%rsp), %r14
pushq $0x1
popq %r15
leaq 0x8(%rsp), %r12
testq %r13, %r13
sete %bpl
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *0x28(%rbx)
cmpl $0x2, %eax
setne %cl
orb %bpl, %cl
jne 0x558f
movq %r12, %rdi
callq 0x21b0
movq 0x10(%rsp), %rax
addq %r13, %rax
cmpq %rax, 0x8(%rsp)
jl 0x5558
jmp 0x55bd
testl %eax, %eax
jne 0x55bd
movzbl 0x7(%rsp), %edx
cmpl $0x76, %edx
je 0x5558
cmpl $0x1f, %edx
je 0x55ab
cmpl $0x79, %edx
jne 0x55db
xorl %eax, %eax
jmp 0x55ae
pushq $0x2
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7a2c(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3a33(%rip), %rdi      # 0x9001
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x55f3
movq 0x7a0e(%rip), %rax      # 0xcff0
movq (%rax), %rdi
leaq 0x3a2e(%rip), %rsi      # 0x901a
xorl %eax, %eax
callq 0x2170
pushq $0x1
jmp 0x55ad
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_warn_stretching
static void stm32_warn_stretching(const char *f)
{
	fprintf(stderr, "Attention !!!\n");
	fprintf(stderr, "\tThis %s error could be caused by your I2C\n", f);
	fprintf(stderr, "\tcontroller not accepting \"clock stretching\"\n");
	fprintf(stderr, "\tas required by bootloader.\n");
	fprintf(stderr, "\tCheck \"I2C.txt\" in stm32flash source code.\n");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x79ea(%rip), %r15      # 0xcff0
movq (%r15), %rcx
leaq 0x3a2a(%rip), %rdi      # 0x903a
pushq $0xe
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x22b0
movq (%r15), %rdi
leaq 0x3a21(%rip), %rsi      # 0x9049
movq %r14, %rdx
xorl %eax, %eax
callq 0x2170
movq (%r15), %rcx
leaq 0x3a39(%rip), %rdi      # 0x9075
pushq $0x2d
popq %rsi
movq %rbx, %rdx
callq 0x22b0
movq (%r15), %rcx
leaq 0x3a52(%rip), %rdi      # 0x90a3
pushq $0x1c
popq %rsi
movq %rbx, %rdx
callq 0x22b0
movq (%r15), %rcx
leaq 0x3a5a(%rip), %rdi      # 0x90c0
pushq $0x2c
popq %rsi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x22b0
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_wunprot_memory
stm32_err_t stm32_wunprot_memory(const stm32_t *stm)
{
	struct port_interface *port = stm->port;
	stm32_err_t s_err;

	if (stm->cmd->uw == STM32_CMD_ERR) {
		fprintf(stderr, "Error: WRITE UNPROTECT command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->uw) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	s_err = stm32_get_ack_timeout(stm, STM32_WUNPROT_TIMEOUT);
	if (s_err == STM32_ERR_NACK) {
		fprintf(stderr, "Error: Failed to WRITE UNPROTECT\n");
		return STM32_ERR_UNKNOWN;
	}
	if (s_err != STM32_ERR_OK) {
		if ((port->flags & PORT_STRETCH_W)
		    && stm->cmd->uw != STM32_CMD_UW_NS)
			stm32_warn_stretching("WRITE UNPROTECT");
		return STM32_ERR_UNKNOWN;
	}
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rax
movb 0x8(%rax), %al
cmpb $-0x1, %al
je 0x56d5
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl %al, %esi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x56a2
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x551e
testl %eax, %eax
je 0x569d
cmpl $0x2, %eax
je 0x56f6
testb $0x10, 0x8(%r14)
je 0x569b
movq 0x18(%rbx), %rax
cmpb $0x74, 0x8(%rax)
je 0x569b
leaq 0x35d1(%rip), %rdi      # 0x8c9f
callq 0x55f7
jmp 0x569b
movq 0x7914(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3558(%rip), %rdi      # 0x8c3e
pushq $0x3e
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rax
jmp 0x569d
movq 0x78f3(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3576(%rip), %rdi      # 0x8c7d
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x569b
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_wprot_memory
stm32_err_t stm32_wprot_memory(const stm32_t *stm)
{
	struct port_interface *port = stm->port;
	stm32_err_t s_err;

	if (stm->cmd->wp == STM32_CMD_ERR) {
		fprintf(stderr, "Error: WRITE PROTECT command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->wp) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	s_err = stm32_get_ack_timeout(stm, STM32_WPROT_TIMEOUT);
	if (s_err == STM32_ERR_NACK) {
		fprintf(stderr, "Error: Failed to WRITE PROTECT\n");
		return STM32_ERR_UNKNOWN;
	}
	if (s_err != STM32_ERR_OK) {
		if ((port->flags & PORT_STRETCH_W)
		    && stm->cmd->wp != STM32_CMD_WP_NS)
			stm32_warn_stretching("WRITE PROTECT");
		return STM32_ERR_UNKNOWN;
	}
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rax
movb 0x7(%rax), %al
cmpb $-0x1, %al
je 0x5773
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl %al, %esi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x5740
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x551e
testl %eax, %eax
je 0x573b
cmpl $0x2, %eax
je 0x5794
testb $0x10, 0x8(%r14)
je 0x5739
movq 0x18(%rbx), %rax
cmpb $0x64, 0x7(%rax)
je 0x5739
leaq 0x35a0(%rip), %rdi      # 0x8d0c
callq 0x55f7
jmp 0x5739
movq 0x7876(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x352b(%rip), %rdi      # 0x8caf
pushq $0x3c
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rax
jmp 0x573b
movq 0x7855(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3547(%rip), %rdi      # 0x8cec
pushq $0x1f
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x5739
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_runprot_memory
stm32_err_t stm32_runprot_memory(const stm32_t *stm)
{
	struct port_interface *port = stm->port;
	stm32_err_t s_err;

	if (stm->cmd->ur == STM32_CMD_ERR) {
		fprintf(stderr, "Error: READOUT UNPROTECT command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->ur) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	s_err = stm32_get_ack_timeout(stm, STM32_MASSERASE_TIMEOUT);
	if (s_err == STM32_ERR_NACK) {
		fprintf(stderr, "Error: Failed to READOUT UNPROTECT\n");
		return STM32_ERR_UNKNOWN;
	}
	if (s_err != STM32_ERR_OK) {
		if ((port->flags & PORT_STRETCH_W)
		    && stm->cmd->ur != STM32_CMD_UR_NS)
			stm32_warn_stretching("READOUT UNPROTECT");
		return STM32_ERR_UNKNOWN;
	}
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rax
movb 0xa(%rax), %al
cmpb $-0x1, %al
je 0x5811
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl %al, %esi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x57de
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x23
popq %rsi
movq %rbx, %rdi
callq 0x551e
testl %eax, %eax
je 0x57d9
cmpl $0x2, %eax
je 0x5832
testb $0x10, 0x8(%r14)
je 0x57d7
movq 0x18(%rbx), %rax
cmpb $-0x6d, 0xa(%rax)
je 0x57d7
leaq 0x3575(%rip), %rdi      # 0x8d7f
callq 0x55f7
jmp 0x57d7
movq 0x77d8(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x34f8(%rip), %rdi      # 0x8d1a
pushq $0x40
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rax
jmp 0x57d9
movq 0x77b7(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x3518(%rip), %rdi      # 0x8d5b
pushq $0x23
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x57d7
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_readprot_memory
stm32_err_t stm32_readprot_memory(const stm32_t *stm)
{
	struct port_interface *port = stm->port;
	stm32_err_t s_err;

	if (stm->cmd->rp == STM32_CMD_ERR) {
		fprintf(stderr, "Error: READOUT PROTECT command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->rp) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	s_err = stm32_get_ack_timeout(stm, STM32_RPROT_TIMEOUT);
	if (s_err == STM32_ERR_NACK) {
		fprintf(stderr, "Error: Failed to READOUT PROTECT\n");
		return STM32_ERR_UNKNOWN;
	}
	if (s_err != STM32_ERR_OK) {
		if ((port->flags & PORT_STRETCH_W)
		    && stm->cmd->rp != STM32_CMD_RP_NS)
			stm32_warn_stretching("READOUT PROTECT");
		return STM32_ERR_UNKNOWN;
	}
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x18(%rdi), %rax
movb 0x9(%rax), %al
cmpb $-0x1, %al
je 0x58af
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl %al, %esi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x587c
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x1
popq %rsi
movq %rbx, %rdi
callq 0x551e
testl %eax, %eax
je 0x5877
cmpl $0x2, %eax
je 0x58d0
testb $0x10, 0x8(%r14)
je 0x5875
movq 0x18(%rbx), %rax
cmpb $-0x7d, 0x9(%rax)
je 0x5875
leaq 0x354a(%rip), %rdi      # 0x8df2
callq 0x55f7
jmp 0x5875
movq 0x773a(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x34d1(%rip), %rdi      # 0x8d91
pushq $0x3e
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rax
jmp 0x5877
movq 0x7719(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x34ef(%rip), %rdi      # 0x8dd0
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x5875
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_go
stm32_err_t stm32_go(const stm32_t *stm, uint32_t address)
{
	struct port_interface *port = stm->port;
	uint8_t buf[5];

	if (stm->cmd->go == STM32_CMD_ERR) {
		fprintf(stderr, "Error: GO command not implemented in bootloader.\n");
		return STM32_ERR_NO_CMD;
	}

	if (stm32_send_command(stm, stm->cmd->go) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;

	buf[0] = address >> 24;
	buf[1] = (address >> 16) & 0xFF;
	buf[2] = (address >> 8) & 0xFF;
	buf[3] = address & 0xFF;
	buf[4] = buf[0] ^ buf[1] ^ buf[2] ^ buf[3];
	if (port->write(port, buf, 5) != PORT_ERR_OK)
		return STM32_ERR_UNKNOWN;

	if (stm32_get_ack(stm) != STM32_ERR_OK)
		return STM32_ERR_UNKNOWN;
	return STM32_ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x18(%rdi), %rax
movb 0x4(%rax), %al
cmpb $-0x1, %al
je 0x5d38
movl %esi, %r15d
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movzbl %al, %esi
callq 0x5132
pushq $0x1
popq %rbp
testl %eax, %eax
jne 0x5d57
movl %r15d, %eax
shrl $0x18, %eax
leaq 0x3(%rsp), %rsi
movb %al, (%rsi)
movl %r15d, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rsi)
movl %r15d, %edx
shrl $0x8, %edx
movb %dl, 0x2(%rsi)
movb %r15b, 0x3(%rsi)
xorb %r15b, %cl
xorb %dl, %al
xorb %cl, %al
movb %al, 0x4(%rsi)
pushq $0x5
popq %rdx
movq %r14, %rdi
callq *0x30(%r14)
testl %eax, %eax
jne 0x5d57
movq %rbx, %rdi
callq 0x5154
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
jmp 0x5d57
movq 0x72b1(%rip), %rax      # 0xcff0
movq (%rax), %rcx
leaq 0x30ee(%rip), %rdi      # 0x8e37
pushq $0x31
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $0x3
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/koendv[P]stm32duino-raspberrypi/Arduino_Tools/src/stm32flash/stm32.c
// Function: stm32_reset_device
stm32_err_t stm32_reset_device(const stm32_t *stm)
{
	uint32_t target_address = stm->dev->ram_start;

	if (stm->dev->flags & F_OBLL) {
		/* set the OBL_LAUNCH bit to reset device (see RM0360, 2.5) */
		return stm32_run_raw_code(stm, target_address, stm_obl_launch_code, stm_obl_launch_code_length);
	} else if (stm->dev->flags & F_PEMPTY) {
		/* clear the PEMPTY bit to reset the device (see RM0394) */
		return stm32_run_raw_code(stm, target_address, stm_pempty_launch_code, stm_pempty_launch_code_length);
	} else {
		return stm32_run_raw_code(stm, target_address, stm_reset_code, stm_reset_code_length);
	}
}

// Assembly:
movq 0x20(%rdi), %rax
movl 0x10(%rax), %esi
movl 0x40(%rax), %eax
testb $0x2, %al
jne 0x5d7f
testb $0x4, %al
jne 0x5d8a
leaq 0x34f3(%rip), %rdx      # 0x9270
jmp 0x5d86
leaq 0x349a(%rip), %rdx      # 0x9220
pushq $0x10
jmp 0x5d93
leaq 0x349f(%rip), %rdx      # 0x9230
pushq $0x38
popq %rcx
jmp 0x5d96