task_name
stringlengths
3
18
source_code
stringlengths
217
74k
x86
stringlengths
1.07k
266k
arm_linux
stringlengths
1.12k
270k
riscv
stringlengths
1.31k
272k
arm_apple
stringlengths
936
266k
ackermann
/* Ackermann.c: calculate the Ackermann function (as far as that is possible), * and discuss its properties. Compile: cc -o ackermann ackermann.c ( Use the flag -D_SHORT_STRINGS if your compiler cannot handle multiline strings.) For usage information, give the command ackermann -h or see USAGE define...
.text .intel_syntax noprefix .file "ackermann.c" .globl ack # -- Begin function ack .p2align 4, 0x90 .type ack,@function ack: # @ack .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register ...
.text .file "ackermann.c" .globl ack // -- Begin function ack .p2align 2 .type ack,@function ack: // @ack .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "ackermann.c" .globl ack # -- Begin function ack .p2align 1 .type ack,@function ack: # @ack .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_o...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _ack ; -- Begin function ack .p2align 2 _ack: ; @ack .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, #3...
aes
#include "libmin.h" #define BLK_SIZE 16 #define ROUNDS 10 uint8_t sbox[256] = { 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, ...
.text .intel_syntax noprefix .file "aes.c" .globl add_round_key # -- Begin function add_round_key .p2align 4, 0x90 .type add_round_key,@function add_round_key: # @add_round_key .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp...
.text .file "aes.c" .globl add_round_key // -- Begin function add_round_key .p2align 2 .type add_round_key,@function add_round_key: // @add_round_key .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] str wzr, [sp, #1...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "aes.c" .globl add_round_key # -- Begin function add_round_key .p2align 1 .type add_round_key,@function add_round_key: # @add_round_key .cfi_startproc # %bb.0: addi sp,...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _add_round_key ; -- Begin function add_round_key .p2align 2 _add_round_key: ; @add_round_key .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp,...
anagram
/* * Anagram program by Raymond Chen, * inspired by a similar program by Brian Scearce * * This program is Copyright 1991 by Raymond Chen. * (rjc@math.princeton.edu) * * This program may be freely distributed provided all alterations * to the original are clearly indicated as such. */ /* The...
.text .intel_syntax noprefix .file "anagram.c" .globl Fatal # -- Begin function Fatal .p2align 4, 0x90 .type Fatal,@function Fatal: # @Fatal .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regis...
.text .file "anagram.c" .globl Fatal // -- Begin function Fatal .p2align 2 .type Fatal,@function Fatal: // @Fatal .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "anagram.c" .globl Fatal # -- Begin function Fatal .p2align 1 .type Fatal,@function Fatal: # @Fatal .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _Fatal ; -- Begin function Fatal .p2align 2 _Fatal: ; @Fatal .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp...
audio-codec
/** * @file * @author [sunzhenliang](https://github.com/HiSunzhenliang) * @brief A-law algorithm for encoding and decoding (16bit pcm <=> a-law). * This is the implementation of [G.711](https://en.wikipedia.org/wiki/G.711) * in C. **/ /** * Linear input code | Compressed code | Linear output code * -----------...
.text .intel_syntax noprefix .file "audio-codec.c" .globl encode # -- Begin function encode .p2align 4, 0x90 .type encode,@function encode: # @encode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cf...
.text .file "audio-codec.c" .globl encode // -- Begin function encode .p2align 2 .type encode,@function encode: // @encode .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str x1, [sp, #64] str x2, [sp, #56] strb wzr, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "audio-codec.c" .globl encode # -- Begin function encode .p2align 1 .type encode,@function encode: # @encode .cfi_startproc # %bb.0: addi sp, sp, -112 .c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _encode ; -- Begin function encode .p2align 2 _encode: ; @encode .cfi_startproc ; %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str x1, [sp, #64] str x2,...
avl-tree
/* A balanced binary search tree(AVLTree) implementation * Written by Coleman * Released under GNU GPL Version 2 or later(http://www.gnu.org/) */ #include "libmin.h" #include "element.h" #include "avlcore.h" #define MAXELEMENTSIZE 500000 void printTree(TreeNode *start, long level) { long i = 0; if(start ==...
.text .intel_syntax noprefix .file "avl-tree.c" .globl printTree # -- Begin function printTree .p2align 4, 0x90 .type printTree,@function printTree: # @printTree .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_...
.text .file "avl-tree.c" .globl printTree // -- Begin function printTree .p2align 2 .type printTree,@function printTree: // @printTree .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "avl-tree.c" .globl printTree # -- Begin function printTree .p2align 1 .type printTree,@function printTree: # @printTree .cfi_startproc # %bb.0: addi sp, sp, -4...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _printTree ; -- Begin function printTree .p2align 2 _printTree: ; @printTree .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Folded Spill add...
banner
/* * Copyright (c) 1980, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above...
.text .intel_syntax noprefix .file "banner.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register ...
.text .file "banner.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-byte Folded Spill add x29, sp, #48 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "banner.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -64 .cfi_def_cfa_o...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29, sp, ...
bit-kernels
#include "libmin.h" #define NUM_ELEMENTS 100 // Total numbers to test #define TABLE_SIZE 256 // For table lookup; precompute for 8-bit numbers // Global lookup table for table method unsigned int popcount_table[TABLE_SIZE]; // ------------------------------ // Bit-counting Kernel 1: Naive method // -----------...
.text .intel_syntax noprefix .file "bit-kernels.c" .globl count_bits_naive # -- Begin function count_bits_naive .p2align 4, 0x90 .type count_bits_naive,@function count_bits_naive: # @count_bits_naive .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, ...
.text .file "bit-kernels.c" .globl count_bits_naive // -- Begin function count_bits_naive .p2align 2 .type count_bits_naive,@function count_bits_naive: // @count_bits_naive .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] str wzr, [sp, #8] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "bit-kernels.c" .globl count_bits_naive # -- Begin function count_bits_naive .p2align 1 .type count_bits_naive,@function count_bits_naive: # @count_bits_naive .cfi_startproc #...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _count_bits_naive ; -- Begin function count_bits_naive .p2align 2 _count_bits_naive: ; @count_bits_naive .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] str wz...
blake2b
/** * @addtogroup hash Hash algorithms * @{ * @file * @author [Daniel Murrow](https://github.com/dsmurrow) * @brief [Blake2b cryptographic hash * function](https://www.rfc-editor.org/rfc/rfc7693) * * The Blake2b cryptographic hash function provides * hashes for data that are secure enough to be used in * cryp...
.text .intel_syntax noprefix .file "blake2b.c" .globl blake2b # -- Begin function blake2b .p2align 4, 0x90 .type blake2b,@function blake2b: # @blake2b .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa...
.text .file "blake2b.c" .globl blake2b // -- Begin function blake2b .p2align 2 .type blake2b,@function blake2b: // @blake2b .cfi_startproc // %bb.0: sub sp, sp, #160 .cfi_def_cfa_offset 160 stp x29, x30, [sp, #144] // 16-byte Folded Spill add x...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "blake2b.c" .globl blake2b # -- Begin function blake2b .p2align 1 .type blake2b,@function blake2b: # @blake2b .cfi_startproc # %bb.0: addi sp, sp, -176 .cf...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _blake2b ; -- Begin function blake2b .p2align 2 _blake2b: ; @blake2b .cfi_startproc ; %bb.0: sub sp, sp, #176 stp x29, x30, [sp, #160] ; 16-byte Folded Spill add x2...
bloom-filter
#include "libmin.h" #include "tinybloom.h" #define NUM_ITEMS 512 /* 2048 */ #define NUM_BUCKETS NUM_ITEMS * 4 int bad_search(const unsigned int* array, unsigned int target, size_t size) { int i; for(i = 0; i < size; i++) if(array[i] == target) return 1; return 0; } int main(void) { unsigned false_positives = ...
.text .intel_syntax noprefix .file "bloom-filter.c" .globl bad_search # -- Begin function bad_search .p2align 4, 0x90 .type bad_search,@function bad_search: # @bad_search .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp...
.text .file "bloom-filter.c" .globl bad_search // -- Begin function bad_search .p2align 2 .type bad_search,@function bad_search: // @bad_search .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str x0, [sp, #32] str w1, [sp, #28] str x2, [sp, #16...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "bloom-filter.c" .globl bad_search # -- Begin function bad_search .p2align 1 .type bad_search,@function bad_search: # @bad_search .cfi_startproc # %bb.0: addi sp,...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _bad_search ; -- Begin function bad_search .p2align 2 _bad_search: ; @bad_search .cfi_startproc ; %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str x0, [sp, #32] str w1, [sp, #28] ...
boyer-moore-search
/* C Program for Bad Character Heuristic of Boyer Moore String Matching Algorithm */ // SOURCE: https://www.geeksforgeeks.org/boyer-moore-algorithm-for-pattern-searching/ #include "libmin.h" // valid SIZE's: 380, 760 (default), 1140, 1520 #define SIZE 760 // Inputs char inp_pat[] = "NzZVOzZXNoGXMl8yxesyY"; char inp_...
.text .intel_syntax noprefix .file "boyer-moore-search.c" .globl badCharHeuristic # -- Begin function badCharHeuristic .p2align 4, 0x90 .type badCharHeuristic,@function badCharHeuristic: # @badCharHeuristic .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offse...
.text .file "boyer-moore-search.c" .globl badCharHeuristic // -- Begin function badCharHeuristic .p2align 2 .type badCharHeuristic,@function badCharHeuristic: // @badCharHeuristic .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str w1, [sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "boyer-moore-search.c" .globl badCharHeuristic # -- Begin function badCharHeuristic .p2align 1 .type badCharHeuristic,@function badCharHeuristic: # @badCharHeuristic .cfi_star...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _badCharHeuristic ; -- Begin function badCharHeuristic .p2align 2 _badCharHeuristic: ; @badCharHeuristic .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str w1...
bubble-sort
#include "libmin.h" // supported sizes: 256 (default), 512, 1024, 2048 #define DATASET_SIZE 256 int data[DATASET_SIZE]; // total swaps executed so far unsigned long swaps = 0; void print_data(int *data, unsigned size) { libmin_printf("DATA DUMP:\n"); for (unsigned i=0; i < size; i++) libmin_printf(" data[%...
.text .intel_syntax noprefix .file "bubble-sort.c" .globl print_data # -- Begin function print_data .p2align 4, 0x90 .type print_data,@function print_data: # @print_data .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "bubble-sort.c" .globl print_data // -- Begin function print_data .p2align 2 .type print_data,@function print_data: // @print_data .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded S...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "bubble-sort.c" .globl print_data # -- Begin function print_data .p2align 1 .type print_data,@function print_data: # @print_data .cfi_startproc # %bb.0: addi sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _print_data ; -- Begin function print_data .p2align 2 _print_data: ; @print_data .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill a...
c-interp
#include "libmin.h" #include "hello-c.h" MFILE hello = { "hello.c", __hello_sz, __hello, 0 }; MFILE *mhello = &hello; long debug; // print the executed instructions long assembly; // print out the assembly and source long token; // current token // instructions enum { LEA ,IMM ,JMP ,CALL,JZ ,JNZ ,ENT ,...
.text .intel_syntax noprefix .file "c-interp.c" .globl next # -- Begin function next .p2align 4, 0x90 .type next,@function next: # @next .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_registe...
.text .file "c-interp.c" .globl next // -- Begin function next .p2align 2 .type next,@function next: // @next .cfi_startproc // %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 stp x29, x30, [sp, #80] // 16-byte Folded Spill add x29, sp, #8...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "c-interp.c" .globl next # -- Begin function next .p2align 1 .type next,@function next: # @next .cfi_startproc # %bb.0: addi sp, sp, -128 .cfi_def_cf...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _next ; -- Begin function next .p2align 2 _next: ; @next .cfi_startproc ; %bb.0: sub sp, sp, #112 stp x29, x30, [sp, #96] ; 16-byte Folded Spill add x29, sp,...
ccmac
// bench_horner_fp64.c // Simple FP64 Horner benchmark: y = (((cD*x + cD-1)*x + ... )*x + c0) // No CLI, no timing. Adjust work via macros. // Knobs (override with -DNAME=value): #ifndef N_ITER #define N_ITER 100 #endif #ifndef N_ELEMS #define N_ELEMS (1u << 6) // 1,048,576 #endif #ifndef DEGREE #define DEG...
.text .intel_syntax noprefix .file "ccmac.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x4109000000000000 # double 204800 .LCPI0_1: .quad 0x3c9cd2b297d889bc # double 9.9999999999999997E-17 .LCPI0_2: .quad 0x...
.text .file "ccmac.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x3c9cd2b297d889bc // double 9.9999999999999997E-17 .LCPI0_1: .xword 0x4109000000000000 // double 204800 .text .globl main .p2align 2 .type...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "ccmac.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x3c9cd2b297d889bc # double 9.9999999999999997E-17 .LCPI0_1: .quad 0xbff0000...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x3c9cd2b297d889bc ; double 9.9999999999999997E-17 lCPI0_1: .quad 0x4109000000000000 ; d...
checkers
#include "libmin.h" #include "consttypes.h" #include "functions.h" #include "test0-txt.h" MFILE __infile = { "test0.txt", __test0_sz, __test0, 0 }; MFILE *infile = &__infile; int main(int argc, char *argv[]) { libmin_mopen(infile, "r"); board_t* board = (board_t*)libmin_malloc(sizeof(board_t)); // main ...
.text .intel_syntax noprefix .file "checkers.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_registe...
.text .file "checkers.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #224 .cfi_def_cfa_offset 224 stp x29, x30, [sp, #208] // 16-byte Folded Spill add x29, sp, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "checkers.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -224 .cfi_def_cf...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #272 stp x28, x27, [sp, #240] ; 16-byte Folded Spill stp x29, x30...
chi-squared
#include "libmin.h" #define DATASET_SIZE 600 #define ASSOC_X_CATEGORIES 4 #define ASSOC_Y_CATEGORIES 3 #define GOF_CATEGORIES 5 static const uint64_t gof_expected_counts[GOF_CATEGORIES] = {60, 120, 180, 150, 90}; static inline uint64_t my_abs_diff(uint64_t lhs, uint64_t rhs) { if (lhs >= rhs) return lhs - rhs;...
.text .intel_syntax noprefix .file "chi-squared.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regi...
.text .file "chi-squared.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: stp x29, x30, [sp, #-32]! // 16-byte Folded Spill .cfi_def_cfa_offset 32 str x28, [sp, #16] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "chi-squared.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 2635249153387078803 # 0x2492492492492493 .LCPI0_1: .quad 33539534679471...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp, #16] ...
cipher
#include "libmin.h" void encipher(uint32_t *const in, uint32_t *const out, const uint32_t *const key) { uint32_t y=in[0], z=in[1], sum=0, delta=0x9E3779B9; uint32_t a=key[0], b=key[1], c=key[2], d=key[3], n=32; while (n-->0) { sum += delta; y += ((z << 4)+a) ^ (z+sum) ^ ((z >> 5)+b); z...
.text .intel_syntax noprefix .file "cipher.c" .globl encipher # -- Begin function encipher .p2align 4, 0x90 .type encipher,@function encipher: # @encipher .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_c...
.text .file "cipher.c" .globl encipher // -- Begin function encipher .p2align 2 .type encipher,@function encipher: // @encipher .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 str x0, [sp, #56] str x1, [sp, #48] str x2, [sp, #40] ldr x8, [...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "cipher.c" .globl encipher # -- Begin function encipher .p2align 1 .type encipher,@function encipher: # @encipher .cfi_startproc # %bb.0: addi sp, sp, -80 .c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _encipher ; -- Begin function encipher .p2align 2 _encipher: ; @encipher .cfi_startproc ; %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 str x0, [sp, #56] str x1, [sp, #48] str...
congrad
/* * bringup_bench_cg.c * * Minimal Conjugate Gradient solver benchmark for Bringup-Bench * Solves Ax = b where A is a 2D Laplacian (5-point stencil). * * - Deterministic init * - Tunable grid size (N*N system) * - Sparse CSR matrix * - Iterative solver with fixed max iterations * - Reports checksum of soluti...
.text .intel_syntax noprefix .file "congrad.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register...
.text .file "congrad.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill add x29, sp, #32...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "congrad.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_def_cfa_...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29, sp, ...
connect4-minimax
#include "libmin.h" #define ROWS 6 #define COLS 7 #define MAX_DEPTH 4 // Players: 1 and 2. Board cells: 0 = empty. #define EMPTY 0 // Scoring constants for evaluation #define WIN_SCORE 100000 #define LOSS_SCORE -100000 // ------------------------------------------------- // Board Helpers // ------------------------...
.text .intel_syntax noprefix .file "connect4-minimax.c" .globl init_board # -- Begin function init_board .p2align 4, 0x90 .type init_board,@function init_board: # @init_board .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp,...
.text .file "connect4-minimax.c" .globl init_board // -- Begin function init_board .p2align 2 .type init_board,@function init_board: // @init_board .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str wzr, [sp, #4] b .LBB0_1 .LB...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "connect4-minimax.c" .globl init_board # -- Begin function init_board .p2align 1 .type init_board,@function init_board: # @init_board .cfi_startproc # %bb.0: addi...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _init_board ; -- Begin function init_board .p2align 2 _init_board: ; @init_board .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str wzr, [sp, #4] ...
convex-hull
#include "libmin.h" #define NUM_POINTS 50 // Total number of points generated. // Adjust this value to stress the algorithm further. typedef struct { int x; int y; } Point; // Global pivot for sorting: the point with the lowest y (and x on tie). Point p0; // Returns the orientati...
.text .intel_syntax noprefix .file "convex-hull.c" .globl orientation # -- Begin function orientation .p2align 4, 0x90 .type orientation,@function orientation: # @orientation .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, r...
.text .file "convex-hull.c" .globl orientation // -- Begin function orientation .p2align 2 .type orientation,@function orientation: // @orientation .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stur x0, [sp, #20] stur x1, [sp, #12] stur x2, [sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "convex-hull.c" .globl orientation # -- Begin function orientation .p2align 1 .type orientation,@function orientation: # @orientation .cfi_startproc # %bb.0: addi s...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _orientation ; -- Begin function orientation .p2align 2 _orientation: ; @orientation .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stur x0, [sp, #20] stur x1, [sp, #...
dhrystone
#include "libmin.h" #ifndef TIME #ifndef CLOCK #ifndef OS2TMR #undef TIMES #define TIMES #endif #endif #endif /* Use times(2) time function unless */ /* explicitly defined otherwise */ #ifdef CLOCK #ifdef HZ #undef HZ #endif #define HZ CLK_TCK #endif /* Use Microsoft C hi-...
.text .intel_syntax noprefix .file "dhrystone.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regist...
.text .file "dhrystone.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #288 .cfi_def_cfa_offset 288 stp x29, x30, [sp, #256] // 16-byte Folded Spill str x28, [sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "dhrystone.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -272 .cfi_def_c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #304 stp x28, x27, [sp, #272] ; 16-byte Folded Spill stp x29, x30...
distinctness
/* ELEMENT DISTINCTNESS ALGORITHM There are multiple ways of detecting whether the elements are distinct or not. One of the ways is to sort the elements in the array and check if the elements next to each other are equal or not. On the other hand an n^2 loop can be used to select an element from the array and chec...
.text .intel_syntax noprefix .file "distinctness.c" .globl isDistinct # -- Begin function isDistinct .p2align 4, 0x90 .type isDistinct,@function isDistinct: # @isDistinct .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp...
.text .file "distinctness.c" .globl isDistinct // -- Begin function isDistinct .p2align 2 .type isDistinct,@function isDistinct: // @isDistinct .cfi_startproc // %bb.0: str x29, [sp, #-16]! // 8-byte Folded Spill .cfi_def_cfa_offset 16 .cfi_offset...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "distinctness.c" .globl isDistinct # -- Begin function isDistinct .p2align 1 .type isDistinct,@function isDistinct: # @isDistinct .cfi_startproc # %bb.0: addi sp,...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _isDistinct ; -- Begin function isDistinct .p2align 2 _isDistinct: ; @isDistinct .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp,...
donut
#include "libmin.h" #undef sin #define sin libmin_sin #undef cos #define cos libmin_cos #undef memset #define memset libmin_memset #undef putchar #define putchar libmin_putc #undef printf #define printf libmin_printf #define xx unsigned x=0; x < 2; x++ #define K int k #define niam int main #define tixe libmin_success()...
.text .intel_syntax noprefix .file "donut.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x40191eb851eb851f # double 6.2800000000000002 .LCPI0_1: .quad 0x3f947ae147ae147b # double 0.02 .LCPI0_2: .quad 0x3fa47a...
.text .file "donut.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x3f947ae147ae147b // double 0.02 .LCPI0_1: .xword 0x3fb1eb851eb851ec // double 0.070000000000000007 .LCPI0_2: .xword 0x40191eb851eb851f ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "donut.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x40191eb851eb851f # double 6.2800000000000002 .LCPI0_1: .quad 0x3fa47ae147a...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x3f947ae147ae147b ; double 0.02 lCPI0_1: .quad 0x3fb1eb851eb851ec ; double 0.0700000000...
edit-distance
#include "libmin.h" // import test genetics data #include "gene-data.h" // total tests to run #define N_TESTS 2 /* 4 */ uint64_t min3(uint64_t x, uint64_t y, uint64_t z) { if ((x < y) && (x < z)) return x; else if (y < z) return y; else return z; } uint64_t EditDistance(uint64_t *str1, uint64_t *s...
.text .intel_syntax noprefix .file "edit-distance.c" .globl min3 # -- Begin function min3 .p2align 4, 0x90 .type min3,@function min3: # @min3 .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_re...
.text .file "edit-distance.c" .globl min3 // -- Begin function min3 .p2align 2 .type min3,@function min3: // @min3 .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #16] str x1, [sp, #8] str x2, [sp] ldr x8, [sp, #16] l...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "edit-distance.c" .globl min3 # -- Begin function min3 .p2align 1 .type min3,@function min3: # @min3 .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_de...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _min3 ; -- Begin function min3 .p2align 2 _min3: ; @min3 .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #16] str x1, [sp, #8] str x2, [sp]...
eulers-approx
#include "libmin.h" #define M_E 2.71828182845904523536 #define MAX_STEPS 10000l int main(void) { // initialize the pseudo-RNG libmin_srand(42); uint64_t steps = MAX_STEPS; /* STEPS is usually a very large number eg 10000000 */ double e, term; // comupute "e" via compound interest limit e = 1.0; term =...
.text .intel_syntax noprefix .file "eulers-approx.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .LCPI0_3: .quad 0x4005bf0a8b145769 # double 2.7182818284590451 .LCPI0_4: .quad 0x3...
.text .file "eulers-approx.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x3c670ef54646d497 // double 1.0000000000000001E-17 .LCPI0_1: .xword 0x4005bf0a8b145769 // double 2.7182818284590451 .text .globl mai...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "eulers-approx.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .LCPI0_1: .quad 0x4005bf0a8b145769 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x3c670ef54646d497 ; double 1.0000000000000001E-17 lCPI0_1: .quad 0x4005bf0a8b145769 ; d...
fft-int
/* fix_fft.c - Fixed-point Fast Fourier Transform */ /* fix_fft() perform FFT or inverse FFT window() applies a Hanning window to the (time) input fix_loud() calculates the loudness of the signal, for each freq point. Result is an integer array, ...
.text .intel_syntax noprefix .file "fft-int.c" .globl fix_fft # -- Begin function fix_fft .p2align 4, 0x90 .type fix_fft,@function fix_fft: # @fix_fft .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa...
.text .file "fft-int.c" .globl fix_fft // -- Begin function fix_fft .p2align 2 .type fix_fft,@function fix_fft: // @fix_fft .cfi_startproc // %bb.0: sub sp, sp, #128 .cfi_def_cfa_offset 128 stp x29, x30, [sp, #112] // 16-byte Folded Spill add x...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "fft-int.c" .globl fix_fft # -- Begin function fix_fft .p2align 1 .type fix_fft,@function fix_fft: # @fix_fft .cfi_startproc # %bb.0: addi sp, sp, -128 .cf...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _fix_fft ; -- Begin function fix_fft .p2align 2 _fix_fft: ; @fix_fft .cfi_startproc ; %bb.0: sub sp, sp, #128 stp x29, x30, [sp, #112] ; 16-byte Folded Spill add x2...
flood-fill
#include "libmin.h" // sizes support 10 (default), 15, 20, 25 #define SIZE 10 // `M × N` matrix #define M SIZE #define N SIZE // matrix showing portion of the screen having different colors char mat[M][N] = { #if SIZE == 10 { 'Y', 'Y', 'Y', 'G', 'G', 'G', 'G', 'G', 'G', 'G' }, { 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '...
.text .intel_syntax noprefix .file "flood-fill.c" .globl floodfill # -- Begin function floodfill .p2align 4, 0x90 .type floodfill,@function floodfill: # @floodfill .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cf...
.text .file "flood-fill.c" .globl floodfill // -- Begin function floodfill .p2align 2 .type floodfill,@function floodfill: // @floodfill .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "flood-fill.c" .globl floodfill # -- Begin function floodfill .p2align 1 .type floodfill,@function floodfill: # @floodfill .cfi_startproc # %bb.0: addi sp, sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _floodfill ; -- Begin function floodfill .p2align 2 _floodfill: ; @floodfill .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add...
frac-calc
/*************************************************************************** * fc.c Version 20180915.214818 * * * * Fraction Calculator * * Copyrig...
.text .intel_syntax noprefix .file "frac-calc.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regist...
.text .file "frac-calc.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #320 .cfi_def_cfa_offset 320 stp x29, x30, [sp, #288] // 16-byte Folded Spill str x28, [sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "frac-calc.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -304 .cfi_def_c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #336 stp x28, x27, [sp, #304] ; 16-byte Folded Spill stp x29, x30...
fuzzy-match
/* * Copyright (C) 2022 Philip Jones * * Licensed under the MIT License. * https://opensource.org/licenses/MIT */ #include "libmin.h" int32_t fuzzy_match(const char *restrict pattern, const char *restrict str); static int32_t compute_score( int32_t jump, int first_char, const char *restrict match); static...
.text .intel_syntax noprefix .file "fuzzy-match.c" .globl fuzzy_match # -- Begin function fuzzy_match .p2align 4, 0x90 .type fuzzy_match,@function fuzzy_match: # @fuzzy_match .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, r...
.text .file "fuzzy-match.c" .globl fuzzy_match // -- Begin function fuzzy_match .p2align 2 .type fuzzy_match,@function fuzzy_match: // @fuzzy_match .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 stp x29, x30, [sp, #64] // 16-byte Folde...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "fuzzy-match.c" .globl fuzzy_match # -- Begin function fuzzy_match .p2align 1 .type fuzzy_match,@function fuzzy_match: # @fuzzy_match .cfi_startproc # %bb.0: addi s...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _fuzzy_match ; -- Begin function fuzzy_match .p2align 2 _fuzzy_match: ; @fuzzy_match .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill ...
fy-shuffle
#include "libmin.h" /* BUILD : g++ FisherYatesShuffle.cpp -std=c++11*/ static int rand_int(int n) { int limit = RAND_MAX - RAND_MAX % n; int rnd; do { rnd = libmin_rand(); } while (rnd >= limit); return rnd % n; } void fy_shuffle(int *array, int n) { int i, j, tmp; for (i = n - 1; i > 0; i--) ...
.text .intel_syntax noprefix .file "fy-shuffle.c" .globl fy_shuffle # -- Begin function fy_shuffle .p2align 4, 0x90 .type fy_shuffle,@function fy_shuffle: # @fy_shuffle .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "fy-shuffle.c" .globl fy_shuffle // -- Begin function fy_shuffle .p2align 2 .type fy_shuffle,@function fy_shuffle: // @fy_shuffle .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "fy-shuffle.c" .globl fy_shuffle # -- Begin function fy_shuffle .p2align 1 .type fy_shuffle,@function fy_shuffle: # @fy_shuffle .cfi_startproc # %bb.0: addi sp, s...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _fy_shuffle ; -- Begin function fy_shuffle .p2align 2 _fy_shuffle: ; @fy_shuffle .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill a...
gcd-list
/** * @file * @brief This program aims at calculating the GCD of n numbers by division * method * * @see gcd_iterative_euclidean.cpp, gcd_recursive_euclidean.cpp */ #include "libmin.h" /** Compute GCD using division algorithm * * @param[in] a array of integers to compute GCD for * @param[in] n number of integ...
.text .intel_syntax noprefix .file "gcd-list.c" .globl gcd # -- Begin function gcd .p2align 4, 0x90 .type gcd,@function gcd: # @gcd .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register r...
.text .file "gcd-list.c" .globl gcd // -- Begin function gcd .p2align 2 .type gcd,@function gcd: // @gcd .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str w1, [sp, #20] mov w8, #1 // =0...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "gcd-list.c" .globl gcd # -- Begin function gcd .p2align 1 .type gcd,@function gcd: # @gcd .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_def_cfa_of...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _gcd ; -- Begin function gcd .p2align 2 _gcd: ; @gcd .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str w1, [sp, #20] mov w8, #1 ...
gemm
#include "libmin.h" #define M 32 #define N 32 #define K 32 #define I_ALPHA 3 #define I_BETA 2 #define D_ALPHA 1.5 #define D_BETA 0.5 /* integer GEMM state */ static int64_t IA[M][K]; static int64_t IA_ref[M][K]; static int64_t IB[K][N]; static int64_t IB_ref[K][N]; static int64_t IC[M][N]; static int64_t IC_ref[M...
.text .intel_syntax noprefix .file "gemm.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register rb...
.text .file "gemm.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16 ....
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "gemm.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_off...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, ...
grad-descent
#include "libmin.h" /** Gradient Descent for linear regression. * The formula for linear regression is : Y= wX + b * Cost Function: 1/n⅀(Yi - (wXi + b))^2 [i starts from 0 → n] *Functions Description: * 1) derivateWRTWeight(double weight, double bias): * Is the partial derivative of the cost function with respect to ...
.text .intel_syntax noprefix .file "grad-descent.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function derivateWRTWeight .LCPI0_0: .quad 0x4049000000000000 # double 50 .LCPI0_1: .quad 0xc000000000000000 # double -2 .text .globl derivate...
.text .file "grad-descent.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function derivateWRTWeight .LCPI0_0: .xword 0x4049000000000000 // double 50 .text .globl derivateWRTWeight .p2align 2 .type derivateWRTWeight,@function derivateWRTWeight: ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "grad-descent.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function derivateWRTWeight .LCPI0_0: .quad 0xc000000000000000 # double -2 .LCPI0_1: .quad 0x4049000...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function derivateWRTWeight lCPI0_0: .quad 0x4049000000000000 ; double 50 .section __TEXT,__text,regular,pure_instructions .globl ...
graph-tests
///////////////////////////////////////////////// // graph.c // a bunch of linked list and graph stuff // kindly contributed by group 7 Fall 2019 // - Jielun Tan, 12/2019 ///////////////////////////////////////////////// #include "libmin.h" struct queue { int items[40]; int front; int rear; }; struct n...
.text .intel_syntax noprefix .file "graph-tests.c" .globl createNode # -- Begin function createNode .p2align 4, 0x90 .type createNode,@function createNode: # @createNode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "graph-tests.c" .globl createNode // -- Begin function createNode .p2align 2 .type createNode,@function createNode: // @createNode .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded S...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "graph-tests.c" .globl createNode # -- Begin function createNode .p2align 1 .type createNode,@function createNode: # @createNode .cfi_startproc # %bb.0: addi sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _createNode ; -- Begin function createNode .p2align 2 _createNode: ; @createNode .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill a...
hanoi
#include "libmin.h" #define other(i,j) (6-(i+j)) static int num[4]; static long count; static int mov(int n, int f, int t) { int o; if (n == 1) { num[f]--; num[t]++; count++; return 0; } o = other(f, t); mov(n-1, f, o); mov(1, f, t); mov(n-1, o, t); return 0; } int mai...
.text .intel_syntax noprefix .file "hanoi.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register r...
.text .file "hanoi.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill add x29, sp, #32 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "hanoi.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_def_cfa_of...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Folded Spill add x29, sp, ...
heapsort
#include "libmin.h" static int64_t bplong; static int64_t base[2048]; /*************************/ /* Heap Sort Program */ /*************************/ int HSORT(int64_t m, int64_t p) { int64_t i,j,k,l; int64_t size; int64_t msize, iran, ia, ic, im, ih, ir; int64_t count, ca; msize = m * bplong; si...
.text .intel_syntax noprefix .file "heapsort.c" .globl HSORT # -- Begin function HSORT .p2align 4, 0x90 .type HSORT,@function HSORT: # @HSORT .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regi...
.text .file "heapsort.c" .globl HSORT // -- Begin function HSORT .p2align 2 .type HSORT,@function HSORT: // @HSORT .cfi_startproc // %bb.0: sub sp, sp, #144 .cfi_def_cfa_offset 144 stp x29, x30, [sp, #128] // 16-byte Folded Spill add x29, s...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "heapsort.c" .globl HSORT # -- Begin function HSORT .p2align 1 .type HSORT,@function HSORT: # @HSORT .cfi_startproc # %bb.0: addi sp, sp, -144 .cfi_def...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _HSORT ; -- Begin function HSORT .p2align 2 _HSORT: ; @HSORT .cfi_startproc ; %bb.0: sub sp, sp, #160 stp x29, x30, [sp, #144] ; 16-byte Folded Spill add x29, s...
heat-calc
#include "libmin.h" #define N 100 // Number of grid points along the rod. #define STEPS 500 // Number of time steps for the simulation. #define ALPHA 1.0 // Thermal diffusivity constant. #define DX 1.0 // Spatial step (distance between grid points). #define DT 0.1 // Time step (should be s...
.text .intel_syntax noprefix .file "heat-calc.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .LCPI0_1: .quad 0x3fb999999999999a # double 0.10000000000000001 .LCPI0_2: .quad 0x4059...
.text .file "heat-calc.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x4059000000000000 // double 100 .LCPI0_1: .xword 0x3fb999999999999a // double 0.10000000000000001 .text .globl main .p2align 2 .type m...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "heat-calc.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0xc000000000000000 # double -2 .LCPI0_1: .quad 0x3fb999999999999a ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x4059000000000000 ; double 100 lCPI0_1: .quad 0x3fb999999999999a ; double 0.10000000000...
heldkarp-tsp
#include "libmin.h" #define TSP_N 8 #define TSP_MASKS (1u << TSP_N) #define TSP_INF ((uint64_t)1000000000ULL) static uint64_t graph[TSP_N][TSP_N]; static uint64_t _graph[TSP_N][TSP_N] = { { 0, 29, 20, 21, 16, 31, 100, 12 }, { 29, 0, 15, 29, 28, 40, 72, 21 }, { 20, 15, 0, 15, 14, 25, 81, 9 }, { 21, 29, 15, 0,...
.text .intel_syntax noprefix .file "heldkarp-tsp.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_reg...
.text .file "heldkarp-tsp.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 stp x29, x30, [sp, #64] // 16-byte Folded Spill add x29, sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "heldkarp-tsp.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -96 .cfi_def...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #96 stp x29, x30, [sp, #80] ; 16-byte Folded Spill add x29, sp, ...
highlife
#include "libmin.h" #define kRows 20 #define kCols 20 unsigned kIterations = 100 /* 250 */; uint64_t board_a[kRows][kCols]; uint64_t board_b[kRows][kCols]; typedef uint64_t board_t[kRows][kCols]; inline unsigned wrap_row(int r) { return (unsigned)((r + (int)(kRows)) % (int)(kRows)); } inline unsigned wrap_col(in...
.text .intel_syntax noprefix .file "highlife.c" .globl print_board # -- Begin function print_board .p2align 4, 0x90 .type print_board,@function print_board: # @print_board .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "highlife.c" .globl print_board // -- Begin function print_board .p2align 2 .type print_board,@function print_board: // @print_board .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-byte Folded S...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "highlife.c" .globl print_board # -- Begin function print_board .p2align 1 .type print_board,@function print_board: # @print_board .cfi_startproc # %bb.0: addi sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _print_board ; -- Begin function print_board .p2align 2 _print_board: ; @print_board .cfi_startproc ; %bb.0: sub sp, sp, #96 stp x29, x30, [sp, #80] ; 16-byte Folded Spill ...
huff-encode
#include "libmin.h" #define MAX_TREE_HT 256 // Huffman tree node typedef struct HuffmanNode { char data; // Stored character (for leaf nodes) int freq; // Frequency of the character struct HuffmanNode *left; // Left child struct HuffmanNode *right;// Right child } Huffma...
.text .intel_syntax noprefix .file "huff-encode.c" .globl createNode # -- Begin function createNode .p2align 4, 0x90 .type createNode,@function createNode: # @createNode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "huff-encode.c" .globl createNode // -- Begin function createNode .p2align 2 .type createNode,@function createNode: // @createNode .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded S...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "huff-encode.c" .globl createNode # -- Begin function createNode .p2align 1 .type createNode,@function createNode: # @createNode .cfi_startproc # %bb.0: addi sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _createNode ; -- Begin function createNode .p2align 2 _createNode: ; @createNode .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill a...
idct-alg
#include "libmin.h" #define N 8 #define PI 3.14159265358979323846 double C(int u) { return (u == 0) ? libmin_sqrt(1.0 / N) : libmin_sqrt(2.0 / N); } void idct_2d(double input[N][N], double output[N][N]) { for (int x = 0; x < N; x++) { for (int y = 0; y < N; y++) { double sum = 0.0; ...
.text .intel_syntax noprefix .file "idct-alg.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function C .LCPI0_0: .quad 0x3fd0000000000000 # double 0.25 .LCPI0_1: .quad 0x3fc0000000000000 # double 0.125 .text .globl C .p2align 4, 0x90 .t...
.text .file "idct-alg.c" .globl C // -- Begin function C .p2align 2 .type C,@function C: // @C .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16 .cfi_d...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "idct-alg.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function C .LCPI0_0: .quad 0x3fd0000000000000 # double 0.25 .LCPI0_1: .quad 0x3fc0000000000000 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _C ; -- Begin function C .p2align 2 _C: ; @C .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, #16 ....
indirect-test
#include "libmin.h" int aglobal = 56; int foo(int x) { return x*x; } void bar(int (*pfoo)(int x)) { // call a function through a pointer aglobal = (*pfoo)(aglobal); // and implement a switch statement switch (aglobal & 0x7) { case 0: aglobal++; break; case 1: aglobal--; break; ca...
.text .intel_syntax noprefix .file "indirect-test.c" .globl foo # -- Begin function foo .p2align 4, 0x90 .type foo,@function foo: # @foo .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regis...
.text .file "indirect-test.c" .globl foo // -- Begin function foo .p2align 2 .type foo,@function foo: // @foo .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] ldr w8, [sp, #12] ldr w9, [sp, #12] mul w0, w8, w9 a...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "indirect-test.c" .globl foo # -- Begin function foo .p2align 1 .type foo,@function foo: # @foo .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _foo ; -- Begin function foo .p2align 2 _foo: ; @foo .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] ldr w8, [sp, #12] ldr w9, [sp, ...
k-means
/** * @file k_means_clustering.c * @brief K Means Clustering Algorithm implemented * @details * This file has K Means algorithm implemmented * It prints test output in eps format * * Note: * Though the code for clustering works for all the * 2D data points and can be extended for any size vector * by making t...
.text .intel_syntax noprefix .file "k-means.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function calculateNearst .LCPI0_0: .quad 0x7fefffffffffffff # double 1.7976931348623157E+308 .text .globl calculateNearst .p2align 4, 0x90 .type calculateNears...
.text .file "k-means.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function calculateNearst .LCPI0_0: .xword 0x7fefffffffffffff // double 1.7976931348623157E+308 .text .globl calculateNearst .p2align 2 .type calculateNearst,@function calculateNearst...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "k-means.c" .globl calculateNearst # -- Begin function calculateNearst .p2align 1 .type calculateNearst,@function calculateNearst: # @calculateNearst .cfi_startproc # %bb.0:...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function calculateNearst lCPI0_0: .quad 0x7fefffffffffffff ; double 1.7976931348623157E+308 .section __TEXT,__text,regular,pure_in...
kadane
#include "libmin.h" // Function to find the maximum sum of a contiguous subarray // in a given integer array int kadane(int arr[], int n, int *ends_at) { // stores the maximum sum subarray found so far int max_so_far = 0; *ends_at = -1; // stores the maximum sum of subarray ending at the current position ...
.text .intel_syntax noprefix .file "kadane.c" .globl kadane # -- Begin function kadane .p2align 4, 0x90 .type kadane,@function kadane: # @kadane .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_reg...
.text .file "kadane.c" .globl kadane // -- Begin function kadane .p2align 2 .type kadane,@function kadane: // @kadane .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str x0, [sp, #40] str w1, [sp, #36] str x2, [sp, #24] str wzr, [sp, #...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "kadane.c" .globl kadane # -- Begin function kadane .p2align 1 .type kadane,@function kadane: # @kadane .cfi_startproc # %bb.0: addi sp, sp, -80 .cfi_def...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _kadane ; -- Begin function kadane .p2align 2 _kadane: ; @kadane .cfi_startproc ; %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str x0, [sp, #40] str w1, [sp, #36] str x2,...
kepler
/* Kepler.c: Solve Kepler's equation using various methods. Can be run as a standalone program or called via the entry point kepler (see below.) Kepler's equation is the transcendental equation E = M + e sin(E) where M is a given angle (in radians) and e is a number in the range [0,1). Solution of K...
.text .intel_syntax noprefix .file "kepler.c" .globl strict_iteration # -- Begin function strict_iteration .p2align 4, 0x90 .type strict_iteration,@function strict_iteration: # @strict_iteration .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 ...
.text .file "kepler.c" .globl strict_iteration // -- Begin function strict_iteration .p2align 2 .type strict_iteration,@function strict_iteration: // @strict_iteration .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "kepler.c" .globl strict_iteration # -- Begin function strict_iteration .p2align 1 .type strict_iteration,@function strict_iteration: # @strict_iteration .cfi_startproc # %bb....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _strict_iteration ; -- Begin function strict_iteration .p2align 2 _strict_iteration: ; @strict_iteration .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Fol...
knapsack
// // A Dynamic Programming based solution for 0-1 Knapsack problem // // The All ▲lgorithms library for python // // https://allalgorithms.com/dynamic-programming/ // https://github.com/allalgorithms/cpp // // Contributed by: Unknown // Github: Unknown // #include "libmin.h" #ifdef PROBLEM_TINY #define N 3 #define W ...
.text .intel_syntax noprefix .file "knapsack.c" .globl max # -- Begin function max .p2align 4, 0x90 .type max,@function max: # @max .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register r...
.text .file "knapsack.c" .globl max // -- Begin function max .p2align 2 .type max,@function max: // @max .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #8] str w1, [sp, #4] ldr w8, [sp, #8] ldr w9, [sp, #4] subs w8...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "knapsack.c" .globl max # -- Begin function max .p2align 1 .type max,@function max: # @max .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_of...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _max ; -- Begin function max .p2align 2 _max: ; @max .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #8] str w1, [sp, #4] ldr w8, [sp, #8...
knights-tour
//////////////////////////////////////////////////// // backtrack.c // C program for Knight Tour problem // There's a tunable hyperparameter called N // which sets the size of the chess board // kindly contributed by group 6 Fall 2019 // - Jielun Tan, 12/2019 /////////////////////////////////////////////////// // #in...
.text .intel_syntax noprefix .file "knights-tour.c" .globl isSafe # -- Begin function isSafe .p2align 4, 0x90 .type isSafe,@function isSafe: # @isSafe .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_c...
.text .file "knights-tour.c" .globl isSafe // -- Begin function isSafe .p2align 2 .type isSafe,@function isSafe: // @isSafe .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str w0, [sp, #28] str w1, [sp, #24] str x2, [sp, #16] ldr w8, [...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "knights-tour.c" .globl isSafe # -- Begin function isSafe .p2align 1 .type isSafe,@function isSafe: # @isSafe .cfi_startproc # %bb.0: addi sp, sp, -48 .c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _isSafe ; -- Begin function isSafe .p2align 2 _isSafe: ; @isSafe .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str w0, [sp, #28] str w1, [sp, #24] str x2,...
lda
#include "libmin.h" typedef int8_t VIP_ENCCHAR; typedef uint64_t VIP_ENCBOOL; typedef uint64_t VIP_ENCUINT64; typedef float VIP_ENCFLOAT; typedef double VIP_ENCDOUBLE; typedef uint64_t VIP_ENCINT; #define sizet 800 #define sizec1 400 #define sizec2 400 static VIP_ENCDOUBLE datax[sizet]; static VIP_ENCDOUBLE datay[si...
.text .intel_syntax noprefix .file "lda.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x4008000000000000 # double 3 .LCPI0_1: .quad 0x4010000000000000 # double 4 .text .globl main .p2align 4, 0x90 .type ma...
.text .file "lda.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #464 .cfi_def_cfa_offset 464 stp x29, x30, [sp, #432] // 16-byte Folded Spill str x28, [sp, #448...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "lda.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x4008000000000000 # double 3 .LCPI0_1: .quad 0x4010000000000000 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp, #16] ...
life
#include "libmin.h" void init(void); void draw(void); void process(void); void processMutate(int x, int y); int getNumNeigbors(int x, int y); void clrscr(void); void flip(void); char getLeft(int x, int y); char getRight(int x, int y); char getUp(int x, int y); char getDown(int x, int y); char getUpLeft(int x, int y); ...
.text .intel_syntax noprefix .file "life.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register rb...
.text .file "life.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16 ....
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "life.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_off...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, ...
longdiv
/* longdiv.c: program to print out examples of "long-division" problems. * (Sure wish I had one of these in grade school.) * * By Terry R. McConnell 12/97 * * Usage: longdiv <dividend> <divisor> * Here both dividend and divisor must be positive integers. At some point * we should improve the program to handle decimal ...
.text .intel_syntax noprefix .file "longdiv.c" .globl sub # -- Begin function sub .p2align 4, 0x90 .type sub,@function sub: # @sub .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register rb...
.text .file "longdiv.c" .globl sub // -- Begin function sub .p2align 2 .type sub,@function sub: // @sub .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 strb w0, [sp, #11] strb w1, [sp, #10] str x2, [sp] ldrb w8, [sp, #11] ldrb w...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "longdiv.c" .globl sub # -- Begin function sub .p2align 1 .type sub,@function sub: # @sub .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_off...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _sub ; -- Begin function sub .p2align 2 _sub: ; @sub .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 strb w0, [sp, #11] strb w1, [sp, #10] str x2, [sp...
lu-decomp
#include "libmin.h" #define N 5 // Matrix size // #define N 3 // Matrix size void print_matrix(const char* name, double mat[N][N]) { libmin_printf("%s =\n", name); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { libmin_printf("%8.4f ", mat[i][j]); } libmin_pri...
.text .intel_syntax noprefix .file "lu-decomp.c" .globl print_matrix # -- Begin function print_matrix .p2align 4, 0x90 .type print_matrix,@function print_matrix: # @print_matrix .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, ...
.text .file "lu-decomp.c" .globl print_matrix // -- Begin function print_matrix .p2align 2 .type print_matrix,@function print_matrix: // @print_matrix .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Fold...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "lu-decomp.c" .globl print_matrix # -- Begin function print_matrix .p2align 1 .type print_matrix,@function print_matrix: # @print_matrix .cfi_startproc # %bb.0: addi ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _print_matrix ; -- Begin function print_matrix .p2align 2 _print_matrix: ; @print_matrix .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spil...
lz-compress
#include "libmin.h" #include "lamia-txt.h" MFILE __infile = { "lamia.txt", __lamia_sz, __lamia, 0 }; MFILE *infile = &__infile; #define MALLOC_SIZE (256*1024) uint32_t lz77_compress (uint8_t *uncompressed_text, uint32_t uncompressed_size, uint8_t *compressed_text, uint8_t pointer_length_width) { uint16...
.text .intel_syntax noprefix .file "lz-compress.c" .globl lz77_compress # -- Begin function lz77_compress .p2align 4, 0x90 .type lz77_compress,@function lz77_compress: # @lz77_compress .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov ...
.text .file "lz-compress.c" .globl lz77_compress // -- Begin function lz77_compress .p2align 2 .type lz77_compress,@function lz77_compress: // @lz77_compress .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str w1, [sp, #68] str x2, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "lz-compress.c" .globl lz77_compress # -- Begin function lz77_compress .p2align 1 .type lz77_compress,@function lz77_compress: # @lz77_compress .cfi_startproc # %bb.0: ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _lz77_compress ; -- Begin function lz77_compress .p2align 2 _lz77_compress: ; @lz77_compress .cfi_startproc ; %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str w1, [sp,...
mandelbrot
/** mandel.c by Eric R. Weeks written 9-28-96 ** weeks@dept.physics.upenn.edu ** http://dept.physics.upenn.edu/~weeks/ ** ** This program is public domain, but this header must be left intact ** and unchanged. ** ** to compile: cc -o mand mandel.c ** **/ #include "libmin.h" void color(int red...
.text .intel_syntax noprefix .file "mandelbrot.c" .globl color # -- Begin function color .p2align 4, 0x90 .type color,@function color: # @color .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_re...
.text .file "mandelbrot.c" .globl color // -- Begin function color .p2align 2 .type color,@function color: // @color .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, s...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "mandelbrot.c" .globl color # -- Begin function color .p2align 1 .type color,@function color: # @color .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_de...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _color ; -- Begin function color .p2align 2 _color: ; @color .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Folded Spill add x29, sp...
matmult
#include "libmin.h" #define N 64 // Matrix dimension (adjust for more cache stress) static int A[N][N]; static int B[N][N]; static int C[N][N]; // Result from main multiplication (order: i, j, k) static int refC[N][N]; // Reference result using an alternative loop order (order: i, k, j) int main() { // I...
.text .intel_syntax noprefix .file "matmult.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register...
.text .file "matmult.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 stp x29, x30, [sp, #80] // 16-byte Folded Spill add x29, sp, #80...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "matmult.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -128 .cfi_def_cfa...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #128 stp x29, x30, [sp, #112] ; 16-byte Folded Spill add x29, sp,...
max-subseq
// The longest common subsequence in C #include "libmin.h" char S1[20] = "ACADBFEDSFSDFDSEFE", S2[20] = "CBDAEFEFESAFEASDD"; int i, j, m, n, LCS_table[40][40]; char b[40][40]; void lcsAlgo() { // Filling 0's in the matrix for (i = 0; i <= m; i++) LCS_table[i][0] = 0; for (i = 0; i <= n; i++) LCS_table...
.text .intel_syntax noprefix .file "max-subseq.c" .globl lcsAlgo # -- Begin function lcsAlgo .p2align 4, 0x90 .type lcsAlgo,@function lcsAlgo: # @lcsAlgo .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_...
.text .file "max-subseq.c" .globl lcsAlgo // -- Begin function lcsAlgo .p2align 2 .type lcsAlgo,@function lcsAlgo: // @lcsAlgo .cfi_startproc // %bb.0: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill .cfi_def_cfa_offset 16 mov x29, sp .cfi_def...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "max-subseq.c" .globl lcsAlgo # -- Begin function lcsAlgo .p2align 1 .type lcsAlgo,@function lcsAlgo: # @lcsAlgo .cfi_startproc # %bb.0: addi sp, sp, -64 ....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _lcsAlgo ; -- Begin function lcsAlgo .p2align 2 _lcsAlgo: ; @lcsAlgo .cfi_startproc ; %bb.0: stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill mov x29, sp sub sp, sp,...
mersenne
/* A C-program for MT19937: Integer version (1999/10/28) */ /* genrand() generates one pseudorandom unsigned integer (32bit) */ /* which is uniformly distributed among 0 to 2^32-1 for each */ /* call. sgenrand(seed) sets initial values to the working area */ /* of 624 words. Before genrand(), sgenrand(s...
.text .intel_syntax noprefix .file "mersenne.c" .globl sgenrand # -- Begin function sgenrand .p2align 4, 0x90 .type sgenrand,@function sgenrand: # @sgenrand .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def...
.text .file "mersenne.c" .globl sgenrand // -- Begin function sgenrand .p2align 2 .type sgenrand,@function sgenrand: // @sgenrand .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] str wzr, [sp, #8] b .LBB0_1 .LBB0_1: ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "mersenne.c" .globl sgenrand # -- Begin function sgenrand .p2align 1 .type sgenrand,@function sgenrand: # @sgenrand .cfi_startproc # %bb.0: addi sp, sp, -32 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _sgenrand ; -- Begin function sgenrand .p2align 2 _sgenrand: ; @sgenrand .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] str wzr, [sp, #8] b L...
minspan
#include "libmin.h" // // Compute the minimal spanning tree of a randomly generated graph. // This program implements Kruscal's algorithm (https://en.wikipedia.org/wiki/Kruskal%27s_algorithm) // over a graph represented as an adjacency matrix (https://en.wikipedia.org/wiki/Adjacency_matrix). // This algorithm works on...
.text .intel_syntax noprefix .file "minspan.c" .globl minVal # -- Begin function minVal .p2align 4, 0x90 .type minVal,@function minVal: # @minVal .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_re...
.text .file "minspan.c" .globl minVal // -- Begin function minVal .p2align 2 .type minVal,@function minVal: // @minVal .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] mov w8, #-1 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "minspan.c" .globl minVal # -- Begin function minVal .p2align 1 .type minVal,@function minVal: # @minVal .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_de...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _minVal ; -- Begin function minVal .p2align 2 _minVal: ; @minVal .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] mov w8,...
monte-carlo
#include "libmin.h" #define NUM_SAMPLES 25000 // samples int main(void) { int count_inside_circle = 0; double x, y; // Seed the random number generator libmin_srand(42); for (int i = 0; i < NUM_SAMPLES; ++i) { // Generate random (x, y) point in [0, 1] × [0, 1] x = (double)libmin_rand() / RAND_M...
.text .intel_syntax noprefix .file "monte-carlo.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x40d86a0000000000 # double 25000 .LCPI0_1: .quad 0x4010000000000000 # double 4 .LCPI0_2: .quad 0x3ff0000000000000...
.text .file "monte-carlo.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x41dfffffffc00000 // double 2147483647 .LCPI0_1: .xword 0x40d86a0000000000 // double 25000 .text .globl main .p2align 2 .type main,@...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "monte-carlo.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x4010000000000000 # double 4 .LCPI0_1: .quad 0x40d86a0000000000 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x41dfffffffc00000 ; double 2147483647 lCPI0_1: .quad 0x40d86a0000000000 ; double 25000 ...
moving-average
#include "libmin.h" #define DATASET_SIZE 128 #define WINDOW_SIZE 7 typedef struct { uint64_t samples[DATASET_SIZE]; } encrypted_series_t; static uint64_t plain_samples[DATASET_SIZE]; static encrypted_series_t encrypted_samples; static uint64_t encrypted_smoothed[DATASET_SIZE]; static void build_plain_samples(void...
.text .intel_syntax noprefix .file "moving-average.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_r...
.text .file "moving-average.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill add x29, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "moving-average.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -64 .cfi_d...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29, sp, ...
murmur-hash
#include "libmin.h" /** * `murmurhash.h' - murmurhash * * copyright (c) 2014-2022 joseph werle <joseph.werle@gmail.com> */ /** * Returns a murmur hash of `key' based on `seed' * using the MurmurHash3 algorithm */ uint32_t murmurhash(const char *, uint32_t, uint32_t); /** * `murmurhash.h' - murmurhash * * ...
.text .intel_syntax noprefix .file "murmur-hash.c" .globl murmurhash # -- Begin function murmurhash .p2align 4, 0x90 .type murmurhash,@function murmurhash: # @murmurhash .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp ...
.text .file "murmur-hash.c" .globl murmurhash // -- Begin function murmurhash .p2align 2 .type murmurhash,@function murmurhash: // @murmurhash .cfi_startproc // %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 str x0, [sp, #88] str w1, [sp, #84] str w2, [sp, #80]...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "murmur-hash.c" .globl murmurhash # -- Begin function murmurhash .p2align 1 .type murmurhash,@function murmurhash: # @murmurhash .cfi_startproc # %bb.0: addi sp, ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _murmurhash ; -- Begin function murmurhash .p2align 2 _murmurhash: ; @murmurhash .cfi_startproc ; %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 str x0, [sp, #88] str w1, [sp, #84] ...
n-queens
#include "libmin.h" #define BOARD_SIZE 10 // You can change this to any board size (e.g., 4, 8, 12) int solution_count = 0; // Check if placing a queen at (row, col) is safe int is_safe(int queens[], int row, int col) { for (int i = 0; i < row; i++) { int q_col = queens[i]; if (q_col == col || libmin_ab...
.text .intel_syntax noprefix .file "n-queens.c" .globl is_safe # -- Begin function is_safe .p2align 4, 0x90 .type is_safe,@function is_safe: # @is_safe .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cf...
.text .file "n-queens.c" .globl is_safe // -- Begin function is_safe .p2align 2 .type is_safe,@function is_safe: // @is_safe .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-byte Folded Spill add x2...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "n-queens.c" .globl is_safe # -- Begin function is_safe .p2align 1 .type is_safe,@function is_safe: # @is_safe .cfi_startproc # %bb.0: addi sp, sp, -64 .cf...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _is_safe ; -- Begin function is_safe .p2align 2 _is_safe: ; @is_safe .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Folded Spill add x29...
natlog
#include "libmin.h" /* calculate e=2.718..., using an interative approximation */ int main(void) { /* STEPS is usually a very large number eg 10000000 */ int steps = 100000; double x, y; y = 1.0 + 1.0/steps; x = 1.0; for(; steps > 0; steps--) x *= y; libmin_printf("natlog: e=%f\n", x); libmin_...
.text .intel_syntax noprefix .file "natlog.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .text .globl main .p2align 4, 0x90 .type main,@function main: # @m...
.text .file "natlog.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill add x29, sp, #32 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "natlog.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .text .globl main .p2align 1 .type main,@f...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, ...
nbody-sim
#include "libmin.h" #define N_BODIES 3 // Number of particles #define NUM_STEPS 1000 // Number of simulation steps #define DT 0.01 // Time step (seconds) #define G 6.67430e-11 // Gravitational constant (m^3 kg^-1 s^-2) #ifndef EPS #define EPS 1e-9 // Softening factor to avoid singularities #endi...
.text .intel_syntax noprefix .file "nbody-sim.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x3f847ae147ae147b # double 0.01 .LCPI0_1: .quad 0x3dd2589effed8acc # double 6.6742999999999994E-11 .LCPI0_2: .quad ...
.text .file "nbody-sim.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x3dd2589effed8acc // double 6.6742999999999994E-11 .LCPI0_1: .xword 0x3cb0000000000000 // double 2.2204460492503131E-16 .LCPI0_2: .xword ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "nbody-sim.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 0x3f847ae147ae147b # double 0.01 .LCPI0_1: .quad 0x3cb0000000000000 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x3dd2589effed8acc ; double 6.6742999999999994E-11 lCPI0_1: .quad 0x3cb0000000000000 ; d...
nonlinear-nn
#include "libmin.h" #include "nonlinear-nn-inputs.h" // VIP type mapping for this port: // VIP_ENCCHAR -> int8_t // VIP_ENCBOOL -> uint64_t // VIP_ENCUINT64 -> uint64_t // VIP_ENCFLOAT -> float // VIP_ENCDOUBLE -> double // LeakyReLU uses a small slope for negative values. static const double kLeakyAlp...
.text .intel_syntax noprefix .file "nonlinear-nn.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x3f847ae147ae147b # double 0.01 .text .globl main .p2align 4, 0x90 .type main,@function main: ...
.text .file "nonlinear-nn.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x3f847ae147ae147b // double 0.01 .text .globl main .p2align 2 .type main,@function main: // @main .cfi_startpr...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "nonlinear-nn.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 4576918229304087675 # 0x3f847ae147ae147b .text .globl main .p2align ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x3f847ae147ae147b ; double 0.01 .section __TEXT,__text,regular,pure_instructions .globl _main .p2a...
nr-solver
#include "libmin.h" typedef double (*fn_type)(double x); double sqrt_value; #define FN_SQRT #ifdef FN_SQRT double f(double x) { return x*x - sqrt_value; } double df(double x) { return x*2.0; } #endif #ifdef FN_COMPLEX double f(double x) { return x*x*x - x - 1.0; } double df(double x) { return x*3.0 - 1.0...
.text .intel_syntax noprefix .file "nr-solver.c" .globl f # -- Begin function f .p2align 4, 0x90 .type f,@function f: # @f .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register rbp m...
.text .file "nr-solver.c" .globl f // -- Begin function f .p2align 2 .type f,@function f: // @f .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str d0, [sp, #8] ldr d0, [sp, #8] ldr d1, [sp, #8] adrp x8, sqrt_value ldr d2, [...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "nr-solver.c" .globl f # -- Begin function f .p2align 1 .type f,@function f: # @f .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_offset ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _f ; -- Begin function f .p2align 2 _f: ; @f .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str d0, [sp, #8] ldr d0, [sp, #8] ldr d1, [sp, #8] a...
ntt-kernel
#include "libmin.h" #define N 256 #define MOD 998244353l #define PRIMITIVE_ROOT 3l static int64_t a[N]; static int64_t a_ref[N]; static int64_t b[N]; static int64_t b_ref[N]; static int64_t fa[N]; static int64_t fb[N]; static int64_t conv[N]; static int64_t ref[N]; static int64_t mod_add(int64_t x, int64_t y) { x ...
.text .intel_syntax noprefix .file "ntt-kernel.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regis...
.text .file "ntt-kernel.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "ntt-kernel.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_c...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, ...
packet-filter
#include "libmin.h" // Define protocol value for TCP #define TCP_PROTOCOL 6 // Define constants for the 192.168.0.0/16 IP range. #define FIXED_IP_FIRST 192 #define FIXED_IP_SECOND 168 #define PACKET_COUNT 100 // Total number of packets to simulate // Packet structure definition typedef struct { unsigned int sr...
.text .intel_syntax noprefix .file "packet-filter.c" .globl generate_packet # -- Begin function generate_packet .p2align 4, 0x90 .type generate_packet,@function generate_packet: # @generate_packet .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -...
.text .file "packet-filter.c" .globl generate_packet // -- Begin function generate_packet .p2align 2 .type generate_packet,@function generate_packet: // @generate_packet .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] //...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "packet-filter.c" .globl generate_packet # -- Begin function generate_packet .p2align 1 .type generate_packet,@function generate_packet: # @generate_packet .cfi_startproc # ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _generate_packet ; -- Begin function generate_packet .p2align 2 _generate_packet: ; @generate_packet .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folde...
parrondo
/* parrando.c: simulation of J. Parrando's probability paradox */ /* Parrondo's game is based upon two simple games of chance. The gambler's fortune starts at 0. The simple game: Toss a biased coin and win +1 with probability S_WIN_PROB (defined below). Otherwise win -1; The complex game: If the playe...
.text .intel_syntax noprefix .file "parrondo.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function cointoss .LCPI0_0: .quad 0x41dfffffffc00000 # double 2147483647 .text .globl cointoss .p2align 4, 0x90 .type cointoss,@function cointoss: ...
.text .file "parrondo.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function cointoss .LCPI0_0: .xword 0x41dfffffffc00000 // double 2147483647 .text .globl cointoss .p2align 2 .type cointoss,@function cointoss: // @coin...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "parrondo.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function cointoss .LCPI0_0: .quad 0x41dfffffffc00000 # double 2147483647 .text .globl cointoss .p2ali...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function cointoss lCPI0_0: .quad 0x41dfffffffc00000 ; double 2147483647 .section __TEXT,__text,regular,pure_instructions .globl _...
partition-equal
#include "libmin.h" #define N_SETS 8 #define MAX_ELEMS 8 #define MAX_SUM 40 typedef struct { uint64_t len; uint64_t values[MAX_ELEMS]; } partition_set_t; typedef struct { uint64_t can_partition; uint64_t subset_mask; } partition_result_t; static const partition_set_t partition_sets[N_SETS] = { {4, {1, 5, ...
.text .intel_syntax noprefix .file "partition-equal.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_...
.text .file "partition-equal.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #240 .cfi_def_cfa_offset 240 stp x29, x30, [sp, #224] // 16-byte Folded Spill add x2...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "partition-equal.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -256 .cfi...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #272 stp x28, x27, [sp, #240] ; 16-byte Folded Spill stp x29, x30...
pascal
/* pascal.c: print rows of Pascal's triangle to stdout. The algorithm is simply to generate successive rows iteratively using the defining property of pascal's triangle: C(n,k) = C(n-1,k-1) + C(n-1,k). The program is written for simplicity rather than efficiency. The only tri...
.text .intel_syntax noprefix .file "pascal.c" .globl num_digits # -- Begin function num_digits .p2align 4, 0x90 .type num_digits,@function num_digits: # @num_digits .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi...
.text .file "pascal.c" .globl num_digits // -- Begin function num_digits .p2align 2 .type num_digits,@function num_digits: // @num_digits .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] mov w8, #1 // =0...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "pascal.c" .globl num_digits # -- Begin function num_digits .p2align 1 .type num_digits,@function num_digits: # @num_digits .cfi_startproc # %bb.0: addi sp, sp, -...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _num_digits ; -- Begin function num_digits .p2align 2 _num_digits: ; @num_digits .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str w0, [sp, #12] mov w8, #1 ...
pca-analysis
#include "libmin.h" #define PCA_SAMPLES 192 #define PCA_FEATURES 6 #define PCA_COMPONENTS 2 #define PCA_POWER_ITERS 20 typedef double fp64_t; static fp64_t data[PCA_SAMPLES][PCA_FEATURES]; static void init_secret_dataset(void) { for (uint64_t i = 0; i < PCA_SAMPLES; ++i) { for (uint64_t j = 0; j < PCA_FEATU...
.text .intel_syntax noprefix .file "pca-analysis.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_reg...
.text .file "pca-analysis.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: stp x29, x30, [sp, #-32]! // 16-byte Folded Spill .cfi_def_cfa_offset 32 str x28, [sp, #16] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "pca-analysis.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -640 .cfi_de...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp, #16] ...
pi-calc
#include "libmin.h" // Developer- Dik T. Winter // Intro- Calculates the first 15000 digits of PI. // Details- http://stackoverflow.com/questions/20287513/can-anyone-make-heads-or-tales-of-this-spigot-algorithm-code-pitiny-c // Source- http://www.iwriteiam.nl/SigProgC.html#pi int a[52514],b,c=52514,d,e,f=1e4,g,h;int...
.text .intel_syntax noprefix .file "pi-calc.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register...
.text .file "pi-calc.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "pi-calc.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_def_cfa_...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, ...
primal-test
/* miller_rabin_int.c -- long long implementation of the Miller-Rabin test * * Copyright 2014 by Colin Benner <colin-software@yzhs.de> * * This file is part of frobenius-test. * * frobenius-test is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as publ...
.text .intel_syntax noprefix .file "primal-test.c" .globl get_random_int # -- Begin function get_random_int .p2align 4, 0x90 .type get_random_int,@function get_random_int: # @get_random_int .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 m...
.text .file "primal-test.c" .globl get_random_int // -- Begin function get_random_int .p2align 2 .type get_random_int,@function get_random_int: // @get_random_int .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-b...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "primal-test.c" .globl get_random_int # -- Begin function get_random_int .p2align 1 .type get_random_int,@function get_random_int: # @get_random_int .cfi_startproc # %bb.0...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _get_random_int ; -- Begin function get_random_int .p2align 2 _get_random_int: ; @get_random_int .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded ...
priority-queue
// ripped from geeksforgeeks // C code to implement Priority Queue // using Linked List #include "libmin.h" // Node typedef struct node { int data; // Lower values indicate higher priority int priority; struct node* next; } Node; // Function to Create A New Node Node* newNode(int d, int p) { ...
.text .intel_syntax noprefix .file "priority-queue.c" .globl newNode # -- Begin function newNode .p2align 4, 0x90 .type newNode,@function newNode: # @newNode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_...
.text .file "priority-queue.c" .globl newNode // -- Begin function newNode .p2align 2 .type newNode,@function newNode: // @newNode .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "priority-queue.c" .globl newNode # -- Begin function newNode .p2align 1 .type newNode,@function newNode: # @newNode .cfi_startproc # %bb.0: addi sp, sp, -3...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _newNode ; -- Begin function newNode .p2align 2 _newNode: ; @newNode .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29...
qsort-demo
#include "libmin.h" /* qsort int comparison function */ int int_cmp(const void *a, const void *b) { const int *ia = (const int *)a; // casting pointer types const int *ib = (const int *)b; return *ia - *ib; /* integer comparison: returns negative if a < b and positive if a > b */ } /* integer arr...
.text .intel_syntax noprefix .file "qsort-demo.c" .globl int_cmp # -- Begin function int_cmp .p2align 4, 0x90 .type int_cmp,@function int_cmp: # @int_cmp .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_...
.text .file "qsort-demo.c" .globl int_cmp // -- Begin function int_cmp .p2align 2 .type int_cmp,@function int_cmp: // @int_cmp .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] ldr x8, [sp, #24] str x8, ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "qsort-demo.c" .globl int_cmp # -- Begin function int_cmp .p2align 1 .type int_cmp,@function int_cmp: # @int_cmp .cfi_startproc # %bb.0: addi sp, sp, -48 ....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _int_cmp ; -- Begin function int_cmp .p2align 2 _int_cmp: ; @int_cmp .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] ldr x...
qsort-test
#include "libmin.h" /* Comparison function for integers. */ int int_compare(const void *a, const void *b) { const int *ia = (const int *) a; const int *ib = (const int *) b; return (*ia) - (*ib); } /* Utility function to check if an array of integers is sorted (non-decreasing order). */ int is_sorted(cons...
.text .intel_syntax noprefix .file "qsort-test.c" .globl int_compare # -- Begin function int_compare .p2align 4, 0x90 .type int_compare,@function int_compare: # @int_compare .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rs...
.text .file "qsort-test.c" .globl int_compare // -- Begin function int_compare .p2align 2 .type int_compare,@function int_compare: // @int_compare .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16] ldr x8, [sp, #2...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "qsort-test.c" .globl int_compare # -- Begin function int_compare .p2align 1 .type int_compare,@function int_compare: # @int_compare .cfi_startproc # %bb.0: addi sp...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _int_compare ; -- Begin function int_compare .p2align 2 _int_compare: ; @int_compare .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str x1, [sp, #16...
quartile-stats
#include "libmin.h" #define DATA_SIZE 128 #define QUARTILES 4 #define QUARTILE_SIZE (DATA_SIZE / QUARTILES) static const uint64_t plain_data[DATA_SIZE] = { 912, 43, 751, 619, 88, 305, 1440, 271, 532, 998, 64, 417, 1205, 349, 781, 56, 663, 214, 1402, 905, 117, 488, 73, 1106, 529, 358, 892, 177, 1364, 441, 629, 82,...
.text .intel_syntax noprefix .file "quartile-stats.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_r...
.text .file "quartile-stats.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #128 .cfi_def_cfa_offset 128 stp x29, x30, [sp, #112] // 16-byte Folded Spill add x29...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "quartile-stats.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -112 .cfi_...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #160 stp x29, x30, [sp, #144] ; 16-byte Folded Spill add x29, sp,...
quaternions
/** * @file * @brief Functions related to 3D quaternions and Euler angles. * @author Krishna Vedala */ #include "libmin.h" /** * @addtogroup quaternions Library for 3D Vectors & Quaternions * @{ * @file * @brief Generic header that provides data types for 3D vectors and quaternions * @author Krishna Vedala ...
.text .intel_syntax noprefix .file "quaternions.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function quat_from_euler .LCPI0_0: .quad 0x3fe0000000000000 # double 0.5 .text .globl quat_from_euler .p2align 4, 0x90 .type quat_from_euler,@function quat...
.text .file "quaternions.c" .globl quat_from_euler // -- Begin function quat_from_euler .p2align 2 .type quat_from_euler,@function quat_from_euler: // @quat_from_euler .cfi_startproc // %bb.0: sub sp, sp, #160 .cfi_def_cfa_offset 160 stp x29, x30, [sp, #144] //...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "quaternions.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function quat_from_euler .LCPI0_0: .quad 0x3fe0000000000000 # double 0.5 .text .globl quat_from_eul...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _quat_from_euler ; -- Begin function quat_from_euler .p2align 2 _quat_from_euler: ; @quat_from_euler .cfi_startproc ; %bb.0: sub sp, sp, #160 stp x29, x30, [sp, #144] ; 16-byte Fold...
quine
#include "libmin.h" #define B(x)int main(){libmin_puts("#include \"libmin.h\"\n#define B(x)"x"\n#define X(s)S(s)\n#define S(s)#s\nB(X(B(x)))\n");libmin_success(); return 0;} #define X(s)S(s) #define S(s)#s B(X(B(x)))
.text .intel_syntax noprefix .file "quine.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register r...
.text .file "quine.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29, sp, #16 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "quine.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -32 .cfi_def_cfa_of...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29, sp, ...
rabinkarp-search
/* Rabin-Karp rolling hash string search algorithm */ #include "libmin.h" #define TRUE 1 #define FALSE 0 // valid SIZE's: 380, 760 (default), 1140, 1520 #define SIZE 1520 // Inputs char inp_pat[] = "NzZVOzZXNoGXMl8yxesyY"; char inp_txt[] = "zJfMus2WzLnMr82T4bmuzKTNjcylzYfNiGjMssyBZc2PzZPMvMyXzJnMvMyjzZQgzYfMnMyx...
.text .intel_syntax noprefix .file "rabinkarp-search.c" .globl search # -- Begin function search .p2align 4, 0x90 .type search,@function search: # @search .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_d...
.text .file "rabinkarp-search.c" .globl search // -- Begin function search .p2align 2 .type search,@function search: // @search .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str w1, [sp, #68] str x2, [sp, #56] str w...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rabinkarp-search.c" .globl search # -- Begin function search .p2align 1 .type search,@function search: # @search .cfi_startproc # %bb.0: addi sp, sp, -96...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _search ; -- Begin function search .p2align 2 _search: ; @search .cfi_startproc ; %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 str x0, [sp, #72] str w1, [sp, #68] str x2,...
rad-to-deg
#include "libmin.h" double rad2deg(double rad) { return ((double)180.0 * rad / (M_PI)); } double deg2rad(double deg) { return ((double)M_PI * deg / 180.0); } int main(void) { // initialize the pseudo-RNG libmin_srand(42); { // Stopwatch s("VIP_Bench Runtime"); for (double x = 0.0; x <= 3...
.text .intel_syntax noprefix .file "rad-to-deg.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function rad2deg .LCPI0_0: .quad 0x400921fb54442d18 # double 3.1415926535897931 .LCPI0_1: .quad 0x4066800000000000 # double 180 .text .globl rad...
.text .file "rad-to-deg.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function rad2deg .LCPI0_0: .xword 0x400921fb54442d18 // double 3.1415926535897931 .LCPI0_1: .xword 0x4066800000000000 // double 180 .text .globl rad2deg .p2align 2 ....
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rad-to-deg.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function rad2deg .LCPI0_0: .quad 0x4066800000000000 # double 180 .LCPI0_1: .quad 0x400921fb54442d18 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function rad2deg lCPI0_0: .quad 0x400921fb54442d18 ; double 3.1415926535897931 lCPI0_1: .quad 0x4066800000000000 ; do...
rand-test
/* * rand_test.c * * A randomness testing application that runs a battery of tests on two random * generators: * 1. A deliberately weak random generator (bad_rand). * 2. The system's standard library rand() function, wrapped in good_rand. * * The tests include: * - Monobit test: Count the number of 1 bit...
.text .intel_syntax noprefix .file "rand-test.c" .globl bad_rand # -- Begin function bad_rand .p2align 4, 0x90 .type bad_rand,@function bad_rand: # @bad_rand .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_de...
.text .file "rand-test.c" .globl bad_rand // -- Begin function bad_rand .p2align 2 .type bad_rand,@function bad_rand: // @bad_rand .cfi_startproc // %bb.0: adrp x8, bad_rand.state ldr w9, [x8, :lo12:bad_rand.state] mov w10, #54436 // =0xd...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rand-test.c" .globl bad_rand # -- Begin function bad_rand .p2align 1 .type bad_rand,@function bad_rand: # @bad_rand .cfi_startproc # %bb.0: addi sp, sp, -16 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _bad_rand ; -- Begin function bad_rand .p2align 2 _bad_rand: ; @bad_rand .cfi_startproc ; %bb.0: adrp x8, _bad_rand.state@PAGE ldr w9, [x8, _bad_rand.state@PAGEOFF] mov w10, #54...
randshell-sort
#include "libmin.h" // VIP_ENCCHAR => int8_t // VIP_ENCBOOL => uint64_t // VIP_ENCUINT64 => uint64_t // VIP_ENCFLOAT => fp32_t // VIP_ENCDOUBLE => fp64_t // supported sizes: 256, 512, 1024 (default), 2048 #ifndef DATASET_SIZE #define DATASET_SIZE 256 #endif static int64_t raw_data[DATASET_SIZE]; #define C 1 static...
.text .intel_syntax noprefix .file "randshell-sort.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_r...
.text .file "randshell-sort.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: stp x29, x30, [sp, #-32]! // 16-byte Folded Spill .cfi_def_cfa_offset 32 str x28, [sp, #16] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "randshell-sort.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -2032 .cfi...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp, #16] ...
ransac
/* * ransac_line_fit.c * * A simple RANSAC application that fits a line (y = m*x + b) * to a set of 2D points. The data is generated with a known ground-truth * line plus some noise (inliers) along with a number of outlier points. * * To compile: * gcc ransac_line_fit.c -lm -o ransac_line_fit * * Then run...
.text .intel_syntax noprefix .file "ransac.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function line_distance .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .text .globl line_distance .p2align 4, 0x90 .type line_distance,@function line_distance: ...
.text .file "ransac.c" .globl line_distance // -- Begin function line_distance .p2align 2 .type line_distance,@function line_distance: // @line_distance .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-byte Fold...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "ransac.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function line_distance .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .text .globl line_distance .p2alig...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _line_distance ; -- Begin function line_distance .p2align 2 _line_distance: ; @line_distance .cfi_startproc ; %bb.0: sub sp, sp, #64 stp x29, x30, [sp, #48] ; 16-byte Folded Sp...
regex-parser
/* * * Mini regex-module inspired by Rob Pike's regex code described in: * * http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html * * * * Supports: * --------- * '.' Dot, matches any character * '^' Start anchor, matches beginning of string * '$' End anchor, mat...
.text .intel_syntax noprefix .file "regex-parser.c" .globl re_match # -- Begin function re_match .p2align 4, 0x90 .type re_match,@function re_match: # @re_match .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi...
.text .file "regex-parser.c" .globl re_match // -- Begin function re_match .p2align 2 .type re_match,@function re_match: // @re_match .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "regex-parser.c" .globl re_match # -- Begin function re_match .p2align 1 .type re_match,@function re_match: # @re_match .cfi_startproc # %bb.0: addi sp, sp, -...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _re_match ; -- Begin function re_match .p2align 2 _re_match: ; @re_match .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x...
rho-factor
#include "libmin.h" // typedef unsigned long int positive_number; typedef uint64_t positive_number; static positive_number multiplication_modulo(positive_number a, positive_number b, const positive_number mod) { positive_number res = 0, tmp; for (b %= mod; a; a & 1 ? b >= mod - res ? res -= mod : 0, res += b ...
.text .intel_syntax noprefix .file "rho-factor.c" .globl factor_worker # -- Begin function factor_worker .p2align 4, 0x90 .type factor_worker,@function factor_worker: # @factor_worker .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov r...
.text .file "rho-factor.c" .globl factor_worker // -- Begin function factor_worker .p2align 2 .type factor_worker,@function factor_worker: // @factor_worker .cfi_startproc // %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 stp x29, x30, [sp, #80] // 16-byte ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rho-factor.c" .globl factor_worker # -- Begin function factor_worker .p2align 1 .type factor_worker,@function factor_worker: # @factor_worker .cfi_startproc # %bb.0: a...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _factor_worker ; -- Begin function factor_worker .p2align 2 _factor_worker: ; @factor_worker .cfi_startproc ; %bb.0: sub sp, sp, #96 stp x29, x30, [sp, #80] ; 16-byte Folded Sp...
rle-compress
/** * @file * @author [serturx](https://github.com/serturx/) * @brief Encode a null terminated string using [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) * @details * Run-length encoding is a lossless compression algorithm. * It works by counting the consecutive occurences symbols * an...
.text .intel_syntax noprefix .file "rle-compress.c" .globl run_length_encode # -- Begin function run_length_encode .p2align 4, 0x90 .type run_length_encode,@function run_length_encode: # @run_length_encode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset r...
.text .file "rle-compress.c" .globl run_length_encode // -- Begin function run_length_encode .p2align 2 .type run_length_encode,@function run_length_encode: // @run_length_encode .cfi_startproc // %bb.0: sub sp, sp, #96 .cfi_def_cfa_offset 96 stp x29, x30, [sp, #80] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rle-compress.c" .globl run_length_encode # -- Begin function run_length_encode .p2align 1 .type run_length_encode,@function run_length_encode: # @run_length_encode .cfi_startpr...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _run_length_encode ; -- Begin function run_length_encode .p2align 2 _run_length_encode: ; @run_length_encode .cfi_startproc ; %bb.0: sub sp, sp, #128 stp x29, x30, [sp, #112] ; 16-byte ...
rsa-cipher
#include "libmin.h" // Define 128-bit integer type (GCC/Clang-specific) typedef __int128 int128; // Fast modular exponentiation: computes (base^exp) mod mod int128 mod_pow(int128 base, int128 exp, int128 mod) { int128 result = 1; base = base % mod; while (exp > 0) { if (exp & 1) result...
.text .intel_syntax noprefix .file "rsa-cipher.c" .globl mod_pow # -- Begin function mod_pow .p2align 4, 0x90 .type mod_pow,@function mod_pow: # @mod_pow .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_...
.text .file "rsa-cipher.c" .globl mod_pow // -- Begin function mod_pow .p2align 2 .type mod_pow,@function mod_pow: // @mod_pow .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 stp x29, x30, [sp, #64] // 16-byte Folded Spill add ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "rsa-cipher.c" .globl mod_pow # -- Begin function mod_pow .p2align 1 .type mod_pow,@function mod_pow: # @mod_pow .cfi_startproc # %bb.0: addi sp, sp, -96 ....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _mod_pow ; -- Begin function mod_pow .p2align 2 _mod_pow: ; @mod_pow .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29...
sat-solver
#include "libmin.h" #define NUM_VARS 8 // Number of variables: x1, x2, ..., x8 #define NUM_CLAUSES 10 // Total number of clauses in the CNF formula #define MAX_LITERALS 4 // Maximum literals per clause (including terminating 0) #define UNASSIGNED -1 // Marker for unassigned variables // Defin...
.text .intel_syntax noprefix .file "sat-solver.c" .globl conflict # -- Begin function conflict .p2align 4, 0x90 .type conflict,@function conflict: # @conflict .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_d...
.text .file "sat-solver.c" .globl conflict // -- Begin function conflict .p2align 2 .type conflict,@function conflict: // @conflict .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str wzr, [sp, #40] b .LBB0_1 .LBB0_1: ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "sat-solver.c" .globl conflict # -- Begin function conflict .p2align 1 .type conflict,@function conflict: # @conflict .cfi_startproc # %bb.0: addi sp, sp, -64...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _conflict ; -- Begin function conflict .p2align 2 _conflict: ; @conflict .cfi_startproc ; %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str wzr, [sp, #40] b LBB0_1 LBB0_1: ...
shortest-path
// C Program for Floyd Warshall Algorithm #include "libmin.h" // Number of vertices in the graph #define V 8 /* Define Infinite as a large enough value. This value will be used for vertices not connected to each other */ #define INF 99999 #define N 99999 // A function to print the solution matrix void printSolu...
.text .intel_syntax noprefix .file "shortest-path.c" .globl floydWarshall # -- Begin function floydWarshall .p2align 4, 0x90 .type floydWarshall,@function floydWarshall: # @floydWarshall .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mo...
.text .file "shortest-path.c" .globl floydWarshall // -- Begin function floydWarshall .p2align 2 .type floydWarshall,@function floydWarshall: // @floydWarshall .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str wzr, [sp, #20] b .LB...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "shortest-path.c" .globl floydWarshall # -- Begin function floydWarshall .p2align 1 .type floydWarshall,@function floydWarshall: # @floydWarshall .cfi_startproc # %bb.0:...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _floydWarshall ; -- Begin function floydWarshall .p2align 2 _floydWarshall: ; @floydWarshall .cfi_startproc ; %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 str x0, [sp, #24] str wzr, [sp...
sieve
#include "libmin.h" /***********************************************/ #define LIMIT 8 /* You may need to change this to '3' for PC's */ /* and Clones or you can experiment with higher*/ /* values, but '13' is currently the max. */ /***********************************************/ ...
.text .intel_syntax noprefix .file "sieve.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register r...
.text .file "sieve.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 stp x29, x30, [sp, #32] // 16-byte Folded Spill add x29, sp, #32 ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "sieve.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -48 .cfi_def_cfa_of...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #48 stp x29, x30, [sp, #32] ; 16-byte Folded Spill add x29, sp, ...
simple-grep
#include "libmin.h" #include "speech.h" #define BUFFER_LENGTH 511 struct _MFILE speech = { "speech.txt", __speech_sz, __speech, 0 }; int main(void) { int ac = 3; char *av[] = { "simple-grep", "speech.txt", "the" }; char lineBuffer[BUFFER_LENGTH+1]; MFILE *fp = &speech; int count = 0; if (ac < 3) { l...
.text .intel_syntax noprefix .file "simple-grep.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regi...
.text .file "simple-grep.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: stp x29, x30, [sp, #-32]! // 16-byte Folded Spill .cfi_def_cfa_offset 32 str x28, [sp, #16] ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "simple-grep.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -576 .cfi_def...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: stp x28, x27, [sp, #-32]! ; 16-byte Folded Spill stp x29, x30, [sp, #16] ...
skeleton
#include "libmin.h" char *ptr = (char *)0ull-1; int main(void) { libmin_printf("This is a test!, %d, %f...\n", 23, 44.4); // illegal insn // __asm__ volatile (".word 0x00000000"); libmin_success(); return 0; }
.text .intel_syntax noprefix .file "skeleton.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function main .LCPI0_0: .quad 0x4046333333333333 # double 44.399999999999999 .text .globl main .p2align 4, 0x90 .type main,@function main: ...
.text .file "skeleton.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function main .LCPI0_0: .xword 0x4046333333333333 // double 44.399999999999999 .text .globl main .p2align 2 .type main,@function main: // @main .c...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "skeleton.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 4631445561792475955 # 0x4046333333333333 .text .globl main .p2align 1 ....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function main lCPI0_0: .quad 0x4046333333333333 ; double 44.399999999999999 .section __TEXT,__text,regular,pure_instructions .glo...
spelt2num
#include "libmin.h" // Developer- Seonghoon Kang // Intro- Reads a spelt number and writes a corresponding decimal number. // Details- http://www.ioccc.org/2012/kang/hint.html char *p = "fifty-two trillion six-hundred and seventy five million and sixty-one thousand and five-hundred sixty-two\n"; long long n,u,m,b;in...
.text .intel_syntax noprefix .file "spelt2num.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regist...
.text .file "spelt2num.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #80 .cfi_def_cfa_offset 80 stp x29, x30, [sp, #64] // 16-byte Folded Spill add x29, sp, #...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "spelt2num.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function main .LCPI0_0: .quad 3353953467947191203 # 0x2e8ba2e8ba2e8ba3 .text .globl main .p2align 1 ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #96 stp x29, x30, [sp, #80] ; 16-byte Folded Spill add x29, sp, ...
spirograph
/** * @file * @author [Krishna Vedala](https://github.com/kvedala) * @brief Implementation of * [Spirograph](https://en.wikipedia.org/wiki/Spirograph) * * @details * Implementation of the program is based on the geometry shown in the figure * below: * * <a * href="https://commons.wikimedia.org/wiki/File:Reso...
.text .intel_syntax noprefix .file "spirograph.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function spirograph .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .LCPI0_1: .quad 0x400921fb54442d18 # double 3.1415926535897931 .section .rodata...
.text .file "spirograph.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 // -- Begin function spirograph .LCPI0_0: .xword 0x400921fb54442d18 // double 3.1415926535897931 .text .globl spirograph .p2align 2 .type spirograph,@function spirograph: ...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "spirograph.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function spirograph .LCPI0_0: .quad 0x400921fb54442d18 # double 3.1415926535897931 .LCPI0_1: .quad 0x...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .section __TEXT,__literal8,8byte_literals .p2align 3, 0x0 ; -- Begin function spirograph lCPI0_0: .quad 0x400921fb54442d18 ; double 3.1415926535897931 .section __TEXT,__text,regular,pure_instructions...
strange
#include "libmin.h" int ma\ in() { int arr[10], i; for(i=0; i<10; i++){ i[arr] = i; } while(i --> 0){ libmin_printf("%d ", *arr+i); } https://www.google.com i = 010; libmin_printf("\n| %d |", i); i = 5i; libmin_printf("\n %d\n", i); libmin_success(); ...
.text .intel_syntax noprefix .file "strange.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_register...
.text .file "strange.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #64 .cfi_def_cfa_offset 64 stp x29, x30, [sp, #48] // 16-byte Folded Spill add x29, sp, #48...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "strange.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -64 .cfi_def_cfa_...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #80 stp x29, x30, [sp, #64] ; 16-byte Folded Spill add x29, sp, ...
sudoku-solver
#include "libmin.h" #define N 9 // Sudoku grid size (9x9) // Hard, but solvable, Sudoku puzzle. // Zeros indicate empty cells. static int board[N][N] = { {8, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 3, 6, 0, 0, 0, 0, 0}, {0, 7, 0, 0, 9, 0, 2, 0, 0}, {0, 5, 0, 0, 0, 7, 0, 0, 0}, {0, 0, 0, 0, 4, 5, 7, 0, 0}...
.text .intel_syntax noprefix .file "sudoku-solver.c" .globl isSafe # -- Begin function isSafe .p2align 4, 0x90 .type isSafe,@function isSafe: # @isSafe .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_...
.text .file "sudoku-solver.c" .globl isSafe // -- Begin function isSafe .p2align 2 .type isSafe,@function isSafe: // @isSafe .cfi_startproc // %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str w0, [sp, #40] str w1, [sp, #36] str w2, [sp, #32] str wzr,...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "sudoku-solver.c" .globl isSafe # -- Begin function isSafe .p2align 1 .type isSafe,@function isSafe: # @isSafe .cfi_startproc # %bb.0: addi sp, sp, -64 ....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _isSafe ; -- Begin function isSafe .p2align 2 _isSafe: ; @isSafe .cfi_startproc ; %bb.0: sub sp, sp, #48 .cfi_def_cfa_offset 48 str w0, [sp, #40] str w1, [sp, #36] str w2,...
tea-cipher
#include "libmin.h" static uint64_t keytext[4]; static uint64_t plaintext[2]; static uint64_t ciphertext[2]; static uint64_t newplain[2]; static inline uint64_t mask32(uint64_t x) { return x & 0xFFFFFFFFul; } static void encipher(const uint64_t in[2], uint64_t out[2], const uint64_t key[4]) { uint64_t y = in[0],...
.text .intel_syntax noprefix .file "tea-cipher.c" .globl main # -- Begin function main .p2align 4, 0x90 .type main,@function main: # @main .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp, rsp .cfi_def_cfa_regis...
.text .file "tea-cipher.c" .globl main // -- Begin function main .p2align 2 .type main,@function main: // @main .cfi_startproc // %bb.0: sub sp, sp, #128 .cfi_def_cfa_offset 128 stp x29, x30, [sp, #112] // 16-byte Folded Spill add x29, sp...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "tea-cipher.c" .globl main # -- Begin function main .p2align 1 .type main,@function main: # @main .cfi_startproc # %bb.0: addi sp, sp, -112 .cfi_def_...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _main ; -- Begin function main .p2align 2 _main: ; @main .cfi_startproc ; %bb.0: sub sp, sp, #160 stp x29, x30, [sp, #144] ; 16-byte Folded Spill add x29, sp,...
tetris-sim
#include "libmin.h" #define BOARD_WIDTH 10 #define BOARD_HEIGHT 20 // Heuristic weights (tuned values from research) #define WEIGHT_AGGREGATE_HEIGHT -0.510066 #define WEIGHT_COMPLETE_LINES 0.760666 #define WEIGHT_HOLES -0.35663 #define WEIGHT_BUMPINESS -0.184483 // ------------------------ // Da...
.text .intel_syntax noprefix .file "tetris-sim.c" .globl create_board # -- Begin function create_board .p2align 4, 0x90 .type create_board,@function create_board: # @create_board .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 mov rbp,...
.text .file "tetris-sim.c" .globl create_board // -- Begin function create_board .p2align 2 .type create_board,@function create_board: // @create_board .cfi_startproc // %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str wzr, [sp, #4] b .LBB0_1 .LB...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "tetris-sim.c" .globl create_board # -- Begin function create_board .p2align 1 .type create_board,@function create_board: # @create_board .cfi_startproc # %bb.0: addi...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _create_board ; -- Begin function create_board .p2align 2 _create_board: ; @create_board .cfi_startproc ; %bb.0: sub sp, sp, #16 .cfi_def_cfa_offset 16 str x0, [sp, #8] str wzr, [sp, #...
tiny-NN
/* ============================================================================ Name : TinyNN.c Author : Darius Malysiak Version : 0.01 Copyright : It's mine Description : A tiny 2-layer NN (one input neuron and one output neuron) implementation with backpropagation training ===================...
.text .intel_syntax noprefix .file "tiny-NN.c" .section .rodata.cst8,"aM",@progbits,8 .p2align 3, 0x0 # -- Begin function g_deriv .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .LCPI0_1: .quad 0xbff0000000000000 # double -1 .text .globl g_deriv .p2align 4, 0x9...
.text .file "tiny-NN.c" .globl g_deriv // -- Begin function g_deriv .p2align 2 .type g_deriv,@function g_deriv: // @g_deriv .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-byte Folded Spill add x29...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "tiny-NN.c" .section .sdata,"aw",@progbits .p2align 3 # -- Begin function g_deriv .LCPI0_0: .quad 0x3ff0000000000000 # double 1 .text .globl g_deriv .p2align 1 .type ...
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _g_deriv ; -- Begin function g_deriv .p2align 2 _g_deriv: ; @g_deriv .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folded Spill add x29...
topo-sort
// C Program to implement Topological Sorting #include "libmin.h" // Structure to represent a stack struct Stack { int data; struct Stack* next; }; struct Graph { int V; // No. of vertices // Pointer to an array containing adjacency lists struct List* adj; }; // Structure to repres...
.text .intel_syntax noprefix .file "topo-sort.c" .globl createStackNode # -- Begin function createStackNode .p2align 4, 0x90 .type createStackNode,@function createStackNode: # @createStackNode .cfi_startproc # %bb.0: push rbp .cfi_def_cfa_offset 16 .cfi_offset rbp, -16 ...
.text .file "topo-sort.c" .globl createStackNode // -- Begin function createStackNode .p2align 2 .type createStackNode,@function createStackNode: // @createStackNode .cfi_startproc // %bb.0: sub sp, sp, #32 .cfi_def_cfa_offset 32 stp x29, x30, [sp, #16] // 16-...
.text .attribute 4, 16 .attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zifencei2p0" .file "topo-sort.c" .globl createStackNode # -- Begin function createStackNode .p2align 1 .type createStackNode,@function createStackNode: # @createStackNode .cfi_startproc # %bb....
.section __TEXT,__text,regular,pure_instructions .build_version macos, 15, 0 .globl _createStackNode ; -- Begin function createStackNode .p2align 2 _createStackNode: ; @createStackNode .cfi_startproc ; %bb.0: sub sp, sp, #32 stp x29, x30, [sp, #16] ; 16-byte Folde...