hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
359c7530e18bb41404a4f57790f6e33bfd2f66d5 | 550 | sql | SQL | Log4Net/DAL/VS2012DatabaseProject/Pre Deployment/PreDeployment.sql | ntierontime/Log4Net | 913953147a1f311f6adc3b1ed9534184fd93fe86 | [
"MIT"
] | 3 | 2016-06-13T02:21:56.000Z | 2018-08-24T19:54:06.000Z | Log4Net/DAL/VS2012DatabaseProject/Pre Deployment/PreDeployment.sql | ntierontime/Log4Net | 913953147a1f311f6adc3b1ed9534184fd93fe86 | [
"MIT"
] | null | null | null | Log4Net/DAL/VS2012DatabaseProject/Pre Deployment/PreDeployment.sql | ntierontime/Log4Net | 913953147a1f311f6adc3b1ed9534184fd93fe86 | [
"MIT"
] | null | null | null | --Delete all data in all tables
EXEC sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
EXEC sp_MSForEachTable 'DELETE FROM ?'
EXEC sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
--reseed all tables with identity columns
declare @reseedsql nvarchar(MAX) = N'';
SELECT @reseedsql += N'
DBCC CHECKIDENT(' + TABLE_NAME + ', RESEED, 0) WITH NO_INFOMSGS'
FROM
INFORMATION_SCHEMA.TABLES
WHERE
OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), 'TableHasIdentity') = 1
AND TABLE_TYPE = 'BASE TABLE'
exec sp_executesql @reseedsql
| 25 | 70 | 0.745455 |
d8a71f4e2d485b4e2f2e6f930a72e83dcd7d1c82 | 579 | sql | SQL | SQL/SQLServer/Strings/string-agg.sql | James-McNeill/Medium | 696a41456a979c64a15553f6e770dfd2c86f7471 | [
"MIT"
] | null | null | null | SQL/SQLServer/Strings/string-agg.sql | James-McNeill/Medium | 696a41456a979c64a15553f6e770dfd2c86f7471 | [
"MIT"
] | null | null | null | SQL/SQLServer/Strings/string-agg.sql | James-McNeill/Medium | 696a41456a979c64a15553f6e770dfd2c86f7471 | [
"MIT"
] | null | null | null | SELECT
company,
- Create a list with all bean origins
STRING_AGG(bean_origin, ',') AS bean_origins
FROM ratings
WHERE company IN ('Bar Au Chocolat', 'Chocolate Con Amor', 'East Van Roasters')
- Specify the columns used for grouping your data
GROUP BY company;
SELECT
company,
- Create a list with all bean origins ordered alphabetically
STRING_AGG(bean_origin, ',') WITHIN GROUP (ORDER BY bean_origin) AS bean_origins
FROM ratings
WHERE company IN ('Bar Au Chocolat', 'Chocolate Con Amor', 'East Van Roasters')
- Specify the columns used for grouping your data
GROUP BY company;
| 34.058824 | 80 | 0.777202 |
90b2136a2ff5c6e0094f2c78d11a380011337765 | 4,457 | py | Python | malcolm/modules/adUtil/parts/reframepluginpart.py | thomascobb/pymalcolm | 801f8fe6217c0c028b5edc87fa0aef9d60b91d9d | [
"Apache-2.0"
] | null | null | null | malcolm/modules/adUtil/parts/reframepluginpart.py | thomascobb/pymalcolm | 801f8fe6217c0c028b5edc87fa0aef9d60b91d9d | [
"Apache-2.0"
] | null | null | null | malcolm/modules/adUtil/parts/reframepluginpart.py | thomascobb/pymalcolm | 801f8fe6217c0c028b5edc87fa0aef9d60b91d9d | [
"Apache-2.0"
] | null | null | null | from typing import Any
from annotypes import Anno, add_call_types
from scanpointgenerator import CompoundGenerator
from malcolm.core import Context, PartRegistrar
from malcolm.modules import ADCore, builtin, scanning
with Anno("Sample frequency of ADC signal in Hz"):
ASampleFreq = float
with Anno("Is the input trigger gated?"):
AGatedTrigger = bool
# Pull re-used annotypes into our namespace in case we are subclassed
APartName = ADCore.parts.APartName
AMri = ADCore.parts.AMri
# We will set these attributes on the child block, so don't save them
@builtin.util.no_save("postCount", "averageSamples")
class ReframePluginPart(ADCore.parts.DetectorDriverPart):
def __init__(
self,
name: APartName,
mri: AMri,
sample_freq: ASampleFreq = 10000.0,
gated_trigger: AGatedTrigger = False,
) -> None:
super().__init__(name, mri, soft_trigger_modes="Always On")
self.sample_freq = sample_freq
self.gated_trigger = gated_trigger
def setup(self, registrar: PartRegistrar) -> None:
super().setup(registrar)
# Hooks
registrar.hook(scanning.hooks.ValidateHook, self.on_validate)
@add_call_types
def on_validate(
self, generator: scanning.hooks.AGenerator
) -> scanning.hooks.UParameterTweakInfos:
duration = generator.duration
if duration == 0.0:
# Set the duration for 2 samples (1 live 1 dead)
serialized = generator.to_dict()
new_generator = CompoundGenerator.from_dict(serialized)
new_generator.duration = 2 / self.sample_freq
return scanning.infos.ParameterTweakInfo("generator", new_generator)
else:
assert (
duration > 0
), f"Generator duration of {duration} must be > 0 to signify fixed exposure"
assert (
self._number_of_adc_samples(duration) > 0
), f"Generator duration of {duration} gives < 1 ADC sample"
return None
def _number_of_adc_samples(self, generator_duration: float):
return int(generator_duration * self.sample_freq)
def setup_detector(
self,
context: Context,
completed_steps: scanning.hooks.ACompletedSteps,
steps_to_do: scanning.hooks.AStepsToDo,
num_images: int,
duration: float,
part_info: scanning.hooks.APartInfo,
initial_configure: bool = True,
**kwargs: Any,
) -> None:
if initial_configure:
# This is an initial configure, so reset arrayCounter to 0
array_counter = 0
self.done_when_reaches = steps_to_do
else:
# This is rewinding or setting up for another batch,
# skip to a uniqueID that has not been produced yet
array_counter = self.done_when_reaches
self.done_when_reaches += steps_to_do
self.uniqueid_offset = completed_steps - array_counter
child = context.block_view(self.mri)
for k, v in dict(
arrayCounter=array_counter,
imageMode=self.multiple_image_mode,
numImages=num_images,
arrayCallbacks=True,
).items():
if k not in kwargs and k in child:
kwargs[k] = v
# Ignore exposure time attribute
kwargs.pop("exposure", None)
child.put_attribute_values(kwargs)
# Calculate number of samples
post_trigger_samples = self._number_of_adc_samples(duration)
if self.is_hardware_triggered:
if self.gated_trigger:
# Gated signal is responsible for number of samples
post_trigger_samples = 0
# We also need averaging to ensure we get consistent frame dimensions
child.averageSamples.put_value("Yes")
else:
# For getting just start triggers, ensure we do not miss one
post_trigger_samples -= 1
assert (
post_trigger_samples > 0
), f"Generator duration {duration} too short for start triggers"
else:
# Need triggerOffCondition to be Always On for Software triggers
assert (
child.triggerOffCondition.value == "Always On"
), "Software triggering requires off condition to be 'Always On'"
child.postCount.put_value(post_trigger_samples)
| 37.453782 | 88 | 0.637424 |
47425c728bcd19f7ec3f581243971ce646102180 | 1,337 | kt | Kotlin | Service/src/main/java/uk/co/armedpineapple/innoextract/service/SpeedCalculator.kt | alanwoolley/innoextract-android | 0c195c2b037f16495ad96d402d5eb49912c26b50 | [
"Apache-2.0"
] | 16 | 2015-04-27T00:12:56.000Z | 2022-01-05T01:52:56.000Z | Service/src/main/java/uk/co/armedpineapple/innoextract/service/SpeedCalculator.kt | alanwoolley/innoextract-android | 0c195c2b037f16495ad96d402d5eb49912c26b50 | [
"Apache-2.0"
] | 1 | 2021-12-11T00:36:35.000Z | 2022-01-11T15:39:01.000Z | Service/src/main/java/uk/co/armedpineapple/innoextract/service/SpeedCalculator.kt | alanwoolley/innoextract-android | 0c195c2b037f16495ad96d402d5eb49912c26b50 | [
"Apache-2.0"
] | 7 | 2015-02-28T01:38:22.000Z | 2019-07-13T13:36:36.000Z | package uk.co.armedpineapple.innoextract.service
class SpeedCalculator {
private var lastTime: Long = 0
private var buffer: LongArray = LongArray(size=3)
private var bufferIdx: Int = 0
private var lastValue: Long = 0
private var lastAverage: Long = -1
private var bufferFilled = false
fun reset() {
bufferIdx =0
lastTime=0
lastValue=0
lastAverage=-1
bufferFilled = false
}
fun update(progress: Long): Long {
val now = System.currentTimeMillis()
if (lastTime == 0L) {
lastTime = now
} else if (now - lastTime > MIN_TIME) {
val secondsPassed: Float = ((now - lastTime) * 1.0f) / 1000
val bps = ((progress - lastValue) * 1.0f) / secondsPassed
lastTime = now
lastValue = progress
bufferIdx = (bufferIdx + 1) % buffer.size
bufferFilled = (bufferFilled || bufferIdx == 0)
buffer[bufferIdx] = bps.toLong()
if (bufferFilled) {
lastAverage = buffer.average().toLong()
}
}
return lastAverage
}
companion object {
private const val MIN_TIME = 5000
}
}
| 25.711538 | 76 | 0.515333 |
b5ebf3035987572906734ba59a7a1e226e261cef | 639 | kt | Kotlin | solve-streams/src/commonMain/kotlin/it/unibo/tuprolog/solve/solver/fsm/State.kt | zakski/thunderjaw | bbd63f9ba2091651f22eca7b0d3c7f1edee1e8ea | [
"Apache-2.0"
] | null | null | null | solve-streams/src/commonMain/kotlin/it/unibo/tuprolog/solve/solver/fsm/State.kt | zakski/thunderjaw | bbd63f9ba2091651f22eca7b0d3c7f1edee1e8ea | [
"Apache-2.0"
] | null | null | null | solve-streams/src/commonMain/kotlin/it/unibo/tuprolog/solve/solver/fsm/State.kt | zakski/thunderjaw | bbd63f9ba2091651f22eca7b0d3c7f1edee1e8ea | [
"Apache-2.0"
] | null | null | null | package it.unibo.tuprolog.solve.solver.fsm
import it.unibo.tuprolog.solve.ExecutionContext
import it.unibo.tuprolog.solve.primitive.Solve
/**
* Represents a State of Prolog solver state-machine
*
* @author Enrico
*/
interface State {
/** The [Solve.Request] or [Solve.Response] that this state carries with it */
val solve: Solve
/** Makes the state behave and lazily returns next states */
fun behave(): Sequence<State>
/** A flag signaling if this [State.behave] has been called */
val hasBehaved: Boolean
/** The state machine execution context in this state */
val context: ExecutionContext
}
| 25.56 | 82 | 0.710485 |
bcd4f39e466351e3db9c8c9b5233acee51d12f89 | 716 | swift | Swift | goTapAPI/Native Sources/Extensions/ComparisonResult+Additions.swift | Tap-Payments/goTapAPI_iOSV2 | 10252251fa32fdcb8b97064272e1049bcf932f00 | [
"MIT"
] | null | null | null | goTapAPI/Native Sources/Extensions/ComparisonResult+Additions.swift | Tap-Payments/goTapAPI_iOSV2 | 10252251fa32fdcb8b97064272e1049bcf932f00 | [
"MIT"
] | null | null | null | goTapAPI/Native Sources/Extensions/ComparisonResult+Additions.swift | Tap-Payments/goTapAPI_iOSV2 | 10252251fa32fdcb8b97064272e1049bcf932f00 | [
"MIT"
] | null | null | null | //
// ComparisonResult+Additions.swift
// Pods
//
// Created by Dennis Pashkov on 10/18/16.
//
//
import Foundation
/** Additions Extends ComparisonResult
*/
public extension ComparisonResult {
public var foundationValue: Foundation.ComparisonResult {
switch self {
case ComparisonResult.OrderedAscending:
return .orderedAscending
case ComparisonResult.OrderedDescending:
return .orderedDescending
case ComparisonResult.OrderedSame:
return .orderedSame
default:
return .orderedSame
}
}
}
| 18.842105 | 61 | 0.548883 |
82ddf3cefebd86dc73ad5943518acd95f17fbce5 | 297 | sql | SQL | init.sql | sunpipi/data-collect | 693bb7fe6f5ac998a5063a1a70bec3ad7e1da07e | [
"Apache-2.0"
] | null | null | null | init.sql | sunpipi/data-collect | 693bb7fe6f5ac998a5063a1a70bec3ad7e1da07e | [
"Apache-2.0"
] | null | null | null | init.sql | sunpipi/data-collect | 693bb7fe6f5ac998a5063a1a70bec3ad7e1da07e | [
"Apache-2.0"
] | null | null | null | DROP database IF EXISTS `topic`;
CREATE DATABASE `topic`;
USE `topic`;
DROP TABLE IF EXISTS `time_series_data`;
CREATE TABLE time_series_data (
item_id char(36),
trading_date date,
stock_code varchar(100),
item_value double,
PRIMARY KEY (item_id, trading_date, stock_code)
); | 24.75 | 51 | 0.727273 |
d8382898219575ac8825335640031604a405a6a3 | 671 | sql | SQL | LinkedinWebPage/SQLScripts/dbo.Users.data.sql | tugba-aydin/LinkedinUpdateWebPage | 6c2a6e6c7243275da33ccb9d35ed72ad6ad4b100 | [
"MIT"
] | null | null | null | LinkedinWebPage/SQLScripts/dbo.Users.data.sql | tugba-aydin/LinkedinUpdateWebPage | 6c2a6e6c7243275da33ccb9d35ed72ad6ad4b100 | [
"MIT"
] | null | null | null | LinkedinWebPage/SQLScripts/dbo.Users.data.sql | tugba-aydin/LinkedinUpdateWebPage | 6c2a6e6c7243275da33ccb9d35ed72ad6ad4b100 | [
"MIT"
] | null | null | null | SET IDENTITY_INSERT [dbo].[Users] ON
INSERT INTO [dbo].[Users] ([Id], [Photo], [Name], [Surname], [EmailAddress], [Password], [Position], [Country], [City]) VALUES (1, N'https://localhost:44346/Resources\Images\profile.jpg', N'Tuğba', N'Aydın', N'tugba.aydinn.94@gmail.com', NULL, N'Junior Software Developer', N'Türkiye', N'Sivas')
INSERT INTO [dbo].[Users] ([Id], [Photo], [Name], [Surname], [EmailAddress], [Password], [Position], [Country], [City]) VALUES (2, N'https://localhost:44346/Resources\Images\1517608193292.jpg', N'Aykut', N'Yakan', N'aykutyakan@gmail.com', NULL, N'Senior Software Developer', N'Türkiye', N'İstanbul')
SET IDENTITY_INSERT [dbo].[Users] OFF
| 134.2 | 299 | 0.698957 |
dda6aec22cdba68a88b95f8dc1c541875295232c | 9,679 | go | Go | go1.5/src/cmd/doc/main.go | cf-unik/gorump | 5f96e96f295a526e61c1accfb41a8f9e641ff96c | [
"MIT"
] | 342 | 2015-12-11T18:31:44.000Z | 2019-06-07T04:21:34.000Z | go1.5/src/cmd/doc/main.go | cf-unik/gorump | 5f96e96f295a526e61c1accfb41a8f9e641ff96c | [
"MIT"
] | 31 | 2015-12-12T14:13:46.000Z | 2017-11-11T19:14:32.000Z | go1.5/src/cmd/doc/main.go | cf-unik/gorump | 5f96e96f295a526e61c1accfb41a8f9e641ff96c | [
"MIT"
] | 20 | 2015-12-11T19:43:13.000Z | 2018-08-21T19:11:59.000Z | // Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Doc (usually run as go doc) accepts zero, one or two arguments.
//
// Zero arguments:
// go doc
// Show the documentation for the package in the current directory.
//
// One argument:
// go doc <pkg>
// go doc <sym>[.<method>]
// go doc [<pkg>].<sym>[.<method>]
// The first item in this list that succeeds is the one whose documentation
// is printed. If there is a symbol but no package, the package in the current
// directory is chosen.
//
// Two arguments:
// go doc <pkg> <sym>[.<method>]
//
// Show the documentation for the package, symbol, and method. The
// first argument must be a full package path. This is similar to the
// command-line usage for the godoc command.
//
// For commands, unless the -cmd flag is present "go doc command"
// shows only the package-level docs for the package.
//
// For complete documentation, run "go help doc".
package main
import (
"flag"
"fmt"
"go/build"
"io"
"log"
"os"
"path"
"path/filepath"
"strings"
"unicode"
"unicode/utf8"
)
var (
unexported bool // -u flag
matchCase bool // -c flag
showCmd bool // -cmd flag
)
// usage is a replacement usage function for the flags package.
func usage() {
fmt.Fprintf(os.Stderr, "Usage of [go] doc:\n")
fmt.Fprintf(os.Stderr, "\tgo doc\n")
fmt.Fprintf(os.Stderr, "\tgo doc <pkg>\n")
fmt.Fprintf(os.Stderr, "\tgo doc <sym>[.<method>]\n")
fmt.Fprintf(os.Stderr, "\tgo doc [<pkg>].<sym>[.<method>]\n")
fmt.Fprintf(os.Stderr, "\tgo doc <pkg> <sym>[.<method>]\n")
fmt.Fprintf(os.Stderr, "For more information run\n")
fmt.Fprintf(os.Stderr, "\tgo help doc\n\n")
fmt.Fprintf(os.Stderr, "Flags:\n")
flag.PrintDefaults()
os.Exit(2)
}
func main() {
log.SetFlags(0)
log.SetPrefix("doc: ")
err := do(os.Stdout, flag.CommandLine, os.Args[1:])
if err != nil {
log.Fatal(err)
}
}
// do is the workhorse, broken out of main to make testing easier.
func do(writer io.Writer, flagSet *flag.FlagSet, args []string) (err error) {
flagSet.Usage = usage
unexported = false
matchCase = false
flagSet.BoolVar(&unexported, "u", false, "show unexported symbols as well as exported")
flagSet.BoolVar(&matchCase, "c", false, "symbol matching honors case (paths not affected)")
flagSet.BoolVar(&showCmd, "cmd", false, "show symbols with package docs even if package is a command")
flagSet.Parse(args)
buildPackage, userPath, symbol := parseArgs(flagSet.Args())
symbol, method := parseSymbol(symbol)
pkg := parsePackage(writer, buildPackage, userPath)
defer func() {
pkg.flush()
e := recover()
if e == nil {
return
}
pkgError, ok := e.(PackageError)
if ok {
err = pkgError
return
}
panic(e)
}()
switch {
case symbol == "":
pkg.packageDoc()
return
case method == "":
pkg.symbolDoc(symbol)
default:
pkg.methodDoc(symbol, method)
}
return nil
}
// parseArgs analyzes the arguments (if any) and returns the package
// it represents, the part of the argument the user used to identify
// the path (or "" if it's the current package) and the symbol
// (possibly with a .method) within that package.
// parseSymbol is used to analyze the symbol itself.
func parseArgs(args []string) (*build.Package, string, string) {
switch len(args) {
default:
usage()
case 0:
// Easy: current directory.
return importDir(pwd()), "", ""
case 1:
// Done below.
case 2:
// Package must be importable.
pkg, err := build.Import(args[0], "", build.ImportComment)
if err != nil {
log.Fatalf("%s", err)
}
return pkg, args[0], args[1]
}
// Usual case: one argument.
arg := args[0]
// If it contains slashes, it begins with a package path.
// First, is it a complete package path as it is? If so, we are done.
// This avoids confusion over package paths that have other
// package paths as their prefix.
pkg, err := build.Import(arg, "", build.ImportComment)
if err == nil {
return pkg, arg, ""
}
// Another disambiguator: If the symbol starts with an upper
// case letter, it can only be a symbol in the current directory.
// Kills the problem caused by case-insensitive file systems
// matching an upper case name as a package name.
if isUpper(arg) {
pkg, err := build.ImportDir(".", build.ImportComment)
if err == nil {
return pkg, "", arg
}
}
// If it has a slash, it must be a package path but there is a symbol.
// It's the last package path we care about.
slash := strings.LastIndex(arg, "/")
// There may be periods in the package path before or after the slash
// and between a symbol and method.
// Split the string at various periods to see what we find.
// In general there may be ambiguities but this should almost always
// work.
var period int
// slash+1: if there's no slash, the value is -1 and start is 0; otherwise
// start is the byte after the slash.
for start := slash + 1; start < len(arg); start = period + 1 {
period = strings.Index(arg[start:], ".")
symbol := ""
if period < 0 {
period = len(arg)
} else {
period += start
symbol = arg[period+1:]
}
// Have we identified a package already?
pkg, err := build.Import(arg[0:period], "", build.ImportComment)
if err == nil {
return pkg, arg[0:period], symbol
}
// See if we have the basename or tail of a package, as in json for encoding/json
// or ivy/value for robpike.io/ivy/value.
path := findPackage(arg[0:period])
if path != "" {
return importDir(path), arg[0:period], symbol
}
}
// If it has a slash, we've failed.
if slash >= 0 {
log.Fatalf("no such package %s", arg[0:period])
}
// Guess it's a symbol in the current directory.
return importDir(pwd()), "", arg
}
// importDir is just an error-catching wrapper for build.ImportDir.
func importDir(dir string) *build.Package {
pkg, err := build.ImportDir(dir, build.ImportComment)
if err != nil {
log.Fatal(err)
}
return pkg
}
// parseSymbol breaks str apart into a symbol and method.
// Both may be missing or the method may be missing.
// If present, each must be a valid Go identifier.
func parseSymbol(str string) (symbol, method string) {
if str == "" {
return
}
elem := strings.Split(str, ".")
switch len(elem) {
case 1:
case 2:
method = elem[1]
isIdentifier(method)
default:
log.Printf("too many periods in symbol specification")
usage()
}
symbol = elem[0]
isIdentifier(symbol)
return
}
// isIdentifier checks that the name is valid Go identifier, and
// logs and exits if it is not.
func isIdentifier(name string) {
if len(name) == 0 {
log.Fatal("empty symbol")
}
for i, ch := range name {
if unicode.IsLetter(ch) || ch == '_' || i > 0 && unicode.IsDigit(ch) {
continue
}
log.Fatalf("invalid identifier %q", name)
}
}
// isExported reports whether the name is an exported identifier.
// If the unexported flag (-u) is true, isExported returns true because
// it means that we treat the name as if it is exported.
func isExported(name string) bool {
return unexported || isUpper(name)
}
// isUpper reports whether the name starts with an upper case letter.
func isUpper(name string) bool {
ch, _ := utf8.DecodeRuneInString(name)
return unicode.IsUpper(ch)
}
// findPackage returns the full file name path specified by the
// (perhaps partial) package path pkg.
func findPackage(pkg string) string {
if pkg == "" {
return ""
}
if isUpper(pkg) {
return "" // Upper case symbol cannot be a package name.
}
path := pathFor(build.Default.GOROOT, pkg)
if path != "" {
return path
}
for _, root := range splitGopath() {
path = pathFor(root, pkg)
if path != "" {
return path
}
}
return ""
}
// splitGopath splits $GOPATH into a list of roots.
func splitGopath() []string {
return filepath.SplitList(build.Default.GOPATH)
}
// pathsFor recursively walks the tree at root looking for possible directories for the package:
// those whose package path is pkg or which have a proper suffix pkg.
func pathFor(root, pkg string) (result string) {
root = path.Join(root, "src")
slashDot := string(filepath.Separator) + "."
// We put a slash on the pkg so can use simple string comparison below
// yet avoid inadvertent matches, like /foobar matching bar.
pkgString := filepath.Clean(string(filepath.Separator) + pkg)
// We use panic/defer to short-circuit processing at the first match.
// A nil panic reports that the path has been found.
defer func() {
err := recover()
if err != nil {
panic(err)
}
}()
visit := func(pathName string, f os.FileInfo, err error) error {
if err != nil {
return nil
}
// One package per directory. Ignore the files themselves.
if !f.IsDir() {
return nil
}
// No .git or other dot nonsense please.
if strings.Contains(pathName, slashDot) {
return filepath.SkipDir
}
// Is the tail of the path correct?
if strings.HasSuffix(pathName, pkgString) && hasGoFiles(pathName) {
result = pathName
panic(nil)
}
return nil
}
filepath.Walk(root, visit)
return "" // Call to panic above sets the real value.
}
// hasGoFiles tests whether the directory contains at least one file with ".go"
// extension
func hasGoFiles(path string) bool {
dir, err := os.Open(path)
if err != nil {
// ignore unreadable directories
return false
}
defer dir.Close()
names, err := dir.Readdirnames(0)
if err != nil {
// ignore unreadable directories
return false
}
for _, name := range names {
if strings.HasSuffix(name, ".go") {
return true
}
}
return false
}
// pwd returns the current directory.
func pwd() string {
wd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
return wd
}
| 27.264789 | 103 | 0.676826 |
c1640c2e0f0eb4849a32fbc4effc2a7c36ab2c50 | 2,497 | rs | Rust | src/test/instruction_tests/instr_vperm2f128.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | src/test/instruction_tests/instr_vperm2f128.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | src/test/instruction_tests/instr_vperm2f128.rs | ftilde/rust-x86asm | f6584b8cfe8e75d978bf7b83a67c69444fd3f161 | [
"MIT"
] | null | null | null | use instruction_def::*;
use test::run_test;
use Operand::*;
use Reg::*;
use RegScale::*;
use RegType::*;
use {BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode};
#[test]
fn vperm2f128_1() {
run_test(
&Instruction {
mnemonic: Mnemonic::VPERM2F128,
operand1: Some(Direct(YMM3)),
operand2: Some(Direct(YMM2)),
operand3: Some(Direct(YMM3)),
operand4: Some(Literal8(7)),
lock: false,
rounding_mode: None,
merge_mode: None,
sae: false,
mask: None,
broadcast: None,
},
&[196, 227, 109, 6, 219, 7],
OperandSize::Dword,
)
}
#[test]
fn vperm2f128_2() {
run_test(
&Instruction {
mnemonic: Mnemonic::VPERM2F128,
operand1: Some(Direct(YMM5)),
operand2: Some(Direct(YMM2)),
operand3: Some(Indirect(EDX, Some(OperandSize::Ymmword), None)),
operand4: Some(Literal8(101)),
lock: false,
rounding_mode: None,
merge_mode: None,
sae: false,
mask: None,
broadcast: None,
},
&[196, 227, 109, 6, 42, 101],
OperandSize::Dword,
)
}
#[test]
fn vperm2f128_3() {
run_test(
&Instruction {
mnemonic: Mnemonic::VPERM2F128,
operand1: Some(Direct(YMM7)),
operand2: Some(Direct(YMM0)),
operand3: Some(Direct(YMM5)),
operand4: Some(Literal8(45)),
lock: false,
rounding_mode: None,
merge_mode: None,
sae: false,
mask: None,
broadcast: None,
},
&[196, 227, 125, 6, 253, 45],
OperandSize::Qword,
)
}
#[test]
fn vperm2f128_4() {
run_test(
&Instruction {
mnemonic: Mnemonic::VPERM2F128,
operand1: Some(Direct(YMM4)),
operand2: Some(Direct(YMM4)),
operand3: Some(IndirectDisplaced(
RDI,
131490697,
Some(OperandSize::Ymmword),
None,
)),
operand4: Some(Literal8(80)),
lock: false,
rounding_mode: None,
merge_mode: None,
sae: false,
mask: None,
broadcast: None,
},
&[196, 227, 93, 6, 167, 137, 99, 214, 7, 80],
OperandSize::Qword,
)
}
| 25.742268 | 95 | 0.492591 |
69fee4b0b22a16175d27d6c08e8b9c302fbfb3d2 | 735 | sql | SQL | database/setup.sql | zeljkobekcic/covid19-ampel | 6bce39229f9c79879c297275829006da6c5e67d1 | [
"MIT"
] | null | null | null | database/setup.sql | zeljkobekcic/covid19-ampel | 6bce39229f9c79879c297275829006da6c5e67d1 | [
"MIT"
] | null | null | null | database/setup.sql | zeljkobekcic/covid19-ampel | 6bce39229f9c79879c297275829006da6c5e67d1 | [
"MIT"
] | 1 | 2020-03-23T18:21:57.000Z | 2020-03-23T18:21:57.000Z | create table results
(
plz VARCHAR(80) NOT NULL,
einwohner_plz INTEGER NOT NULL,
landkreis VARCHAR(255) NOT NULL,
anzahl_fall_aktiv_landkreis INTEGER NOT NULL,
anzahl_fall_immun_landkreis INTEGER NOT NULL,
anzahl_tode_landkreis INTEGER,
einwohner_landkreis INTEGER NOT NULL,
faelle_pro_hunderttausend FLOAT,
eintrag_rot INTEGER NOT NULL,
eintrag_gelb INTEGER NOT NULL,
eintrag_gruen INTEGER NOT NULL,
prognose INTEGER NOT NULL,
wachstum FLOAT,
erster_fall TIMESTAMP
) | 43.235294 | 54 | 0.538776 |
1bf85c0291f5897e3bb159145ca9ab09b5a8ce44 | 39 | py | Python | bob/db/swan/config_protocol_licit_p1_face_f4.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | bob/db/swan/config_protocol_licit_p1_face_f4.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | bob/db/swan/config_protocol_licit_p1_face_f4.py | bioidiap/bob.db.swan | 676510d47cb08b65be04f51d45746127c36bf2ce | [
"BSD-3-Clause"
] | null | null | null | database.protocol = 'licit_p1_face_f4'
| 19.5 | 38 | 0.820513 |
a77da4f108716e36160bc5999912c7dc353279a6 | 2,421 | swift | Swift | SpriteKitGameProgrammatically/Controller/Game Scenes/MainMenuScene.swift | IlijaMihajlovic/Sweet-Sweets-Mania-SpriteKit-Game | 48b4652751bafbc7d781ffdb573fab63663f6f09 | [
"MIT"
] | null | null | null | SpriteKitGameProgrammatically/Controller/Game Scenes/MainMenuScene.swift | IlijaMihajlovic/Sweet-Sweets-Mania-SpriteKit-Game | 48b4652751bafbc7d781ffdb573fab63663f6f09 | [
"MIT"
] | null | null | null | SpriteKitGameProgrammatically/Controller/Game Scenes/MainMenuScene.swift | IlijaMihajlovic/Sweet-Sweets-Mania-SpriteKit-Game | 48b4652751bafbc7d781ffdb573fab63663f6f09 | [
"MIT"
] | null | null | null | //
// MainMenuScene.swift
// Sweet Sweets Mania
//
// Created by Ilija Mihajlovic on 4/18/19.
// Copyright © 2019 Ilija Mihajlovic. All rights reserved.
//
import SpriteKit
import UIKit
class MainMenuScene: SKScene {
var background: SKSpriteNode = {
var sprite = SKSpriteNode(imageNamed: "MainMenuBackground")
sprite.scaleTo(screenWidthPercentage: 1.0)
sprite.zPosition = 0
return sprite
}()
lazy var playButton: SSMButton = {
var button = SSMButton(imageNamed: "ButtonPlay", buttonAction: {
self.startGameplay()
})
button.scaleTo(screenWithPercentage: 0.22)
button.zPosition = 1
return button
}()
lazy var handleMoreButton: SSMButton = {
var button = SSMButton(imageNamed: "ButtonSettings", buttonAction: {
self.handleMore()
})
button.scaleTo(screenWithPercentage: 0.22)
button.zPosition = 2
return button
}()
lazy var settingsLauncher: SettingsLauncher = {
let launcher = SettingsLauncher()
launcher.mainMenu = self //Make MainMenuScene Not Nil
return launcher
}()
func handleMore() {
settingsLauncher.mainMenu = self
settingsLauncher.showSettings()
}
override func didMove(to view: SKView) {
anchorPoint = CGPoint(x: 0.5, y: 0.5)
playButton.position = CGPoint.zero
setupNodes()
addNodes()
}
@objc func startGameplayNotification(_ info:Notification) {
startGameplay()
}
func startGameplay() {
SSMManager.shared.transition(self, toScene: .Gameplay, transition: SKTransition.moveIn(with: .right, duration: 0.5))
}
func addNodes() {
[background, playButton, handleMoreButton].forEach{(addChild($0))}
}
//MARK: - Constraints
func setupNodes() {
background.position = CGPoint.zero
playButton.position = CGPoint.zero
if DeviceType.isiPhoneX {
handleMoreButton.position = CGPoint(x: ScreenSize.width * 0.36, y: ScreenSize.heigth * 0.36)
} else {
handleMoreButton.position = CGPoint(x: ScreenSize.width * 0.34, y: ScreenSize.heigth * 0.35)
}
}
}
| 23.970297 | 124 | 0.579513 |
65054cfd998e3e6858fee00ff01c36b5dddea1ff | 383 | py | Python | models.py | collingreen/yaib_plugin_leavemessage | c1e7254edee5255167c2015ee2566f9770b35412 | [
"MIT"
] | null | null | null | models.py | collingreen/yaib_plugin_leavemessage | c1e7254edee5255167c2015ee2566f9770b35412 | [
"MIT"
] | 1 | 2015-06-06T06:28:45.000Z | 2015-06-06T06:28:45.000Z | models.py | collingreen/yaib_plugin_leavemessage | c1e7254edee5255167c2015ee2566f9770b35412 | [
"MIT"
] | null | null | null | from sqlalchemy import Table, Column, String, DateTime, Text
from modules.persistence import Base, getModelBase
CustomBase = getModelBase('leavemessage')
class Message(Base, CustomBase):
user = Column(String(200))
nick = Column(String(100))
message_time = Column(DateTime)
to_nick = Column(String(100))
channel = Column(String(50))
message = Column(Text)
| 25.533333 | 60 | 0.723238 |
b176519a7ac518a4d893f0ad5f9aaa4d90ea9929 | 589 | css | CSS | src/app/resume/resume.component.css | BuddhaTheChef/angular-portfolio | 580f729254a6b37f5d4692c33731b9bf02d7fd1b | [
"Apache-2.0"
] | null | null | null | src/app/resume/resume.component.css | BuddhaTheChef/angular-portfolio | 580f729254a6b37f5d4692c33731b9bf02d7fd1b | [
"Apache-2.0"
] | 4 | 2021-09-02T03:22:05.000Z | 2022-02-18T16:15:35.000Z | src/app/resume/resume.component.css | BuddhaTheChef/angular-portfolio | 580f729254a6b37f5d4692c33731b9bf02d7fd1b | [
"Apache-2.0"
] | null | null | null | .main-div {
background-color: rgb(37,37,37);
height: 100vh;
}
.main-footer {
text-align: center;
background-color: salmon;
padding-top: 30px;
}
.icon-div {
background: rgb(37,37,37);
display: block;
padding: 10px;
border-radius: 50%;
}
.resume-div {
width: 100%;
margin-top: 30px;
display: flex;
justify-content: center;
align-items: center;
}
.img-div {
padding: 20px;
background-color:#0069d9;
border-radius: 9px;
} | 19 | 36 | 0.500849 |
7771a21f9ff8ca1c3105afe7d9f6d1d5c414b1b4 | 33,473 | html | HTML | tornado/c06/s01.html | kwshare/html | 1b4d2549f3d2a155f7cebd97089e407c1595c44f | [
"MIT"
] | null | null | null | tornado/c06/s01.html | kwshare/html | 1b4d2549f3d2a155f7cebd97089e407c1595c44f | [
"MIT"
] | null | null | null | tornado/c06/s01.html | kwshare/html | 1b4d2549f3d2a155f7cebd97089e407c1595c44f | [
"MIT"
] | 1 | 2020-06-03T02:03:34.000Z | 2020-06-03T02:03:34.000Z | <!DOCTYPE HTML>
<html lang="en" >
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>6.1 Cookie | 引言</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="generator" content="GitBook 2.6.7">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="../gitbook/style.css">
<link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
<link rel="next" href="../c06/s02.html" />
<link rel="prev" href="../c06/index.html" />
</head>
<body>
<div class="book"
data-level="6.1"
data-chapter-title="6.1 Cookie"
data-filepath="c06/s01.md"
data-basepath=".."
data-revision="Fri Feb 10 2017 17:36:30 GMT+0800 (CST)"
data-innerlanguage="">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="0" data-path="index.html">
<a href="../index.html">
<i class="fa fa-check"></i>
引言
</a>
</li>
<li class="chapter " data-level="1" data-path="c01/index.html">
<a href="../c01/index.html">
<i class="fa fa-check"></i>
<b>1.</b>
1 关于Tornado
</a>
<ul class="articles">
<li class="chapter " data-level="1.1" data-path="c01/s01.html">
<a href="../c01/s01.html">
<i class="fa fa-check"></i>
<b>1.1.</b>
1.1 Tornado是为何物
</a>
</li>
<li class="chapter " data-level="1.2" data-path="c01/s02.html">
<a href="../c01/s02.html">
<i class="fa fa-check"></i>
<b>1.2.</b>
1.2 Tornado与Django
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="2" data-path="c02/index.html">
<a href="../c02/index.html">
<i class="fa fa-check"></i>
<b>2.</b>
2 初识Tornado
</a>
<ul class="articles">
<li class="chapter " data-level="2.1" data-path="c02/s01.html">
<a href="../c02/s01.html">
<i class="fa fa-check"></i>
<b>2.1.</b>
2.1 安装
</a>
</li>
<li class="chapter " data-level="2.2" data-path="c02/s02.html">
<a href="../c02/s02.html">
<i class="fa fa-check"></i>
<b>2.2.</b>
2.2 Hello Itcast
</a>
</li>
<li class="chapter " data-level="2.3" data-path="c02/s03.html">
<a href="../c02/s03.html">
<i class="fa fa-check"></i>
<b>2.3.</b>
2.3 httpserver
</a>
</li>
<li class="chapter " data-level="2.4" data-path="c02/s04.html">
<a href="../c02/s04.html">
<i class="fa fa-check"></i>
<b>2.4.</b>
2.4 options
</a>
</li>
<li class="chapter " data-level="2.5" data-path="c02/s05.html">
<a href="../c02/s05.html">
<i class="fa fa-check"></i>
<b>2.5.</b>
2.5 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="3" data-path="c03/index.html">
<a href="../c03/index.html">
<i class="fa fa-check"></i>
<b>3.</b>
3 深入Tornado
</a>
<ul class="articles">
<li class="chapter " data-level="3.1" data-path="c03/s01.html">
<a href="../c03/s01.html">
<i class="fa fa-check"></i>
<b>3.1.</b>
3.1 Application
</a>
</li>
<li class="chapter " data-level="3.2" data-path="c03/s02.html">
<a href="../c03/s02.html">
<i class="fa fa-check"></i>
<b>3.2.</b>
3.2 输入
</a>
</li>
<li class="chapter " data-level="3.3" data-path="c03/s03.html">
<a href="../c03/s03.html">
<i class="fa fa-check"></i>
<b>3.3.</b>
3.3 输出
</a>
</li>
<li class="chapter " data-level="3.4" data-path="c03/s04.html">
<a href="../c03/s04.html">
<i class="fa fa-check"></i>
<b>3.4.</b>
3.4 接口与调用顺序
</a>
</li>
<li class="chapter " data-level="3.5" data-path="c03/s05.html">
<a href="../c03/s05.html">
<i class="fa fa-check"></i>
<b>3.5.</b>
3.5 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="4" data-path="c04/index.html">
<a href="../c04/index.html">
<i class="fa fa-check"></i>
<b>4.</b>
4 模板
</a>
<ul class="articles">
<li class="chapter " data-level="4.1" data-path="c04/s01.html">
<a href="../c04/s01.html">
<i class="fa fa-check"></i>
<b>4.1.</b>
4.1 静态文件
</a>
</li>
<li class="chapter " data-level="4.2" data-path="c04/s02.html">
<a href="../c04/s02.html">
<i class="fa fa-check"></i>
<b>4.2.</b>
4.2 使用模板
</a>
</li>
<li class="chapter " data-level="4.3" data-path="c04/s03.html">
<a href="../c04/s03.html">
<i class="fa fa-check"></i>
<b>4.3.</b>
4.3 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="5" data-path="c05/index.html">
<a href="../c05/index.html">
<i class="fa fa-check"></i>
<b>5.</b>
5 数据库
</a>
<ul class="articles">
<li class="chapter " data-level="5.1" data-path="c05/s01.html">
<a href="../c05/s01.html">
<i class="fa fa-check"></i>
<b>5.1.</b>
5.1 数据库
</a>
</li>
<li class="chapter " data-level="5.2" data-path="c05/s02.html">
<a href="../c05/s02.html">
<i class="fa fa-check"></i>
<b>5.2.</b>
5.2 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="6" data-path="c06/index.html">
<a href="../c06/index.html">
<i class="fa fa-check"></i>
<b>6.</b>
6 安全应用
</a>
<ul class="articles">
<li class="chapter active" data-level="6.1" data-path="c06/s01.html">
<a href="../c06/s01.html">
<i class="fa fa-check"></i>
<b>6.1.</b>
6.1 Cookie
</a>
</li>
<li class="chapter " data-level="6.2" data-path="c06/s02.html">
<a href="../c06/s02.html">
<i class="fa fa-check"></i>
<b>6.2.</b>
6.2 XSRF
</a>
</li>
<li class="chapter " data-level="6.3" data-path="c06/s03.html">
<a href="../c06/s03.html">
<i class="fa fa-check"></i>
<b>6.3.</b>
6.3 用户验证
</a>
</li>
<li class="chapter " data-level="6.4" data-path="c06/s04.html">
<a href="../c06/s04.html">
<i class="fa fa-check"></i>
<b>6.4.</b>
6.4 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="7" data-path="c07/index.html">
<a href="../c07/index.html">
<i class="fa fa-check"></i>
<b>7.</b>
7 异步与WebSocket
</a>
<ul class="articles">
<li class="chapter " data-level="7.1" data-path="c07/s01.html">
<a href="../c07/s01.html">
<i class="fa fa-check"></i>
<b>7.1.</b>
7.1 认识异步
</a>
</li>
<li class="chapter " data-level="7.2" data-path="c07/s02.html">
<a href="../c07/s02.html">
<i class="fa fa-check"></i>
<b>7.2.</b>
7.2 Tornado异步
</a>
</li>
<li class="chapter " data-level="7.3" data-path="c07/s03.html">
<a href="../c07/s03.html">
<i class="fa fa-check"></i>
<b>7.3.</b>
7.3 WebSocket
</a>
</li>
<li class="chapter " data-level="7.4" data-path="c07/s04.html">
<a href="../c07/s04.html">
<i class="fa fa-check"></i>
<b>7.4.</b>
7.4 练习
</a>
</li>
</ul>
</li>
<li class="chapter " data-level="8" data-path="c08/index.html">
<a href="../c08/index.html">
<i class="fa fa-check"></i>
<b>8.</b>
8 部署
</a>
<ul class="articles">
<li class="chapter " data-level="8.1" data-path="c08/s01.html">
<a href="../c08/s01.html">
<i class="fa fa-check"></i>
<b>8.1.</b>
8.1 部署Tornado
</a>
</li>
</ul>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Actions Left -->
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="../" >引言</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<h1 id="61-cookie">6.1 Cookie</h1>
<p>对于RequestHandler,除了在第二章中讲到的之外,还提供了操作cookie的方法。</p>
<h2 id="设置">设置</h2>
<p><strong>set_cookie(name, value, domain=None, expires=None, path='/', expires_days=None)</strong></p>
<p>参数说明:</p>
<table>
<thead>
<tr>
<th style="text-align:left">参数名</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">name</td>
<td style="text-align:left">cookie名</td>
</tr>
<tr>
<td style="text-align:left">value</td>
<td style="text-align:left">cookie值</td>
</tr>
<tr>
<td style="text-align:left">domain</td>
<td style="text-align:left">提交cookie时匹配的域名</td>
</tr>
<tr>
<td style="text-align:left">path</td>
<td style="text-align:left">提交cookie时匹配的路径</td>
</tr>
<tr>
<td style="text-align:left">expires</td>
<td style="text-align:left">cookie的有效期,可以是时间戳整数、时间元组或者datetime类型,为<strong>UTC时间</strong></td>
</tr>
<tr>
<td style="text-align:left">expires_days</td>
<td style="text-align:left">cookie的有效期,天数,优先级低于expires</td>
</tr>
</tbody>
</table>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> datetime
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
self.set_cookie(<span class="hljs-string">"n1"</span>, <span class="hljs-string">"v1"</span>)
self.set_cookie(<span class="hljs-string">"n2"</span>, <span class="hljs-string">"v2"</span>, path=<span class="hljs-string">"/new"</span>, expires=time.strptime(<span class="hljs-string">"2016-11-11 23:59:59"</span>,<span class="hljs-string">"%Y-%m-%d %H:%M:%S"</span>))
self.set_cookie(<span class="hljs-string">"n3"</span>, <span class="hljs-string">"v3"</span>, expires_days=<span class="hljs-number">20</span>)
<span class="hljs-comment"># 利用time.mktime将本地时间转换为UTC标准时间</span>
self.set_cookie(<span class="hljs-string">"n4"</span>, <span class="hljs-string">"v4"</span>, expires=time.mktime(time.strptime(<span class="hljs-string">"2016-11-11 23:59:59"</span>,<span class="hljs-string">"%Y-%m-%d %H:%M:%S"</span>)))
self.write(<span class="hljs-string">"OK"</span>)
</code></pre>
<p><img src="../images/set_cookie.png" alt="设置cookie"></p>
<h4 id="原理">原理</h4>
<p>设置cookie实际就是通过设置header的<strong>Set-Cookie</strong>来实现的。</p>
<p><img src="../images/set_cookie_header.png" alt="设置Set-Cookie"></p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
self.set_header(<span class="hljs-string">"Set-Cookie"</span>, <span class="hljs-string">"n5=v5; expires=Fri, 11 Nov 2016 15:59:59 GMT; Path=/"</span>)
self.write(<span class="hljs-string">"OK"</span>)
</code></pre>
<h2 id="获取">获取</h2>
<p><strong>get_cookie(name, default=None)</strong></p>
<p>获取名为name的cookie,可以设置默认值。</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
n3 = self.get_cookie(<span class="hljs-string">"n3"</span>)
self.write(n3)
</code></pre>
<h2 id="清除">清除</h2>
<p><strong>clear_cookie(name, path='/', domain=None)</strong></p>
<p>删除名为name,并同时匹配domain和path的cookie。</p>
<p><strong>clear_all_cookies(path='/', domain=None)</strong></p>
<p>删除同时匹配domain和path的所有cookie。</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ClearOneCookieHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
self.clear_cookie(<span class="hljs-string">"n3"</span>)
self.write(<span class="hljs-string">"OK"</span>)
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ClearAllCookieHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
self.clear_all_cookies()
self.write(<span class="hljs-string">"OK"</span>)
</code></pre>
<p><strong>注意:执行清除cookie操作后,并不是立即删除了浏览器中的cookie,而是给cookie值置空,并改变其有效期使其失效。真正的删除cookie是由浏览器去清理的。</strong></p>
<h2 id="安全cookie">安全Cookie</h2>
<p>Cookie是存储在客户端浏览器中的,很容易被篡改。Tornado提供了一种对Cookie进行简易加密签名的方法来防止Cookie被恶意篡改。</p>
<p>使用安全Cookie需要为应用配置一个用来给Cookie进行混淆的秘钥cookie_secret,将其传递给Application的构造函数。我们可以使用如下方法来生成一个随机字符串作为cookie_secret的值。</p>
<pre><code class="lang-python"><span class="hljs-prompt">>>> </span><span class="hljs-keyword">import</span> base64, uuid
<span class="hljs-prompt">>>> </span>base64.b64encode(uuid.uuid4().bytes + uuid.uuid4().bytes)
<span class="hljs-string">'2hcicVu+TqShDpfsjMWQLZ0Mkq5NPEWSk9fi0zsSt3A='</span>
</code></pre>
<blockquote>
<p>Base64是一种基于64个可打印字符来表示二进制数据的表示方法。由于2的6次方等于64,所以每6个比特为一个单元,对应某个可打印字符。三个字节有24个比特,对应于4个Base64单元,即3个字节需要用4个可打印字符来表示。</p>
<p>uuid, 通用唯一识别码(英语:Universally Unique Identifier,简称UUID),是由一组32个16进制数字所构成(两个16进制数是一个字节,总共16字节),因此UUID理论上的总数为16^32=2^128,约等于3.4 x 10^38。也就是说若每纳秒产生1兆个UUID,要花100亿年才会将所有UUID用完。</p>
<p>uuid模块的uuid4()函数可以随机产生一个uuid码,bytes属性将此uuid码作为16字节字符串。</p>
</blockquote>
<p>将生成的cookie_secret传入Application构造函数:</p>
<pre><code class="lang-python">app = tornado.web.Application(
[(<span class="hljs-string">r"/"</span>, IndexHandler),],
cookie_secret = <span class="hljs-string">"2hcicVu+TqShDpfsjMWQLZ0Mkq5NPEWSk9fi0zsSt3A="</span>
)
</code></pre>
<h3 id="获取和设置">获取和设置</h3>
<h4 id="setsecurecookiename-value-expiresdays30">set_secure_cookie(name, value, expires_days=30)</h4>
<p>设置一个带签名和时间戳的cookie,防止cookie被伪造。</p>
<h4 id="getsecurecookiename-valuenone-maxagedays31">get_secure_cookie(name, value=None, max_age_days=31)</h4>
<p>如果cookie存在且验证通过,返回cookie的值,否则返回None。max_age_day不同于expires_days,expires_days是设置浏览器中cookie的有效期,而max_age_day是过滤安全cookie的时间戳。</p>
<pre><code class="lang-python"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">IndexHandler</span><span class="hljs-params">(RequestHandler)</span>:</span>
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">get</span><span class="hljs-params">(self)</span>:</span>
cookie = self.get_secure_cookie(<span class="hljs-string">"count"</span>)
count = int(cookie) + <span class="hljs-number">1</span> <span class="hljs-keyword">if</span> cookie <span class="hljs-keyword">else</span> <span class="hljs-number">1</span>
self.set_secure_cookie(<span class="hljs-string">"count"</span>, str(count))
self.write(
<span class="hljs-string">'<html><head><title>Cookie计数器</title></head>'</span>
<span class="hljs-string">'<body><h1>您已访问本页%d次。</h1>'</span> % count +
<span class="hljs-string">'</body></html>'</span>
)
</code></pre>
<p>我们看签名后的cookie值:</p>
<pre><code class="lang-python"><span class="hljs-string">"2|1:0|10:1476412069|5:count|4:NQ==|cb5fc1d4434971de6abf87270ac33381c686e4ec8c6f7e62130a0f8cbe5b7609"</span>
</code></pre>
<p>字段说明:</p>
<ol>
<li>安全cookie的版本,默认使用版本2,不带长度说明前缀</li>
<li>默认为0</li>
<li>时间戳</li>
<li>cookie名</li>
<li>base64编码的cookie值</li>
<li>签名值,不带长度说明前缀</li>
</ol>
<p><strong>注意:Tornado的安全cookie只是一定程度的安全,仅仅是增加了恶意修改的难度。Tornado的安全cookies仍然容易被窃听,而cookie值是签名不是加密,攻击者能够读取已存储的cookie值,并且可以传输他们的数据到任意服务器,或者通过发送没有修改的数据给应用伪造请求。因此,避免在浏览器cookie中存储敏感的用户数据是非常重要的。</strong></p>
</section>
</div>
</div>
</div>
<a href="../c06/index.html" class="navigation navigation-prev " aria-label="Previous page: 6 安全应用"><i class="fa fa-angle-left"></i></a>
<a href="../c06/s02.html" class="navigation navigation-next " aria-label="Next page: 6.2 XSRF"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="../gitbook/app.js"></script>
<script src="../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
<script src="../gitbook/plugins/gitbook-plugin-search/search.js"></script>
<script src="../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
<script src="../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
<script>
require(["gitbook"], function(gitbook) {
var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}};
gitbook.start(config);
});
</script>
</body>
</html>
| 39.19555 | 1,101 | 0.440923 |
953139a8f7b2ba28ed1c59da7dc691b69c570c73 | 784 | asm | Assembly | oeis/235/A235892.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/235/A235892.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/235/A235892.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A235892: Number of (n+1) X (7+1) 0..3 arrays with the minimum plus the upper median equal to the lower median plus the maximum in every 2 X 2 subblock.
; Submitted by Jon Maiga
; 67072,70168,76456,89416,116872,177928,324616,716296,1892872,5818888,19962376,73415176,280984072,1098775048,4344969736,17279810056,68919294472,275277478408,1100310706696,4399644604936,17595382168072,70375136360968,281487761013256,1125925475383816,4503650764388872,18014500783454728,72057798585809416,288230785247410696,1152922322798180872,4611687654809991688,18446747346474695176,73786982840368429576,295147918270413208072,1180591646899532003848,4722366535233886550536,18889466036207063464456
mov $1,2
pow $1,$0
add $1,95
mul $1,6
mov $2,$1
add $1,3
mul $1,$2
mov $0,$1
div $0,54
mul $0,24
sub $0,81152
| 49 | 493 | 0.829082 |
cd9ce8bc18a303239548988651d4deda8168ea2f | 11,846 | swift | Swift | NewsApp/Helper/Extensions/UIViewExtension.swift | bestiosdeveloper/NewsApp | 4383e725324d75c644ae701deca809f1e3cb08f4 | [
"MIT"
] | 17 | 2019-06-21T12:48:42.000Z | 2021-11-12T09:07:42.000Z | NewsApp/Helper/Extensions/UIViewExtension.swift | bestiosdeveloper/NewsApp | 4383e725324d75c644ae701deca809f1e3cb08f4 | [
"MIT"
] | 1 | 2019-10-19T20:11:28.000Z | 2020-03-25T15:31:42.000Z | NewsApp/Helper/Extensions/UIViewExtension.swift | bestiosdeveloper/NewsApp | 4383e725324d75c644ae701deca809f1e3cb08f4 | [
"MIT"
] | 8 | 2019-06-23T05:13:51.000Z | 2022-02-10T23:24:00.000Z | //
// UIViewExtension.swift
//
// Created by Pramod Kumar on 5/17/17.
// Copyright © 2017 Pramod Kumar. All rights reserved.
//
import Foundation
import UIKit
// MARK: - UIView
extension UIView {
public var autoResizingActive: Bool {
get {
return self.translatesAutoresizingMaskIntoConstraints
}
set {
self.translatesAutoresizingMaskIntoConstraints = autoResizingActive
for view in self.subviews {
view.autoResizingActive = autoResizingActive
}
}
}
public var cornerRadius: CGFloat {
get {
return self.layer.cornerRadius
}
set {
self.layer.cornerRadius = newValue
self.clipsToBounds = true
}
}
public var x: CGFloat {
get {
return self.frame.origin.x
} set(value) {
self.frame = CGRect(x: value, y: self.y, width: self.width, height: self.height)
}
}
public var y: CGFloat {
get {
return self.frame.origin.y
} set(value) {
self.frame = CGRect(x: self.x, y: value, width: self.width, height: self.height)
}
}
public var width: CGFloat {
get {
return self.frame.size.width
} set(value) {
self.frame = CGRect(x: self.x, y: self.y, width: value, height: self.height)
}
}
public var height: CGFloat {
get {
return self.frame.size.height
} set(value) {
self.frame = CGRect(x: self.x, y: self.y, width: self.width, height: value)
}
}
public var left: CGFloat {
get {
return self.x
} set(value) {
self.x = value
}
}
public var right: CGFloat {
get {
return self.x + self.width
} set(value) {
self.x = value - self.width
}
}
public var top: CGFloat {
get {
return self.y
} set(value) {
self.y = value
}
}
public var bottom: CGFloat {
get {
return self.y + self.height
} set(value) {
self.y = value - self.height
}
}
public var origin: CGPoint {
get {
return self.frame.origin
} set(value) {
self.frame = CGRect(origin: value, size: self.frame.size)
}
}
public var centerX: CGFloat {
get {
return self.center.x
} set(value) {
self.center.x = value
}
}
public var centerY: CGFloat {
get {
return self.center.y
} set(value) {
self.center.y = value
}
}
public var size: CGSize {
get {
return self.frame.size
} set(value) {
self.frame = CGRect(origin: self.frame.origin, size: value)
}
}
// MARK: - set round corners
func roundCorners(corners: UIRectCorner, radius: CGFloat) {
let path = UIBezierPath(roundedRect: bounds, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.path = path.cgPath
self.layer.mask = mask
}
// MARK: - set round corners by clips to bounds
func roundTopCorners(cornerRadius: CGFloat) {
self.clipsToBounds = true
self.addShadow(cornerRadius: cornerRadius, maskedCorners: [.layerMinXMinYCorner, .layerMaxXMinYCorner], color: .clear, offset: .zero, opacity: 0.0, shadowRadius: 0.0)
}
func roundBottomCorners(cornerRadius: CGFloat) {
self.clipsToBounds = true
self.addShadow(cornerRadius: cornerRadius, maskedCorners: [.layerMinXMaxYCorner, .layerMaxXMaxYCorner], color: .clear, offset: .zero, opacity: 0.0, shadowRadius: 0.0)
}
func addShadow(cornerRadius: CGFloat, maskedCorners: CACornerMask, color: UIColor, offset: CGSize, opacity: Float, shadowRadius: CGFloat) {
self.layer.cornerRadius = cornerRadius
self.layer.maskedCorners = maskedCorners
self.layer.shadowColor = color.cgColor
self.layer.shadowOffset = offset
self.layer.shadowOpacity = opacity
self.layer.shadowRadius = shadowRadius
}
/// SHOW VIEW
func showViewWithFade() {
self.alpha = 0.0
UIView.animate(withDuration: 0.3, animations: {
self.alpha = 0.0
}, completion: { (_: Bool) -> Void in
self.alpha = 1.0
let transition = CATransition()
transition.duration = 0.3
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.fade
self.layer.add(transition, forKey: nil)
self.isHidden = false
})
}
/// HIDE VIEW
func hideViewWithFade() {
UIView.animate(withDuration: 0.3, animations: {
self.alpha = 1.0
}, completion: { (_: Bool) -> Void in
self.alpha = 0.0
let transition = CATransition()
transition.duration = 0.3
transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
transition.type = CATransitionType.fade
self.layer.add(transition, forKey: nil)
self.isHidden = true
})
}
public func addGrayShadow(ofColor color: UIColor = UIColor.black, radius: CGFloat = 3, offset: CGSize = .zero, opacity: Float = 0.2, cornerRadius: CGFloat? = nil) {
layer.shadowColor = color.cgColor
layer.shadowOffset = offset
layer.shadowRadius = radius
layer.shadowOpacity = opacity
layer.masksToBounds = false
if let r = cornerRadius {
layer.shadowPath = UIBezierPath(roundedRect: layer.bounds, cornerRadius: r).cgPath
}
}
var parentViewController: UIViewController? {
var parentResponder: UIResponder? = self
while parentResponder != nil {
parentResponder = parentResponder!.next
if let viewController = parentResponder as? UIViewController {
return viewController
}
}
return nil
}
func addNoDataLable(_ withDataCount: Int, withMessage: String = "No Data Found", withFont: UIFont = UIFont.systemFont(ofSize: 18.0), textColor: UIColor = UIColor.lightGray) {
self.removeNoDataLabel()
if withDataCount <= 0 {
let msgLabel = UILabel()
msgLabel.frame = self.bounds
msgLabel.text = withMessage.isEmpty ? "No Data Found" : withMessage
msgLabel.textAlignment = NSTextAlignment.center
msgLabel.tag = 862548
msgLabel.font = withFont
msgLabel.textColor = textColor
msgLabel.numberOfLines = 0
msgLabel.backgroundColor = UIColor.clear
msgLabel.lineBreakMode = NSLineBreakMode.byWordWrapping
self.addSubview(msgLabel)
self.bringSubviewToFront(msgLabel)
}
}
fileprivate func removeNoDataLabel() {
if let msgLabel = self.viewWithTag(862548) {
msgLabel.removeFromSuperview()
}
}
// method to make a view circular
func makeCircular(borderWidth: CGFloat = 0.0, borderColor: UIColor = .clear) {
self.cropCorner(radius: self.frame.size.height / 2.0, borderWidth: borderWidth, borderColor: borderColor)
}
// method to give corner a view
func cropCorner(radius: CGFloat, borderWidth: CGFloat = 0.0, borderColor: UIColor = .clear) {
self.layer.cornerRadius = radius
self.layer.borderWidth = borderWidth
self.layer.borderColor = borderColor.cgColor
self.layer.masksToBounds = true
}
func drawDottedLine(color: UIColor = .lightGray, start p0: CGPoint, end p1: CGPoint) {
_ = self.layer.sublayers?.filter({ $0.name == "DashedTopLine" }).map({ $0.removeFromSuperlayer() })
let shapeLayer = CAShapeLayer()
shapeLayer.name = "DashedTopLine"
shapeLayer.strokeColor = color.cgColor
shapeLayer.lineWidth = 1
shapeLayer.lineDashPattern = [3, 2] // 3 is the length of dash, 2 is length of the gap.
let path = CGMutablePath()
path.addLines(between: [p0, p1])
shapeLayer.path = path
self.layer.addSublayer(shapeLayer)
}
func rotate(rotationAngle: CGFloat) {
self.transform = CGAffineTransform(rotationAngle: rotationAngle)
self.clipsToBounds = true
}
var collectionViewCell: UICollectionViewCell? {
var subviewClass = self
while !(subviewClass is UICollectionViewCell) {
guard let view = subviewClass.superview else { return nil }
subviewClass = view
}
return subviewClass as? UICollectionViewCell
}
func showBlurLoader(frame:CGRect) {
// let blurLoader = BlurLoader(frame: frame)
// self.addSubview(blurLoader)
}
func removeBluerLoader() {
// if let blurLoader = subviews.first(where: { $0 is BlurLoader }) {
// blurLoader.removeFromSuperview()
// }
}
func collectionViewIndexPath(_ collectionView: UICollectionView) -> IndexPath? {
if let cell = self.collectionViewCell {
return collectionView.indexPath(for: cell)
}
return nil
}
func rootSuperView() -> UIView? {
var view = self
while let parentView = view.superview {
view = parentView
}
return view
}
}
extension UIView {
func addshadowOnSelectedEdge(top: Bool,
left: Bool,
bottom: Bool,
right: Bool,
opacity: Float,
shadowRadius: CGFloat = 2.0,
offset:CGSize = CGSize.zero,
color: UIColor = .lightGray) {
self.layer.masksToBounds = false
self.layer.shadowOffset = offset
self.layer.shadowRadius = shadowRadius
self.layer.shadowColor = color.cgColor
self.layer.shadowOpacity = opacity
let path = UIBezierPath()
var x: CGFloat = 0
var y: CGFloat = 0
var viewWidth = self.frame.width
var viewHeight = self.frame.height
// here x, y, viewWidth, and viewHeight can be changed }}
// order to play around with the shadow paths.
if (!top) {
y+=(shadowRadius+1)
}
if (!bottom) {
viewHeight-=(shadowRadius+1)
}
if (!left) {
x+=(shadowRadius+1)
}
if (!right) {
viewWidth-=(shadowRadius+1)
}
// selecting top most point
path.move(to: CGPoint(x: x, y: y))
// Move to the Bottom Left Corner, this will cover left edges
/*
|☐
*/
path.addLine(to: CGPoint(x: x, y: viewHeight))
// Move to the Bottom Right Corner, this will cover bottom edge
/*
☐
-
*/
path.addLine(to: CGPoint(x: viewWidth, y: viewHeight))
// Move to the Top Right Corner, this will cover right edge
/*
☐|
*/
path.addLine(to: CGPoint(x: viewWidth, y: y))
// Move back to the initial point, this will cover the top edge
/*
_
☐
*/
path.close()
self.layer.shadowPath = path.cgPath
}
}
| 31.589333 | 178 | 0.562637 |
fd7c120410e21a5b31be3c6c5f2b214784eedf09 | 1,657 | h | C | quic_io/src/wrapper/quic_raw_lib.h | GaoMingKai/owt-deps-quic | 2da1476f6445dd3b8705a7b847c295b2844e0e9a | [
"BSD-3-Clause"
] | 37 | 2019-04-26T02:46:53.000Z | 2021-05-18T05:58:16.000Z | quic_io/src/wrapper/quic_raw_lib.h | GaoMingKai/owt-deps-quic | 2da1476f6445dd3b8705a7b847c295b2844e0e9a | [
"BSD-3-Clause"
] | 13 | 2021-06-07T02:45:15.000Z | 2021-12-23T01:36:38.000Z | quic_io/src/wrapper/quic_raw_lib.h | GaoMingKai/owt-deps-quic | 2da1476f6445dd3b8705a7b847c295b2844e0e9a | [
"BSD-3-Clause"
] | 24 | 2019-04-28T02:59:39.000Z | 2021-01-29T09:46:48.000Z | #ifndef NET_TOOLS_QUIC_RAW_WRAPPER_QUIC_RAW_LIB_H_
#define NET_TOOLS_QUIC_RAW_WRAPPER_QUIC_RAW_LIB_H_
#include <memory>
namespace net {
class RQuicListener {
public:
RQuicListener() {}
virtual ~RQuicListener() {}
virtual void onReady() = 0;
// The session_id will not be used for client
virtual void onData(uint32_t session_id,
uint32_t stream_id,
char* data, uint32_t len) = 0;
};
class RQuicClientInterface {
public:
virtual ~RQuicClientInterface() {}
virtual bool start(const char* host, int port) = 0;
virtual void stop() = 0;
virtual void waitForClose() = 0;
// Send data on default stream
virtual void send(const char* data, uint32_t len) = 0;
// Send data on specified stream
virtual void send(uint32_t stream_id, const char* data, uint32_t len) = 0;
virtual void setListener(RQuicListener* listener) = 0;
};
class RQuicServerInterface {
public:
virtual ~RQuicServerInterface() {}
virtual bool listen(int port) = 0;
virtual void stop() = 0;
virtual void waitForClose() = 0;
// Send data on default(first) stream
virtual void send(const char* data, uint32_t len) = 0;
// Send data on specified session, stream
virtual void send(uint32_t session_id,
uint32_t stream_id,
const char* data, uint32_t len) = 0;
virtual int getServerPort() = 0;
virtual void setListener(RQuicListener* listener) = 0;
};
class RQuicFactory {
public:
static RQuicClientInterface* createQuicClient();
static RQuicServerInterface* createQuicServer(
const char* cert_file, const char* key_file);
};
} // namespace net
#endif
| 28.568966 | 76 | 0.695836 |
4a2d760a43d82ec58c7a24223d3a9aefac240d8e | 656 | js | JavaScript | app/scripts/components/wheel_controller.js | lucaspiller/all-the-timezones | ba44c5c96584d51867aeecdca9c05824943c37a4 | [
"MIT"
] | null | null | null | app/scripts/components/wheel_controller.js | lucaspiller/all-the-timezones | ba44c5c96584d51867aeecdca9c05824943c37a4 | [
"MIT"
] | null | null | null | app/scripts/components/wheel_controller.js | lucaspiller/all-the-timezones | ba44c5c96584d51867aeecdca9c05824943c37a4 | [
"MIT"
] | null | null | null | import React from 'react';
import Actions from '../actions/actions'
import moment from 'moment';
export default React.createClass({
getDefaultProps(): any {
return {
date: new Date()
}
},
componentDidMount(): any {
document.addEventListener('mousewheel', this.scrollEvent);
},
componentWillUnmount(): any {
document.removeEventListener('mousewheel', this.scrollEvent);
},
scrollEvent(event): any {
event.preventDefault();
var newTime = moment(this.props.date).add(event.wheelDelta * 6, 'second').toDate();
Actions.setSelectedTime(newTime);
},
render(): any {
return <div>
</div>;
}
});
| 21.16129 | 87 | 0.653963 |
1641c26e04ac1d87e4da844cf291d1db38e85c31 | 221 | ts | TypeScript | frontend/src/function/swimlane-issues-compare/get-children-issues-from-redmine-issue-data.ts | pavel-g/redmine-kanban | 1dedf115b7b5147a4cb4ad2002b21e71997390b2 | [
"MIT"
] | 4 | 2020-10-11T16:00:16.000Z | 2022-02-21T15:29:06.000Z | frontend/src/function/swimlane-issues-compare/get-children-issues-from-redmine-issue-data.ts | pavel-g/redmine-kanban | 1dedf115b7b5147a4cb4ad2002b21e71997390b2 | [
"MIT"
] | null | null | null | frontend/src/function/swimlane-issues-compare/get-children-issues-from-redmine-issue-data.ts | pavel-g/redmine-kanban | 1dedf115b7b5147a4cb4ad2002b21e71997390b2 | [
"MIT"
] | null | null | null | import {RedmineIssueData} from "../../models/redmine-issue-data";
export function GetChildrenIssuesFromRedmineIssueData(issueData: RedmineIssueData): number[] {
return issueData.children?.map(child => child.id) || []
} | 44.2 | 94 | 0.760181 |
81f3129ea2735d58a75b7aa9cc5bf8f6645c743f | 2,581 | go | Go | token_filter_pattern_capture.go | junwen-k/estemplate | 79dc8c9a8845c49481eac3a47ed5e484b7b2f330 | [
"MIT"
] | 2 | 2020-02-01T06:01:47.000Z | 2020-03-12T01:46:45.000Z | token_filter_pattern_capture.go | junwen-k/estemplate | 79dc8c9a8845c49481eac3a47ed5e484b7b2f330 | [
"MIT"
] | null | null | null | token_filter_pattern_capture.go | junwen-k/estemplate | 79dc8c9a8845c49481eac3a47ed5e484b7b2f330 | [
"MIT"
] | null | null | null | // Copyright (c) KwanJunWen
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
package estemplate
import "fmt"
// TokenFilterPatternCapture token filter that emits a oktne for every capture
// group in the regular expression. Patterns are not anchored to the beginning
// and end of the string, so each pattern can match multiple times, and matches
// are allowed to overlap.
//
// See https://www.elastic.co/guide/en/elasticsearch/reference/7.5/analysis-pattern-capture-tokenfilter.html
// for details.
type TokenFilterPatternCapture struct {
TokenFilter
name string
// fields specific to pattern capture token filter
preserveOriginal *bool
patterns []string
}
// NewTokenFilterPatternCapture initializes a new TokenFilterPatternCapture.
func NewTokenFilterPatternCapture(name string) *TokenFilterPatternCapture {
return &TokenFilterPatternCapture{
name: name,
patterns: make([]string, 0),
}
}
// Name returns field key for the Token Filter.
func (c *TokenFilterPatternCapture) Name() string {
return c.name
}
// PreserveOriginal sets whether to emit the original token.
// Defaults to true.
func (c *TokenFilterPatternCapture) PreserveOriginal(preserveOriginal bool) *TokenFilterPatternCapture {
c.preserveOriginal = &preserveOriginal
return c
}
// Patterns sets the regular expressions for the filter.
func (c *TokenFilterPatternCapture) Patterns(patterns ...string) *TokenFilterPatternCapture {
c.patterns = append(c.patterns, patterns...)
return c
}
// Validate validates TokenFilterPatternCapture.
func (c *TokenFilterPatternCapture) Validate(includeName bool) error {
var invalid []string
if includeName && c.name == "" {
invalid = append(invalid, "Name")
}
if len(invalid) > 0 {
return fmt.Errorf("missing required fields or invalid values: %v", invalid)
}
return nil
}
// Source returns the serializable JSON for the source builder.
func (c *TokenFilterPatternCapture) Source(includeName bool) (interface{}, error) {
// {
// "test": {
// "type": "pattern_capture",
// "preserve_original": true,
// "patterns": ["(\\p{Ll}+|\\p{Lu}\\p{Ll}+|\\p{Lu}+)", "(\\d+)"]
// }
// }
options := make(map[string]interface{})
options["type"] = "pattern_capture"
if c.preserveOriginal != nil {
options["preserve_original"] = c.preserveOriginal
}
if len(c.patterns) > 0 {
options["patterns"] = c.patterns
}
if !includeName {
return options, nil
}
source := make(map[string]interface{})
source[c.name] = options
return source, nil
}
| 28.677778 | 108 | 0.729562 |
74130a327e5c4666b10c75d2935fdd60d0310a63 | 984 | h | C | modules/task_3/stepanov_a_convex_hull_binary_image/convex_hull_binary_image.h | Oskg/pp_2021_autumn | c05d35f4d4b324cc13e58188b4a0c0174f891976 | [
"BSD-3-Clause"
] | 1 | 2021-12-09T17:20:25.000Z | 2021-12-09T17:20:25.000Z | modules/task_3/stepanov_a_convex_hull_binary_image/convex_hull_binary_image.h | Oskg/pp_2021_autumn | c05d35f4d4b324cc13e58188b4a0c0174f891976 | [
"BSD-3-Clause"
] | null | null | null | modules/task_3/stepanov_a_convex_hull_binary_image/convex_hull_binary_image.h | Oskg/pp_2021_autumn | c05d35f4d4b324cc13e58188b4a0c0174f891976 | [
"BSD-3-Clause"
] | 3 | 2022-02-23T14:20:50.000Z | 2022-03-30T09:00:02.000Z | // Copyright 2021 Stepanov Alexander
#ifndef MODULES_TASK_3_STEPANOV_A_CONVEX_HULL_BINARY_IMAGE_CONVEX_HULL_BINARY_IMAGE_H_
#define MODULES_TASK_3_STEPANOV_A_CONVEX_HULL_BINARY_IMAGE_CONVEX_HULL_BINARY_IMAGE_H_
#include <vector>
void generateBinaryImage(std::vector<int>* image,
std::size_t size_image);
std::vector<std::vector<int>> markingComponents(std::vector<int>* image,
std::size_t size_image);
void markingNeighbors(std::vector<int>* image, std::size_t size_image,
std::vector<int>* current_component, int marker, std::size_t start_index);
std::vector<int> createHullComponent(const std::vector<int>& component,
std::size_t size_image);
std::vector<std::vector<int>> createHullImageSequential(const std::vector<int>& image,
std::size_t size_image);
std::vector<std::vector<int>> createHullImageParallel(const std::vector<int>& image,
std::size_t size_image);
#endif // MODULES_TASK_3_STEPANOV_A_CONVEX_HULL_BINARY_IMAGE_CONVEX_HULL_BINARY_IMAGE_H_
| 46.857143 | 89 | 0.801829 |
90b9135efe40fb1211769eead4dae5ab0ea2b104 | 2,548 | py | Python | tests/test_inheritance_routers.py | kmlee78/django-ninja | ae543f2d43ff4fbc0aa22713942be77d25e1bca3 | [
"MIT"
] | 2,809 | 2020-06-21T08:48:40.000Z | 2022-03-30T16:42:11.000Z | tests/test_inheritance_routers.py | kmlee78/django-ninja | ae543f2d43ff4fbc0aa22713942be77d25e1bca3 | [
"MIT"
] | 311 | 2020-06-22T07:59:27.000Z | 2022-03-31T18:01:23.000Z | tests/test_inheritance_routers.py | kmlee78/django-ninja | ae543f2d43ff4fbc0aa22713942be77d25e1bca3 | [
"MIT"
] | 178 | 2020-07-08T00:40:43.000Z | 2022-03-29T02:05:20.000Z | import pytest
from ninja import NinjaAPI, Router
from ninja.testing import TestClient
api = NinjaAPI()
@api.get("/endpoint")
# view->api
def global_op(request):
return "global"
first_router = Router()
@first_router.get("/endpoint_1")
# view->router, router->api
def router_op1(request):
return "first 1"
second_router_one = Router()
@second_router_one.get("endpoint_1")
# view->router2, router2->router1, router1->api
def router_op2(request):
return "second 1"
second_router_two = Router()
@second_router_two.get("endpoint_2")
# view->router2, router2->router1, router1->api
def router2_op3(request):
return "second 2"
first_router.add_router("/second", second_router_one, tags=["one"])
first_router.add_router("/second", second_router_two, tags=["two"])
api.add_router("/first", first_router, tags=["global"])
@first_router.get("endpoint_2")
# router->api, view->router
def router1_op1(request):
return "first 2"
@second_router_one.get("endpoint_3")
# router2->router1, router1->api, view->router2
def router21_op3(request, path_param: int = None):
return "second 3" if path_param is None else f"second 3: {path_param}"
second_router_three = Router()
@second_router_three.get("endpoint_4")
# router1->api, view->router2, router2->router1
def router_op3(request, path_param: int = None):
return "second 4" if path_param is None else f"second 4: {path_param}"
first_router.add_router("/second", second_router_three, tags=["three"])
client = TestClient(api)
@pytest.mark.parametrize(
"path,expected_status,expected_response",
[
("/endpoint", 200, "global"),
("/first/endpoint_1", 200, "first 1"),
("/first/endpoint_2", 200, "first 2"),
("/first/second/endpoint_1", 200, "second 1"),
("/first/second/endpoint_2", 200, "second 2"),
("/first/second/endpoint_3", 200, "second 3"),
("/first/second/endpoint_4", 200, "second 4"),
],
)
def test_inheritance_responses(path, expected_status, expected_response):
response = client.get(path)
assert response.status_code == expected_status, response.content
assert response.json() == expected_response
def test_tags():
schema = api.get_openapi_schema()
# print(schema)
glob = schema["paths"]["/api/first/endpoint_1"]["get"]
assert glob["tags"] == ["global"]
e1 = schema["paths"]["/api/first/second/endpoint_1"]["get"]
assert e1["tags"] == ["one"]
e2 = schema["paths"]["/api/first/second/endpoint_2"]["get"]
assert e2["tags"] == ["two"]
| 24.737864 | 74 | 0.685243 |
53bbc53ff5f68439c29a64a1fd0ce058540090b9 | 1,443 | java | Java | src/main/java/com/jeecms/cms/entity/back/base/BaseCmsConstraints.java | zhim/jeecms | df2856502e30e1dde3077f283f82cabff91766b4 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/jeecms/cms/entity/back/base/BaseCmsConstraints.java | zhim/jeecms | df2856502e30e1dde3077f283f82cabff91766b4 | [
"Apache-2.0"
] | 1 | 2021-06-04T02:32:06.000Z | 2021-06-04T02:32:06.000Z | src/main/java/com/jeecms/cms/entity/back/base/BaseCmsConstraints.java | zhim/jeecms | df2856502e30e1dde3077f283f82cabff91766b4 | [
"Apache-2.0"
] | 1 | 2021-01-31T14:46:54.000Z | 2021-01-31T14:46:54.000Z | package com.jeecms.cms.entity.back.base;
import java.io.Serializable;
public abstract class BaseCmsConstraints implements Serializable {
// constructors
public BaseCmsConstraints() {
initialize();
}
protected void initialize() {
}
private int hashCode = Integer.MIN_VALUE;
// fields
private java.lang.String name;
private java.lang.String tableName;
private java.lang.String columnName;
private java.lang.String referencedTableName;
private java.lang.String referencedColumnName;
public java.lang.String getName() {
return name;
}
public void setName(java.lang.String name) {
this.name = name;
}
public java.lang.String getTableName() {
return tableName;
}
public void setTableName(java.lang.String tableName) {
this.tableName = tableName;
}
public java.lang.String getColumnName() {
return columnName;
}
public void setColumnName(java.lang.String columnName) {
this.columnName = columnName;
}
public java.lang.String getReferencedTableName() {
return referencedTableName;
}
public void setReferencedTableName(java.lang.String referencedTableName) {
this.referencedTableName = referencedTableName;
}
public java.lang.String getReferencedColumnName() {
return referencedColumnName;
}
public void setReferencedColumnName(java.lang.String referencedColumnName) {
this.referencedColumnName = referencedColumnName;
}
public String toString() {
return super.toString();
}
} | 21.220588 | 77 | 0.76438 |
56e04ce901ae417f2d90097dc282548d5d13bd87 | 1,028 | ts | TypeScript | src/languages/minimal/domain-object-model/global-info.ts | tom-weatherhead/thaw-grammar | 3ab3d0c528ee01e6e01b448c99d62d6fd3dd6630 | [
"MIT"
] | null | null | null | src/languages/minimal/domain-object-model/global-info.ts | tom-weatherhead/thaw-grammar | 3ab3d0c528ee01e6e01b448c99d62d6fd3dd6630 | [
"MIT"
] | 8 | 2020-08-17T21:13:10.000Z | 2021-07-07T23:19:45.000Z | src/languages/minimal/domain-object-model/global-info.ts | tom-weatherhead/thaw-grammar | 3ab3d0c528ee01e6e01b448c99d62d6fd3dd6630 | [
"MIT"
] | null | null | null | // tom-weatherhead/thaw-grammar/src/languages/minimal/domain-object-model/global-info.ts
import { IParser, ITokenizer } from 'thaw-interpreter-types';
import { GlobalInfoBase } from '../../../common/domain-object-model/global-info-base';
export class MinimalLanguageGlobalInfo extends GlobalInfoBase<number> {
private readonly trueValueForAccessor = 1;
private readonly falseValueForAccessor = 0;
constructor(
options: {
parser?: IParser;
tokenizer?: ITokenizer;
} = {}
) {
super(options);
}
public get falseValue(): number {
return this.falseValueForAccessor;
}
public get trueValue(): number {
return this.trueValueForAccessor;
}
public override valueIsFalse(value: number): boolean {
return value === this.falseValue;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public valueIsInteger(value: number): boolean {
return true;
}
public valueAsInteger(value: number): number {
return value;
}
public integerAsValue(value: number): number {
return value;
}
}
| 22.844444 | 88 | 0.730545 |
403b595766d2fb4e4bbfbec543c06f9a594c67f5 | 1,658 | dart | Dart | lib/src/utils/designColor.dart | Ginkgo-App/ginkgo-mobile | 2e380448dd31c05d03c797d6b14a970263098e93 | [
"MIT"
] | 2 | 2021-06-07T01:59:35.000Z | 2021-06-07T03:35:14.000Z | lib/src/utils/designColor.dart | Ginkgo-App/ginkgo-mobile | 2e380448dd31c05d03c797d6b14a970263098e93 | [
"MIT"
] | 26 | 2020-04-11T13:20:10.000Z | 2020-07-07T13:59:23.000Z | lib/src/utils/designColor.dart | Ginkgo-App/ginkgo-mobile | 2e380448dd31c05d03c797d6b14a970263098e93 | [
"MIT"
] | 1 | 2021-06-06T09:41:27.000Z | 2021-06-06T09:41:27.000Z | import 'package:flutter/material.dart';
class DesignColor {
static Color blockHeader = Color(0xffBD1700);
static Color cta = Color(0xff0DAEE1);
static Color darkerWhite = Color(0xffE4D8D8);
static Color darkestWhite = Color(0xffD7C6C6);
static Color tinyItems = Color(0xff747576);
static Color darkRed = Color(0xffF41D00);
static Color darkestRed = Color(0xffBD1700);
static Color lightRed = Color(0xffFF5946);
static Color lighterRed = Color(0xffFF8E7E);
static Color pink = Color(0xffF4988F);
static Color lightPink = Color(0xffFADBD4);
static Color lighterPink = Color(0xffFFECE8);
static Color lightBlack = Color(0xff595758);
static Color lightestBlack = Color(0xff9B9C9D);
static Color lighterBlack = Color(0xff747576);
static const darkestGreen = Color(0xff02842E);
static const darkerBlue = Color(0xff0DAEE1);
static const darkestBlue = Color(0xff007DA6);
static Color shimmerBackground = Colors.grey[200];
static Color shimmerHightlight = Colors.grey[100];
static final defaultDropShadow = [
BoxShadow(
color: Color(0xffFF3422).withOpacity(0.25),
blurRadius: 5,
offset: Offset(0, 4),
)
];
static final backgroundColorShadow = [
BoxShadow(
color: Color(0xffBD1700).withOpacity(0.25),
blurRadius: 10,
offset: Offset(2, 2),
),
];
static final imageShadow = [
BoxShadow(
color: Color(0xff000000).withOpacity(0.25),
blurRadius: 4,
offset: Offset(4, 4),
),
];
static final buttonShadow = [
BoxShadow(
color: Color(0xff000000).withOpacity(0.25),
blurRadius: 4,
offset: Offset(0, 1),
),
];
}
| 28.586207 | 52 | 0.693004 |
4ddb22022739d7dec9b211ab5ed6763c8080963b | 409 | sql | SQL | src/DataBase/Database/dbo/Tables/Model.sql | pabloandrei/eFolding-GridProtein | f2d9c312c4451c0370f99b3e2ee602c21d5bb3a8 | [
"Apache-2.0"
] | null | null | null | src/DataBase/Database/dbo/Tables/Model.sql | pabloandrei/eFolding-GridProtein | f2d9c312c4451c0370f99b3e2ee602c21d5bb3a8 | [
"Apache-2.0"
] | null | null | null | src/DataBase/Database/dbo/Tables/Model.sql | pabloandrei/eFolding-GridProtein | f2d9c312c4451c0370f99b3e2ee602c21d5bb3a8 | [
"Apache-2.0"
] | null | null | null | CREATE TABLE [dbo].[Model] (
[process_guid] UNIQUEIDENTIFIER NOT NULL,
[monomero] TINYINT NOT NULL,
[value] FLOAT (53) NOT NULL,
CONSTRAINT [PK_Model] PRIMARY KEY CLUSTERED ([process_guid] ASC, [monomero] ASC),
CONSTRAINT [FK_Model_Process] FOREIGN KEY ([process_guid]) REFERENCES [dbo].[Process] ([guid]) ON DELETE CASCADE ON UPDATE CASCADE
);
| 31.461538 | 135 | 0.635697 |
d1be70cb1d1b5530d3ac49c2d9bccf2bcdd54767 | 29,935 | sql | SQL | public/database/learning_academy.sql | ezzatmalak/learning-acadimy | f5d62cbe07c2ba03a61b753765c6d54c87b32a96 | [
"MIT"
] | null | null | null | public/database/learning_academy.sql | ezzatmalak/learning-acadimy | f5d62cbe07c2ba03a61b753765c6d54c87b32a96 | [
"MIT"
] | null | null | null | public/database/learning_academy.sql | ezzatmalak/learning-acadimy | f5d62cbe07c2ba03a61b753765c6d54c87b32a96 | [
"MIT"
] | null | null | null | -- MySQL dump 10.13 Distrib 8.0.26, for Linux (x86_64)
--
-- Host: localhost Database: learning_academy
-- ------------------------------------------------------
-- Server version 8.0.26-0ubuntu0.20.04.2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `admins`
--
DROP TABLE IF EXISTS `admins`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `admins` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `admins_username_unique` (`username`),
UNIQUE KEY `admins_email_unique` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `admins`
--
LOCK TABLES `admins` WRITE;
/*!40000 ALTER TABLE `admins` DISABLE KEYS */;
/*!40000 ALTER TABLE `admins` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `cats`
--
DROP TABLE IF EXISTS `cats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cats` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cats`
--
LOCK TABLES `cats` WRITE;
/*!40000 ALTER TABLE `cats` DISABLE KEYS */;
INSERT INTO `cats` VALUES (1,'programing','2021-07-30 14:31:56','2021-07-30 14:31:56'),(2,'medical','2021-07-30 14:32:24','2021-07-30 14:32:24'),(3,'english','2021-07-30 14:32:32','2021-07-30 14:32:32');
/*!40000 ALTER TABLE `cats` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `course_student`
--
DROP TABLE IF EXISTS `course_student`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_student` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`course_id` bigint unsigned NOT NULL,
`student_id` bigint unsigned NOT NULL,
`status` enum('pending','approve','reject') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'pending',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `course_student_course_id_foreign` (`course_id`),
KEY `course_student_student_id_foreign` (`student_id`),
CONSTRAINT `course_student_course_id_foreign` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`),
CONSTRAINT `course_student_student_id_foreign` FOREIGN KEY (`student_id`) REFERENCES `students` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `course_student`
--
LOCK TABLES `course_student` WRITE;
/*!40000 ALTER TABLE `course_student` DISABLE KEYS */;
INSERT INTO `course_student` VALUES (1,3,37,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(2,5,17,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(3,9,18,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(4,2,18,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(5,6,25,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(6,5,46,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(7,6,57,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(8,3,26,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(9,7,4,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(10,6,17,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(11,8,38,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(12,9,23,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(13,4,33,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(14,8,13,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(15,7,8,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(16,9,47,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(17,2,37,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(18,7,56,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(19,2,5,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57'),(20,2,17,'pending','2021-07-30 20:13:57','2021-07-30 20:13:57');
/*!40000 ALTER TABLE `course_student` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `courses`
--
DROP TABLE IF EXISTS `courses`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `courses` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`cat_id` bigint unsigned NOT NULL,
`trainer_id` bigint unsigned NOT NULL,
`name` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`small_desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`desc` text COLLATE utf8mb4_unicode_ci NOT NULL,
`price` int NOT NULL,
`img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `courses_cat_id_foreign` (`cat_id`),
KEY `courses_trainer_id_foreign` (`trainer_id`),
CONSTRAINT `courses_cat_id_foreign` FOREIGN KEY (`cat_id`) REFERENCES `cats` (`id`),
CONSTRAINT `courses_trainer_id_foreign` FOREIGN KEY (`trainer_id`) REFERENCES `trainers` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `courses`
--
LOCK TABLES `courses` WRITE;
/*!40000 ALTER TABLE `courses` DISABLE KEYS */;
INSERT INTO `courses` VALUES (1,1,3,'course num 1 cat 1','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',476,'11.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(2,1,1,'course num 1 cat 2','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',218,'12.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(3,1,2,'course num 1 cat 3','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',234,'13.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(4,2,1,'course num 2 cat 1','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',155,'21.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(5,2,3,'course num 2 cat 2','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',476,'22.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(6,2,2,'course num 2 cat 3','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',119,'23.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(7,3,2,'course num 3 cat 1','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',163,'31.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(8,3,1,'course num 3 cat 2','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',142,'32.png','2021-07-30 15:47:21','2021-07-30 15:47:21'),(9,3,2,'course num 3 cat 3','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra.','Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque vel augue tempor, accumsan sem nec, pharetra urna. Nulla dictum nec enim ut viverra. Nam id purus a lorem hendrerit commodo. Phasellus sodales quis nisl eget aliquet. Maecenas eget enim vitae ipsum varius iaculis ut et quam. Aliquam auctor ac lacus non faucibus. Sed laoreet, enim sit amet vestibulum condimentum, lorem odio dictum orci, vitae malesuada augue justo quis nulla.',212,'33.png','2021-07-30 15:47:21','2021-07-30 15:47:21');
/*!40000 ALTER TABLE `courses` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `messages`
--
DROP TABLE IF EXISTS `messages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `messages` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`subject` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `messages`
--
LOCK TABLES `messages` WRITE;
/*!40000 ALTER TABLE `messages` DISABLE KEYS */;
/*!40000 ALTER TABLE `messages` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `migrations`
--
DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
`id` int unsigned NOT NULL AUTO_INCREMENT,
`migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`batch` int NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `migrations`
--
LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` VALUES (1,'2021_07_29_140914_create_cats_table',1),(2,'2021_07_29_142212_create_trainers_table',1),(3,'2021_07_29_142219_create_courses_table',1),(4,'2021_07_29_142325_create_students_table',1),(5,'2021_07_29_142336_create_admins_table',1),(7,'2021_07_29_151234_create_course_student_table',2),(9,'2021_07_31_004910_create_testimonials_table',3),(10,'2021_07_31_191358_create_settings_table',4),(11,'2021_08_01_095417_create_site_contents_table',5),(16,'2021_08_01_132409_create_news_letters_table',6),(17,'2021_08_01_132445_create_messages_table',6);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `news_letters`
--
DROP TABLE IF EXISTS `news_letters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `news_letters` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `news_letters`
--
LOCK TABLES `news_letters` WRITE;
/*!40000 ALTER TABLE `news_letters` DISABLE KEYS */;
INSERT INTO `news_letters` VALUES (1,'m_mostafa1948@yahoo.com','2021-08-01 14:04:11','2021-08-01 14:04:11'),(2,'m_mostafa1948@yahoo.com','2021-08-01 14:04:16','2021-08-01 14:04:16');
/*!40000 ALTER TABLE `news_letters` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `settings` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`logo` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`favicon` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`city` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`working_hours` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`map` text COLLATE utf8mb4_unicode_ci NOT NULL,
`fb` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`twit` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`insta` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `settings`
--
LOCK TABLES `settings` WRITE;
/*!40000 ALTER TABLE `settings` DISABLE KEYS */;
INSERT INTO `settings` VALUES (1,'Learning academy','logo.png','favicon.png','Cario','35 Abou Bakr El-Sedeek, Heliopolis','01067370803','Sun to Thur 9am to 5pm','ezzatmakar93@gmail.com','<iframe src=\"https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3451.7359937855103!2d31.328786715500833!3d30.10174648186152!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x1458158d55e603dd%3A0xb1d24531fc063b7e!2s35%20Abou%20Bakr%20El-Sedeek%2C%20El-Bostan%2C%20Heliopolis%2C%20Cairo%20Governorate%2C%20Egypt!5e0!3m2!1sen!2sus!4v1627759937220!5m2!1sen!2sus\" width=\"1000\" height=\"400\" style=\"border:0;\" allowfullscreen=\"\" loading=\"lazy\"></iframe>','https://facebook.com','https://twitter.com','https://instagram.com','2021-07-31 19:30:17','2021-07-31 19:30:21');
/*!40000 ALTER TABLE `settings` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `site_contents`
--
DROP TABLE IF EXISTS `site_contents`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `site_contents` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`content` text COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `site_contents`
--
LOCK TABLES `site_contents` WRITE;
/*!40000 ALTER TABLE `site_contents` DISABLE KEYS */;
INSERT INTO `site_contents` VALUES (1,'banner_content','{\"title\":\"The purpose of our lives is to be happy. — Dalai Lama\",\"subtitle\":\"Don\'t just promise, prove.\",\"desc\":\"Life will become much easier when we will finally understand which hands to shake and which ones to Hold. Be thankful and proud of the struggles you had in your life. They shaped you in the person you are today. They’ll light your life in the darkness.\"}','2021-08-01 08:07:11','2021-08-01 08:07:11'),(2,'courses_content','{\"title\":\"Latest Courses\",\"subtitle\":\"Find what you need to learn\"}','2021-08-01 11:09:12','2021-08-01 11:09:12');
/*!40000 ALTER TABLE `site_contents` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `students`
--
DROP TABLE IF EXISTS `students`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `students` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`spec` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `students`
--
LOCK TABLES `students` WRITE;
/*!40000 ALTER TABLE `students` DISABLE KEYS */;
INSERT INTO `students` VALUES (1,'Maudie Hackett','torp.nakia@rice.net',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(2,'Myrtle Gutkowski','pterry@cummings.org',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(3,'Brandt Bechtelar I','sporer.sunny@kris.net',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(4,'Mr. Shayne Waters DVM','leannon.candida@yahoo.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(5,'Garett Stroman','lenore.ullrich@yahoo.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(6,'Pasquale Sanford','abashirian@denesik.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(7,'Dr. Ava Haag','blick.bria@hotmail.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(8,'Mr. Payton Stracke II','orlando.runte@torphy.info',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(9,'Malinda Morar','emie.deckow@fritsch.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(10,'Ms. Itzel Kessler','geovanny.abshire@gmail.com',NULL,'2021-07-30 16:15:10','2021-07-30 16:15:10'),(11,'Aurelio Effertz','leannon.bruce@schaefer.info',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(12,'Mia Crooks','gerhold.flossie@kiehn.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(13,'Raquel Trantow','hlabadie@hotmail.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(14,'Emory Roob V','lpadberg@yahoo.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(15,'Nedra Nitzsche','dakota.prohaska@haag.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(16,'Marion Koelpin','graham.roberta@yahoo.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(17,'Raphaelle Considine','kaycee49@parisian.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(18,'Ms. Lavinia Satterfield Jr.','schamberger.sammie@yahoo.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(19,'Ms. Reta Fadel MD','dameon.feest@yahoo.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(20,'Jevon Halvorson','aubrey.watsica@steuber.biz',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(21,'Candelario Hermiston Sr.','camille81@hill.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(22,'Mrs. Lucie Leffler','zulauf.hazle@rogahn.info',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(23,'Dr. Amir Franecki Sr.','liliana29@hotmail.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(24,'Dr. Floy Moen PhD','elfrieda52@kerluke.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(25,'Bernhard Pollich','elmira74@mccullough.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(26,'Kasey Ankunding','zrice@gmail.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(27,'Alycia Hills','ryan.adelbert@botsford.com',NULL,'2021-07-30 16:15:18','2021-07-30 16:15:18'),(28,'Darrin Turcotte','udare@kuvalis.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(29,'Miss Irma Sauer Jr.','peyton.collins@mccullough.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(30,'Marcelle DuBuque','kblick@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(31,'Genoveva Spinka','kailee32@hirthe.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(32,'Darian Hegmann','gislason.joel@yahoo.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(33,'Julian Shields','erdman.geoffrey@rutherford.net',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(34,'Pattie Lueilwitz','bradford.upton@cummerata.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(35,'Constance Kassulke IV','jordane.mayer@swift.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(36,'Drew Nienow','elza.treutel@gislason.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(37,'Terrence Hansen','haag.merle@hotmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(38,'Dr. Gunner Hammes Jr.','cleve.reichert@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(39,'Graham Block','arvid45@hotmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(40,'Prof. Stan O\'Hara','isabelle.fay@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(41,'Kaelyn Leffler','nrogahn@schoen.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(42,'Isabell Hessel III','beatty.dawson@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(43,'Prof. Israel Feil Sr.','esteban11@hane.net',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(44,'Aleen Crist','wisoky.florine@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(45,'Tate Ledner','tromp.eleonore@hane.org',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(46,'Elna Bruen I','nolan13@mckenzie.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(47,'Tobin Bosco','darron.dach@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(48,'Caroline Langworth DDS','zpacocha@hotmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(49,'Prof. Clifton Bechtelar II','mae31@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(50,'Prof. Mack Collins IV','chance.cassin@casper.info',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(51,'Della Hoeger V','kory.hickle@farrell.info',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(52,'Cale Walker I','rafaela.kozey@hotmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(53,'Vilma Durgan','blubowitz@schumm.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(54,'Mrs. Brenna Kris','brett86@hotmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(55,'Dr. Hiram Reichel','tquigley@hackett.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(56,'Emile Bahringer','wehner.jamison@kutch.org',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(57,'Rosella Klein','walter.verlie@stanton.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(58,'Prof. Lyric Batz','camylle90@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(59,'Maggie Howe','bergnaum.myron@gmail.com',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19'),(60,'Dr. Burley Cormier','wherzog@hilpert.org',NULL,'2021-07-30 16:15:19','2021-07-30 16:15:19');
/*!40000 ALTER TABLE `students` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `testimonials`
--
DROP TABLE IF EXISTS `testimonials`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `testimonials` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`specialty` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`desc` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `testimonials`
--
LOCK TABLES `testimonials` WRITE;
/*!40000 ALTER TABLE `testimonials` DISABLE KEYS */;
INSERT INTO `testimonials` VALUES (1,'Girgis Saad','.Net developer','Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','1.png','2021-07-31 01:01:00','2021-07-31 01:01:10'),(2,'Ezzat Makar','PHP developer','Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','2.png','2021-07-31 01:01:04','2021-07-31 01:01:12'),(3,'Ben Eflic','Actor','Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.','3.png','2021-07-31 01:01:07','2021-07-31 01:01:14');
/*!40000 ALTER TABLE `testimonials` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `trainers`
--
DROP TABLE IF EXISTS `trainers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `trainers` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`spec` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`img` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `trainers`
--
LOCK TABLES `trainers` WRITE;
/*!40000 ALTER TABLE `trainers` DISABLE KEYS */;
INSERT INTO `trainers` VALUES (1,'Ezzat Malak',NULL,'web development','1.png','2021-07-30 15:27:47','2021-07-30 15:27:47'),(2,'Thomas Malak',NULL,'English teacher','2.png','2021-07-30 15:27:47','2021-07-30 15:27:47'),(3,'Ezzat Makar',NULL,'Software engineering','3.png','2021-07-30 15:27:47','2021-07-30 15:27:47');
/*!40000 ALTER TABLE `trainers` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-08-01 18:08:06
| 78.569554 | 6,266 | 0.735226 |
a50f9e6c83e309bf6e226ee421bca2eb84b2f24a | 941 | kt | Kotlin | app/src/main/java/com/greylabsdev/pexwalls/data/ext/Prefs.kt | Badalsinh/PexWalls | bcc2fa605e8efc86ef9724ca2576b5798e85b6aa | [
"MIT"
] | 31 | 2019-11-26T05:52:34.000Z | 2022-01-30T19:05:59.000Z | app/src/main/java/com/greylabsdev/pexwalls/data/ext/Prefs.kt | Badalsinh/PexWalls | bcc2fa605e8efc86ef9724ca2576b5798e85b6aa | [
"MIT"
] | 2 | 2020-06-27T17:44:23.000Z | 2021-07-27T12:51:46.000Z | app/src/main/java/com/greylabsdev/pexwalls/data/ext/Prefs.kt | Badalsinh/PexWalls | bcc2fa605e8efc86ef9724ca2576b5798e85b6aa | [
"MIT"
] | 10 | 2020-02-23T17:24:45.000Z | 2021-09-14T19:46:20.000Z | package com.greylabsdev.pexwalls.data.ext
import android.content.SharedPreferences
/**
* Put one of few prmitive types of values to SharedPreferences. Always using to reduce repeating code
* Returns false if your value is not one of supported primtves
*
* @property key
* @property value
*/
fun SharedPreferences.putPrimitiveValue(key: String, value: Any): Boolean {
return when (value) {
is Boolean -> {
this.edit().putBoolean(key, value).apply()
true
}
is String -> {
this.edit().putString(key, value).apply()
true
}
is Int -> {
this.edit().putInt(key, value).apply()
true
}
is Float -> {
this.edit().putFloat(key, value).apply()
true
}
is Long -> {
this.edit().putLong(key, value).apply()
true
}
else -> false
}
}
| 25.432432 | 102 | 0.54729 |
a01f5dcc9be7304e4aa7b0972e9fdce861884952 | 38 | sql | SQL | sql/category_attribute_option.sql | pacificnm/pacificnm-category-attribute-option | 602871e8b8f4f9b75815c5e67bb1f9d5f47fad98 | [
"BSD-3-Clause"
] | 1 | 2018-02-05T20:57:58.000Z | 2018-02-05T20:57:58.000Z | sql/category_attribute_option.sql | pacificnm/pacificnm-category-attribute-option | 602871e8b8f4f9b75815c5e67bb1f9d5f47fad98 | [
"BSD-3-Clause"
] | null | null | null | sql/category_attribute_option.sql | pacificnm/pacificnm-category-attribute-option | 602871e8b8f4f9b75815c5e67bb1f9d5f47fad98 | [
"BSD-3-Clause"
] | null | null | null | -- category-attribute-option sql file
| 19 | 37 | 0.789474 |
5c4bb28e4d8e6e8c3f04ebd5a09c63c014b1947f | 1,001 | h | C | eagleeye/ui/ButtonView.h | MirrorYu/eagleeye | c251e7b3bc919673b41360212c38d5fda85bbe2f | [
"Apache-2.0"
] | 12 | 2020-09-21T02:24:11.000Z | 2022-03-10T03:02:03.000Z | eagleeye/ui/ButtonView.h | MirrorYu/eagleeye | c251e7b3bc919673b41360212c38d5fda85bbe2f | [
"Apache-2.0"
] | 1 | 2020-11-30T08:22:50.000Z | 2020-11-30T08:22:50.000Z | eagleeye/ui/ButtonView.h | MirrorYu/eagleeye | c251e7b3bc919673b41360212c38d5fda85bbe2f | [
"Apache-2.0"
] | 3 | 2020-03-16T12:10:55.000Z | 2021-07-20T09:58:15.000Z | #ifndef _EAGLEEYE_BUTTONVIEW_H_
#define _EAGLEEYE_BUTTONVIEW_H_
#include "eagleeye/common/EagleeyeMacro.h"
#include "eagleeye/framework/pipeline/AnyNode.h"
#include "eagleeye/render/RenderNode.h"
#include "eagleeye/basic/Array.h"
#include "eagleeye/basic/Matrix.h"
#include "eagleeye/framework/pipeline/SignalFactory.h"
#include <GLES3/gl3.h>
namespace eagleeye
{
class ButtongView:public RenderNode{
public:
typedef ButtongView Self;
typedef RenderNode Superclass;
EAGLEEYE_CLASSIDENTITY(ButtongView);
ButtongView();
virtual ~ButtongView();
/**
* @brief execute Node
* @note user must finish this function
*/
virtual void executeNodeInfo();
/**
* @brief init gl
*/
virtual void init();
private:
ButtongView(const ButtongView&);
void operator=(const ButtongView&);
float m_button_h;
float m_button_w;
float m_button_x;
float m_button_y;
};
} // namespace eagleeye
#endif | 21.76087 | 54 | 0.687313 |
2c6edf1b113f91ba7807c45be5222d56d1ae8478 | 8,986 | kt | Kotlin | kotlin-source/src/test/kotlin/net/corda/training/state/EstadoTDBOTests.kt | cgalfaro/corda-training-solutions-spa | 8c4f2c0aa44d130845d71d381a47c24ecbd92b6c | [
"Apache-2.0"
] | null | null | null | kotlin-source/src/test/kotlin/net/corda/training/state/EstadoTDBOTests.kt | cgalfaro/corda-training-solutions-spa | 8c4f2c0aa44d130845d71d381a47c24ecbd92b6c | [
"Apache-2.0"
] | null | null | null | kotlin-source/src/test/kotlin/net/corda/training/state/EstadoTDBOTests.kt | cgalfaro/corda-training-solutions-spa | 8c4f2c0aa44d130845d71d381a47c24ecbd92b6c | [
"Apache-2.0"
] | null | null | null | package net.corda.training.state
import net.corda.core.contracts.*
import net.corda.core.identity.Party
import net.corda.finance.*
import net.corda.training.ALICE
import net.corda.training.BOB
import net.corda.training.MEGACORP
import net.corda.training.MINICORP
import org.junit.Test
import java.util.*
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
/**
* Instrucciones de ejercicio práctico.
* Descomenta el primer unit test [tieneCampoCantidadTDBODelTipoCorrecto] y luego ejecuta el unit test con la flecha verde
* a la izquierda de la clase [EstadoTDBOTests] o el método [tieneCampoCantidadTDBODelTipoCorrecto].
* Ejecutando las pruebas desde [EstadoTDBOTests] ejecuta todos los unit tests definidos en la clase.
* La primera prueba debería de fallar por que necesitas hacer algunos cambios al EstadoTDBO para que pase. Lea el TODO
* bajo cada número de tarea para una descripción y un concejo de que es necesario hacer.
* Una vez hayas la prueba pase, descomenta la siguiente prueba.
* Continúa con todas las pruebas hasta que todas pasen.
* Consejo: CMD / Ctrl + en los nombres color café en corchetes "[]" para su definición en el código base.
*/
class EstadoTDBOTests {
/**
* Tarea 1.
* TODO: Agregue una propiedad 'cantidad' de tipo [Amount] a la clase [EstadoTDBO] para que esta prueba pase.
* Consejo: [Amount] es una clase plantilla que toma una clase como parámetro del token que quieras de [Amount].
* Como estamos lidiando con dinero prestado de un participante a otro hace sentioo que nuestro token sea [Currency].
*/
@Test
fun tieneCampoCantidadTDBODelTipoCorrecto() {
// Does the amount field exist?
EstadoTDBO::class.java.getDeclaredField("cantidad")
// Is the amount field of the correct type?
assertEquals(EstadoTDBO::class.java.getDeclaredField("cantidad").type, Amount::class.java)
}
/**
* Tarea 2.
* TODO: Agregar 'prestamista' del tipo [Party] a la clase [EstadoTDBO] para que esta prueba pase.
*/
@Test
fun tieneCampoPrestamistaDelTipoCorrecto() {
// Does the lender field exist?
EstadoTDBO::class.java.getDeclaredField("prestamista")
// Is the lender field of the correct type?
assertEquals(EstadoTDBO::class.java.getDeclaredField("prestamista").type, Party::class.java)
}
/**
* Tarea 3.
* TODO: Agregar 'deudor' de tipo [Party] a la clase [EstadoTDBO] para que esta prueba pase.
*/
@Test
fun tieneCampoDeudorDelTipoCorrecto() {
// Does the borrower field exist?
EstadoTDBO::class.java.getDeclaredField("deudor")
// Is the borrower field of the correct type?
assertEquals(EstadoTDBO::class.java.getDeclaredField("deudor").type, Party::class.java)
}
/**
* Tarea 4.
* TODO: Agregar una propiedad 'pagado' de tipo [Amount] a la clase [EstadoTDBO] para que esta prueba pase.
* Consejo:
* - Queremos que esta propiedad sea iniciada con monto cero en la creación de [EstadoTDBO].
* - Puedes usar [POUNDS] una extensión sobre [Int] para crear una cantidad de libras esterlina e.j. '10.POUNDS'.
* - Esta propiedad lleva el registro de cuanto del inicial de [EstadoTDBO.amount] ha sido pagado por el deudor.
* - Puedes iniciar una propiedad con un valor por defecto en Kotlin de la siguiente manera:
*
* data class(val numero: Int = 10)
*
* - Necesitamos asegurarnos que la propiedad [EstadoTDBO.paid] sea de la misma moneda que la propiedad
* [EstadoTDBO.amount]. Puedes crear una instancia de la clase [Amount] que toma como valor cero y un token
* representando la moneda - que deberia ser la misma moneda que la propiedad [EstadoTDBO.amount].
*/
@Test
fun tieneCampoPagadoDelTipoCorrecto() {
// Does the paid field exist?
EstadoTDBO::class.java.getDeclaredField("pagado")
// Is the paid field of the correct type?
assertEquals(EstadoTDBO::class.java.getDeclaredField("pagado").type, Amount::class.java)
}
/**
* Tarea 5.
* TODO: Incluya al prestamista en la lista [EstadoTDBO.participants]
* Consejo: [listOf] toma cualquier numero de parametros y los agrega a la lista
*/
@Test
fun prestamistaEsParticipante() {
val estadoTdbo = EstadoTDBO(1.POUNDS, ALICE.party, BOB.party)
assertNotEquals(estadoTdbo.participants.indexOf(ALICE.party), -1)
}
/**
* Tarea 6.
* TODO: Similar a la tarea anterior, incluya al deudor en la lista [EstadoTDBO.participants]
*/
@Test
fun deudorEsParticipante() {
val estadoTdbo = EstadoTDBO(1.POUNDS, ALICE.party, BOB.party)
assertNotEquals(estadoTdbo.participants.indexOf(BOB.party), -1)
}
/**
* Tarea 7.
* TODO: Implementar [LinearState] junto con las propiedades y metodos requeridos.
* Consejo: [LinearState] implementa [ContractState] que define una propiedad y metodo adicional. Puedes usar
* IntellIJ para que agrefue las definiciones o puedes agregarlas tu mismo. Mira la definicion
* de [LinearState] para ver que es requerido añadir.
*/
@Test
fun esLinearState() {
assert(LinearState::class.java.isAssignableFrom(EstadoTDBO::class.java))
}
/**
* Tarea 8.
* TODO: Override la propiedad [LinearState.linearId] y asignarle un valor por medio del constructor.
* Consejo:
* - La propiedad [LinearState.linearId] es de tipo [UniqueIdentifier]. Necesitas crear una nueva instancia de
* la clase [UniqueIdentifier].
* - El [LinearState.linearId] está diseñado para enlazar todos los [LinearState]s (que representan un estado de un
* acuerdo un punto de tiempo especifico) juntos. Todos los [LinearState]s con el mismo [LinearState.linearId]
* representan el ciclo de vida completo de un acuerdo, un valor o un hecho compartido.
* - Provee un valor por defecto para el [linearId] para un nuevo [EstadoTDBO]
*/
@Test
fun tieneCampoLinearIdFieldDeTipoCorrecto() {
// Does the linearId field exist?
EstadoTDBO::class.java.getDeclaredField("linearId")
// Is the linearId field of the correct type?
assertEquals(EstadoTDBO::class.java.getDeclaredField("linearId").type, UniqueIdentifier::class.java)
}
/**
* Tarea 9.
* TODO: Asegurarse que los parámetros han sido ordenados correctamente.
* Consejo: Asegúrate que el deudor y el prestamista no estén en el orden equivocado ya que esto puede causar
* confusión en las tareas mas adelante!
*/
@Test
fun compruebaEstadoTDBOOrdenParametros() {
val fields = EstadoTDBO::class.java.declaredFields
val amountIdx = fields.indexOf(EstadoTDBO::class.java.getDeclaredField("cantidad"))
val lenderIdx = fields.indexOf(EstadoTDBO::class.java.getDeclaredField("prestamista"))
val borrowerIdx = fields.indexOf(EstadoTDBO::class.java.getDeclaredField("deudor"))
val paidIdx = fields.indexOf(EstadoTDBO::class.java.getDeclaredField("pagado"))
val linearIdIdx = fields.indexOf(EstadoTDBO::class.java.getDeclaredField("linearId"))
assert(amountIdx < lenderIdx)
assert(lenderIdx < borrowerIdx)
assert(borrowerIdx < paidIdx)
assert(paidIdx < linearIdIdx)
}
/**
* Tarea 10.
* TODO: agregar un metodo para ayuda llamado [pagar] que pueda ser llamado desde [EstadoTDBO] para liquidar una cantidad del TDBO.
* Consejo:
* - Necesitarás incrementar la propiedad [EstadoTDBO.pagado] por la cantidad que el deudor quiera pagar.
* - Agrega una función llamada [pagar] en [EstadoTDBO]. Esta funcion debe devolver un [EstadoTDBO].
* - El estado existente es inmutable así que un nuevo estado debe ser creado. Kotlin provee un metodo [copy]
* el cual crea un nuevo objeto con los nuevos valores para los campos especificados.
* - [copy] devuelve una copia de la instancia del objeto y los campos pueden ser cambiados escpecificando los nuevos valores
* como parametros de [copy] */
@Test
fun compruebaMetodoAyudaPagar() {
val tdbo = EstadoTDBO(10.DOLLARS, ALICE.party, BOB.party)
assertEquals(5.DOLLARS, tdbo.pagar(5.DOLLARS).pagado)
assertEquals(3.DOLLARS, tdbo.pagar(1.DOLLARS).pagar(2.DOLLARS).pagado)
assertEquals(10.DOLLARS, tdbo.pagar(5.DOLLARS).pagar(3.DOLLARS).pagar(2.DOLLARS).pagado)
}
/**
* Tarea 11.
* TODO: Agregar metodo de ayuda [conNuevoPrestamista] que pueda ser llamado desde [EstadoTDBO] para cambiar el prestamista del TDBO.
*/
@Test
fun compurbeTieneMetodoAyudaNuevoPrestamista() {
val tdbo = EstadoTDBO(10.DOLLARS, ALICE.party, BOB.party)
assertEquals(MINICORP.party, tdbo.conNuevoPrestamista(MINICORP.party).prestamista)
assertEquals(MEGACORP.party, tdbo.conNuevoPrestamista(MEGACORP.party).prestamista)
}
}
| 47.04712 | 137 | 0.701981 |
17b03c0d5b4bc68305d008d1cb9af6adba753657 | 1,837 | swift | Swift | JustPeek/Classes/PeekView.swift | FroeMic/JustPeek | de96e8572661de199fdd1ec248e0a31bf106d4fb | [
"Apache-2.0"
] | null | null | null | JustPeek/Classes/PeekView.swift | FroeMic/JustPeek | de96e8572661de199fdd1ec248e0a31bf106d4fb | [
"Apache-2.0"
] | null | null | null | JustPeek/Classes/PeekView.swift | FroeMic/JustPeek | de96e8572661de199fdd1ec248e0a31bf106d4fb | [
"Apache-2.0"
] | null | null | null | //
// PeekView.swift
// JustPeek
//
// Copyright 2016 Just Eat Holdings Ltd.
//
import UIKit
@objcMembers internal class PeekView: UIView {
init(frame: CGRect, contentView: UIView) {
super.init(frame: frame)
addSubview(contentView)
contentView.frame = bounds
contentView.autoresizingMask = [.flexibleHeight, .flexibleWidth]
isUserInteractionEnabled = false
clipsToBounds = true
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) must not be used")
}
override func layoutSubviews() {
super.layoutSubviews()
layer.cornerRadius = cornerRadiusFor(frame: frame)
}
func animateToFrame(_ frame: CGRect, alongsideAnimation otherAnimation: (() -> Void)? = nil, completion: ((Bool) -> Void)? = nil) {
layoutIfNeeded()
let animations: () -> Void = { [weak self] in
if let strongSelf = self {
otherAnimation?()
strongSelf.frame = frame
strongSelf.layoutIfNeeded()
}
}
let borderRadiusAnimation = CABasicAnimation(keyPath: "cornerRadius")
borderRadiusAnimation.fromValue = layer.cornerRadius
borderRadiusAnimation.toValue = cornerRadiusFor(frame: frame)
borderRadiusAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
layer.add(borderRadiusAnimation, forKey: "cornerRadiusAnimation")
let animationDuration = PeekContext.AnimationConfiguration.animationDuration
UIView.animate(withDuration: animationDuration, animations: animations, completion: completion)
}
private func cornerRadiusFor(frame: CGRect) -> CGFloat {
return min(frame.height, frame.width) * 0.05 // 5% of the smallest side
}
}
| 34.660377 | 135 | 0.655416 |
fd937e72f546c773de0ac51f1da7cf73c6b2c22c | 1,711 | h | C | functionwrapper.h | LingyanYin/lockfree_work_stealing_queue | d59a11416435ecd7d6ba37655e44bc76b83e9440 | [
"MIT"
] | null | null | null | functionwrapper.h | LingyanYin/lockfree_work_stealing_queue | d59a11416435ecd7d6ba37655e44bc76b83e9440 | [
"MIT"
] | null | null | null | functionwrapper.h | LingyanYin/lockfree_work_stealing_queue | d59a11416435ecd7d6ba37655e44bc76b83e9440 | [
"MIT"
] | null | null | null | #include <memory>
#include <tuple>
#include <utility>
/**
* previously used a function<void()> as member
* but it cannot use packaged_task since function is copy-constructed
* however packaged_task is move-only, changed it to type-erasure class
*/
class FunctionWrapper {
private:
class ImplBase {
public:
virtual void invoke() = 0;
virtual ~ImplBase() {}
};
std::unique_ptr<ImplBase> impl;
template <typename FunctionType, typename... Args>
class Impl : public ImplBase {
public:
FunctionType f;
std::tuple<Args...> args;
Impl(FunctionType&& f_, Args&&... args_) : f(std::move(f_)), args(std::make_tuple(std::move(args_)...)) {}
void invoke() override {
// expland a tuple as it was a parameter pack
call(std::make_index_sequence<std::tuple_size<std::tuple<Args...>>::value>{});
}
template<std::size_t... Indices>
void call(const std::index_sequence<Indices...>) {
f(std::get<Indices>(std::forward<std::tuple<Args...>>(args))...);
}
};
public:
template <typename F, typename... Args>
FunctionWrapper(F&& f_, Args&&... args_) : impl(new Impl<F, Args...>(std::move(f_), std::move(args_)...)) {}
void operator()() { impl->invoke(); }
FunctionWrapper() = default;
FunctionWrapper(FunctionWrapper&& other) : impl(std::move(other.impl)) {}
FunctionWrapper& operator=(FunctionWrapper&& other) {
impl = std::move(other.impl);
return *this;
}
FunctionWrapper(const FunctionWrapper&) = delete;
FunctionWrapper(FunctionWrapper&) = delete;
FunctionWrapper& operator=(const FunctionWrapper&) = delete;
};
| 31.685185 | 114 | 0.62069 |
e582cd1c6eecdbb77f0a3302d255a4629cbb39a7 | 5,507 | swift | Swift | MediastreamPlatformSDKiOS/Classes/MediastreamPlayerConfig.swift | mediastream/PodMediastreamPlatformSDKiOS | 07717f124fbb35163ee37a445b6ebc05c19211a4 | [
"MIT"
] | null | null | null | MediastreamPlatformSDKiOS/Classes/MediastreamPlayerConfig.swift | mediastream/PodMediastreamPlatformSDKiOS | 07717f124fbb35163ee37a445b6ebc05c19211a4 | [
"MIT"
] | null | null | null | MediastreamPlatformSDKiOS/Classes/MediastreamPlayerConfig.swift | mediastream/PodMediastreamPlatformSDKiOS | 07717f124fbb35163ee37a445b6ebc05c19211a4 | [
"MIT"
] | null | null | null | //
// MediastreamPlayerConfig.swift
// Pods
//
// Created by Adler Oliveira on 6/8/16.
//
//
open class MediastreamPlayerConfig {
public init () {}
public enum VideoTypes: String {
case LIVE = "live-stream"
case VOD = "video"
}
public enum Environments: String {
case PRODUCTION = "https://mdstrm.com"
case DEV = "https://develop.mdstrm.com"
}
fileprivate var _accessToken: String?
fileprivate var _accountID: String?
fileprivate var _adCustomAttributes: [(String, String)] = []
fileprivate var _adURL: String?
fileprivate var _analyticsCustom: String?
fileprivate var _appCertificateUrl: String?
fileprivate var _autoplay: Bool = false
fileprivate var _customUI: Bool = true
fileprivate var _customerID: String?
fileprivate var _debug: Bool = false
fileprivate var _dvr: Bool = false
fileprivate var _drmHeaders: [(String, String)] = []
fileprivate var _drmUrl: String?
fileprivate var _environment = Environments.PRODUCTION
fileprivate var _id: String?
fileprivate var _src: String?
fileprivate var _maxProfile: String?
fileprivate var _referer: String?
fileprivate var _showControls: Bool = true
fileprivate var _type = VideoTypes.VOD
fileprivate var _volume: Int?
fileprivate var _windowDvr: Int = 0
fileprivate var _defaultOrientation: UIInterfaceOrientation?
fileprivate var _showDismissButton: Bool = false
fileprivate var _showCastButton: Bool = false
open var accessToken: String? {
get { return _accessToken }
set (val) { _accessToken = val }
}
open var accountID: String? {
get { return _accountID }
set (val) { _accountID = val }
}
open func addAdCustomAttribute(_ key: String, value: String) {
_adCustomAttributes.append((key, value))
}
open var adURL: String? {
get { return _adURL }
set (val) { _adURL = val }
}
open func addDrmHeader(_ key: String, value: String) {
_drmHeaders.append((key, value))
}
open var analyticsCustom: String? {
get { return _analyticsCustom }
set (val) { _analyticsCustom = val }
}
open var appCertificateUrl: String? {
get { return _appCertificateUrl }
set (val) { _appCertificateUrl = val }
}
open var autoplay: Bool {
get { return _autoplay }
set (val) { _autoplay = val}
}
open var customerID: String? {
get { return _customerID }
set (val) { _customerID = val }
}
open var debug: Bool {
get { return _debug }
set (val) { _debug = val }
}
open var defaultOrientation: UIInterfaceOrientation? {
get { return _defaultOrientation }
set (val) { _defaultOrientation = val }
}
open var dvr: Bool {
get { return _dvr }
set (val) { _dvr = val }
}
open var customUI: Bool {
get { return _customUI }
set (val) { _customUI = val }
}
open var drmHeaders: [(String, String)] {
return _drmHeaders
}
open var drmUrl: String? {
get { return _drmUrl }
set (val) { _drmUrl = val }
}
open var environment: Environments {
get { return _environment }
set (val) { _environment = val }
}
open var id: String? {
get { return _id }
set (val) { _id = val }
}
open var maxProfile: String? {
get { return _maxProfile }
set (val) { _maxProfile = val }
}
open var showControls: Bool {
get { return _showControls }
set (val) { _showControls = val}
}
open var showDismissButton: Bool {
get { return _showDismissButton }
set (val) { _showDismissButton = val }
}
open var showCastButton: Bool {
get { return _showCastButton }
set (val) { _showCastButton = val }
}
open var src: String? {
get { return _src }
set (val) { _src = val }
}
open var referer: String? {
get { return _referer }
set (val) { _referer = val }
}
open var type: VideoTypes {
get { return _type }
set (val) { _type = val }
}
open var volume: Int {
get { return _volume == nil ? -1 : _volume! }
set (val) { _volume = val }
}
open var windowDvr: Int {
get { return _windowDvr }
set (val) { _windowDvr = val }
}
//Methods:
open func hasAds() -> Bool {
return _adURL != nil
}
open func getAdQueryString() -> String {
return "?mobile=true" + _adCustomAttributes.map(queryString).joined(separator: "")
}
open func getMediaQueryString() -> String {
var mediaInfo = "?sdk=true&dnt=true"
if _customerID != nil {
mediaInfo += "&c=" + customerID!
}
if _accessToken != nil {
mediaInfo += "&access_token=" + accessToken!
}
if _maxProfile != nil {
mediaInfo += "&max_profile=" + maxProfile!
}
if _type == VideoTypes.LIVE && _dvr && _windowDvr > 0 {
mediaInfo += "&dvrOffset=" + String(_windowDvr)
}
return mediaInfo
}
fileprivate func queryString(_ attribute: (String, String)) -> String {
return "&\(attribute.0)=\(attribute.1)"
}
}
| 26.863415 | 90 | 0.573634 |
7de4f59528f8800328d3bf8aac3739ce93d78498 | 476 | swift | Swift | 1stop/Models/RoutePoint.swift | lozy219/1stop | 8f7cab977f63737c878c095a8d0babf642a30b77 | [
"MIT"
] | null | null | null | 1stop/Models/RoutePoint.swift | lozy219/1stop | 8f7cab977f63737c878c095a8d0babf642a30b77 | [
"MIT"
] | 1 | 2016-03-18T04:06:13.000Z | 2016-03-18T08:43:53.000Z | 1stop/Models/RoutePoint.swift | lozy219/1stop | 8f7cab977f63737c878c095a8d0babf642a30b77 | [
"MIT"
] | null | null | null | //
// RoutePoint.swift
// 1stop
//
// Created by Long Pan on 12/12/15.
// Copyright © 2015 golearn. All rights reserved.
//
import Foundation
import MapKit
class RoutePoint: NSObject, MKAnnotation {
let coordinate: CLLocationCoordinate2D
let title: String?
let identifier: String
init(c: CLLocationCoordinate2D, title: String, identifier: String) {
self.coordinate = c
self.title = title
self.identifier = identifier
}
}
| 20.695652 | 72 | 0.670168 |
34cd003eb0e5d527b39271c49e7877cf1bad5962 | 22,810 | kt | Kotlin | src/main/kotlin/saarland/cispa/frontmatter/CallchainWalker.kt | uds-se/Frontmatter | 2ce4b52fc84e4c837749a205c9b32d48b9423c4c | [
"MIT"
] | 1 | 2022-02-28T16:00:22.000Z | 2022-02-28T16:00:22.000Z | src/main/kotlin/saarland/cispa/frontmatter/CallchainWalker.kt | uds-se/Frontmatter | 2ce4b52fc84e4c837749a205c9b32d48b9423c4c | [
"MIT"
] | 1 | 2022-02-02T00:24:45.000Z | 2022-02-02T00:24:45.000Z | src/main/kotlin/saarland/cispa/frontmatter/CallchainWalker.kt | uds-se/Frontmatter | 2ce4b52fc84e4c837749a205c9b32d48b9423c4c | [
"MIT"
] | null | null | null | package saarland.cispa.frontmatter
import mu.KLogging
import saarland.cispa.frontmatter.Utils.implements
import saarland.cispa.frontmatter.Utils.isAndroidMethod
import saarland.cispa.frontmatter.Utils.isDummy
import saarland.cispa.frontmatter.data.Dialog
import saarland.cispa.frontmatter.data.Menu
import saarland.cispa.frontmatter.data.StmtSite
import saarland.cispa.frontmatter.data.UIElement
import saarland.cispa.frontmatter.data.UIViewElement
import saarland.cispa.frontmatter.resolvers.ValueResolver
import saarland.cispa.frontmatter.resolvers.ViewId
import soot.Body
import soot.Kind
import soot.Local
import soot.RefType
import soot.Scene
import soot.SootClass
import soot.SootMethod
import soot.Unit
import soot.Value
import soot.jimple.AssignStmt
import soot.jimple.BinopExpr
import soot.jimple.ConditionExpr
import soot.jimple.EqExpr
import soot.jimple.IfStmt
import soot.jimple.IntConstant
import soot.jimple.InvokeStmt
import soot.jimple.LookupSwitchStmt
import soot.jimple.NeExpr
import soot.jimple.NewExpr
import soot.jimple.Stmt
import soot.jimple.toolkits.callgraph.Edge
import soot.toolkits.graph.Block
import soot.toolkits.graph.ExceptionalBlockGraph
import soot.toolkits.graph.ExceptionalUnitGraph
import soot.toolkits.graph.UnitGraph
import soot.toolkits.scalar.SimpleLocalDefs
import soot.toolkits.scalar.SimpleLocalDefsNoSSA
import soot.util.HashMultiMap
import soot.util.MultiMap
data class BlockEdge(val src: Block, val tgt: Block)
data class UIElementWithContext(val view: UIElement, val context: ActivityOrFragmentClass)
class CallchainWalker(val sceneV: Scene, val appModel: AppModel, val valueResolver: ValueResolver) {
companion object : KLogging()
val icfg = valueResolver.icfg
val callgraph = icfg.callGraph
private val viewClass = sceneV.getSootClass("android.view.View")
private val menuClass = sceneV.getSootClass("android.view.MenuItem")
private val uiCallbackMethods: MultiMap<String, SootMethod>
private val listenersToUI: MultiMap<SootMethod, UIElementWithContext> = HashMultiMap()
init {
for ((activity, layout) in appModel.activityLayouts) {
collectLayoutListeners(layout.uiViewElement, activity)
}
for ((activity, layout) in appModel.orphanedFragmentLayouts) {
collectLayoutListeners(layout, activity)
}
for ((activity, menu) in appModel.activityMenus) {
collectMenuListeners(menu, activity)
}
for ((activity, dialog) in appModel.activityDialogs) {
collectDialogListeners(dialog, activity)
}
uiCallbackMethods = listenersToUI.keySet().map { it.subSignature to it }.toMultiMap()
}
private fun collectLayoutListeners(layout: UIViewElement, activity: ActivityClass) {
val uiElements = layout.getAllChildrenFlatten()
for (uiElement in uiElements) {
uiElement.listeners.forEach { listenersToUI.put(it, UIElementWithContext(uiElement, activity)) }
}
}
private fun collectMenuListeners(menu: Menu, activity: ActivityClass) {
val menuItems = menu.getAllItems()
for (menuItem in menuItems) {
if (menu.listener != null)
listenersToUI.put(menu.listener, UIElementWithContext(menuItem, activity))
}
}
private fun collectDialogListeners(dialog: Dialog, activity: ActivityClass) {
val buttons = dialog.buttons
for (button in buttons) {
button.listener.forEach { listenersToUI.put(it, UIElementWithContext(button, activity)) }
}
}
/**
* resolve UI view which triggers stmtSite call
* */
fun getUITriggerOfCall(stmtSite: StmtSite): Set<UIElementWithContext> {
val callbacks = traceToCallback(stmtSite) // get a callback
return callbacks.flatMap { resolveViewForCallback(it) }.toSet()
}
/**
* identify the view to which this callback belongs
* */
private fun resolveViewForCallback(callbackSite: StmtSite): List<UIElementWithContext> {
// 2) check if there is condition or lookup table with viewId
val (targetViewId, excludedIds) = findViewIdsInConditions(callbackSite)
// 3) bind callback with UI
val callbackMethod = callbackSite.method //TODO: interfaces and inheritance
val uiElements = listenersToUI[callbackMethod]
if (uiElements.isEmpty()) logger.warn("Missing ui element for $callbackMethod")
return if (targetViewId == 0)
uiElements.filterNot { it.view.id in excludedIds }
else
uiElements.filter { it.view.id == targetViewId }
}
private fun findViewIdsInConditions(callbackSite: StmtSite): Pair<Int, Set<Int>> {
val unitGraph = icfg.getOrCreateUnitGraph(callbackSite.method) as ExceptionalUnitGraph
val defs = SimpleLocalDefsNoSSA(unitGraph)
val blockGraph = ExceptionalBlockGraph(unitGraph)
val block = getTargetBlock(blockGraph, callbackSite.stmt)
return goAroundBlockGraph(block, defs)
}
/**
* identify the callback method from which the stmtSite call occured
* traverse the callgraph from stmtSite call till the callback method
* */
private fun traceToCallback(stmtSite: StmtSite): Set<StmtSite> {
val method = stmtSite.method
if (isCallback(method)) {
return setOf(stmtSite)
}
val workList = mutableListOf<SootMethod>()
val visitedNodes = mutableSetOf(method)
val callbackNodes = mutableSetOf<StmtSite>()
workList.add(method)
visitedNodes.add(method)
while (workList.isNotEmpty()) {
val node = workList.removeAt(0)
visitedNodes.add(node)
val edges = callgraph.edgesInto(node)
.asSequence()
.filterNot { it.src().isAndroidMethod() }
.filterNot { it.src().isDummy() }
.filterNot { it.src() in visitedNodes }
.filterNot { it.src() in workList }
.toSet()
edges.forEach {
if (isCallback(it.src())) {
callbackNodes.add(StmtSite(it.srcStmt(), it.src()))
} else {
workList.add(it.src())
}
}
}
return callbackNodes
}
private fun isCallback(method: SootMethod): Boolean {
return method.subSignature in uiCallbackMethods
}
/**
* return blocks that contain the callee
* */
private fun getTargetBlocks(blockGraph: ExceptionalBlockGraph, callee: SootMethod): List<Block> {
return blockGraph.blocks.filter { isInBlock(it, callee) }
}
/**
* return block that contain the stmt
* */
private fun getTargetBlock(blockGraph: ExceptionalBlockGraph, stmt: Stmt): Block {
return blockGraph.blocks.first { isInBlock(it, stmt) }
}
/**
* check if the statement is in the body of a block
* */
private fun isInBlock(block: Block, stmt: Unit): Boolean {
return block.iterator().asSequence()
.any { it == stmt }
}
/**
* check if the callee is in the body of a block
* */
private fun isInBlock(block: Block, callee: SootMethod): Boolean {
return block.iterator().asSequence()
.filterIsInstance<Stmt>()
.filter { it.containsInvokeExpr() }
.any { it.invokeExpr.method == callee }
}
/**
* FIXME: check the purpose
* callback can be assignet to multiple views
* expect view resolution by view id
* check if viewId is encountered in if conditions
* XXX: refactor, it can overapproximate
* */
private fun isMultiCallback(callback: SootMethod): Boolean {
val body = callback.activeBody
val viewIdStmts = getViewIdStmt(body)
val viewIdVars = viewIdStmts.map { it.leftOp }
// if (viewIdIsArg(body)) return false // TODO: propagate one level down
return body.units.asSequence()
.filterIsInstance<IfStmt>() // TODO: add lookup switch
.map { it.condition }
.filterIsInstance<BinopExpr>()
.filter { it is EqExpr || it is NeExpr }
.flatMap { sequenceOf(it.op1, it.op2) }
.any { it in viewIdVars }
}
//FIXME: check
fun traceToViewId(callback: SootMethod, method: SootMethod): Set<Int> {
if (!isMultiCallback(callback))
return setOf(0)
val unitGraph = icfg.getOrCreateUnitGraph(callback) as ExceptionalUnitGraph
val defs = SimpleLocalDefsNoSSA(unitGraph)
val blockGraph = ExceptionalBlockGraph(unitGraph)
val blocks = getTargetBlocks(blockGraph, method)
return blocks.map { goAroundBlockGraph(it, defs).first }.toSet()
}
/**
* identify viewId from findviewById by tracing back from set###Listener
* */
private fun findViewId(edgeToAssignListenerSite: Edge, callbackClass: SootClass): List<ViewId> {
val clickStmt = edgeToAssignListenerSite.srcStmt()
val clickMethod = edgeToAssignListenerSite.src()
if (edgeToAssignListenerSite.kind().isInterface()) { //XXX: specialInvoke may be required as well
// resolve by type if possible
val callingContextSites = valueResolver.resolveInvokerBase(StmtSite(clickStmt, clickMethod), null)
val callingContext = callingContextSites
.filter { (((it.stmt as? AssignStmt)?.rightOp as? NewExpr)?.type as? RefType)?.sootClass == callbackClass }
.toSet()
logger.info("${callingContext.size}")
//TODO: complete
}
val invokeExpr = clickStmt.invokeExpr
val view = invokeExpr.args
.filter { it.type is RefType }
.firstOrNull() { sceneV.implements((it.type as RefType).sootClass, viewClass) } ?: return emptyList()
val viewAllocation = valueResolver.resolveVar(view, StmtSite(clickStmt, clickMethod), null)
val viewNewExpr = viewAllocation.filter { it.stmt is AssignStmt }
.firstOrNull { (it.stmt as AssignStmt).rightOp is NewExpr } //XXX: we assume there is only one newExpression (there may be no new Expr)
if (viewNewExpr == null) {
logger.warn("BindCallback: Missing newExpr for ${viewAllocation.joinToString("; ")}")
return emptyList()
}
// val findViewStmt = icfg.getPredsOf(viewNewExpr.stmt).first() // XXX: is it safe to use body instead of control flow graph
val findViewStmt = viewNewExpr.method.activeBody.units.getPredOf(viewNewExpr.stmt) as Stmt // findViewById should be right before newExpr
if (!(findViewStmt.containsInvokeExpr() && findViewStmt.invokeExpr.method.name == FIND_VIEW_METHOD_NAME)) {
logger.warn("BindCallback: Could not find findViewById call for $viewNewExpr, found: ${findViewStmt}")
return emptyList()
}
TODO("remove")
}
//XXX: No we consider only cases when a View.getId is called directly
// we fail if viewId is a method parameter
/**
* walk back the block graph from targetBlock to the entry point of the method, collect conditions which contain viewIds
* @return a pair of <viewId, set of ids which should be excluded>
* */
private fun goAroundBlockGraph(targetBlock: Block, localDefs: SimpleLocalDefsNoSSA): Pair<Int, Set<Int>> {
val workList = mutableListOf<BlockEdge>()
val visitedList = mutableListOf(targetBlock)
val excludedIds = mutableSetOf<Int>()
workList.addAll(targetBlock.preds.map { BlockEdge(it, targetBlock) })
while (workList.isNotEmpty()) {
val currentBlockEdge = workList.removeAt(0)
val currentBlock = currentBlockEdge.src
visitedList.add(currentBlock)
when (val tail = currentBlock.tail) { //look at the last stmt of a block
is IfStmt -> {//check if condition contains viewId reference
val condition = tail.condition
if (condition is ConditionExpr) {
val leftSideIsViewId = isViewId(condition.op1, tail, localDefs)
val rightSideIsViewId = isViewId(condition.op2, tail, localDefs)
if (leftSideIsViewId || rightSideIsViewId) {
val (_, viewId) = getViewIdFromCondition(tail.condition)
if (isEqBranchBlock(tail, currentBlockEdge.tgt) && viewId != null) {
return Pair(viewId, excludedIds) //XXX: we assume this is a hit and don't propagate further
}
viewId?.let { excludedIds.add(it) } // update list of ViewIds that don't trigger that block
}
}
// else propagate further
workList.addAll(currentBlock.preds.filter { it !in visitedList }.map { BlockEdge(it, currentBlock) })
}
is LookupSwitchStmt -> {
if (isViewId(tail.key, tail, localDefs)) {
val viewId = tail.targets.withIndex()
.filter { (_, target) -> target == currentBlockEdge.tgt.head }
.map { (index, _) -> tail.getLookupValue(index) }
.firstOrNull()
val lookupValues = tail.lookupValues.map { it.value }
excludedIds.addAll(lookupValues)
excludedIds.remove(viewId)
if (viewId != null)
return Pair(viewId, excludedIds)
// else we hit default branch of lookupStmt
}
workList.addAll(currentBlock.preds.filter { it !in visitedList }.map { BlockEdge(it, currentBlock) })
}
else -> // take all blocks, propagate up
workList.addAll(currentBlock.preds.filter { it !in visitedList }.map { BlockEdge(it, currentBlock) })
}
}
return Pair(0, excludedIds)
}
private fun isDecidingCondition(condition: Value, viewIdVars: List<Value>): Boolean {
return (condition is EqExpr || condition is NeExpr) && (condition is BinopExpr) && (condition.op1 in viewIdVars || condition.op2 in viewIdVars)
}
/**
* check if the value is initialized with View.getId method
* */
private fun isViewId(value: Value, unit: Unit, localDefs: SimpleLocalDefs): Boolean {
if (value !is Local)
return false
val defsOfCondition = localDefs.getDefsOfAt(value, unit)
return defsOfCondition.filterIsInstance<AssignStmt>()
.filter { it.containsInvokeExpr() }
.any { it.invokeExpr.method.signature in getIdSignatures }
}
/**
* we assume that there is just one getId call inside onClick(View)
* which is reasonable but may not hold TODO: support for multiple getId()
* */
private fun getViewIdStmt(body: Body): List<AssignStmt> {
return body.units.asSequence()
.filterIsInstance<AssignStmt>()
.filter { it.containsInvokeExpr() }
.filter { it.invokeExpr.method.signature in getIdSignatures }
.toList()
}
@Deprecated("unused")
fun resolveCallbackUnitsById(callback: SootMethod, viewId: Int): List<Unit> {
val body = callback.activeBody
var viewVar = getViewParam(body)
if (viewVar == null) {
logger.warn("No appropriate param found in $callback")
return emptyList()
}
val viewIdVal = IntConstant.v(viewId)
val unitGraph = icfg.getOrCreateUnitGraph(callback) as UnitGraph
val entryUnits = mutableListOf<Unit>()
val visitedUnits = mutableSetOf<Unit>()
val walkList = mutableListOf<Unit>(unitGraph.heads.single())
while (walkList.isNotEmpty()) {
val unit = walkList.removeAt(0)
if (unit in visitedUnits) continue
visitedUnits.add(unit)
if (unit is AssignStmt && unit.containsInvokeExpr())
if (unit.invokeExpr.method.signature in getIdSignatures) {
viewVar = unit.leftOp as Local
} else {
entryUnits.add(unit)
}
if (unit is InvokeStmt) entryUnits.add(unit)
val succs = unitGraph.getSuccsOf(unit)
if (unit is IfStmt) {
val condition = unit.condition
val ifTarget = unit.target
if (condition is EqExpr && (condition.op1 == viewVar || condition.op2 == viewVar)) {
if (condition.op1 == viewIdVal || condition.op2 == viewIdVal) {
walkList.add(ifTarget)
continue
} else {
if (condition.op1 is IntConstant || condition.op2 is IntConstant) { //exclude only branches which for sure are for other views, otherwise overapproximate
succs.filterNotTo(walkList) { it == ifTarget } //add to walklist
continue
}
}
}
}
walkList.addAll(succs)
}
return entryUnits
}
fun getReachableAndroidMethods(root: Unit): Set<SootMethod> {
val rootMethod = callgraph.edgesOutOf(root).asSequence().single().tgt()
val visitedMethods = mutableSetOf<SootMethod>()
val reachableAndroidMethods = mutableSetOf<SootMethod>()
val walkList = mutableListOf<SootMethod>(rootMethod)
while (walkList.isNotEmpty()) {
val method = walkList.removeAt(0)
visitedMethods.add(method)
val callees = callgraph.edgesOutOf(method).asSequence()
.map { it.tgt() }
.filterNot { it in visitedMethods }
callees.filterNotTo(walkList) { it.isAndroidMethod() }
callees.filterTo(reachableAndroidMethods) { it.isAndroidMethod() }
}
return reachableAndroidMethods
}
/**
* Entry method can be:
* - a callback
* - a call method of Runnable (or similar async class, like doInBackground) (unless we patched them)
* */
@Deprecated("unused")
fun getEntryMethods(stmtSite: StmtSite): List<SootMethod> {
val method = stmtSite.method
if (isEntry(method)) {
return listOf(method)
}
val entryMethods = mutableListOf<SootMethod>()
val visitedMethods = mutableSetOf<SootMethod>() //prevent recursion
val walkList = mutableListOf<SootMethod>(method)
while (walkList.isNotEmpty()) {
val tgt = walkList.removeAt(0)
visitedMethods.add(tgt)
val callers = callgraph.edgesInto(tgt).asSequence()
.map { it.src() }
.filterNot { it.isDummy() }
.filterNot { it.isAndroidMethod() }
.filterNot { it in visitedMethods }
.toList()
callers.filterTo(entryMethods) { isEntry(it) }
walkList.addAll(callers)
}
return entryMethods
}
/**
* Entry method can be:
* - a callback
* - a call method of Runnable (or similar async class, like doInBackground) (unless we patched them)
* */
fun getCallersAlongCallchain(stmtSite: StmtSite, isTarget: (SootClass) -> Boolean): List<SootClass> {
val method = stmtSite.method
if (isTarget(method.declaringClass) && !method.isStatic) {
return listOf(method.declaringClass)
}
val entryMethods = mutableListOf<SootMethod>()
val visitedMethods = mutableSetOf<SootMethod>() //prevent recursion
val walkList = mutableListOf<SootMethod>(method)
while (walkList.isNotEmpty()) {
val tgt = walkList.removeAt(0)
visitedMethods.add(tgt)
val callers = callgraph.edgesInto(tgt).asSequence()
.map { it.src() }
.filterNot { it.isDummy() }
.filterNot { it.isAndroidMethod() }
.filterNot { it in visitedMethods }
.toList()
val targetCallers = callers.filter { isTarget(it.declaringClass) }.map { it.declaringClass }
if (targetCallers.isNotEmpty()) return targetCallers //FIXME
callers.filterTo(entryMethods) { isEntry(it) }
callers.filterNotTo(walkList) { it.isDummy() }
}
return emptyList()
}
private fun isEntry(m: SootMethod): Boolean {
return callgraph.edgesInto(m).asSequence()
.map { it.src() }
.filterNot { it.isDummy() }
.none()
}
/**
* get local associated with View param of the method
* */
private fun getViewParam(body: Body): Local? {
return body.parameterLocals
.firstOrNull {
val type = it.type as? RefType
if (type != null)
sceneV.implements(type.sootClass, viewClass) || sceneV.implements(type.sootClass, menuClass) else false
}
}
private fun isEqBranchBlock(ifStmt: IfStmt, nextBlock: Block): Boolean {
val condition = ifStmt.condition
if (condition !is EqExpr && condition !is NeExpr) return false
val target = ifStmt.target
return target == nextBlock.head
}
private fun getBlockBranches(block: Block): Pair<Block, Block> {
val tail = block.tail
require(tail is IfStmt)
val condition = tail.condition
require(condition is EqExpr || condition is NeExpr)
val nextBlocks = block.succs
val target = tail.target
return when (condition) {
is EqExpr -> Pair(nextBlocks.first { it.head == target }, nextBlocks.first { it.head != target })
is NeExpr -> Pair(nextBlocks.first { it.head != target }, nextBlocks.first { it.head == target })
else -> error("Unreachable state")
}
}
/**
* parse condition and return <viewIdVariable, int value> pair
* currently supporting constant integers only
* */
private fun getViewIdFromCondition(condition: Value): Pair<Value?, Int?> {
require(condition is ConditionExpr)
val op1 = condition.op1
val op2 = condition.op2
if (op1 is IntConstant) //FIXME: add staticFieldRef
return Pair(op2, op1.value)
if (op2 is IntConstant)
return Pair(op1, op2.value)
return Pair(null, null)
}
}
private fun Kind.isInterface(): Boolean = this == Kind.INTERFACE
| 42.956685 | 177 | 0.622929 |
90d55c04409fd8bb54bab60449f3eeb23ddc540d | 3,719 | py | Python | src/Models/load.py | eladwass/Dynamic-Deep | 14c0af2012ebaebb7f12d6d4db859c79f4b57b4d | [
"MIT"
] | 1 | 2022-01-09T17:47:41.000Z | 2022-01-09T17:47:41.000Z | src/Models/load.py | eladwass/Dynamic-Deep | 14c0af2012ebaebb7f12d6d4db859c79f4b57b4d | [
"MIT"
] | null | null | null | src/Models/load.py | eladwass/Dynamic-Deep | 14c0af2012ebaebb7f12d6d4db859c79f4b57b4d | [
"MIT"
] | null | null | null | from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
# import tensorflow.keras
from tensorflow.keras.utils import to_categorical
import numpy as np
import os
import random
import scipy.io as sio
import tqdm
STEP = 256
def data_generator(batch_size, preproc, x, y):
num_examples = len(x)
examples = zip(x, y)
examples = sorted(examples, key = lambda x: x[0].shape[0])
end = num_examples - batch_size + 1
batches = [examples[i:i+batch_size]
for i in range(0, end, batch_size)]
random.shuffle(batches)
while True:
for batch in batches:
x, y = zip(*batch)
yield preproc.process(x, y)
class Preproc:
def __init__(self, ecg, labels,app=True,skip=False,CINC=False):
self.mean, self.std = compute_mean_std(ecg)
def generage_classes(labels):
classes = set()
for label in labels:
if isinstance(label,list):
for l in label:
classes.add(l)
else:
classes.add(label)
return sorted(classes)
self.classes = generage_classes(labels) #sorted(set(l for label in labels for l in label))
self.int_to_class = dict(zip(range(len(self.classes)), self.classes))
self.class_to_int = {c : i for i, c in self.int_to_class.items()}
self.app = app
self.skip = skip
self.CINC=CINC
def process(self, x, y):
if self.skip is True and self.app is True:
return self.process_x(x), [self.process_x(x), self.process_x(x), self.process_y(y), self.process_y(y)] # TODO change to 2 outputs
elif self.app:
return self.process_x(x),[self.process_x(x), self.process_y(y)] # TODO change to 2 outputs
else:
return self.process_x(x), self.process_x(x) # TODO change to 2 outputs
def process_x(self, x):
x = pad(x)
x = (x - self.mean) / self.std
x = x[:, :, None]
return x
def process_y(self, y):
# TODO, awni, fix hack pad with noise for cinc
if self.CINC:
y = pad([[self.class_to_int[c] for c in s] for s in y], val=3, dtype=np.int32)
y = to_categorical(
y, num_classes=len(self.classes))
return y
def pad(x, val=0, dtype=np.float32):
max_len = max(len(i) for i in x)
padded = np.full((len(x), max_len), val, dtype=dtype)
for e, i in enumerate(x):
padded[e, :len(i)] = i
return padded
def compute_mean_std(x):
x = np.hstack(x)
return (np.mean(x).astype(np.float32),
np.std(x).astype(np.float32))
def load_dataset(data_json):
with open(data_json, 'r') as fid:
data = [json.loads(l) for l in fid]
labels = []; ecgs = []
for d in tqdm.tqdm(data):
loaded_ecg = load_ecg(d['ecg'])
if (loaded_ecg.shape[0]==8960):
labels.append(d['labels'])
ecgs.append(loaded_ecg)
return ecgs, labels
def load_ecg(record):
if os.path.splitext(record)[1] == ".npy":
ecg = np.load(record)
elif os.path.splitext(record)[1] == ".mat":
ecg = sio.loadmat(record)['val'].squeeze()
else: # Assumes binary 16 bit integers
with open(record, 'r') as fid:
ecg = np.fromfile(fid, dtype=np.int16)
trunc_samp = STEP * int(len(ecg) / STEP)
return ecg[:trunc_samp]
if __name__ == "__main__":
data_json = "examples/cinc17/train.json"
train = load_dataset(data_json)
preproc = Preproc(*train)
gen = data_generator(32, preproc, *train)
for x, y in gen:
print(x.shape, y.shape)
break
| 32.060345 | 142 | 0.597204 |
c1b34ccbecd574cf024c5e687efd4cda3977d2ce | 2,307 | sql | SQL | share-memo-common/src/main/resources/sql/schema.sql | ya850805/share-memo | 0d36fdfab5b66a70babc79fb445ccc006dd9ebdf | [
"Apache-2.0"
] | null | null | null | share-memo-common/src/main/resources/sql/schema.sql | ya850805/share-memo | 0d36fdfab5b66a70babc79fb445ccc006dd9ebdf | [
"Apache-2.0"
] | 1 | 2022-01-26T13:54:46.000Z | 2022-02-11T11:02:25.000Z | share-memo-common/src/main/resources/sql/schema.sql | ya850805/share-memo | 0d36fdfab5b66a70babc79fb445ccc006dd9ebdf | [
"Apache-2.0"
] | null | null | null | USE `share-memo`;
DROP TABLE IF EXISTS member_notification;
DROP TABLE IF EXISTS quartz_member_notification;
DROP TABLE IF EXISTS notification;
DROP TABLE IF EXISTS quartz_notification;
DROP TABLE IF EXISTS member;
CREATE TABLE member
(
id int(6) AUTO_INCREMENT PRIMARY KEY,
name varchar(30) NOT NULL,
line_id varchar(50),
email varchar(50),
create_timestamp varchar(30),
create_user varchar(20),
update_timestamp varchar(30),
update_user varchar(20)
);
CREATE TABLE notification
(
id int(6) AUTO_INCREMENT PRIMARY KEY,
subject varchar(100) NOT NULL,
content varchar(4000) NOT NULL,
notification_date varchar(10) NOT NULL,
create_timestamp varchar(30),
create_user varchar(20),
update_timestamp varchar(30),
update_user varchar(20)
);
CREATE TABLE member_notification
(
member_id int(6) NOT NULL,
notification_id int(6) NOT NULL,
isSend varchar(1) NOT NULL,
create_timestamp varchar(30),
create_user varchar(20),
update_timestamp varchar(30),
update_user varchar(20),
PRIMARY KEY (member_id, notification_id),
FOREIGN KEY (member_id) REFERENCES member (id),
FOREIGN KEY (notification_id) REFERENCES notification (id)
);
CREATE TABLE quartz_notification
(
id int(6) AUTO_INCREMENT PRIMARY KEY,
job_name varchar(50) NOT NULL,
job_group varchar(50) NOT NULL,
subject varchar(100) NOT NULL,
content varchar(4000) NOT NULL,
cron varchar(50) NOT NULL,
create_timestamp varchar(30),
create_user varchar(20),
update_timestamp varchar(30),
update_user varchar(20)
);
CREATE TABLE quartz_member_notification
(
member_id int(6) NOT NULL,
quartz_notification_id int(6) NOT NULL,
isSend varchar(1) NOT NULL,
create_timestamp varchar(30),
create_user varchar(20),
update_timestamp varchar(30),
update_user varchar(20),
PRIMARY KEY (member_id, quartz_notification_id),
FOREIGN KEY (member_id) REFERENCES member (id),
FOREIGN KEY (quartz_notification_id) REFERENCES quartz_notification (id)
); | 31.60274 | 76 | 0.653663 |
605b05284d7bca0513ee57af56f6162b82158b45 | 345 | swift | Swift | FitnessApp/FitnessApp/Routing/Coordinators/Actions/StartingRoutine.swift | ChristianSlanzi/FitnessApp | 1fd8c1cc516552c422d6ca0432867869280b38fd | [
"MIT"
] | null | null | null | FitnessApp/FitnessApp/Routing/Coordinators/Actions/StartingRoutine.swift | ChristianSlanzi/FitnessApp | 1fd8c1cc516552c422d6ca0432867869280b38fd | [
"MIT"
] | null | null | null | FitnessApp/FitnessApp/Routing/Coordinators/Actions/StartingRoutine.swift | ChristianSlanzi/FitnessApp | 1fd8c1cc516552c422d6ca0432867869280b38fd | [
"MIT"
] | null | null | null | //
// StartingRoutine.swift
// FitnessApp
//
// Created by Christian Slanzi on 31.10.20.
//
import Foundation
protocol StartingRoutine: AnyObject {
func startRoutineCountdown(with routine: RoutineDTO)//TODO: (with routine: Routine)
func startRoutinePlay(with routine: RoutineDTO)
func stopRoutine()
func completeRoutine()
}
| 21.5625 | 87 | 0.733333 |
84d93b3466323d8157e38811ebca2919487fd84e | 4,973 | c | C | src/runtime/c/pgf/parseval.c | danshaub/GF | b2739fe14364e18880c12cfca35c24e45c06a2b3 | [
"BSD-3-Clause"
] | null | null | null | src/runtime/c/pgf/parseval.c | danshaub/GF | b2739fe14364e18880c12cfca35c24e45c06a2b3 | [
"BSD-3-Clause"
] | null | null | null | src/runtime/c/pgf/parseval.c | danshaub/GF | b2739fe14364e18880c12cfca35c24e45c06a2b3 | [
"BSD-3-Clause"
] | null | null | null | #include <pgf/pgf.h>
#include <pgf/linearizer.h>
#include <pgf/parser.h>
typedef struct {
int start, end;
PgfCId cat;
int lin_idx;
} PgfPhrase;
typedef struct {
PgfLinFuncs* funcs;
PgfParseState* ps;
int pos;
GuBuf* marks;
GuBuf* phrases;
int found, matches;
GuPool* pool;
} PgfMetricsLznState;
static void
pgf_metrics_lzn_symbol_tokens(PgfLinFuncs** funcs, PgfTokens* toks)
{
PgfMetricsLznState* state = gu_container(funcs, PgfMetricsLznState, funcs);
size_t len = gu_seq_length(toks);
for (size_t i = 0; i < len; i++) {
PgfToken tok = gu_seq_get(toks, PgfToken, i);
if (state->ps != NULL)
state->ps = pgf_parser_next_state(state->ps, tok);
state->pos++;
}
}
static void
pgf_metrics_lzn_expr_literal(PgfLinFuncs** funcs, PgfLiteral lit)
{
PgfMetricsLznState* state = gu_container(funcs, PgfMetricsLznState, funcs);
GuVariantInfo i = gu_variant_open(lit);
switch (i.tag) {
case PGF_LITERAL_STR: {
PgfLiteralStr* lstr = i.data;
if (state->ps != NULL) {
state->ps = pgf_parser_next_state(state->ps, lstr->val);
}
state->pos++;
break;
}
case PGF_LITERAL_INT: {
PgfLiteralInt* lint = i.data;
if (state->ps != NULL) {
GuString tok =
gu_format_string(state->pool, "%d", lint->val);
state->ps = pgf_parser_next_state(state->ps, tok);
}
state->pos++;
break;
}
case PGF_LITERAL_FLT: {
PgfLiteralFlt* lflt = i.data;
if (state->ps != NULL) {
GuString tok =
gu_format_string(state->pool, "%f", lflt->val);
state->ps = pgf_parser_next_state(state->ps, tok);
}
state->pos++;
break;
}
default:
gu_impossible();
}
}
static void
pgf_metrics_lzn_begin_phrase(PgfLinFuncs** funcs, PgfCId cat, int fid, int lin_index, PgfCId fun)
{
PgfMetricsLznState* state = gu_container(funcs, PgfMetricsLznState, funcs);
gu_buf_push(state->marks, int, state->pos);
}
static void
pgf_metrics_lzn_end_phrase1(PgfLinFuncs** funcs, PgfCId cat, int fid, int lin_idx, PgfCId fun)
{
PgfMetricsLznState* state = gu_container(funcs, PgfMetricsLznState, funcs);
int start = gu_buf_pop(state->marks, int);
int end = state->pos;
if (start != end) {
PgfPhrase* phrase = gu_new(PgfPhrase, state->pool);
phrase->start = start;
phrase->end = end;
phrase->cat = cat;
phrase->lin_idx = lin_idx;
gu_buf_push(state->phrases, PgfPhrase*, phrase);
}
}
static void
pgf_metrics_lzn_end_phrase2(PgfLinFuncs** funcs, PgfCId cat, int fid, int lin_idx, PgfCId fun)
{
PgfMetricsLznState* state = gu_container(funcs, PgfMetricsLznState, funcs);
int start = gu_buf_pop(state->marks, int);
int end = state->pos;
if (start != end) {
size_t n_phrases = gu_buf_length(state->phrases);
for (size_t i = 0; i < n_phrases; i++) {
PgfPhrase* phrase = gu_buf_get(state->phrases, PgfPhrase*, i);
if (phrase->start == start &&
phrase->end == end &&
gu_string_eq(phrase->cat, cat) &&
phrase->lin_idx == lin_idx) {
state->matches++;
break;
}
}
state->found++;
}
}
static PgfLinFuncs pgf_metrics_lin_funcs1 = {
.symbol_tokens = pgf_metrics_lzn_symbol_tokens,
.expr_literal = pgf_metrics_lzn_expr_literal,
.begin_phrase = pgf_metrics_lzn_begin_phrase,
.end_phrase = pgf_metrics_lzn_end_phrase1
};
static PgfLinFuncs pgf_metrics_lin_funcs2 = {
.symbol_tokens = pgf_metrics_lzn_symbol_tokens,
.expr_literal = pgf_metrics_lzn_expr_literal,
.begin_phrase = pgf_metrics_lzn_begin_phrase,
.end_phrase = pgf_metrics_lzn_end_phrase2
};
bool
pgf_parseval(PgfConcr* concr, PgfExpr expr, PgfCId cat,
double *precision, double *recall, double *exact)
{
GuPool* pool = gu_new_pool();
GuEnum* en_lins1 =
pgf_lzr_concretize(concr, expr, pool);
PgfCncTree ctree1 = gu_next(en_lins1, PgfCncTree, pool);
if (gu_variant_is_null(ctree1)) {
gu_pool_free(pool);
return false;
}
PgfMetricsLznState state;
state.funcs = &pgf_metrics_lin_funcs1;
state.ps = pgf_parser_init_state(concr, cat, 0, -1, pool, pool);
state.marks = gu_new_buf(int, pool);
state.pos = 0;
state.phrases = gu_new_buf(PgfPhrase*, pool);
state.matches = 0;
state.found = 0;
state.pool = pool;
pgf_lzr_linearize(concr, ctree1, 0, &state.funcs);
if (state.ps == NULL) {
gu_pool_free(pool);
return false;
}
GuEnum* en_trees = pgf_parse_result(state.ps);
PgfExprProb* ep = gu_next(en_trees, PgfExprProb*, pool);
if (ep == NULL) {
gu_pool_free(pool);
return false;
}
GuEnum* en_lins2 =
pgf_lzr_concretize(concr, ep->expr, pool);
PgfCncTree ctree2 = gu_next(en_lins2, PgfCncTree, pool);
if (gu_variant_is_null(ctree2)) {
gu_pool_free(pool);
return false;
}
state.funcs = &pgf_metrics_lin_funcs2;
state.ps = NULL;
state.pos = 0;
pgf_lzr_linearize(concr, ctree2, 0, &state.funcs);
*precision = ((double) state.matches)/((double) state.found);
*recall = ((double) state.matches)/((double) gu_buf_length(state.phrases));
*exact = pgf_expr_eq(expr, ep->expr) ? 1 : 0;
return true;
}
| 24.741294 | 97 | 0.693344 |
04a6dfb1064de694ca46fe9d4e4543acc49ca320 | 439 | html | HTML | site/partials/api/index.html | decipherinc/angular-envoy | caae6b35d12f589fbc58b292cf1dd8f8c5cb7c60 | [
"MIT"
] | null | null | null | site/partials/api/index.html | decipherinc/angular-envoy | caae6b35d12f589fbc58b292cf1dd8f8c5cb7c60 | [
"MIT"
] | null | null | null | site/partials/api/index.html | decipherinc/angular-envoy | caae6b35d12f589fbc58b292cf1dd8f8c5cb7c60 | [
"MIT"
] | null | null | null | <a href="https://github.com/decipherinc/angular-envoy.git/blob/e1fe4cb/docs/api/index.ngdoc#L2" class="view-source"><i class="icon-eye-open"> </i>View source</a><h1><code ng:non-bindable=""></code>
<div><span class="hint"></span>
</div>
</h1>
<div><div class="api-information-page"><h2 id="api-information">API Information</h2>
<h3 id="api-information_how-it-works">How it Works</h3>
<p>TODO: fill this in after refactors</p>
</div></div>
| 48.777778 | 197 | 0.699317 |
d26eb014872c05e362d6df27699bf7454dd5f47b | 14,728 | php | PHP | app/Http/Controllers/Finance/RekapBudgetController.php | MuhammadSuryono/management-b2 | 47258ab55fc7b005f7bf7a1912bb713647f04906 | [
"MIT"
] | null | null | null | app/Http/Controllers/Finance/RekapBudgetController.php | MuhammadSuryono/management-b2 | 47258ab55fc7b005f7bf7a1912bb713647f04906 | [
"MIT"
] | null | null | null | app/Http/Controllers/Finance/RekapBudgetController.php | MuhammadSuryono/management-b2 | 47258ab55fc7b005f7bf7a1912bb713647f04906 | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers\Finance;
use App\Http\Controllers\Controller;
use App\Project;
use App\Kota;
use App\Pembayaran_interviewer;
use App\Pembayaran_tl;
use App\Project_imported;
use App\Project_team;
use App\Respondent;
use App\Respondent_gift;
use App\Status_pembayaran;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Session;
class RekapBudgetController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$projectstest = Respondent::select("respondent_gifts.*", 'project_honor_gifts.honor_gift', 'respondents.project_id')
->join('respondent_gifts', 'respondent_gifts.respondent_id', '=', 'respondents.id')
->join('project_kotas', 'project_kotas.kota_id', '=', 'respondents.kota_id')
->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'project_kotas.id')
// ->groupBy('respondents.project_id')
// ->distinct()
->get();
$arr_project = [];
$projects = Project::all();
foreach ($projects as $p) {
$total_gift = Respondent::select(DB::raw('SUM(project_honor_gifts.honor_gift)'))
->join('project_kotas', function ($join) use ($p) {
$join->on('respondents.kota_id', '=', 'project_kotas.kota_id')
->where('project_kotas.project_id', '=', $p->id);
})
->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'project_kotas.id')
->where('respondents.project_id', $p->id)->sum('project_honor_gifts.honor_gift');
$total_honor_interviewer = DB::table('respondents')->select(DB::raw('SUM(project_honors.honor)'))
->join('project_kotas', function ($join) use ($p) {
$join->on('respondents.kota_id', '=', 'project_kotas.kota_id')
->where('project_kotas.project_id', '=', $p->id);
})
->join('project_honors', function ($join) use ($p) {
$join->on('project_kotas.id', '=', 'project_honors.project_kota_id')
->where(DB::raw('lower(respondents.kategori_honor)'), '=', DB::raw('lower(project_honors.nama_honor)'));
})
->where('respondents.project_id', '=', $p->id)
->sum('project_honors.honor');
$total_honor_tl = Project_team::select('*')
->join('teams', 'teams.id', '=', 'project_teams.team_id')
->join('project_jabatans', 'project_jabatans.id', '=', 'project_teams.project_jabatan_id')
->join('jabatans', 'jabatans.id', '=', 'project_jabatans.jabatan_id')
->join('kotas', 'kotas.id', '=', 'teams.kota_id')
->join('project_kotas', 'project_kotas.id', '=', 'project_jabatans.project_kota_id')
->where('project_kotas.project_id', '=', $p->id)
->sum('project_teams.gaji');
// if ($p->id == 33) {
// $total_gift = Respondent::select('respondents.id', 'project_honor_gifts.honor_gift')
// ->join('project_kotas', function ($join) use ($p) {
// $join->on('respondents.kota_id', '=', 'project_kotas.kota_id')
// ->where('project_kotas.project_id', '=', $p->id);
// })
// ->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'project_kotas.id')
// ->where('respondents.project_id', $p->id)->groupBy('respondents.id')->get();
// dd($total_gift);
// var_dump($total_gift);
// var_dump($total_honor_interviewer);
// var_dump($total_honor_tl);
// }
$total = $total_gift + $total_honor_interviewer + $total_honor_tl;
// -------------------------
$total_gift_dipakai = Respondent::select(DB::raw('SUM(project_honor_gifts.honor_gift)'))
->join('respondent_gifts', 'respondent_gifts.respondent_id', '=', 'respondents.id')
->join('project_kotas', function ($join) use ($p) {
$join->on('respondents.kota_id', '=', 'project_kotas.kota_id')
->where('project_kotas.project_id', '=', $p->id);
})
->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'project_kotas.id')
->where('respondents.project_id', $p->id)
->where('respondent_gifts.status_pembayaran_id', 3)
->sum('project_honor_gifts.honor_gift');
$total_honor_interviewer_dipakai = Pembayaran_interviewer::select('*')->where('project_id', '=', $p->id)->where('status_pembayaran_id', 3)->sum('total');
$total_honor_tl_dipakai = Pembayaran_tl::select('*')->where('project_id', '=', $p->id)->where('status_pembayaran_id', 3)->sum('total');
$total_dipakai = $total_gift_dipakai + $total_honor_interviewer_dipakai + $total_honor_tl_dipakai;
$temp = [
'nama_project' => $p->nama,
'total' => $total,
'total_dipakai' => $total_dipakai,
'total_belum_dipakai' => $total - $total_dipakai
];
$arr_project[$p->id] = $temp;
}
// $projects = Project::select(DB::raw('SUM(project_honor_gifts.honor_gift)'), DB::raw('COUNT(respondents.id)'), 'projects.nama', 'projects.id')
// ->join('respondents', 'respondents.project_id', '=', 'projects.id')
// ->join('project_kotas as a', 'a.kota_id', '=', 'respondents.kota_id')
// ->join('project_kotas as b', 'b.project_id', '=', 'projects.id')
// ->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'a.id')
// ->groupBy('projects.id')
// ->get();
// dd($projects);
// $projects = Respondent::select(DB::raw("SUM(project_honor_gifts.honor_gift) as total"), 'projects.nama', 'status_pembayarans.id as status_id')
// ->join('respondent_gifts', 'respondent_gifts.respondent_id', '=', 'respondents.id')
// ->join('project_kotas', 'project_kotas.kota_id', '=', 'respondents.kota_id')
// ->join('project_honor_gifts', 'project_honor_gifts.project_kota_id', '=', 'project_kotas.id')
// ->join('projects', 'projects.id', '=', 'respondents.project_id')
// ->join('status_pembayarans', 'status_pembayarans.id', '=', 'respondent_gifts.status_pembayaran_id')
// ->groupBy('respondents.project_id')
// ->groupBy('respondent_gifts.status_pembayaran_id')
// ->get();
// $arr = [];
// $namaProject = '';
// $totalBelumDibayar = 0;
// $totalSudahDiajukan = 0;
// $totalSudahDibayar = 0;
// $totalGagalDibayar = 0;
// foreach ($projects as $item) {
// if ($namaProject != $item->nama) {
// if ($namaProject) {
// $data[$namaProject] = [
// 'nama_project' => $namaProject,
// 'total_belum_dibayar' => $totalBelumDibayar,
// 'total_sudah_diajukan' => $totalSudahDiajukan,
// 'total_sudah_dibayar' => $totalSudahDibayar,
// 'total_gagal_dibayar' => $totalGagalDibayar,
// 'total' => $totalBelumDibayar + $totalSudahDiajukan + $totalSudahDibayar + $totalGagalDibayar,
// ];
// }
// $namaProject = $item->nama;
// $totalBelumDibayar = 0;
// $totalSudahDiajukan = 0;
// $totalSudahDibayar = 0;
// $totalGagalDibayar = 0;
// }
// if ($item->status_id == 1) {
// $totalBelumDibayar = $item->total;
// }
// if ($item->status_id == 2) {
// $totalSudahDiajukan = $item->total;
// }
// if ($item->status_id == 3) {
// $totalSudahDibayar = $item->total;
// }
// if ($item->status_id == 4) {
// $totalGagalDibayar = $item->total;
// }
// }
// $data[$namaProject] = [
// 'nama_project' => $namaProject,
// 'total_belum_dibayar' => $totalBelumDibayar,
// 'total_sudah_diajukan' => $totalSudahDiajukan,
// 'total_sudah_dibayar' => $totalSudahDibayar,
// 'total_gagal_dibayar' => $totalGagalDibayar,
// 'total' => $totalBelumDibayar + $totalSudahDiajukan + $totalSudahDibayar + $totalGagalDibayar,
// ];
return view('finances.rekap_gift.index', compact('arr_project', 'projects'));
}
public function rtpGift(Request $request)
{
if ($request->project_imported_id != 'all' && $request->project_imported_id) {
$project_importeds = Project_imported::all()->sortBy('project_imported');
$kotas = Respondent::join('kotas', 'respondents.kota_id', '=', 'kotas.id')->select('kotas.*')->where('project_imported_id', '=', $request->project_imported_id)->orderBy('kotas.kota', 'ASC')->distinct()->get();
} else {
$project_importeds = Project_imported::all()->sortBy('project_imported');
$kotas = Kota::all()->sortBy('kota');
}
if (session('link_from') == 'saving') {
$params = session('last_resp_param');
} else {
$params = $request->except('_token');
Session::put('last_resp_param', $params);
}
$respondents = Respondent_gift::filter($params)->where('status', 0)->orderBy('respname', 'ASC')->get();
// $add_url = url('/menus/create');
return view('finances.respondent_gift.pengajuan_gift', compact('project_importeds', 'respondents', 'kotas'));
}
public function changeStatus(Request $request)
{
if ($request->nextStatus == 2) {
$insert = Respondent_gift::where('id', $request->id)->update([
'status_pembayaran_id' => $request->nextStatus,
// 'success_or_fail_paid' => $request->status_bayar,
'tanggal_pengajuan' => date('Y-m-d'),
'keterangan_pembayaran' => $request->ket_pembayaran,
'tanggal_update_pembayaran' => Carbon::now()
]);
} else if ($request->nextStatus == 3) {
$insert = Respondent_gift::where('id', $request->id)->update([
'status_pembayaran_id' => $request->nextStatus,
// 'success_or_fail_paid' => $request->status_bayar,
'tanggal_pembayaran' => date('Y-m-d'),
'keterangan_pembayaran' => $request->ket_pembayaran,
'tanggal_update_pembayaran' => Carbon::now()
]);
} else {
$insert = Respondent_gift::where('id', $request->id)->update([
'status_pembayaran_id' => $request->nextStatus,
// 'success_or_fail_paid' => $request->status_bayar,
'keterangan_pembayaran' => $request->ket_pembayaran,
'tanggal_update_pembayaran' => Carbon::now()
]);
}
$params = explode("?", $request->link);
// dd($params);
if ($insert) {
return redirect('/respondent_gift?' . $params[1])->with('status', 'Status Berhasil Diubah');
} else {
return redirect('/respondent_gift?' . $params[1])->with('status-fail', 'Status Gagal Diubah');
}
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$menu = Menu::first();
$title = 'Tambah Menu';
$create_edit = 'create';
$action_url = url('/menus');
$include_form = 'otentikasis.menus.form_menu';
return view('crud.open_record', compact('menu', 'title', 'create_edit', 'action_url', 'include_form'));
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//Validation
$validatedData = $request->validate([
'menu' => 'required|unique:menus|max:60',
]);
Menu::create($request->all());
return redirect('/menus')->with('status', 'Data sudah disimpan');
}
/**
* Display the specified resource.
*
* @param \App\Menu $menu
* @return \Illuminate\Http\Response
*/
public function show(Menu $menu)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Menu $menu
* @return \Illuminate\Http\Response
*/
public function edit(Menu $menu)
{
$title = 'Edit Menu';
$create_edit = 'edit';
$action_url = url('/menus') . '/' . $menu->id;
$include_form = 'otentikasis.menus.form_menu';
return view('crud.open_record', compact('menu', 'title', 'create_edit', 'action_url', 'include_form'));
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Menu $menu
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Menu $menu)
{
$validatedData = $request->validate([
'menu' => 'required|unique:menus,menu,' . $menu->id . ',id|max:60',
]);
Menu::where('id', $menu->id)->update([
'menu' => $request->menu,
]);
return redirect('/menus')->with('status', 'Data sudah diubah');
}
/**
* Remove the specified resource from storage.
*
* @param \App\Menu $menu
* @return \Illuminate\Http\Response
*/
public function destroy(Menu $menu)
{
//
}
public function delete($id)
{
Menu::destroy($id);
return redirect('/menus')->with('status', 'Data sudah dihapus');
}
private function in_array_r($needle, $haystack, $strict = false)
{
foreach ($haystack as $key => $item) {
if (($strict ? $key === $needle : $key == $needle) || (is_array($key) && in_array_r($needle, $key, $strict))) {
return true;
}
}
return false;
}
}
| 42.566474 | 221 | 0.543115 |
ddd1c09f11d4e969d9de5fd025d9c19e256692f2 | 474 | php | PHP | app/Http/Controllers/welcomeController.php | hasanakashhstu/laravel_basic | 080f60a8faea18cea058e9dbcfba739619b1d99f | [
"MIT"
] | null | null | null | app/Http/Controllers/welcomeController.php | hasanakashhstu/laravel_basic | 080f60a8faea18cea058e9dbcfba739619b1d99f | [
"MIT"
] | null | null | null | app/Http/Controllers/welcomeController.php | hasanakashhstu/laravel_basic | 080f60a8faea18cea058e9dbcfba739619b1d99f | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class welcomeController extends Controller
{
public function index(){
return view('master.home.home');
}
public function about(){
return view('master.about.about');
}
public function blog(){
return view('master.blog.blog');
}
public function details(){
return view('master.details.details');
}
public function contact(){
return view('master.contact.contact');
}
}
| 18.96 | 42 | 0.685654 |
41452c3e92c3296a3cdfd6c07b6f2e34a4c49240 | 866 | h | C | source/rendercore/include/rendercore/scene/Scene.h | sbusch42/rendercore | 8d0bd316ff23f8f6596a07d8a3ce568049ad08d2 | [
"MIT"
] | 1 | 2019-02-12T16:00:45.000Z | 2019-02-12T16:00:45.000Z | source/rendercore/include/rendercore/scene/Scene.h | sbusch42/rendercore | 8d0bd316ff23f8f6596a07d8a3ce568049ad08d2 | [
"MIT"
] | null | null | null | source/rendercore/include/rendercore/scene/Scene.h | sbusch42/rendercore | 8d0bd316ff23f8f6596a07d8a3ce568049ad08d2 | [
"MIT"
] | null | null | null |
#pragma once
#include <rendercore/scene/SceneNode.h>
namespace rendercore
{
/**
* @brief
* Represents a virtual 3D scene
*/
class RENDERCORE_API Scene
{
public:
/**
* @brief
* Constructor
*/
Scene();
/**
* @brief
* Destructor
*/
virtual ~Scene();
/**
* @brief
* Get root node
*
* @return
* Scene node (never null)
*/
const SceneNode * root() const;
/**
* @brief
* Get root node
*
* @return
* Scene node (never null)
*/
SceneNode * root();
/**
* @brief
* Set root node
*
* @param[in] node
* Scene node (must NOT be null)
*/
void setRoot(std::unique_ptr<SceneNode> && node);
protected:
std::unique_ptr<SceneNode> m_root; ///< Root node of the scene
};
} // namespace rendercore
| 13.53125 | 66 | 0.513857 |
2293a0fd4272125c2bb805cceb48eb097d6658e8 | 1,070 | html | HTML | Website/html_css/listen/listen.html | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Website/html_css/listen/listen.html | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | Website/html_css/listen/listen.html | Kreijeck/learning | eaffee08e61f2a34e01eb8f9f04519aac633f48c | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Listen in HTML</title>
<link rel="stylesheet" type="text/css" href="listen.css">
</head>
<body>
<ul>
<li>Äpfel</li>
<li>Birnen</li>
<li>Kokusnuss</li>
<li>Pizza</li>
<li>Salami</li>
<li>Abendessen
<ul>
<li>Lasagne-Platten</li>
<li>Tomatensoße</li>
<li>Käse</li>
<li>Hackfleisch</li>
</ul>
</li>
<li>Kakao</li>
<li>Kaffee</li>
<li>Kuchen</li>
</ul>
<ol>
<li>Weitwurf</li>
<li>Kugelstoßen</li>
<li>Weitsprung</li>
<li>Läufe
<ol>
<li>100m Sprint</li>
<li>400m</li>
<li>800m</li>
</ol>
</li>
<li>Diskus</li>
<li>Hochsprung</li>
</ol>
<ol>
<li>Maria</li>
<li>Peter</li>
<li>Simon</li>
<li>Mia</li>
</ol>
<ul>
<li>Nudeln</li>
<li>Äpfel</li>
<li>Kartoffeln</li>
<li>SCHOKOLADE!</li>
</ul>
</body>
</html>
| 16.984127 | 59 | 0.446729 |
deacb78a342b80828b26a2486506c29562c770b2 | 1,809 | rs | Rust | src/percent_formatter.rs | foldu/iv | 5fcd836130bcdd268765f5080755b576a7d6908f | [
"MIT"
] | null | null | null | src/percent_formatter.rs | foldu/iv | 5fcd836130bcdd268765f5080755b576a7d6908f | [
"MIT"
] | null | null | null | src/percent_formatter.rs | foldu/iv | 5fcd836130bcdd268765f5080755b576a7d6908f | [
"MIT"
] | null | null | null | use std::fmt;
#[derive(Debug, Clone, Copy)]
enum State {
GotPercent,
Normal,
Skip(usize),
}
pub trait PercentFormatable<W: fmt::Write> {
fn try_parse(&self, rest: &str, writer: &mut W) -> Result<Option<usize>, fmt::Error>;
}
pub fn percent_format<W, P>(fmt: &str, mut w: &mut W, p: &P) -> Result<(), fmt::Error>
where
W: fmt::Write,
P: PercentFormatable<W>,
{
let mut state = State::Normal;
let mut last = 0;
for (i, ch) in fmt.chars().enumerate() {
state = match state {
State::Normal => {
if ch == '%' {
write!(w, "{}", &fmt[last..i])?;
State::GotPercent
} else {
State::Normal
}
}
State::GotPercent => {
if ch == '%' {
State::Normal
} else if let Some(skippie) = p.try_parse(&fmt[i..], &mut w)? {
last = i + skippie + 1;
State::Skip(skippie)
} else {
State::Normal
}
}
State::Skip(0) => State::Normal,
State::Skip(n) => State::Skip(n - 1),
}
}
if last != fmt.len() {
write!(w, "{}", &fmt[last..])?;
}
Ok(())
}
#[derive(Debug, Clone)]
pub struct PercentFormatBuf {
buf: String,
format_str: String,
}
impl PercentFormatBuf {
pub fn new(format: &str) -> Self {
Self {
buf: String::new(),
format_str: format.to_owned(),
}
}
pub fn format<P>(&mut self, p: &P) -> &str
where
P: PercentFormatable<String>,
{
self.buf.clear();
percent_format(&self.format_str, &mut self.buf, p).unwrap();
&self.buf
}
}
| 23.802632 | 89 | 0.450525 |
f9949b9ef8ac76a42bd780d06d2344efc84d4944 | 2,437 | go | Go | store/drivers/dsn_test.go | jrapoport/gothic | de86be384e009eb34addf48c671f37cd8210809b | [
"MIT"
] | 62 | 2021-03-14T10:17:09.000Z | 2022-03-25T19:37:08.000Z | store/drivers/dsn_test.go | jrapoport/gotrue | 90241243e461956eb848e47918f605e0579fd0a0 | [
"MIT"
] | 9 | 2021-03-19T05:16:11.000Z | 2022-03-24T07:37:38.000Z | store/drivers/dsn_test.go | jrapoport/gotrue | 90241243e461956eb848e47918f605e0579fd0a0 | [
"MIT"
] | 5 | 2021-03-21T18:13:41.000Z | 2022-03-18T14:52:55.000Z | package drivers
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNormalizeDSN(t *testing.T) {
const (
myDSN = "root@tcp(0.0.0.0:3306)/test?parseTime=true"
pgDSN = "postgres://root:password@0.0.0.0:5432/test"
msDSN = "sqlserver://sa:password@0.0.0.0:5432?database=test"
)
var dir = t.TempDir()
tests := []struct {
drv Driver
name string
dsn string
nameOut string
dsnOut string
Err assert.ErrorAssertionFunc
}{
{
MySQL, "", "",
"", "", assert.Error,
},
{
MySQL, "", "\n",
"", "", assert.Error,
},
{
MySQL, "", myDSN,
"test", myDSN, assert.NoError,
},
{
Postgres, "", "",
"", "", assert.Error,
},
{
Postgres, "", "\n",
"", "", assert.Error,
},
{
Postgres, "", pgDSN,
"test", pgDSN, assert.NoError,
},
{
SQLServer, "", "",
"", "", assert.Error,
},
{
SQLServer, "", "\n",
"", "", assert.Error,
},
{
SQLServer, "", msDSN,
"test", msDSN, assert.NoError,
},
{
SQLite, "", "", "db",
"db.sqlite", assert.NoError,
},
{
SQLite, "", "\n", "",
"", assert.Error,
},
{
SQLite, "", dir, "db",
dir + "/db.sqlite", assert.NoError,
},
{
SQLite, "", "db", "db",
"db/db.sqlite", assert.NoError,
},
{
SQLite, "", "db.sqlite",
"db", "db.sqlite", assert.NoError,
},
{
SQLite, "", dir + "/db.sqlite",
"db", dir + "/db.sqlite", assert.NoError,
},
{
SQLite, "test", "", "test",
"test.sqlite", assert.NoError,
},
{
SQLite, "test", "\n", "",
"", assert.Error,
},
{
SQLite, "test", dir, "test",
dir + "/test.sqlite", assert.NoError,
},
{
SQLite, "test", "db", "test",
"db/test.sqlite", assert.NoError,
},
{
SQLite, "test", "db.sqlite",
"db", "db.sqlite", assert.NoError,
},
{
SQLite, "test", dir + "/db.sqlite",
"db", dir + "/db.sqlite", assert.NoError,
},
{
SQLite, "test", "foo/db/",
"test", "foo/db/test.sqlite", assert.NoError,
},
{
SQLite, "test", "http://",
"test", "http://test.sqlite", assert.NoError,
},
{
SQLite, "test", "http://foo.",
"test", "http://foo./test.sqlite", assert.NoError,
},
{
"unkn", "test", "test",
"test", "test", assert.NoError,
},
}
for _, test := range tests {
name, dsn, err := NormalizeDSN(test.name, test.drv, test.dsn)
test.Err(t, err)
assert.Equal(t, test.nameOut, name)
assert.Equal(t, test.dsnOut, dsn)
}
}
| 18.462121 | 63 | 0.515798 |
c2a55a208e8ef50065cfe9930dd63b5585f0f617 | 8,036 | go | Go | cache/cache.go | domgoer/drone-cache | db62862d69d0282dccd0d87d1d3e737d3bf6398a | [
"Apache-2.0"
] | null | null | null | cache/cache.go | domgoer/drone-cache | db62862d69d0282dccd0d87d1d3e737d3bf6398a | [
"Apache-2.0"
] | null | null | null | cache/cache.go | domgoer/drone-cache | db62862d69d0282dccd0d87d1d3e737d3bf6398a | [
"Apache-2.0"
] | null | null | null | // Package cache provides functionality for cache storage
package cache
import (
"archive/tar"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
)
// Backend implements operations for caching files
type Backend interface {
Get(string) (io.ReadCloser, error)
Put(string, io.ReadSeeker) error
}
// Cache contains configuration for Cache functionality
type Cache struct {
logger log.Logger
b Backend
opts options
}
// New creates a new cache with given parameters
func New(logger log.Logger, b Backend, opts ...Option) Cache {
options := options{
archiveFmt: DefaultArchiveFormat,
compressionLevel: DefaultCompressionLevel,
}
for _, o := range opts {
o.apply(&options)
}
return Cache{
logger: log.With(logger, "component", "cache"),
b: b,
opts: options,
}
}
// Push pushes the archived file to the cache
func (c Cache) Push(src, dst string) error {
// 1. check if source is reachable
src, err := filepath.Abs(filepath.Clean(src))
if err != nil {
return fmt.Errorf("read source directory %v", err)
}
level.Info(c.logger).Log("msg", "archiving directory", "src", src)
// 2. create a temporary file for the archive
if err := os.MkdirAll("/tmp", os.FileMode(0755)); err != nil {
return fmt.Errorf("create tmp directory %v", err)
}
dir, err := ioutil.TempDir("", "")
if err != nil {
return fmt.Errorf("create tmp folder for archive %v", err)
}
archivePath := filepath.Join(dir, "archive.tar")
file, err := os.Create(archivePath)
if err != nil {
return fmt.Errorf("create tarball file <%s> %v", archivePath, err)
}
tw, twCloser, err := archiveWriter(file, c.opts.archiveFmt, c.opts.compressionLevel)
if err != nil {
return fmt.Errorf("initialize archive writer %v", err)
}
level.Debug(c.logger).Log("msg", "archive compression level", "level", c.opts.compressionLevel)
closer := func() {
twCloser()
file.Close()
}
defer closer()
// 3. walk through source and add each file
err = filepath.Walk(src, writeToArchive(tw, c.opts.skipSymlinks))
if err != nil {
return fmt.Errorf("add all files to archive %v", err)
}
// 4. Close resources before upload
closer()
// 5. upload archive file to server
level.Info(c.logger).Log("msg", "uploading archived directory", "src", src, "dst", dst)
return c.pushArchive(dst, archivePath)
}
func (c Cache) pushArchive(dst, archivePath string) error {
f, err := os.Open(archivePath)
if err != nil {
return fmt.Errorf("open archived file to send %v", err)
}
defer f.Close()
if err := c.b.Put(dst, f); err != nil {
return fmt.Errorf("upload file %v", err)
}
return nil
}
// Pull fetches the archived file from the cache and restores to the host machine's file system
func (c Cache) Pull(src, dst string) error {
level.Info(c.logger).Log("msg", "downloading archived directory", "src", src)
// 1. download archive
rc, err := c.b.Get(src)
if err != nil {
return fmt.Errorf("get file from storage backend %v", err)
}
defer rc.Close()
// 2. extract archive
level.Info(c.logger).Log("msg", "extracting archived directory", "src", src, "dst", dst)
if err := extractFromArchive(archiveReader(rc, c.opts.archiveFmt)); err != nil {
return fmt.Errorf("extract files from downloaded archive %v", err)
}
return nil
}
// Helpers
func archiveWriter(w io.Writer, f string, l int) (*tar.Writer, func(), error) {
switch f {
case "gzip":
gw, err := gzip.NewWriterLevel(w, l)
if err != nil {
return nil, nil, fmt.Errorf("create archive writer %v", err)
}
tw := tar.NewWriter(gw)
return tw, func() {
gw.Close()
tw.Close()
}, nil
default:
tw := tar.NewWriter(w)
return tw, func() { tw.Close() }, nil
}
}
func writeToArchive(tw *tar.Writer, skipSymlinks bool) func(path string, fi os.FileInfo, err error) error {
return func(path string, fi os.FileInfo, pErr error) error {
if pErr != nil {
return pErr
}
var h *tar.Header
// Create header for Regular files and Directories
var err error
h, err = tar.FileInfoHeader(fi, "")
if err != nil {
return fmt.Errorf("create header for <%s> %v", path, err)
}
if isSymlink(fi) {
if skipSymlinks {
return nil
}
var err error
if h, err = createSymlinkHeader(fi, path); err != nil {
return fmt.Errorf("create header for symbolic link %v", err)
}
}
h.Name = path // to give absolute path
if err := tw.WriteHeader(h); err != nil {
return fmt.Errorf("write header for <%s> %v", path, err)
}
if fi.Mode().IsRegular() { // open and write only if it is a regular file
if err := writeFileToArchive(tw, path); err != nil {
return fmt.Errorf("write file to archive %v", err)
}
}
return nil
}
}
func createSymlinkHeader(fi os.FileInfo, path string) (*tar.Header, error) {
lnk, err := os.Readlink(path)
if err != nil {
return nil, fmt.Errorf("read link <%s> %v", path, err)
}
h, err := tar.FileInfoHeader(fi, lnk)
if err != nil {
return nil, fmt.Errorf("create symlink header for <%s> %v", path, err)
}
return h, nil
}
func writeFileToArchive(tw io.Writer, path string) error {
f, err := os.Open(path)
if err != nil {
return fmt.Errorf("open file <%s> %v", path, err)
}
defer f.Close()
if _, err := io.Copy(tw, f); err != nil {
return fmt.Errorf("copy the file <%s> data to the tarball %v", path, err)
}
return nil
}
func archiveReader(r io.Reader, archiveFmt string) *tar.Reader {
tr := tar.NewReader(r)
switch archiveFmt {
case "gzip":
gzr, err := gzip.NewReader(r)
if err != nil {
gzr.Close()
return tr
}
return tar.NewReader(gzr)
default:
return tr
}
}
func extractFromArchive(tr *tar.Reader) error {
for {
h, err := tr.Next()
switch {
case err == io.EOF: // if no more files are found return
return nil
case err != nil: // return any other error
return fmt.Errorf("tar reader failed %v", err)
case h == nil: // if the header is nil, skip it
continue
}
switch h.Typeflag {
case tar.TypeDir:
if err := extractDir(h); err != nil {
return err
}
continue
case tar.TypeReg, tar.TypeRegA, tar.TypeChar, tar.TypeBlock, tar.TypeFifo:
if err := extractRegular(h, tr); err != nil {
return fmt.Errorf("extract regular file %v", err)
}
continue
case tar.TypeSymlink:
if err := extractSymlink(h); err != nil {
return fmt.Errorf("extract symbolic link %v", err)
}
continue
case tar.TypeLink:
if err := extractLink(h); err != nil {
return fmt.Errorf("extract link %v", err)
}
continue
case tar.TypeXGlobalHeader:
continue
default:
return fmt.Errorf("extract %s, unknown type flag: %c", h.Name, h.Typeflag)
}
}
}
func extractDir(h *tar.Header) error {
if err := os.MkdirAll(h.Name, os.FileMode(h.Mode)); err != nil {
return fmt.Errorf("create directory <%s> %v", h.Name, err)
}
return nil
}
func extractRegular(h *tar.Header, tr io.Reader) error {
f, err := os.OpenFile(h.Name, os.O_CREATE|os.O_RDWR, os.FileMode(h.Mode))
if err != nil {
return fmt.Errorf("open extracted file for writing <%s> %v", h.Name, err)
}
defer f.Close()
if _, err := io.Copy(f, tr); err != nil {
return fmt.Errorf("copy extracted file for writing <%s> %v", h.Name, err)
}
return nil
}
func extractSymlink(h *tar.Header) error {
if err := unlink(h.Name); err != nil {
return fmt.Errorf("unlink <%s> %v", h.Name, err)
}
if err := os.Symlink(h.Linkname, h.Name); err != nil {
return fmt.Errorf("create symbolic link <%s> %v", h.Name, err)
}
return nil
}
func extractLink(h *tar.Header) error {
if err := unlink(h.Name); err != nil {
return fmt.Errorf("unlink <%s> %v", h.Name, err)
}
if err := os.Link(h.Linkname, h.Name); err != nil {
return fmt.Errorf("create hard link <%s> %v", h.Linkname, err)
}
return nil
}
func isSymlink(fi os.FileInfo) bool {
return fi.Mode()&os.ModeSymlink != 0
}
func unlink(path string) error {
_, err := os.Lstat(path)
if err == nil {
return os.Remove(path)
}
return nil
}
| 22.894587 | 107 | 0.651319 |
865403bf25fc6437a89e8089aaeea936ef6b34e6 | 4,494 | go | Go | pkg/types/traverser.go | sergenyalcin/typewriter | 80e49fe1eb320ef802ef12d55940669796458397 | [
"Apache-2.0"
] | 5 | 2021-04-12T20:44:39.000Z | 2022-01-31T20:59:07.000Z | pkg/types/traverser.go | sergenyalcin/typewriter | 80e49fe1eb320ef802ef12d55940669796458397 | [
"Apache-2.0"
] | 4 | 2021-06-12T21:09:51.000Z | 2022-01-31T20:16:32.000Z | pkg/types/traverser.go | sergenyalcin/typewriter | 80e49fe1eb320ef802ef12d55940669796458397 | [
"Apache-2.0"
] | 1 | 2022-01-27T14:55:35.000Z | 2022-01-27T14:55:35.000Z | // Copyright 2021 Muvaffak Onus
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package types
import (
"go/types"
"github.com/pkg/errors"
"github.com/muvaf/typewriter/pkg/packages"
)
func WithFieldProcessor(fp FieldProcessor) TraverserOption {
return func(t *Traverser) {
t.FieldProcessors = fp
}
}
func WithTypeProcessor(tp TypeProcessor) TraverserOption {
return func(t *Traverser) {
t.TypeProcessors = tp
}
}
type TraverserOption func(*Traverser)
func NewTraverser(cache *packages.Cache, opts ...TraverserOption) *Traverser {
t := &Traverser{
cache: cache,
commentCache: packages.NewCommentCache(cache),
TypeProcessors: TypeProcessorChain{},
FieldProcessors: FieldProcessorChain{},
}
for _, f := range opts {
f(t)
}
return t
}
type Traverser struct {
TypeProcessors TypeProcessor
FieldProcessors FieldProcessor
cache *packages.Cache
commentCache *packages.CommentCache
}
func (t *Traverser) Traverse(n *types.Named, formerFields ...string) error {
pComments, err := t.commentCache.GetPackageComments(n.Obj().Pkg().Path())
if err != nil {
return errors.Wrapf(err, "cannot get comments for package %s", n.Obj().Pkg().Path())
}
if err := t.TypeProcessors.Process(n, pComments.CommentOf(n.Obj())); err != nil {
return errors.Wrapf(err, "type processors failed to run for type %s", n.Obj().Name())
}
st, ok := n.Underlying().(*types.Struct)
if !ok {
return nil
}
for i := 0; i < st.NumFields(); i++ {
field := st.Field(i)
tag := st.Tag(i)
if err := t.FieldProcessors.Process(n, field, tag, pComments.CommentOf(field), formerFields); err != nil {
return errors.Wrapf(err, "field processors failed to run for field %s of type %s", field.Name(), n.Obj().Name())
}
switch ft := field.Type().(type) {
case *types.Named:
if err := t.Traverse(ft, append(formerFields, field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
case *types.Pointer:
switch elemType := ft.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemType, append(formerFields, "*", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
}
case *types.Slice:
switch elemType := ft.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemType, append(formerFields, "[]", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
case *types.Pointer:
switch elemElemType := elemType.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemElemType, append(formerFields, "[]", "*", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
}
}
case *types.Map:
switch elemType := ft.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemType, append(formerFields, "[mapvalue]", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
case *types.Pointer:
switch elemElemType := elemType.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemElemType, append(formerFields, "[mapvalue]", "*", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
}
}
switch keyType := ft.Key().(type) {
case *types.Named:
if err := t.Traverse(keyType, append(formerFields, "[mapkey]", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
case *types.Pointer:
switch elemKeyType := keyType.Elem().(type) {
case *types.Named:
if err := t.Traverse(elemKeyType, append(formerFields, "[mapkey]", "*", field.Name())...); err != nil {
return errors.Wrapf(err, "failed to traverse type of field %s", field.Name())
}
}
}
}
}
return nil
}
| 33.288889 | 115 | 0.656431 |
1363bb9e74a83f7103f3f1169012b67dfa4b1bff | 2,974 | h | C | chrome/browser/views/options/content_page_view.h | bluebellzhy/chromium | 008c4fef2676506869a0404239da31e83fd6ccc7 | [
"BSD-3-Clause"
] | 1 | 2016-05-08T15:35:17.000Z | 2016-05-08T15:35:17.000Z | chrome/browser/views/options/content_page_view.h | bluebellzhy/chromium | 008c4fef2676506869a0404239da31e83fd6ccc7 | [
"BSD-3-Clause"
] | null | null | null | chrome/browser/views/options/content_page_view.h | bluebellzhy/chromium | 008c4fef2676506869a0404239da31e83fd6ccc7 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H__
#define CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H__
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/shell_dialogs.h"
#include "chrome/common/pref_member.h"
#include "chrome/views/native_button.h"
#include "chrome/views/view.h"
namespace views {
class CheckBox;
class RadioButton;
}
class FileDisplayArea;
class OptionsGroupView;
class PrefService;
////////////////////////////////////////////////////////////////////////////////
// ContentPageView
class ContentPageView : public OptionsPageView,
public views::NativeButton::Listener,
public SelectFileDialog::Listener {
public:
explicit ContentPageView(Profile* profile);
virtual ~ContentPageView();
// views::NativeButton::Listener implementation:
virtual void ButtonPressed(views::NativeButton* sender);
// SelectFileDialog::Listener implementation:
virtual void FileSelected(const std::wstring& path, void* params);
// OptionsPageView implementation:
virtual bool CanClose() const;
protected:
// OptionsPageView implementation:
virtual void InitControlLayout();
virtual void NotifyPrefChanged(const std::wstring* pref_name);
// views::View overrides:
virtual void Layout();
private:
// Init all the dialog controls.
void InitDownloadLocation();
void InitPasswordSavingGroup();
void InitFontsLangGroup();
// Updates the directory displayed in the default download location view with
// the current value of the pref.
void UpdateDownloadDirectoryDisplay();
// Controls for the Download Location group.
OptionsGroupView* download_location_group_;
FileDisplayArea* download_default_download_location_display_;
views::NativeButton* download_browse_button_;
views::CheckBox* download_ask_for_save_location_checkbox_;
scoped_refptr<SelectFileDialog> select_file_dialog_;
// Controls for the Password Saving group
OptionsGroupView* passwords_group_;
views::RadioButton* passwords_asktosave_radio_;
views::RadioButton* passwords_neversave_radio_;
views::NativeButton* passwords_show_passwords_button_;
// Controls for the Popup Blocking group.
OptionsGroupView* popups_group_;
views::RadioButton* popups_show_minimized_radio_;
views::RadioButton* popups_block_all_radio_;
// Controls for the Fonts and Languages group.
OptionsGroupView* fonts_lang_group_;
views::Label* fonts_and_languages_label_;
views::NativeButton* change_content_fonts_button_;
StringPrefMember default_download_location_;
BooleanPrefMember ask_for_save_location_;
BooleanPrefMember ask_to_save_passwords_;
DISALLOW_EVIL_CONSTRUCTORS(ContentPageView);
};
#endif // #ifndef CHROME_BROWSER_VIEWS_OPTIONS_CONTENT_PAGE_VIEW_H__
| 32.681319 | 80 | 0.770007 |
7b34666c1dfa9edac471de00cd987c86f422dc71 | 1,277 | rb | Ruby | lib/alki/execution/context_class_builder.rb | medlefsen/alki | 121c78dda7427490d574496ec3de2d928caed552 | [
"MIT"
] | 23 | 2016-12-03T04:26:04.000Z | 2022-01-16T15:02:22.000Z | lib/alki/execution/context_class_builder.rb | medlefsen/alki | 121c78dda7427490d574496ec3de2d928caed552 | [
"MIT"
] | 1 | 2018-11-09T03:39:09.000Z | 2018-11-21T23:43:53.000Z | lib/alki/execution/context_class_builder.rb | medlefsen/alki | 121c78dda7427490d574496ec3de2d928caed552 | [
"MIT"
] | 1 | 2020-09-22T17:10:09.000Z | 2020-09-22T17:10:09.000Z | require 'alki/class_builder'
require 'alki/execution/context'
module Alki
module Execution
module ContextClassBuilder
def self.build(config)
if config[:body]
methods = {
__call__: {body: (config[:body])},
meta: {body: ->{@__meta__}}
}
else
methods = {}
end
(config[:lookup_methods]||config[:scope]||{}).each do |name,path|
methods[name] = {
body:->(*args,&blk) {
__execute__ path, args, blk
}
}
methods[:"__raw_#{name}__"] = {
body:->(*args,&blk) {
__executor__.execute @__meta__, path, args, blk
},
private: true
}
methods[:"__reference_#{name}__"] = {
body:->(*args,&blk) {
__reference__ path, args, blk
},
}
end
(config[:methods]||{}).each do |name,body|
methods[name] = {
body: body,
private: name.to_s.start_with?('__'),
}
end
ClassBuilder.build(
super_class: Alki::Execution::Context,
modules: config[:modules],
instance_methods: methods,
)
end
end
end
end
| 25.039216 | 73 | 0.469851 |
670033164ac024ba764e2090e6fe51b89227b1cd | 6,797 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_967.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_967.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i3-7100_9_0x84_notsx.log_21829_967.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x92f2, %r14
clflush (%r14)
nop
and $48226, %r9
movl $0x61626364, (%r14)
cmp $11626, %rdi
lea addresses_D_ht+0xf672, %rdx
nop
nop
inc %r15
mov (%rdx), %r10
nop
nop
nop
nop
nop
cmp $59310, %r15
lea addresses_WC_ht+0x19f72, %r14
nop
nop
xor $6471, %r8
mov $0x6162636465666768, %rdx
movq %rdx, %xmm1
vmovups %ymm1, (%r14)
nop
nop
sub $9477, %rdx
lea addresses_WC_ht+0xa672, %rsi
lea addresses_normal_ht+0x2b72, %rdi
nop
nop
nop
nop
nop
and %r10, %r10
mov $39, %rcx
rep movsq
cmp %rsi, %rsi
lea addresses_D_ht+0x11f72, %r10
nop
nop
nop
nop
and %rsi, %rsi
vmovups (%r10), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r8
nop
xor $19531, %rdx
lea addresses_UC_ht+0xf872, %rdx
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, %xmm2
movups %xmm2, (%rdx)
nop
nop
nop
add $58053, %r8
lea addresses_UC_ht+0x6a0a, %r9
nop
nop
nop
nop
nop
inc %rsi
mov $0x6162636465666768, %r15
movq %r15, %xmm7
vmovups %ymm7, (%r9)
nop
nop
nop
add %r9, %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r8
push %rcx
push %rdx
// Store
lea addresses_PSE+0xdb2, %rcx
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r12
movq %r12, %xmm3
vmovups %ymm3, (%rcx)
nop
xor $6048, %rdx
// Store
lea addresses_D+0xf912, %r13
nop
sub %r8, %r8
mov $0x5152535455565758, %rcx
movq %rcx, (%r13)
nop
nop
nop
nop
xor %r8, %r8
// Store
lea addresses_PSE+0x1c232, %r8
clflush (%r8)
nop
nop
add %r15, %r15
movl $0x51525354, (%r8)
nop
nop
nop
nop
add $26367, %r12
// Store
lea addresses_normal+0x6772, %r15
nop
nop
nop
nop
nop
cmp %r12, %r12
mov $0x5152535455565758, %rcx
movq %rcx, %xmm7
vmovups %ymm7, (%r15)
dec %r13
// Faulty Load
lea addresses_normal+0x6772, %r8
inc %r12
mov (%r8), %dx
lea oracles, %r12
and $0xff, %rdx
shlq $12, %rdx
mov (%r12,%rdx,1), %rdx
pop %rdx
pop %rcx
pop %r8
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_normal', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 32, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'58': 21829}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 35.586387 | 2,999 | 0.656907 |
ad82bb0658102fb8183a7a03a656923735a9dc52 | 2,197 | swift | Swift | BettasLiveSwiftTest/BettasLiveSwiftTest/Classes/Home/View/RecommendGameView.swift | cuilinhao/DouYuTDemo | d5ae8c728c0e18216581075a92420cc988baa97a | [
"Apache-2.0"
] | 1 | 2020-06-18T03:19:56.000Z | 2020-06-18T03:19:56.000Z | BettasLiveSwiftTest/BettasLiveSwiftTest/Classes/Home/View/RecommendGameView.swift | cuilinhao/DouYuTDemo | d5ae8c728c0e18216581075a92420cc988baa97a | [
"Apache-2.0"
] | null | null | null | BettasLiveSwiftTest/BettasLiveSwiftTest/Classes/Home/View/RecommendGameView.swift | cuilinhao/DouYuTDemo | d5ae8c728c0e18216581075a92420cc988baa97a | [
"Apache-2.0"
] | null | null | null | //
// RecommendGameView.swift
// BettasLiveSwiftTest
//
// Created by 崔林豪 on 2018/9/10.
// Copyright © 2018年 崔林豪. All rights reserved.
//
import UIKit
private let kGameCell = "kGameCell"
class RecommendGameView: UIView {
@IBOutlet weak var collectionView: UICollectionView!
var gameGroup : [AnchorGroupModel]? {
didSet {
collectionView.reloadData()
}
}
override func awakeFromNib() {
super.awakeFromNib()
// 设置该控件不随着父控件的拉伸而拉伸
autoresizingMask = UIViewAutoresizing()
collectionView.delegate = self
collectionView.dataSource = self
collectionView.isPagingEnabled = true
//---创建布局---
let collectionLayout = UICollectionViewFlowLayout()
collectionLayout.itemSize = CGSize(width: 80, height: 80)
collectionLayout.minimumLineSpacing = 0
collectionLayout.minimumInteritemSpacing = 0
collectionLayout.scrollDirection = .horizontal
collectionView.collectionViewLayout = collectionLayout
//注册cell
collectionView.register(UINib(nibName: "CollectionViewGameCell", bundle: nil), forCellWithReuseIdentifier: kGameCell)
}
}
extension RecommendGameView : UICollectionViewDelegate {
}
extension RecommendGameView : UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
//return 12
//return (self.gameGroup?.count)!
return (gameGroup?.count ?? 0)
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: kGameCell, for: indexPath) as! CollectionViewGameCell
cell.group = self.gameGroup![indexPath.item]
return cell
}
}
//MARK:- 提供一个快速创建的类方法
extension RecommendGameView {
class func recommendGameView() -> RecommendGameView {
return Bundle.main.loadNibNamed("RecommendGameView", owner: nil, options: nil)?.first as! RecommendGameView
}
}
| 28.166667 | 128 | 0.669549 |
7dba159622a448596321ca4d2cdb554aaad138b4 | 34 | tab | SQL | www/bases-examples_Windows/rda/def/en/100-ind1.tab | mdama003/ABCD2 | b5f93be122791ab690a4d5954a3ec866196413a5 | [
"Unlicense"
] | null | null | null | www/bases-examples_Windows/rda/def/en/100-ind1.tab | mdama003/ABCD2 | b5f93be122791ab690a4d5954a3ec866196413a5 | [
"Unlicense"
] | null | null | null | www/bases-examples_Windows/rda/def/en/100-ind1.tab | mdama003/ABCD2 | b5f93be122791ab690a4d5954a3ec866196413a5 | [
"Unlicense"
] | null | null | null | 0|Forename
1|Surname
3|Family name | 11.333333 | 13 | 0.823529 |
b7c2c446163a62ab3300a6b2bf9977d56c5f707d | 2,915 | dart | Dart | lib/widget/platform/platform_app_layout.dart | Njima1572/flutter_masamune | 98b4fea749fb5310a9f5482582a3e69d7ff5e639 | [
"BSD-3-Clause"
] | null | null | null | lib/widget/platform/platform_app_layout.dart | Njima1572/flutter_masamune | 98b4fea749fb5310a9f5482582a3e69d7ff5e639 | [
"BSD-3-Clause"
] | 1 | 2022-01-21T19:45:12.000Z | 2022-01-22T23:35:50.000Z | lib/widget/platform/platform_app_layout.dart | Njima1572/flutter_masamune | 98b4fea749fb5310a9f5482582a3e69d7ff5e639 | [
"BSD-3-Clause"
] | 1 | 2022-01-21T19:44:50.000Z | 2022-01-21T19:44:50.000Z | part of masamune;
class PlatformAppLayout extends StatefulWidget {
const PlatformAppLayout({
required this.initialPath,
required this.builder,
this.futures = const [],
this.loading,
this.indicatorColor,
this.appBar,
});
/// Loading indicator color.
final Color? indicatorColor;
/// Builder when the data is empty.
final Widget? loading;
final List<FutureOr<dynamic>> futures;
final String initialPath;
final Widget Function(
BuildContext context,
bool isMobile,
NavigatorController? controller,
String? routeId,
) builder;
final SliverAppBar? appBar;
@override
State<StatefulWidget> createState() => _PlatformAppLayoutState();
}
class _PlatformAppLayoutState extends State<PlatformAppLayout> {
NavigatorController? _controller;
Widget? _inlinePageCache;
@override
void initState() {
super.initState();
if (Config.isMobile) {
return;
}
_controller = NavigatorController(widget.initialPath);
_controller?.addListener(_handledOnUpdate);
}
@override
void didUpdateWidget(PlatformAppLayout oldWidget) {
super.didUpdateWidget(oldWidget);
if (Config.isMobile) {
return;
}
if (widget.initialPath != oldWidget.initialPath) {
_inlinePageCache = null;
_controller?.dispose();
_controller = NavigatorController(widget.initialPath);
_controller?.addListener(_handledOnUpdate);
setState(() {});
}
if (widget.futures != oldWidget.futures && widget.futures.isNotEmpty) {
setState(() {});
}
}
@override
void dispose() {
super.dispose();
_controller?.dispose();
}
void _handledOnUpdate() {
setState(() {});
}
@override
Widget build(BuildContext context) {
if (widget.futures.isNotEmpty) {
return _sliverScroll(
context,
LoadingBuilder(futures: widget.futures, builder: _build),
);
} else {
return _sliverScroll(
context,
_build(context),
);
}
}
Widget _build(BuildContext context) {
final isMobile = Config.isMobile;
if (isMobile) {
return widget.builder.call(context, isMobile, null, null);
} else {
final routeId = _controller?.route?.name?.last();
return CMSLayout(
sideBorder: const BorderSide(),
leftBar: widget.builder.call(context, isMobile, _controller, routeId),
child: _inlinePage(context),
);
}
}
Widget _inlinePage(BuildContext context) {
if (_inlinePageCache != null) {
return _inlinePageCache!;
}
_inlinePageCache = InlinePageBuilder(controller: _controller);
return _inlinePageCache!;
}
Widget _sliverScroll(BuildContext context, Widget child) {
if (!Config.isMobile) {
return child;
}
return CustomScrollView(
slivers: [
if (widget.appBar != null) widget.appBar!,
child,
],
);
}
}
| 23.508065 | 78 | 0.656261 |
ddbf3abb695a1b57c72a8f34634d79a83fa36081 | 1,762 | php | PHP | resources/views/book/create.blade.php | Belendor/biblioteka | 687f92f19e6ef699ccbfba3c33e9eb69123006f9 | [
"MIT"
] | null | null | null | resources/views/book/create.blade.php | Belendor/biblioteka | 687f92f19e6ef699ccbfba3c33e9eb69123006f9 | [
"MIT"
] | 1 | 2021-10-06T20:10:10.000Z | 2021-10-06T20:10:10.000Z | resources/views/book/create.blade.php | Belendor/biblioteka | 687f92f19e6ef699ccbfba3c33e9eb69123006f9 | [
"MIT"
] | null | null | null | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Prideti nauja knyga:</div>
<div class="card-body">
<form method="POST" action="{{route('book.store')}}">
<div class="form-group">
<label>Title:</label>
<input class="form-control" type="text" name="book_title">
</div>
<div class="form-group">
<label>ISBN:</label>
<input class="form-control" type="text" name="book_isbn">
</div>
<div class="form-group">
<label>Pages:</label>
<input class="form-control" type="text" name="book_pages">
</div>
<div class="form-group">
<label>About:</label>
<textarea class="form-control" name="book_about"></textarea>
</div>
<select name="author_id">
@foreach ($authors as $author)
<option value="{{$author->id}}">{{$author->name}} {{$author->surname}}</option>
@endforeach
</select>
@csrf
<button class="btn btn-success" type="submit">ADD</button>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection | 36.708333 | 111 | 0.389898 |
84dd5d8163f9f456c686e999e45ae7ead60e6104 | 2,247 | sql | SQL | 2. Database_Initialisation_Insert_Scripts.sql | hanuseew/MCBAssignment | 31eebad3825684cfc7203916ae0827b4477eb344 | [
"Apache-2.0"
] | null | null | null | 2. Database_Initialisation_Insert_Scripts.sql | hanuseew/MCBAssignment | 31eebad3825684cfc7203916ae0827b4477eb344 | [
"Apache-2.0"
] | null | null | null | 2. Database_Initialisation_Insert_Scripts.sql | hanuseew/MCBAssignment | 31eebad3825684cfc7203916ae0827b4477eb344 | [
"Apache-2.0"
] | null | null | null |
-- define list of KPIs for reporting
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(1, 'ER.FSH.PROD.MT','Total fisheries production (metric tons)','ER_FSH_PROD_MT','ER_FSH_PROD_MT');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(2, 'AG.LND.AGRI.K2','Agricultural land (sq. km)','AG_LND_AGRI_K2','AG_LND_AGRI_K2');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(3, 'IC.REG.DURS','Time required to start a business (days)','IC_REG_DURS','IC_REG_DURS');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(4, 'IC.BUS.NREG ','New businesses registered (number)','IC_BUS_NREG','IC_BUS_NREG');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(5, 'SL.AGR.EMPL.ZS','Employment in agriculture (% of total employment) (modeled ILO estimate)','SL_AGR_EMPL_ZS','SL_AGR_EMPL_ZS');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(6, 'SL.EMP.SELF.ZS','Self-employed, total (% of total employment) (modeled ILO estimate)','SL_EMP_SELF_ZS','SL_EMP_SELF_ZS');
INSERT INTO REF_KPILIST(KPINUMBER, KPICODE, KPIDESCRIPTION, DBCOLUMNNAME, FORMULA)
VALUES(7, 'CPI','Corruption Perception Index','CPI','CPI');
-- define list of reporting countries for Power BI
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('SYC');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('MDV');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('CIV');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('KEN');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('LKA');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('IND');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('SGP');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('AUS');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('DNK');
INSERT INTO REF_REPORTING_COUNTRY(CountryCode) Values('FIN');
-- initialisation of the start year load for fact data
INSERT INTO REF_PARAMETERS(YearStartLoad) values (2010); | 72.483871 | 150 | 0.749444 |
dc160245dbde18467131a7fbfeafe75ac88d44c1 | 137 | lua | Lua | extensions/usb/init.lua | degbug/hammerspoon | 3351062c8f7dc47fc97e8208da344c9185150487 | [
"MIT"
] | 9,367 | 2015-01-02T10:17:23.000Z | 2022-03-31T11:11:44.000Z | extensions/usb/init.lua | degbug/hammerspoon | 3351062c8f7dc47fc97e8208da344c9185150487 | [
"MIT"
] | 2,771 | 2015-01-01T09:20:42.000Z | 2022-03-31T11:33:09.000Z | extensions/usb/init.lua | degbug/hammerspoon | 3351062c8f7dc47fc97e8208da344c9185150487 | [
"MIT"
] | 571 | 2015-01-02T04:02:50.000Z | 2022-03-28T20:29:19.000Z | --- === hs.usb ===
---
--- Inspect USB devices
local usb = require "hs.usb.internal"
usb.watcher = require "hs.usb.watcher"
return usb
| 15.222222 | 38 | 0.642336 |
397143164e29002fcd28adddca62314d72234900 | 14,376 | html | HTML | canovadoc/org/canova/cli/csv/schema/CSVInputSchema.html | YeewenTan/YeewenTan.github.io | 6b6e1f551f4a150d0e7170d8503a74e02beef220 | [
"Apache-2.0"
] | 1 | 2017-05-06T10:52:55.000Z | 2017-05-06T10:52:55.000Z | canovadoc/org/canova/cli/csv/schema/CSVInputSchema.html | YeewenTan/YeewenTan.github.io | 6b6e1f551f4a150d0e7170d8503a74e02beef220 | [
"Apache-2.0"
] | null | null | null | canovadoc/org/canova/cli/csv/schema/CSVInputSchema.html | YeewenTan/YeewenTan.github.io | 6b6e1f551f4a150d0e7170d8503a74e02beef220 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_60) on Sun Jun 19 15:23:06 PDT 2016 -->
<title>CSVInputSchema</title>
<meta name="date" content="2016-06-19">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CSVInputSchema";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/canova/cli/csv/schema/CSVInputSchema.html" target="_top">Frames</a></li>
<li><a href="CSVInputSchema.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.canova.cli.csv.schema</div>
<h2 title="Class CSVInputSchema" class="title">Class CSVInputSchema</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.canova.cli.csv.schema.CSVInputSchema</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="strong">CSVInputSchema</span>
extends java.lang.Object</pre>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#delimiter">delimiter</a></strong></code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#relation">relation</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#CSVInputSchema()">CSVInputSchema</a></strong>()</code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#computeDatasetStatistics()">computeDatasetStatistics</a></strong>()</code>
<div class="block">We call this method once we've scanned the entire dataset once to gather column stats</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#debugPringDatasetStatistics()">debugPringDatasetStatistics</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#debugPrintColumns()">debugPrintColumns</a></strong>()</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#evaluateInputRecord(java.lang.String)">evaluateInputRecord</a></strong>(java.lang.String csvRecordLine)</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema">CSVSchemaColumn</a></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#getColumnSchemaByName(java.lang.String)">getColumnSchemaByName</a></strong>(java.lang.String colName)</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.util.Map<java.lang.String,<a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema">CSVSchemaColumn</a>></code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#getColumnSchemas()">getColumnSchemas</a></strong>()</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#getTransformedVectorSize()">getTransformedVectorSize</a></strong>()</code>
<div class="block">Returns how many columns a newly transformed vector should have</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../../org/canova/cli/csv/schema/CSVInputSchema.html#parseSchemaFile(java.lang.String)">parseSchemaFile</a></strong>(java.lang.String schemaPath)</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="relation">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>relation</h4>
<pre>public java.lang.String relation</pre>
</li>
</ul>
<a name="delimiter">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>delimiter</h4>
<pre>public java.lang.String delimiter</pre>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CSVInputSchema()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CSVInputSchema</h4>
<pre>public CSVInputSchema()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getColumnSchemaByName(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getColumnSchemaByName</h4>
<pre>public <a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema">CSVSchemaColumn</a> getColumnSchemaByName(java.lang.String colName)</pre>
</li>
</ul>
<a name="getColumnSchemas()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getColumnSchemas</h4>
<pre>public java.util.Map<java.lang.String,<a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema">CSVSchemaColumn</a>> getColumnSchemas()</pre>
</li>
</ul>
<a name="parseSchemaFile(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseSchemaFile</h4>
<pre>public void parseSchemaFile(java.lang.String schemaPath)
throws java.lang.Exception</pre>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
<a name="getTransformedVectorSize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getTransformedVectorSize</h4>
<pre>public int getTransformedVectorSize()</pre>
<div class="block">Returns how many columns a newly transformed vector should have</div>
<dl><dt><span class="strong">Returns:</span></dt><dd></dd></dl>
</li>
</ul>
<a name="evaluateInputRecord(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evaluateInputRecord</h4>
<pre>public void evaluateInputRecord(java.lang.String csvRecordLine)
throws java.lang.Exception</pre>
<dl><dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.Exception</code></dd></dl>
</li>
</ul>
<a name="computeDatasetStatistics()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeDatasetStatistics</h4>
<pre>public void computeDatasetStatistics()</pre>
<div class="block">We call this method once we've scanned the entire dataset once to gather column stats</div>
</li>
</ul>
<a name="debugPringDatasetStatistics()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>debugPringDatasetStatistics</h4>
<pre>public void debugPringDatasetStatistics()</pre>
</li>
</ul>
<a name="debugPrintColumns()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>debugPrintColumns</h4>
<pre>public void debugPrintColumns()</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev Class</li>
<li><a href="../../../../../org/canova/cli/csv/schema/CSVSchemaColumn.html" title="class in org.canova.cli.csv.schema"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/canova/cli/csv/schema/CSVInputSchema.html" target="_top">Frames</a></li>
<li><a href="CSVInputSchema.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#field_summary">Field</a> | </li>
<li><a href="#constructor_summary">Constr</a> | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#field_detail">Field</a> | </li>
<li><a href="#constructor_detail">Constr</a> | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| 35.235294 | 230 | 0.648929 |
a6510d7b24c3189f8022a76a2e004b80c2ed0517 | 11,776 | asm | Assembly | src/scoreboard.asm | tina-hoeflich/pong | 2420f504c323582e7f0bf6f51753d062a0674c92 | [
"MIT"
] | null | null | null | src/scoreboard.asm | tina-hoeflich/pong | 2420f504c323582e7f0bf6f51753d062a0674c92 | [
"MIT"
] | null | null | null | src/scoreboard.asm | tina-hoeflich/pong | 2420f504c323582e7f0bf6f51753d062a0674c92 | [
"MIT"
] | null | null | null | # Authors: Miriam Penger, Lena Gerken, Tina Höflich
# function draws the scoreboard of the pong game pixel by pixel using the draw pixel function
# gets:
# a2: the decimal number between 0 and 11 that then are displayed on the bitmap display
# returns:
# -
.text
# Funktion to draw dots that separate the numbers on the scoreboard
# drawing two circles using "draw_circle.asm"
draw_dots:
# allocate Memory:
addi sp, sp,-20
sw a3, (sp)
sw a4, 4 (sp)
sw a5, 8 (sp)
sw a7, 12 (sp)
sw ra, 16 (sp)
# draw dots
li a3, 117
li a4, 14
li a5, 1
li a7, 0xffffff # white
jal draw_circle
li a3, 117
li a4, 20
li a5, 1
li a7, 0xffffff # white
jal draw_circle
# restore and Jump back
lw ra, 16 (sp)
addi sp, sp, 20
ret
# Function to draw left numbers on the scoreboard
# gets:
# a2: number that is displayed on the screen
draw_left_number:
# allocate memory for x0-y1 + color variable
addi sp, sp,-28
sw a2, 0 (sp)
sw a3, 4 (sp)
sw a4, 8 (sp)
sw a5, 12 (sp)
sw a6, 16 (sp)
sw a7, 20 (sp)
sw ra, 24 (sp)
# draw a black 18 to remove numbers:
# ----------- 18-----------
# -1---
li a3, 95
li a4, 10
li a5, 95
li a6, 25
li a7,0
jal draw_line
# -1----
li a3, 110
li a4, 10
li a5, 110
li a6, 25
# -- 8 -----
li a3, 100
li a4, 10
li a5, 100
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
li a7, 0xffffff # white
lw t0, (sp) # input number
switch.start:
# ----------- 0 ------------
switch.0:
li t1, 0
bne t0, t1 switch.1
li a3, 100
li a4, 10
li a5, 100
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
beq zero, zero switch.end
# ----------------1------------
switch.1:
li t1, 1
bne t0, t1 switch.2
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
beq zero, zero switch.end
# ---------------2-------------
switch.2:
li t1, 2
bne t0, t1 switch.3
li a3, 100
li a4, 17
li a5, 100
li a6, 25
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 17
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
# -------------3---------------
switch.3:
li t1, 3
bne t0, t1 switch.4
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
beq zero, zero switch.end
# --------------4-------------
switch.4:
li t1, 4
bne t0, t1 switch.5
li a3, 100
li a4, 10
li a5, 100
li a6, 17
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
beq zero, zero switch.end
# --------------5------------
switch.5:
li t1, 5
bne t0, t1 switch.6
li a3, 100
li a4, 10
li a5, 100
li a6, 17
jal draw_line
li a3, 110
li a4, 17
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
beq zero, zero switch.end
# --------------6------------
switch.6:
li t1, 6
bne t0, t1 switch.7
li a3, 100
li a4, 10
li a5, 100
li a6, 25
jal draw_line
li a3, 110
li a4, 17
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
beq zero, zero switch.end
# --------------7------------
switch.7:
li t1,7
bne t0, t1 switch.8
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
beq zero, zero switch.end
# ----------- 8------------
switch.8:
li t1, 8
bne t0, t1 switch.9
li a3, 100
li a4, 10
li a5, 100
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
beq zero, zero switch.end
# ----------- 9------------
switch.9:
li t1,9
bne t0, t1 switch.10
li a3, 100
li a4, 10
li a5, 100
li a6, 17
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 17
li a5, 110
li a6, 17
jal draw_line
beq zero, zero switch.end
# ----------- 10------------
switch.10:
li t1,10
bne t0, t1 switch.11
# -0----
li a3, 100
li a4, 10
li a5, 100
li a6, 25
jal draw_line
li a3, 100
li a4, 10
li a5, 110
li a6, 10
jal draw_line
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
li a3, 100
li a4, 25
li a5, 110
li a6, 25
jal draw_line
# -1---
li a3, 95
li a4, 10
li a5, 95
li a6, 25
jal draw_line
beq zero, zero switch.end
# ----------- 11-----------
switch.11:
li t1,11
bne t0, t1 switch.end
# -1----
li a3, 110
li a4, 10
li a5, 110
li a6, 25
jal draw_line
# -1---
li a3, 95
li a4, 10
li a5, 95
li a6, 25
jal draw_line
beq zero, zero switch.end
switch.end:
lw ra, 24 (sp)
addi sp, sp, 28
ret
# function to draw right number to the scoreboard
draw_right_number:
# allocate memory for x0-y1 + color variable
addi sp, sp,-28
sw a2, 0 (sp)
sw a3, 4 (sp)
sw a4, 8 (sp)
sw a5, 12 (sp)
sw a6, 16 (sp)
sw a7, 20 (sp)
sw ra, 24 (sp)
# -----------dots---------
# draw a black 18 to remove numbers:
# ----------- 18-----------
# -1---
li a3, 125
li a4, 10
li a5, 125
li a6, 25
li a7,0
jal draw_line
# -1----
li a3, 140
li a4, 10
li a5, 140
li a6, 25
# -- 8 -----
li a3, 130
li a4, 10
li a5, 130
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
li a7, 0xffffff # white
lw t0, (sp) # input number
switch.start_2:
# ----------- 0 ------------
switch.null:
li t1, 0
bne t0, t1 switch.eins
li a3, 130
li a4, 10
li a5, 130
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
beq zero, zero switch.end_2
# ----------------1------------
switch.eins:
li t1, 1
bne t0, t1 switch.zwei
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
beq zero, zero switch.end_2
# ---------------2-------------
switch.zwei:
li t1, 2
bne t0, t1 switch.drei
li a3, 130
li a4, 17
li a5, 130
li a6, 25
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 17
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
# -------------3---------------
switch.drei:
li t1, 3
bne t0, t1 switch.vier
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
beq zero, zero switch.end_2
# --------------4-------------
switch.vier:
li t1, 4
bne t0, t1 switch.fuenf
li a3, 130
li a4, 10
li a5, 130
li a6, 17
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
beq zero, zero switch.end_2
# --------------5------------
switch.fuenf:
li t1, 5
bne t0, t1 switch.sechs
li a3, 130
li a4, 10
li a5, 130
li a6, 17
jal draw_line
li a3, 140
li a4, 17
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
beq zero, zero switch.end_2
# --------------6------------
switch.sechs:
li t1, 6
bne t0, t1 switch.sieben
li a3, 130
li a4, 10
li a5, 130
li a6, 25
jal draw_line
li a3, 140
li a4, 17
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
beq zero, zero switch.end_2
# --------------7------------
switch.sieben:
li t1,7
bne t0, t1 switch.acht
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
beq zero, zero switch.end_2
# ----------- 8------------
switch.acht:
li t1, 8
bne t0, t1 switch.neun
li a3, 130
li a4, 10
li a5, 130
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
beq zero, zero switch.end_2
# ----------- 9------------
switch.neun:
li t1,9
bne t0, t1 switch.zehn
li a3, 130
li a4, 10
li a5, 130
li a6, 17
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 17
li a5, 140
li a6, 17
jal draw_line
beq zero, zero switch.end_2
# ----------- 10------------
switch.zehn:
li t1,10
bne t0, t1 switch.elf
# -0----
li a3, 130
li a4, 10
li a5, 130
li a6, 25
jal draw_line
li a3, 130
li a4, 10
li a5, 140
li a6, 10
jal draw_line
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
li a3, 130
li a4, 25
li a5, 140
li a6, 25
jal draw_line
# -1---
li a3, 125
li a4, 10
li a5, 125
li a6, 25
jal draw_line
beq zero, zero switch.end_2
# ----------- 11-----------
switch.elf:
li t1,11
bne t0, t1 switch.end_2
# -1----
li a3, 140
li a4, 10
li a5, 140
li a6, 25
jal draw_line
# -1---
li a3, 125
li a4, 10
li a5, 125
li a6, 25
jal draw_line
beq zero, zero switch.end_2
switch.end_2:
lw ra, 24 (sp)
addi sp, sp, 28
ret
#function to initialize the scoreboard with 0 : 0
init_scoreboard:
addi sp, sp, -4
sw ra ,(sp)
jal draw_dots
li a2,0
jal draw_left_number
li a2,0
jal draw_right_number
lw ra, (sp)
addi sp, sp, 4
ret | 15.175258 | 93 | 0.553244 |
c2bc1495c3a0c24cd344c4d8f8af97389cec3134 | 774 | go | Go | plugin/kemper.com.br.plugin.mongodb.user/funcGetByEmail.go | helmutkemper/sitePessoal | 7cabb4185af0faed52c0078fc2695a0f2072201c | [
"Apache-2.0"
] | null | null | null | plugin/kemper.com.br.plugin.mongodb.user/funcGetByEmail.go | helmutkemper/sitePessoal | 7cabb4185af0faed52c0078fc2695a0f2072201c | [
"Apache-2.0"
] | null | null | null | plugin/kemper.com.br.plugin.mongodb.user/funcGetByEmail.go | helmutkemper/sitePessoal | 7cabb4185af0faed52c0078fc2695a0f2072201c | [
"Apache-2.0"
] | null | null | null | package main
import (
"github.com/helmutkemper/kemper.com.br.module.dataformat"
"github.com/helmutkemper/kemper.com.br.plugin.dataaccess.constants"
"github.com/helmutkemper/util"
"go.mongodb.org/mongo-driver/mongo"
)
func (e *MongoDBUser) GetByEmail(mail string) (user dataformat.User, err error) {
var cursor *mongo.Cursor
var userSlice []dataformat.User
e.ClientUser = e.Client.Database(constants.KMongoDBDatabase).Collection(constants.KMongoDBCollectionUser)
user = dataformat.User{Mail: mail}
cursor, err = e.ClientUser.Find(e.Ctx, user.GetMailAsBSonQuery())
if err != nil {
util.TraceToLog()
return
}
err = cursor.All(e.Ctx, &userSlice)
if err != nil {
util.TraceToLog()
return
}
if len(userSlice) != 0 {
user = userSlice[0]
}
return
}
| 22.764706 | 106 | 0.732558 |
dc6d53e69a233c266c5f1339179e5f29460faefa | 1,645 | swift | Swift | Triggers/Class/Controller/sdmGameController.swift | PJCSpencer/TriggerNode | 2692647a0e58f0426551ebe883dd7beb874ba98b | [
"MIT"
] | null | null | null | Triggers/Class/Controller/sdmGameController.swift | PJCSpencer/TriggerNode | 2692647a0e58f0426551ebe883dd7beb874ba98b | [
"MIT"
] | null | null | null | Triggers/Class/Controller/sdmGameController.swift | PJCSpencer/TriggerNode | 2692647a0e58f0426551ebe883dd7beb874ba98b | [
"MIT"
] | 1 | 2020-04-04T20:10:53.000Z | 2020-04-04T20:10:53.000Z | //
// sdmGameController.swift
// Triggers
//
// Created by Peter Spencer on 22/10/2018.
// Copyright © 2018 Peter Spencer. All rights reserved.
//
import UIKit
import SceneKit
class GameController: UIViewController
{
// MARK: - Property(s)
var game: Game?
private var observation: NSKeyValueObservation?
// MARK: - Cleaning Up
deinit
{ self.observation?.invalidate() }
// MARK: - Managing the View
override func loadView()
{
let rootView = GameView(frame: UIScreen.main.bounds, options: [:])
self.view = rootView
}
// MARK: - Responding to View Events
override func viewDidAppear(_ animated: Bool)
{
super.viewDidAppear(animated)
guard let gameView = self.view as? GameView else
{ return }
self.game = Game()
self.game?.load()
self.observation = self.game?.trigger.attach(self.handler)
gameView.scene = self.game?.scene
gameView.pointOfView = self.game?.camera
}
}
// MARK: - Action(s)
extension GameController
{
func handler(_ trigger: TriggerNode,
_ change: NSKeyValueObservedChange<TriggerEvent>)
{
if let status = change.newValue?.status
{
SCNTransaction.begin()
SCNTransaction.animationDuration = 0.3
SCNTransaction.animationTimingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
self.game?.box.position.y = (status == .begin ? 3.0 : 1.0)
SCNTransaction.commit()
}
}
}
| 22.847222 | 121 | 0.6 |
e5545a65a6a3f4d8b82301d25a6d54f01f3d7fa5 | 1,104 | ts | TypeScript | src/app/shared/components/event/event.component.spec.ts | jkevingutierrez/angularcolombia.com | 6e4b1b0a7d743b76684ea438bf21ed5ab18284da | [
"MIT"
] | null | null | null | src/app/shared/components/event/event.component.spec.ts | jkevingutierrez/angularcolombia.com | 6e4b1b0a7d743b76684ea438bf21ed5ab18284da | [
"MIT"
] | null | null | null | src/app/shared/components/event/event.component.spec.ts | jkevingutierrez/angularcolombia.com | 6e4b1b0a7d743b76684ea438bf21ed5ab18284da | [
"MIT"
] | null | null | null | import { AngularFireDatabase } from 'angularfire2/database';
import { AuthenticationService } from './../../../core/services/authentication.service';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EventComponent } from './event.component';
class mockAuthenticationService {}
class mockAngularFireDatabase {}
describe('EventComponent', () => {
let component: EventComponent;
let fixture: ComponentFixture<EventComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EventComponent],
providers: [
{provide: AuthenticationService, useClass: mockAuthenticationService},
{provide: AngularFireDatabase, useClass: mockAngularFireDatabase}
],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EventComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
| 30.666667 | 88 | 0.699275 |
8a5c2afb2c2db7e04a13ce34055fd88ebafbc4e5 | 196 | dart | Dart | lib/models/color.dart | taher-fawaz/flutter_ecommerce_app | ad5c07ae5c82f23ca1704a7e87c942c93be10ced | [
"MIT"
] | null | null | null | lib/models/color.dart | taher-fawaz/flutter_ecommerce_app | ad5c07ae5c82f23ca1704a7e87c942c93be10ced | [
"MIT"
] | null | null | null | lib/models/color.dart | taher-fawaz/flutter_ecommerce_app | ad5c07ae5c82f23ca1704a7e87c942c93be10ced | [
"MIT"
] | null | null | null |
import 'package:flutter/cupertino.dart';
Color mainColor =Color(0xffEDF0FF);
Color mainColorDark =Color(0xff99ADFF);
Color mainBlue =Color(0xff365EFF);
Color mainWhiteDark =Color(0xffFDFDFD);
| 19.6 | 40 | 0.795918 |
81e1082c02c84d688f97eb502ca3ee773526ad3c | 1,829 | go | Go | common/util.go | cg-/go-hello-bench | d67a4c284f6194acc07200b1b1dee33be56784a6 | [
"MIT"
] | null | null | null | common/util.go | cg-/go-hello-bench | d67a4c284f6194acc07200b1b1dee33be56784a6 | [
"MIT"
] | null | null | null | common/util.go | cg-/go-hello-bench | d67a4c284f6194acc07200b1b1dee33be56784a6 | [
"MIT"
] | null | null | null | /*
Random utility functions used in various packages
*/
package common
import (
"bytes"
"os"
"os/exec"
"github.com/op/go-logging"
)
var log = logging.MustGetLogger("go-hello-bench")
/*
CheckIfSuperuser returns true if the user is running as Superuser, otherwise
it will return false.
*/
func CheckIfSuperuser() bool {
if os.Getegid() != 0 {
return false
}
return true
}
/*
IsInStringSlice will return true if a string matches a string inside a slice,
otherwise it will return false.
*/
func IsInStringSlice(s string, slice []string) bool {
for i := range slice {
if slice[i] == s {
return true
}
}
return false
}
/*
CheckFatal checks an error and crashes the program if it exists with a message to the log.
*/
func CheckFatal(e error) {
if e != nil {
log.Fatal(e.Error())
}
}
/*
CheckFatal checks an error and notes a message to the log if it exists.
*/
func CheckLog(e error) {
if e != nil {
log.Error(e.Error())
}
}
/*
RunCmd runs a command using exec, and returns what was printed to Stdout and Stderr as strings. If an error was
encountered, it is returned as well.
*/
func RunCmd(cmd string, args []string) (err error, outputStr, errorStr string) {
var outputBuf bytes.Buffer
var errorBuf bytes.Buffer
argsStr := ""
for i := range args {
argsStr += args[i]
if i != len(args)-1 {
argsStr += " "
}
}
fullCmd := cmd + " " + argsStr
log.Infof("About to exec: [%s]", fullCmd)
cmdVar := exec.Command(cmd, args...)
cmdVar.Stdout = &outputBuf
cmdVar.Stderr = &errorBuf
errVar := cmdVar.Run()
if errVar != nil {
log.Infof("Got back err[%s], out[%s], err[%s]", errVar.Error(), outputBuf.String(), errorBuf.String())
} else {
log.Infof("Got back err[nil], out[%s], err[%s]", outputBuf.String(), errorBuf.String())
}
return errVar, outputBuf.String(), errorBuf.String()
}
| 21.267442 | 111 | 0.674139 |
393037434373289c91d7e1480ffef506f2a090ea | 456 | html | HTML | Backend/static/default_index.html | introlab/opentera-webportal-service | 9db6a5a4d657630232a3a08d0c9f3360e78785d0 | [
"Apache-2.0"
] | null | null | null | Backend/static/default_index.html | introlab/opentera-webportal-service | 9db6a5a4d657630232a3a08d0c9f3360e78785d0 | [
"Apache-2.0"
] | null | null | null | Backend/static/default_index.html | introlab/opentera-webportal-service | 9db6a5a4d657630232a3a08d0c9f3360e78785d0 | [
"Apache-2.0"
] | null | null | null | <html>
<head>
<title>WebPortalService - Fallback page</title>
</head>
<body>
<h1>Web Portal - Default page</h1>
<p>If you see this, the Web Portal service is working properly... almost!</p>
<p>The website files are missing, probably because they were not generated and moved to the appropriate place.</p>
<p>Please see the instructions in the "frontend" folder for more information on how to generate and copy the website structure.</p>
</body>
</html> | 41.454545 | 131 | 0.739035 |
260f4eec8ea81f3c34bfdce5cbba8cf4b4fcd00d | 446 | java | Java | starter/critter/src/main/java/com/udacity/jdnd/course3/critter/pet/PetRepository.java | nxdf2015/critter | 285dfb9c5b173a19468e1627b3c699e3ae6cd3bb | [
"MIT"
] | null | null | null | starter/critter/src/main/java/com/udacity/jdnd/course3/critter/pet/PetRepository.java | nxdf2015/critter | 285dfb9c5b173a19468e1627b3c699e3ae6cd3bb | [
"MIT"
] | null | null | null | starter/critter/src/main/java/com/udacity/jdnd/course3/critter/pet/PetRepository.java | nxdf2015/critter | 285dfb9c5b173a19468e1627b3c699e3ae6cd3bb | [
"MIT"
] | null | null | null | package com.udacity.jdnd.course3.critter.pet;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface PetRepository extends JpaRepository<PetEntity,Long> {
@Query("select p from PetEntity p join p.owner o where o.id = ?1")
List<PetEntity> findPetByOwner(long ownerId);
}
| 29.733333 | 71 | 0.795964 |
277d06fbfde394119a885e697d4a1f89cc8da0ea | 2,861 | dart | Dart | test/pages/calculator_page_test.dart | nikkijuk/flutter-bmi-calculator-app | 2dcdfe85555568b3f4f6a0580bbecb83c4319f92 | [
"Apache-2.0"
] | null | null | null | test/pages/calculator_page_test.dart | nikkijuk/flutter-bmi-calculator-app | 2dcdfe85555568b3f4f6a0580bbecb83c4319f92 | [
"Apache-2.0"
] | null | null | null | test/pages/calculator_page_test.dart | nikkijuk/flutter-bmi-calculator-app | 2dcdfe85555568b3f4f6a0580bbecb83c4319f92 | [
"Apache-2.0"
] | null | null | null | //@Skip('currently failing (reason: FILL HERE)')
// Left skip annotation here to wait next time when test lifecycle has problems
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:bmi_calculator_app/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('BMI calculator smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(BmiCalculatorApp());
// quick fix: wait for the localization delegate's Future to complete.
// read also: https://github.com/flutter/flutter/issues/22193
// summary: "Assets are failing to load in tests when they are over 10Kb.
// This is really confusing and hard to debug behaviour."
await tester.pumpAndSettle();
// check 'height' and 'weight' input widgets are there
expect(find.byKey (const ValueKey('height')), findsOneWidget);
expect(find.byKey (const ValueKey('weight')), findsOneWidget);
// check 'bmi' output widgets is not there
expect(find.byKey (const ValueKey('bmi')), findsNothing);
expect(find.byKey (const ValueKey('bmi-name')), findsNothing);
// check 'not-calculated' output widget is there
expect(find.byKey (const ValueKey('not-calculated')), findsOneWidget);
// check that "not calculated" text is visible
expect(find.text('not calculated'), findsOneWidget);
// set height
await tester.enterText(find.byKey (const ValueKey('height')), '170');
await tester.pump(); // trigger frame rendering
// part set, bmi not calculated
expect(find.text('not calculated'), findsOneWidget);
// set weight
await tester.enterText(find.byKey (const ValueKey('weight')), '70');
await tester.pump(); // trigger frame rendering
// check "bmi" is shown
expect(find.byKey(const ValueKey('bmi')), findsOneWidget);
expect(find.byKey(const ValueKey('bmi-name')), findsOneWidget);
// print out result field - very primitive debug option, works with me
//debugPrint (find.byKey(ValueKey("bmi")).evaluate().join(","));
//debugPrint (find.byKey(ValueKey("bmi-name")).evaluate().join(","));
// check not calculated is not shown
expect(find.byKey(const ValueKey('not-calculated')), findsNothing);
// bmi should have now changed after setting value to fields and rendering
expect(find.text('not calculated'), findsNothing);
expect(find.text('bmi is 24.22'), findsOneWidget);
expect(find.text('Normal Weight'), findsOneWidget);
});
}
| 39.736111 | 80 | 0.707095 |
86313c2c0439b868b16b02758f3077883e520892 | 632 | asm | Assembly | oeis/271/A271494.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/271/A271494.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/271/A271494.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A271494: Expansion of (1+16*x)/((1+4*x)*(1-8*x)).
; Submitted by Jamie Morken(s1.)
; 1,20,112,1088,7936,66560,520192,4210688,33488896,268697600,2146435072,17184063488,137422176256,1099578736640,8795824586752,70369817919488,562945658454016,4503616807239680,36028728299487232,288230651029618688,2305841909702066176,18446748471756062720,147573934997490368512,1180591691086155481088,9444732684264313716736,75557864851814230261760,604462905303714959982592,4835703296472915208306688,38685626155610539552669696,309485010109575444876492800,2475880077417839045191401472
mov $2,-4
pow $2,$0
mov $3,8
pow $3,$0
mul $3,2
sub $3,$2
mov $0,$3
| 52.666667 | 477 | 0.841772 |
d061e3b024c45cd5fd28eae279f54c31a17cebdb | 1,034 | swift | Swift | Volume/Supporting/AppDelegate.swift | cuappdev/volume-ios | 1eb19d0a9d66966ff41595a48e6c34929e5cf263 | [
"MIT"
] | 5 | 2020-11-09T19:46:30.000Z | 2022-01-28T04:00:03.000Z | Volume/Supporting/AppDelegate.swift | cuappdev/volume-ios | 1eb19d0a9d66966ff41595a48e6c34929e5cf263 | [
"MIT"
] | 31 | 2020-10-29T18:42:06.000Z | 2022-03-31T17:10:26.000Z | Volume/Supporting/AppDelegate.swift | cuappdev/volume-ios | 1eb19d0a9d66966ff41595a48e6c34929e5cf263 | [
"MIT"
] | null | null | null | //
// AppDelegate.swift
// Volume
//
// Created by Hanzheng Li on 9/29/21.
// Copyright © 2021 Cornell AppDev. All rights reserved.
//
import UIKit
import UserNotifications
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let deviceTokenString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
print("UIApplicationDelegate didRegisterForRemoteNotifications with deviceToken: \(deviceTokenString)")
// send device token to backend
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
print("UIApplicationDelegate didRegisterForRemoteNotifications with error: \(error.localizedDescription)")
}
}
| 38.296296 | 152 | 0.746615 |
0a0d35188f40413527f57491186877753e7f1c5a | 262 | h | C | SuperSaaSObjCSDK/Classes/Api/SSSBaseApi.h | TertiumQuid/supersaas-objc-sdk | fb873f5fc3e3b98d232c2f54eb0a1cd6862067a4 | [
"MIT"
] | null | null | null | SuperSaaSObjCSDK/Classes/Api/SSSBaseApi.h | TertiumQuid/supersaas-objc-sdk | fb873f5fc3e3b98d232c2f54eb0a1cd6862067a4 | [
"MIT"
] | null | null | null | SuperSaaSObjCSDK/Classes/Api/SSSBaseApi.h | TertiumQuid/supersaas-objc-sdk | fb873f5fc3e3b98d232c2f54eb0a1cd6862067a4 | [
"MIT"
] | null | null | null | #import <Foundation/Foundation.h>
@class SSSClient;
@interface SSSBaseApi : NSObject
- (id)initWithClient:(SSSClient*)client;
- (NSString *)formatDateString:(NSDate *)date;
- (NSString *)formatIntString:(NSInteger)integer;
@property SSSClient *client;
@end
| 18.714286 | 49 | 0.755725 |
cb1f1c5e33e9ed81048d18ba196e24b6f6f7c185 | 6,445 | go | Go | core/connector/protobuf.go | sutaakar/rhpam-kogito-operator | b6f011523122cfe6306efdaed46335d89f1ea24c | [
"Apache-2.0"
] | null | null | null | core/connector/protobuf.go | sutaakar/rhpam-kogito-operator | b6f011523122cfe6306efdaed46335d89f1ea24c | [
"Apache-2.0"
] | null | null | null | core/connector/protobuf.go | sutaakar/rhpam-kogito-operator | b6f011523122cfe6306efdaed46335d89f1ea24c | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 Red Hat, Inc. and/or its affiliates
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package connector
import (
"github.com/kiegroup/kogito-cloud-operator/api"
"github.com/kiegroup/kogito-cloud-operator/core/client/kubernetes"
"github.com/kiegroup/kogito-cloud-operator/core/framework"
"github.com/kiegroup/kogito-cloud-operator/core/manager"
"github.com/kiegroup/kogito-cloud-operator/core/operator"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"path"
)
const (
// Default Proto Buf file path
defaultProtobufMountPath = operator.KogitoHomeDir + "/data/protobufs"
// Proto Buf folder env
protoBufKeyFolder string = "KOGITO_PROTOBUF_FOLDER"
// Proto Buf watch env
protoBufKeyWatch string = "KOGITO_PROTOBUF_WATCH"
// ConfigMapProtoBufEnabledLabelKey label key used by configMaps that are meant to hold protobuf files
ConfigMapProtoBufEnabledLabelKey = "kogito-protobuf"
)
// ProtoBufHandler ...
type ProtoBufHandler interface {
MountProtoBufConfigMapsOnDeployment(deployment *appsv1.Deployment) (err error)
MountProtoBufConfigMapOnDataIndex(kogitoRuntime api.KogitoRuntimeInterface) (err error)
}
type protoBufHandler struct {
*operator.Context
supportingServiceHandler manager.KogitoSupportingServiceHandler
}
// NewProtoBufHandler ...
func NewProtoBufHandler(context *operator.Context, supportingServiceHandler manager.KogitoSupportingServiceHandler) ProtoBufHandler {
return &protoBufHandler{
Context: context,
supportingServiceHandler: supportingServiceHandler,
}
}
// MountProtoBufConfigMapsOnDeployment mounts protobuf configMaps from KogitoRuntime services into the given deployment
func (p *protoBufHandler) MountProtoBufConfigMapsOnDeployment(deployment *appsv1.Deployment) (err error) {
cms, err := p.getProtoBufConfigMapsForAllRuntimeServices(deployment.Namespace)
if err != nil || len(cms.Items) == 0 {
return err
}
for _, cm := range cms.Items {
appendProtoBufVolumeIntoDeployment(deployment, cm)
appendProtoBufVolumeMountIntoDeployment(deployment, cm)
}
updateProtoBufPropInToDeploymentEnv(deployment)
return nil
}
// MountProtoBufConfigMapOnDataIndex mounts protobuf configMaps from KogitoRuntime services into the given deployment instance of DataIndex
func (p *protoBufHandler) MountProtoBufConfigMapOnDataIndex(kogitoRuntime api.KogitoRuntimeInterface) (err error) {
supportingServiceManager := manager.NewKogitoSupportingServiceManager(p.Context, p.supportingServiceHandler)
deployment, err := supportingServiceManager.FetchKogitoSupportingServiceDeployment(kogitoRuntime.GetNamespace(), api.DataIndex)
if err != nil || deployment == nil {
return
}
cms, err := p.getProtoBufConfigMapsForSpecificRuntimeService(kogitoRuntime)
if err != nil || len(cms.Items) == 0 {
return
}
for _, cm := range cms.Items {
appendProtoBufVolumeIntoDeployment(deployment, cm)
appendProtoBufVolumeMountIntoDeployment(deployment, cm)
}
updateProtoBufPropInToDeploymentEnv(deployment)
return kubernetes.ResourceC(p.Client).Update(deployment)
}
func appendProtoBufVolumeIntoDeployment(deployment *appsv1.Deployment, cm corev1.ConfigMap) {
for _, volume := range deployment.Spec.Template.Spec.Volumes {
if volume.Name == cm.Name {
return
}
}
// append volume if its not exists
deployment.Spec.Template.Spec.Volumes =
append(deployment.Spec.Template.Spec.Volumes, corev1.Volume{
Name: cm.Name,
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
DefaultMode: &framework.ModeForProtoBufConfigMapVolume,
LocalObjectReference: corev1.LocalObjectReference{
Name: cm.Name,
},
},
},
})
}
func appendProtoBufVolumeMountIntoDeployment(deployment *appsv1.Deployment, cm corev1.ConfigMap) {
for fileName := range cm.Data {
mountPath := path.Join(defaultProtobufMountPath, cm.Labels["app"], fileName)
for _, volumeMount := range deployment.Spec.Template.Spec.Containers[0].VolumeMounts {
if volumeMount.MountPath == mountPath {
return
}
}
// append volume mount if its not exists
deployment.Spec.Template.Spec.Containers[0].VolumeMounts =
append(deployment.Spec.Template.Spec.Containers[0].VolumeMounts, corev1.VolumeMount{
Name: cm.Name,
MountPath: mountPath,
SubPath: fileName,
})
}
}
func updateProtoBufPropInToDeploymentEnv(deployment *appsv1.Deployment) {
if len(deployment.Spec.Template.Spec.Volumes) > 0 {
framework.SetEnvVar(protoBufKeyWatch, "true", &deployment.Spec.Template.Spec.Containers[0])
framework.SetEnvVar(protoBufKeyFolder, defaultProtobufMountPath, &deployment.Spec.Template.Spec.Containers[0])
} else {
framework.SetEnvVar(protoBufKeyWatch, "false", &deployment.Spec.Template.Spec.Containers[0])
framework.SetEnvVar(protoBufKeyFolder, "", &deployment.Spec.Template.Spec.Containers[0])
}
}
// getProtoBufConfigMapsForAllRuntimeServices will return every configMap labeled as "protobuf=true" in the given namespace
func (p *protoBufHandler) getProtoBufConfigMapsForAllRuntimeServices(namespace string) (*corev1.ConfigMapList, error) {
cms := &corev1.ConfigMapList{}
if err := kubernetes.ResourceC(p.Client).ListWithNamespaceAndLabel(namespace, cms, map[string]string{ConfigMapProtoBufEnabledLabelKey: "true"}); err != nil {
return nil, err
}
return cms, nil
}
// getProtoBufConfigMapsForAllRuntimeServices will return every configMap labeled as "protobuf=true" in the given namespace
func (p *protoBufHandler) getProtoBufConfigMapsForSpecificRuntimeService(kogitoRuntime api.KogitoRuntimeInterface) (*corev1.ConfigMapList, error) {
cms := &corev1.ConfigMapList{}
labelMaps := map[string]string{
ConfigMapProtoBufEnabledLabelKey: "true",
framework.LabelAppKey: kogitoRuntime.GetName(),
}
if err := kubernetes.ResourceC(p.Client).ListWithNamespaceAndLabel(kogitoRuntime.GetNamespace(), cms, labelMaps); err != nil {
return nil, err
}
return cms, nil
}
| 39.29878 | 158 | 0.780915 |
86f87b9307246101d53c6b8b048115cec178ac18 | 48,548 | rs | Rust | fyrox-core/src/pool.rs | jackos/Fyrox | 4b293733bda8e1a0a774aaf82554ac8930afdd8b | [
"MIT"
] | 1 | 2021-12-14T20:01:33.000Z | 2021-12-14T20:01:33.000Z | fyrox-core/src/pool.rs | jackos/Fyrox | 4b293733bda8e1a0a774aaf82554ac8930afdd8b | [
"MIT"
] | null | null | null | fyrox-core/src/pool.rs | jackos/Fyrox | 4b293733bda8e1a0a774aaf82554ac8930afdd8b | [
"MIT"
] | null | null | null | //! A generational arena - a contiguous growable array type which allows removing
//! from the middle without shifting and therefore without invalidating other indices.
//!
//! Pool is a contiguous block of memory with fixed-size entries, each entry can be
//! either vacant or occupied. When you put an object into the pool you get a handle to
//! that object. You can use that handle later on to borrow a reference to an object.
//! A handle can point to some object or be invalid, this may look similar to raw
//! pointers, but there is two major differences:
//!
//! 1) We can check if a handle is valid before accessing the object it might point to.
//! 2) We can ensure the handle we're using is still valid for the object it points to
//! to make sure it hasn't been replaced with a different object on the same position.
//! Each handle stores a special field called generation which is shared across the entry
//! and the handle, so the handle is valid if these fields are the same on both the entry
//! and the handle. This protects from situations where you have a handle that has
//! a valid index of a record, but the payload in this record has been replaced.
//!
//! Contiguous memory block increases efficiency of memory operations - the CPU will
//! load portions of data into its cache piece by piece, it will be free from any
//! indirections that might cause cache invalidation. This is the so called cache
//! friendliness.
#![allow(clippy::unneeded_field_pattern)]
use crate::{
inspect::{Inspect, PropertyInfo},
visitor::{Visit, VisitResult, Visitor},
};
use std::{
any::TypeId,
fmt::{Debug, Display, Formatter},
future::Future,
hash::{Hash, Hasher},
iter::FromIterator,
marker::PhantomData,
ops::{Index, IndexMut},
};
const INVALID_GENERATION: u32 = 0;
pub trait PayloadContainer: Sized {
type Element: Sized;
fn new_empty() -> Self;
fn new(element: Self::Element) -> Self;
fn is_some(&self) -> bool;
fn as_ref(&self) -> Option<&Self::Element>;
fn as_mut(&mut self) -> Option<&mut Self::Element>;
fn replace(&mut self, element: Self::Element) -> Option<Self::Element>;
fn take(&mut self) -> Option<Self::Element>;
}
impl<T> PayloadContainer for Option<T> {
type Element = T;
fn new_empty() -> Self {
Self::None
}
fn new(element: Self::Element) -> Self {
Self::Some(element)
}
fn is_some(&self) -> bool {
Option::is_some(self)
}
fn as_ref(&self) -> Option<&Self::Element> {
Option::as_ref(self)
}
fn as_mut(&mut self) -> Option<&mut Self::Element> {
Option::as_mut(self)
}
fn replace(&mut self, element: Self::Element) -> Option<Self::Element> {
Option::replace(self, element)
}
fn take(&mut self) -> Option<Self::Element> {
Option::take(self)
}
}
/// Pool allows to create as many objects as you want in contiguous memory
/// block. It allows to create and delete objects much faster than if they'll
/// be allocated on heap. Also since objects stored in contiguous memory block
/// they can be effectively accessed because such memory layout is cache-friendly.
#[derive(Debug)]
pub struct Pool<T, P = Option<T>>
where
T: Sized,
P: PayloadContainer<Element = T>,
{
records: Vec<PoolRecord<T, P>>,
free_stack: Vec<u32>,
}
impl<T: PartialEq> PartialEq for Pool<T> {
fn eq(&self, other: &Self) -> bool {
self.records == other.records
}
}
/// Handle is some sort of non-owning reference to content in a pool. It stores
/// index of object and additional information that allows to ensure that handle
/// is still valid (points to the same object as when handle was created).
pub struct Handle<T> {
/// Index of object in pool.
index: u32,
/// Generation number, if it is same as generation of pool record at
/// index of handle then this is valid handle.
generation: u32,
/// Type holder.
type_marker: PhantomData<T>,
}
impl<T: 'static> Inspect for Handle<T> {
fn properties(&self) -> Vec<PropertyInfo<'_>> {
vec![
PropertyInfo {
owner_type_id: TypeId::of::<Self>(),
name: "index",
display_name: "Index",
value: &self.index,
read_only: true,
min_value: None,
max_value: None,
step: None,
precision: None,
description: "Index of an object in a pool.".to_string(),
is_modified: false,
},
PropertyInfo {
owner_type_id: TypeId::of::<Self>(),
name: "generation",
display_name: "Generation",
value: &self.generation,
read_only: true,
min_value: None,
max_value: None,
step: None,
precision: None,
description: "Generation of an object in a pool.".to_string(),
is_modified: false,
},
]
}
}
unsafe impl<T> Send for Handle<T> {}
unsafe impl<T> Sync for Handle<T> {}
impl<T> Display for Handle<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}:{}", self.index, self.generation)
}
}
/// Type-erased handle.
#[derive(Copy, Clone, Debug, Ord, PartialOrd, PartialEq, Eq, Hash, Inspect)]
pub struct ErasedHandle {
/// Index of object in pool.
#[inspect(read_only)]
index: u32,
/// Generation number, if it is same as generation of pool record at
/// index of handle then this is valid handle.
#[inspect(read_only)]
generation: u32,
}
impl Default for ErasedHandle {
fn default() -> Self {
Self::none()
}
}
impl<T> From<ErasedHandle> for Handle<T> {
fn from(erased_handle: ErasedHandle) -> Self {
Handle {
index: erased_handle.index,
generation: erased_handle.generation,
type_marker: PhantomData,
}
}
}
impl<T> From<Handle<T>> for ErasedHandle {
fn from(h: Handle<T>) -> Self {
Self {
index: h.index,
generation: h.generation,
}
}
}
impl Visit for ErasedHandle {
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
visitor.enter_region(name)?;
self.index.visit("Index", visitor)?;
self.generation.visit("Generation", visitor)?;
visitor.leave_region()
}
}
impl ErasedHandle {
pub fn none() -> Self {
Self {
index: 0,
generation: INVALID_GENERATION,
}
}
pub fn new(index: u32, generation: u32) -> Self {
Self { index, generation }
}
#[inline(always)]
pub fn is_some(&self) -> bool {
self.generation != INVALID_GENERATION
}
#[inline(always)]
pub fn is_none(&self) -> bool {
!self.is_some()
}
#[inline(always)]
pub fn index(self) -> u32 {
self.index
}
#[inline(always)]
pub fn generation(self) -> u32 {
self.generation
}
}
impl<T> Visit for Handle<T> {
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
visitor.enter_region(name)?;
self.index.visit("Index", visitor)?;
self.generation.visit("Generation", visitor)?;
visitor.leave_region()
}
}
impl<T> Default for Handle<T> {
fn default() -> Self {
Self::NONE
}
}
impl<T> Debug for Handle<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "[Idx: {}; Gen: {}]", self.index, self.generation)
}
}
#[derive(Debug)]
struct PoolRecord<T, P = Option<T>>
where
T: Sized,
P: PayloadContainer<Element = T>,
{
/// Generation number, used to keep info about lifetime. The handle is valid
/// only if record it points to is of the same generation as the pool record.
/// Notes: Zero is unknown generation used for None handles.
generation: u32,
/// Actual payload.
payload: P,
}
impl<T: PartialEq> PartialEq for PoolRecord<T> {
fn eq(&self, other: &Self) -> bool {
self.generation == other.generation && self.payload == other.payload
}
}
impl<T, P> Default for PoolRecord<T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
fn default() -> Self {
Self {
generation: INVALID_GENERATION,
payload: P::new_empty(),
}
}
}
impl<T, P> Visit for PoolRecord<T, P>
where
T: Visit + 'static,
P: PayloadContainer<Element = T> + Visit,
{
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
visitor.enter_region(name)?;
self.generation.visit("Generation", visitor)?;
self.payload.visit("Payload", visitor)?;
visitor.leave_region()
}
}
impl<T> Clone for Handle<T> {
fn clone(&self) -> Handle<T> {
Handle {
index: self.index,
generation: self.generation,
type_marker: PhantomData,
}
}
}
impl<T> Copy for Handle<T> {}
impl<T> Eq for Handle<T> {}
impl<T> PartialEq for Handle<T> {
fn eq(&self, other: &Handle<T>) -> bool {
self.generation == other.generation && self.index == other.index
}
}
impl<T, P> Visit for Pool<T, P>
where
T: Visit + 'static,
P: PayloadContainer<Element = T> + Default + Visit + 'static,
{
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
visitor.enter_region(name)?;
self.records.visit("Records", visitor)?;
self.free_stack.visit("FreeStack", visitor)?;
visitor.leave_region()
}
}
impl<T> Hash for Handle<T> {
fn hash<H: Hasher>(&self, state: &mut H) {
self.index.hash(state);
self.generation.hash(state);
}
}
impl<T> Handle<T> {
pub const NONE: Handle<T> = Handle {
index: 0,
generation: INVALID_GENERATION,
type_marker: PhantomData,
};
#[inline(always)]
pub fn is_none(self) -> bool {
self.index == 0 && self.generation == INVALID_GENERATION
}
#[inline(always)]
pub fn is_some(self) -> bool {
!self.is_none()
}
#[inline(always)]
pub fn index(self) -> u32 {
self.index
}
#[inline(always)]
pub fn generation(self) -> u32 {
self.generation
}
#[inline(always)]
pub fn new(index: u32, generation: u32) -> Self {
Handle {
index,
generation,
type_marker: PhantomData,
}
}
}
impl<T> Default for Pool<T>
where
T: 'static,
{
fn default() -> Self {
Self::new()
}
}
#[derive(Debug)]
pub struct Ticket<T> {
index: u32,
marker: PhantomData<T>,
}
impl<T: Clone> Clone for PoolRecord<T> {
fn clone(&self) -> Self {
Self {
generation: self.generation,
payload: self.payload.clone(),
}
}
}
impl<T: Clone> Clone for Pool<T> {
fn clone(&self) -> Self {
Self {
records: self.records.clone(),
free_stack: self.free_stack.clone(),
}
}
}
impl<T, P> Pool<T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
#[inline]
pub fn new() -> Self {
Pool {
records: Vec::new(),
free_stack: Vec::new(),
}
}
#[inline]
pub fn with_capacity(capacity: u32) -> Self {
let capacity = usize::try_from(capacity).expect("capacity overflowed usize");
Pool {
records: Vec::with_capacity(capacity),
free_stack: Vec::new(),
}
}
fn records_len(&self) -> u32 {
u32::try_from(self.records.len()).expect("Number of records overflowed u32")
}
fn records_get(&self, index: u32) -> Option<&PoolRecord<T, P>> {
let index = usize::try_from(index).expect("Index overflowed usize");
self.records.get(index)
}
fn records_get_mut(&mut self, index: u32) -> Option<&mut PoolRecord<T, P>> {
let index = usize::try_from(index).expect("Index overflowed usize");
self.records.get_mut(index)
}
#[inline]
#[must_use]
pub fn spawn(&mut self, payload: T) -> Handle<T> {
self.spawn_with(|_| payload)
}
/// Tries to put an object in the pool at given position. Returns `Err(payload)` if a corresponding
/// entry is occupied.
///
/// # Performance
///
/// The method has O(n) complexity in worst case, where `n` - amount of free records in the pool.
/// In typical uses cases `n` is very low. It should be noted that if a pool is filled entirely
/// and you trying to put an object at the end of pool, the method will have O(1) complexity.
///
/// # Panics
///
/// Panics if the index is occupied or reserved (e.g. by [`take_reserve`]).
///
/// [`take_reserve`]: Pool::take_reserve
#[inline]
pub fn spawn_at(&mut self, index: u32, payload: T) -> Result<Handle<T>, T> {
self.spawn_at_internal(index, INVALID_GENERATION, payload)
}
/// Tries to put an object in the pool at given handle. Returns `Err(payload)` if a corresponding
/// entry is occupied.
///
/// # Performance
///
/// The method has O(n) complexity in worst case, where `n` - amount of free records in the pool.
/// In typical uses cases `n` is very low. It should be noted that if a pool is filled entirely
/// and you trying to put an object at the end of pool, the method will have O(1) complexity.
///
/// # Panics
///
/// Panics if the index is occupied or reserved (e.g. by [`take_reserve`]).
///
/// [`take_reserve`]: Pool::take_reserve
pub fn spawn_at_handle(&mut self, handle: Handle<T>, payload: T) -> Result<Handle<T>, T> {
self.spawn_at_internal(handle.index, handle.generation, payload)
}
fn spawn_at_internal(
&mut self,
index: u32,
desired_generation: u32,
payload: T,
) -> Result<Handle<T>, T> {
let index_usize = usize::try_from(index).expect("index overflowed usize");
match self.records.get_mut(index_usize) {
Some(record) => match record.payload.as_ref() {
Some(_) => Err(payload),
None => {
let position = self
.free_stack
.iter()
.rposition(|i| *i == index)
.expect("free_stack must contain the index of the empty record (most likely attempting to spawn at a reserved index)!");
self.free_stack.remove(position);
let generation = if desired_generation == INVALID_GENERATION {
record.generation + 1
} else {
desired_generation
};
record.generation = generation;
record.payload = P::new(payload);
Ok(Handle::new(index, generation))
}
},
None => {
// Spawn missing records to fill gaps.
for i in self.records_len()..index {
self.records.push(PoolRecord {
generation: 1,
payload: P::new_empty(),
});
self.free_stack.push(i);
}
let generation = if desired_generation == INVALID_GENERATION {
1
} else {
desired_generation
};
self.records.push(PoolRecord {
generation,
payload: P::new(payload),
});
Ok(Handle::new(index, generation))
}
}
}
#[inline]
#[must_use]
/// Construct a value with the handle it would be given.
/// Note: Handle is _not_ valid until function has finished executing.
pub fn spawn_with<F: FnOnce(Handle<T>) -> T>(&mut self, callback: F) -> Handle<T> {
if let Some(free_index) = self.free_stack.pop() {
let record = self
.records_get_mut(free_index)
.expect("free stack contained invalid index");
if record.payload.is_some() {
panic!(
"Attempt to spawn an object at pool record with payload! Record index is {}",
free_index
);
}
let generation = record.generation + 1;
let handle = Handle {
index: free_index,
generation,
type_marker: PhantomData,
};
let payload = callback(handle);
record.generation = generation;
record.payload.replace(payload);
handle
} else {
// No free records, create new one
let generation = 1;
let handle = Handle {
index: self.records.len() as u32,
generation,
type_marker: PhantomData,
};
let payload = callback(handle);
let record = PoolRecord {
generation,
payload: P::new(payload),
};
self.records.push(record);
handle
}
}
#[inline]
/// Asynchronously construct a value with the handle it would be given.
/// Note: Handle is _not_ valid until function has finished executing.
pub async fn spawn_with_async<F, Fut>(&mut self, callback: F) -> Handle<T>
where
F: FnOnce(Handle<T>) -> Fut,
Fut: Future<Output = T>,
{
if let Some(free_index) = self.free_stack.pop() {
let record = self
.records_get_mut(free_index)
.expect("free stack contained invalid index");
if record.payload.is_some() {
panic!(
"Attempt to spawn an object at pool record with payload! Record index is {}",
free_index
);
}
let generation = record.generation + 1;
let handle = Handle {
index: free_index,
generation,
type_marker: PhantomData,
};
let payload = callback(handle).await;
record.generation = generation;
record.payload.replace(payload);
handle
} else {
// No free records, create new one
let generation = 1;
let handle = Handle {
index: self.records.len() as u32,
generation,
type_marker: PhantomData,
};
let payload = callback(handle).await;
let record = PoolRecord {
generation,
payload: P::new(payload),
};
self.records.push(record);
handle
}
}
/// Borrows shared reference to an object by its handle.
///
/// # Panics
///
/// Panics if handle is out of bounds or generation of handle does not match with
/// generation of pool record at handle index (in other words it means that object
/// at handle's index is different than the object was there before).
#[inline]
#[must_use]
pub fn borrow(&self, handle: Handle<T>) -> &T {
if let Some(record) = self.records_get(handle.index) {
if record.generation == handle.generation {
if let Some(payload) = record.payload.as_ref() {
payload
} else {
panic!("Attempt to borrow destroyed object at {:?} handle.", handle);
}
} else {
panic!(
"Attempt to use dangling handle {:?}. Record has generation {}!",
handle, record.generation
);
}
} else {
panic!(
"Attempt to borrow object using out-of-bounds handle {:?}! Record count is {}",
handle,
self.records.len()
);
}
}
/// Borrows mutable reference to an object by its handle.
///
/// # Panics
///
/// Panics if handle is out of bounds or generation of handle does not match with
/// generation of pool record at handle index (in other words it means that object
/// at handle's index is different than the object was there before).
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// let a = pool.spawn(1);
/// let a = pool.borrow_mut(a);
/// *a = 11;
/// ```
#[inline]
#[must_use]
pub fn borrow_mut(&mut self, handle: Handle<T>) -> &mut T {
let record_count = self.records.len();
if let Some(record) = self.records_get_mut(handle.index) {
if record.generation == handle.generation {
if let Some(payload) = record.payload.as_mut() {
payload
} else {
panic!("Attempt to borrow destroyed object at {:?} handle.", handle);
}
} else {
panic!("Attempt to borrow object using dangling handle {:?}. Record has {} generation!", handle, record.generation);
}
} else {
panic!(
"Attempt to borrow object using out-of-bounds handle {:?}! Record count is {}",
handle, record_count
);
}
}
/// Borrows shared reference to an object by its handle.
///
/// Returns None if handle is out of bounds or generation of handle does not match with
/// generation of pool record at handle index (in other words it means that object
/// at handle's index is different than the object was there before).
#[inline]
#[must_use]
pub fn try_borrow(&self, handle: Handle<T>) -> Option<&T> {
self.records_get(handle.index).and_then(|r| {
if r.generation == handle.generation {
r.payload.as_ref()
} else {
None
}
})
}
/// Borrows mutable reference to an object by its handle.
///
/// Returns None if handle is out of bounds or generation of handle does not match with
/// generation of pool record at handle index (in other words it means that object
/// at handle's index is different than the object was there before).
#[inline]
#[must_use]
pub fn try_borrow_mut(&mut self, handle: Handle<T>) -> Option<&mut T> {
self.records_get_mut(handle.index).and_then(|r| {
if r.generation == handle.generation {
r.payload.as_mut()
} else {
None
}
})
}
/// Borrows mutable references of objects at the same time. This method will succeed only
/// if handles are unique (not equal). Borrowing multiple mutable references at the same
/// time is useful in case if you need to mutate some objects at the same time.
///
/// # Panics
///
/// See [`borrow_mut`](Self::borrow_mut).
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// let a = pool.spawn(1);
/// let b = pool.spawn(2);
/// let (a, b) = pool.borrow_two_mut((a, b));
/// *a = 11;
/// *b = 22;
/// ```
#[inline]
#[must_use = "Handle set must not be ignored"]
pub fn borrow_two_mut(&mut self, handles: (Handle<T>, Handle<T>)) -> (&mut T, &mut T) {
// Prevent giving two mutable references to same record.
assert_ne!(handles.0.index, handles.1.index);
unsafe {
let this = self as *mut Self;
((*this).borrow_mut(handles.0), (*this).borrow_mut(handles.1))
}
}
/// Borrows mutable references of objects at the same time. This method will succeed only
/// if handles are unique (not equal). Borrowing multiple mutable references at the same
/// time is useful in case if you need to mutate some objects at the same time.
///
/// # Panics
///
/// See [`borrow_mut`](Self::borrow_mut).
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// let a = pool.spawn(1);
/// let b = pool.spawn(2);
/// let c = pool.spawn(3);
/// let (a, b, c) = pool.borrow_three_mut((a, b, c));
/// *a = 11;
/// *b = 22;
/// *c = 33;
/// ```
#[inline]
#[must_use = "Handle set must not be ignored"]
pub fn borrow_three_mut(
&mut self,
handles: (Handle<T>, Handle<T>, Handle<T>),
) -> (&mut T, &mut T, &mut T) {
// Prevent giving mutable references to same record.
assert_ne!(handles.0.index, handles.1.index);
assert_ne!(handles.0.index, handles.2.index);
assert_ne!(handles.1.index, handles.2.index);
unsafe {
let this = self as *mut Self;
(
(*this).borrow_mut(handles.0),
(*this).borrow_mut(handles.1),
(*this).borrow_mut(handles.2),
)
}
}
/// Borrows mutable references of objects at the same time. This method will succeed only
/// if handles are unique (not equal). Borrowing multiple mutable references at the same
/// time is useful in case if you need to mutate some objects at the same time.
///
/// # Panics
///
/// See [`borrow_mut`](Self::borrow_mut).
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// let a = pool.spawn(1);
/// let b = pool.spawn(2);
/// let c = pool.spawn(3);
/// let d = pool.spawn(4);
/// let (a, b, c, d) = pool.borrow_four_mut((a, b, c, d));
/// *a = 11;
/// *b = 22;
/// *c = 33;
/// *d = 44;
/// ```
#[inline]
#[must_use = "Handle set must not be ignored"]
pub fn borrow_four_mut(
&mut self,
handles: (Handle<T>, Handle<T>, Handle<T>, Handle<T>),
) -> (&mut T, &mut T, &mut T, &mut T) {
// Prevent giving mutable references to same record.
// This is kinda clunky since const generics are not stabilized yet.
assert_ne!(handles.0.index, handles.1.index);
assert_ne!(handles.0.index, handles.2.index);
assert_ne!(handles.0.index, handles.3.index);
assert_ne!(handles.1.index, handles.2.index);
assert_ne!(handles.1.index, handles.3.index);
assert_ne!(handles.2.index, handles.3.index);
unsafe {
let this = self as *mut Self;
(
(*this).borrow_mut(handles.0),
(*this).borrow_mut(handles.1),
(*this).borrow_mut(handles.2),
(*this).borrow_mut(handles.3),
)
}
}
/// Tries to borrow two objects when a handle to the second object stored in the first object.
pub fn try_borrow_dependant_mut<F>(
&mut self,
handle: Handle<T>,
func: F,
) -> (Option<&mut T>, Option<&mut T>)
where
F: FnOnce(&T) -> Handle<T>,
{
let this = unsafe { &mut *(self as *mut Pool<T, P>) };
let first = self.try_borrow_mut(handle);
if let Some(first_object) = first.as_ref() {
let second_handle = func(first_object);
if second_handle != handle {
return (first, this.try_borrow_mut(second_handle));
}
}
(first, None)
}
/// Moves object out of the pool using the given handle. All handles to the object will become invalid.
///
/// # Panics
///
/// Panics if the given handle is invalid.
#[inline]
pub fn free(&mut self, handle: Handle<T>) -> T {
let index = usize::try_from(handle.index).expect("index overflowed usize");
if let Some(record) = self.records.get_mut(index) {
if record.generation == handle.generation {
// Remember this index as free
self.free_stack.push(handle.index);
// Return current payload.
if let Some(payload) = record.payload.take() {
payload
} else {
panic!("Attempt to double free object at handle {:?}!", handle);
}
} else {
panic!(
"Attempt to free object using dangling handle {:?}! Record generation is {}",
handle, record.generation
);
}
} else {
panic!("Attempt to free destroyed object using out-of-bounds handle {:?}! Record count is {}", handle, self.records.len());
}
}
/// Moves an object out of the pool using the given handle with a promise that the object will be returned back.
/// Returns pair (ticket, value). The ticket must be used to put the value back!
///
/// # Motivation
///
/// This method is useful when you need to take temporary ownership of an object, do something
/// with it and then put it back while preserving all handles to it and being able to put new objects into
/// the pool without overriding the payload at its handle.
///
/// # Notes
///
/// All handles to the object will be temporarily invalid until the object is returned to the pool! The pool record will
/// be reserved for a further [`put_back`] call, which means if you lose the ticket you will have an empty
/// "unusable" pool record forever.
///
/// # Panics
///
/// Panics if the given handle is invalid.
///
/// [`put_back`]: Pool::put_back
#[inline]
pub fn take_reserve(&mut self, handle: Handle<T>) -> (Ticket<T>, T) {
if let Some(record) = self.records_get_mut(handle.index) {
if record.generation == handle.generation {
if let Some(payload) = record.payload.take() {
let ticket = Ticket {
index: handle.index,
marker: PhantomData,
};
(ticket, payload)
} else {
panic!(
"Attempt to take already taken object at handle {:?}!",
handle
);
}
} else {
panic!(
"Attempt to take object using dangling handle {:?}! Record generation is {}",
handle, record.generation
);
}
} else {
panic!("Attempt to take destroyed object using out-of-bounds handle {:?}! Record count is {}", handle, self.records.len());
}
}
/// Does the same as [`take_reserve`] but returns an option, instead of panicking.
///
/// [`take_reserve`]: Pool::take_reserve
#[inline]
pub fn try_take_reserve(&mut self, handle: Handle<T>) -> Option<(Ticket<T>, T)> {
if let Some(record) = self.records_get_mut(handle.index) {
if record.generation == handle.generation {
if let Some(payload) = record.payload.take() {
let ticket = Ticket {
index: handle.index,
marker: PhantomData,
};
Some((ticket, payload))
} else {
None
}
} else {
None
}
} else {
None
}
}
/// Returns the value back into the pool using the given ticket. See [`take_reserve`] for more
/// information.
///
/// [`take_reserve`]: Pool::take_reserve
pub fn put_back(&mut self, ticket: Ticket<T>, value: T) -> Handle<T> {
let record = self
.records_get_mut(ticket.index)
.expect("Ticket index was invalid");
let old = record.payload.replace(value);
assert!(old.is_none());
Handle::new(ticket.index, record.generation)
}
/// Forgets that value at ticket was reserved and makes it usable again.
/// Useful when you don't need to put value back by ticket, but just make
/// pool record usable again.
pub fn forget_ticket(&mut self, ticket: Ticket<T>) {
self.free_stack.push(ticket.index);
}
/// Returns total capacity of pool. Capacity has nothing about real amount of objects in pool!
#[inline]
#[must_use]
pub fn get_capacity(&self) -> u32 {
u32::try_from(self.records.len()).expect("records.len() overflowed u32")
}
/// Destroys all objects in pool. All handles to objects will become invalid.
///
/// # Remarks
///
/// Use this method cautiously if objects in pool have cross "references" (handles)
/// to each other. This method will make all produced handles invalid and any further
/// calls for [`borrow`](Self::borrow) or [`borrow_mut`](Self::borrow_mut) will raise panic.
#[inline]
pub fn clear(&mut self) {
self.records.clear();
self.free_stack.clear();
}
#[inline]
#[must_use]
pub fn at_mut(&mut self, n: u32) -> Option<&mut T> {
self.records_get_mut(n).and_then(|rec| rec.payload.as_mut())
}
#[inline]
#[must_use]
pub fn at(&self, n: u32) -> Option<&T> {
self.records_get(n).and_then(|rec| rec.payload.as_ref())
}
#[inline]
#[must_use]
pub fn handle_from_index(&self, n: u32) -> Handle<T> {
if let Some(record) = self.records_get(n) {
if record.generation != INVALID_GENERATION {
return Handle::new(n, record.generation);
}
}
Handle::NONE
}
/// Returns the exact number of "alive" objects in the pool.
///
/// Records that have been reserved (e.g. by [`take_reserve`]) are *not* counted.
///
/// It iterates through the entire pool to count the live objects so the complexity is `O(n)`.
///
/// See also [`total_count`].
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// pool.spawn(123);
/// pool.spawn(321);
/// assert_eq!(pool.alive_count(), 2);
/// ```
///
/// [`take_reserve`]: Pool::take_reserve
/// [`total_count`]: Pool::total_count
#[inline]
#[must_use]
pub fn alive_count(&self) -> u32 {
let cnt = self.iter().count();
u32::try_from(cnt).expect("alive_count overflowed u32")
}
/// Returns the number of allocated objects in the pool.
///
/// It also counts records that have been reserved (e.g. by [`take_reserve`]).
///
/// This method is `O(1)`.
///
/// See also [`alive_count`].
///
/// [`take_reserve`]: Pool::take_reserve
/// [`alive_count`]: Pool::alive_count
pub fn total_count(&self) -> u32 {
let free = u32::try_from(self.free_stack.len()).expect("free stack length overflowed u32");
self.records_len() - free
}
#[inline]
pub fn replace(&mut self, handle: Handle<T>, payload: T) -> Option<T> {
let index_usize = usize::try_from(handle.index).expect("index overflowed usize");
if let Some(record) = self.records.get_mut(index_usize) {
if record.generation == handle.generation {
self.free_stack.retain(|i| *i != handle.index);
record.payload.replace(payload)
} else {
panic!("Attempt to replace object in pool using dangling handle! Handle is {:?}, but pool record has {} generation", handle, record.generation);
}
} else {
None
}
}
/// Checks if given handle "points" to some object.
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// let handle = pool.spawn(123);
/// assert_eq!(pool.is_valid_handle(handle), true)
/// ```
#[inline]
pub fn is_valid_handle(&self, handle: Handle<T>) -> bool {
if let Some(record) = self.records_get(handle.index) {
record.payload.is_some() && record.generation == handle.generation
} else {
false
}
}
/// Creates new pool iterator that iterates over filled records in pool.
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// pool.spawn(123);
/// pool.spawn(321);
/// let mut iter = pool.iter();
/// assert_eq!(*iter.next().unwrap(), 123);
/// assert_eq!(*iter.next().unwrap(), 321);
/// ```
#[must_use]
pub fn iter(&self) -> PoolIterator<T, P> {
unsafe {
PoolIterator {
ptr: self.records.as_ptr(),
end: self.records.as_ptr().add(self.records.len()),
marker: PhantomData,
}
}
}
/// Creates new pair iterator that iterates over filled records using pair (handle, payload)
/// Can be useful when there is a need to iterate over pool records and know a handle of
/// that record.
pub fn pair_iter(&self) -> PoolPairIterator<T, P> {
PoolPairIterator {
pool: self,
current: 0,
}
}
/// Creates new pool iterator that iterates over filled records in pool allowing
/// to modify record payload.
///
/// # Example
///
/// ```
/// use fyrox_core::pool::Pool;
/// let mut pool = Pool::<u32>::new();
/// pool.spawn(123);
/// pool.spawn(321);
/// let mut iter = pool.iter_mut();
/// assert_eq!(*iter.next().unwrap(), 123);
/// assert_eq!(*iter.next().unwrap(), 321);
/// ```
#[must_use]
pub fn iter_mut(&mut self) -> PoolIteratorMut<T, P> {
unsafe {
PoolIteratorMut {
ptr: self.records.as_mut_ptr(),
end: self.records.as_mut_ptr().add(self.records.len()),
marker: PhantomData,
}
}
}
/// Creates new pair iterator that iterates over filled records using pair (handle, payload)
/// Can be useful when there is a need to iterate over pool records and know a handle of
/// that record.
pub fn pair_iter_mut(&mut self) -> PoolPairIteratorMut<T, P> {
unsafe {
PoolPairIteratorMut {
current: 0,
ptr: self.records.as_mut_ptr(),
end: self.records.as_mut_ptr().add(self.records.len()),
marker: PhantomData,
}
}
}
/// Retains pool records selected by `pred`. Useful when you need to remove all pool records
/// by some criteria.
pub fn retain<F>(&mut self, mut pred: F)
where
F: FnMut(&T) -> bool,
{
for (i, record) in self.records.iter_mut().enumerate() {
if record.generation == INVALID_GENERATION {
continue;
}
let retain = if let Some(payload) = record.payload.as_ref() {
pred(payload)
} else {
continue;
};
if !retain {
self.free_stack.push(i as u32);
record.payload.take(); // and Drop
}
}
}
fn end(&self) -> *const PoolRecord<T, P> {
unsafe { self.records.as_ptr().add(self.records.len()) }
}
fn begin(&self) -> *const PoolRecord<T, P> {
self.records.as_ptr()
}
pub fn handle_of(&self, ptr: &T) -> Handle<T> {
let begin = self.begin() as usize;
let end = self.end() as usize;
let val = ptr as *const T as usize;
if val >= begin && val < end {
let record_size = std::mem::size_of::<PoolRecord<T>>();
let record_location = (val - offset_of!(PoolRecord<T>, payload)) - begin;
if record_location % record_size == 0 {
let index = record_location / record_size;
let index = u32::try_from(index).expect("Index overflowed u32");
return self.handle_from_index(index);
}
}
Handle::NONE
}
}
impl<T> FromIterator<T> for Pool<T>
where
T: 'static,
{
fn from_iter<C: IntoIterator<Item = T>>(iter: C) -> Self {
let iter = iter.into_iter();
let (lower_bound, upper_bound) = iter.size_hint();
let lower_bound = u32::try_from(lower_bound).expect("lower_bound overflowed u32");
let upper_bound =
upper_bound.map(|b| u32::try_from(b).expect("upper_bound overflowed u32"));
let mut pool = Self::with_capacity(upper_bound.unwrap_or(lower_bound));
for v in iter {
let _ = pool.spawn(v);
}
pool
}
}
impl<T, P> Index<Handle<T>> for Pool<T, P>
where
T: 'static,
P: PayloadContainer<Element = T> + 'static,
{
type Output = T;
fn index(&self, index: Handle<T>) -> &Self::Output {
self.borrow(index)
}
}
impl<T, P> IndexMut<Handle<T>> for Pool<T, P>
where
T: 'static,
P: PayloadContainer<Element = T> + 'static,
{
fn index_mut(&mut self, index: Handle<T>) -> &mut Self::Output {
self.borrow_mut(index)
}
}
impl<'a, T, P> IntoIterator for &'a Pool<T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
type Item = &'a T;
type IntoIter = PoolIterator<'a, T, P>;
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
impl<'a, T, P> IntoIterator for &'a mut Pool<T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
type Item = &'a mut T;
type IntoIter = PoolIteratorMut<'a, T, P>;
fn into_iter(self) -> Self::IntoIter {
self.iter_mut()
}
}
pub struct PoolIterator<'a, T, P>
where
P: PayloadContainer<Element = T>,
{
ptr: *const PoolRecord<T, P>,
end: *const PoolRecord<T, P>,
marker: PhantomData<&'a T>,
}
impl<'a, T, P> Iterator for PoolIterator<'a, T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
type Item = &'a T;
fn next(&mut self) -> Option<Self::Item> {
unsafe {
while self.ptr != self.end {
let current = &*self.ptr;
if let Some(payload) = current.payload.as_ref() {
self.ptr = self.ptr.offset(1);
return Some(payload);
}
self.ptr = self.ptr.offset(1);
}
None
}
}
}
pub struct PoolPairIterator<'a, T, P: PayloadContainer<Element = T>> {
pool: &'a Pool<T, P>,
current: usize,
}
impl<'a, T, P> Iterator for PoolPairIterator<'a, T, P>
where
P: PayloadContainer<Element = T>,
{
type Item = (Handle<T>, &'a T);
fn next(&mut self) -> Option<Self::Item> {
loop {
match self.pool.records.get(self.current) {
Some(record) => {
if let Some(payload) = record.payload.as_ref() {
let handle = Handle::new(self.current as u32, record.generation);
self.current += 1;
return Some((handle, payload));
}
self.current += 1;
}
None => return None,
}
}
}
}
pub struct PoolIteratorMut<'a, T, P>
where
P: PayloadContainer<Element = T>,
{
ptr: *mut PoolRecord<T, P>,
end: *mut PoolRecord<T, P>,
marker: PhantomData<&'a mut T>,
}
impl<'a, T, P> Iterator for PoolIteratorMut<'a, T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
type Item = &'a mut T;
fn next(&mut self) -> Option<Self::Item> {
unsafe {
while self.ptr != self.end {
let current = &mut *self.ptr;
if let Some(payload) = current.payload.as_mut() {
self.ptr = self.ptr.offset(1);
return Some(payload);
}
self.ptr = self.ptr.offset(1);
}
None
}
}
}
pub struct PoolPairIteratorMut<'a, T, P>
where
P: PayloadContainer<Element = T>,
{
ptr: *mut PoolRecord<T, P>,
end: *mut PoolRecord<T, P>,
marker: PhantomData<&'a mut T>,
current: usize,
}
impl<'a, T, P> Iterator for PoolPairIteratorMut<'a, T, P>
where
P: PayloadContainer<Element = T> + 'static,
{
type Item = (Handle<T>, &'a mut T);
fn next(&mut self) -> Option<Self::Item> {
unsafe {
while self.ptr != self.end {
let current = &mut *self.ptr;
if let Some(payload) = current.payload.as_mut() {
let handle = Handle::new(self.current as u32, current.generation);
self.ptr = self.ptr.offset(1);
self.current += 1;
return Some((handle, payload));
}
self.ptr = self.ptr.offset(1);
self.current += 1;
}
None
}
}
}
#[cfg(test)]
mod test {
use crate::pool::{Handle, Pool, INVALID_GENERATION};
#[test]
fn pool_sanity_tests() {
let mut pool: Pool<String> = Pool::new();
let foobar_handle = pool.spawn(String::from("Foobar"));
assert_eq!(foobar_handle.index, 0);
assert_ne!(foobar_handle.generation, INVALID_GENERATION);
let foobar_handle_copy = foobar_handle;
assert_eq!(foobar_handle.index, foobar_handle_copy.index);
assert_eq!(foobar_handle.generation, foobar_handle_copy.generation);
let baz_handle = pool.spawn(String::from("Baz"));
assert_eq!(pool.borrow(foobar_handle), "Foobar");
assert_eq!(pool.borrow(baz_handle), "Baz");
pool.free(foobar_handle);
assert!(!pool.is_valid_handle(foobar_handle_copy));
assert!(pool.is_valid_handle(baz_handle));
let at_foobar_index = pool.spawn(String::from("AtFoobarIndex"));
assert_eq!(at_foobar_index.index, 0);
assert_ne!(at_foobar_index.generation, INVALID_GENERATION);
assert_eq!(pool.borrow(at_foobar_index), "AtFoobarIndex");
let bar_handle = pool.spawn_with(|_handle| String::from("Bar"));
assert_ne!(bar_handle.index, 0);
assert_ne!(bar_handle.generation, INVALID_GENERATION);
assert_eq!(pool.borrow(bar_handle), "Bar");
}
#[test]
fn pool_iterator_mut_test() {
let mut pool: Pool<String> = Pool::new();
let foobar = pool.spawn("Foobar".to_string());
let d = pool.spawn("Foo".to_string());
pool.free(d);
let baz = pool.spawn("Baz".to_string());
for s in pool.iter() {
println!("{}", s);
}
for s in pool.iter_mut() {
println!("{}", s);
}
for s in &pool {
println!("{}", s);
}
for s in &mut pool {
println!("{}", s);
}
pool.free(foobar);
pool.free(baz);
}
#[test]
fn handle_of() {
#[allow(dead_code)]
struct Value {
data: String,
}
let mut pool = Pool::<Value>::new();
let foobar = pool.spawn(Value {
data: "Foobar".to_string(),
});
let bar = pool.spawn(Value {
data: "Bar".to_string(),
});
let baz = pool.spawn(Value {
data: "Baz".to_string(),
});
assert_eq!(pool.handle_of(pool.borrow(foobar)), foobar);
assert_eq!(pool.handle_of(pool.borrow(bar)), bar);
assert_eq!(pool.handle_of(pool.borrow(baz)), baz);
}
#[test]
fn pool_test_spawn_at() {
let mut pool = Pool::<Payload>::new();
#[derive(Debug, Eq, PartialEq)]
struct Payload;
assert_eq!(pool.spawn_at(2, Payload), Ok(Handle::new(2, 1)));
assert_eq!(pool.spawn_at(2, Payload), Err(Payload));
assert_eq!(pool.records[0].payload, None);
assert_eq!(pool.records[1].payload, None);
assert_ne!(pool.records[2].payload, None);
assert_eq!(pool.spawn_at(2, Payload), Err(Payload));
pool.free(Handle::new(2, 1));
assert_eq!(pool.spawn_at(2, Payload), Ok(Handle::new(2, 2)));
assert_eq!(pool.spawn(Payload), Handle::new(1, 2));
assert_eq!(pool.spawn(Payload), Handle::new(0, 2));
}
}
| 31.080666 | 160 | 0.54682 |
4d66463786d945c93a29db78547c3336b7f2b5ae | 1,223 | lua | Lua | events/thunderstorm.lua | kcaze/rags_to_riches | 6484737b3a172563be4e42d8293823b44d6ede5f | [
"CC-BY-4.0"
] | 1 | 2019-10-14T02:18:08.000Z | 2019-10-14T02:18:08.000Z | events/thunderstorm.lua | kcaze/rags_to_riches | 6484737b3a172563be4e42d8293823b44d6ede5f | [
"CC-BY-4.0"
] | null | null | null | events/thunderstorm.lua | kcaze/rags_to_riches | 6484737b3a172563be4e42d8293823b44d6ede5f | [
"CC-BY-4.0"
] | null | null | null | local item = require("../item");
local image = require("../image")
return {
name = "Stormy weather",
amount = 5,
weight = 0.25,
condition = function(state)
return state.coins >= 10 and state.hp >= 10
end,
description = "Dark clouds are looming above you.",
heads = {
effectDescription = "+1 red fish",
effect = function (state)
table.insert(state.items, item.redFish)
return {
description = "You stay outside. It's raining... red fish? You catch one in the process.",
image = image.fishRed,
}
end
},
tails = {
effectDescription = "+3 rats",
effect = function (state)
table.insert(state.items, item.rat)
table.insert(state.items, item.rat)
table.insert(state.items, item.rat)
return {
description = "You hide in a cave. A group of rats approaches you. You manage to befriend 3 of them.",
image = image.rat3,
}
end
},
beg = {
effectDescription = "-5 hp",
effect = function (state)
state.hp = state.hp - 5
return {
description = "Ack! You get caught in the thunderstorm and harmed by debris. You lose 5 hp.",
image = image.thundercloud,
}
end
}
}
| 27.177778 | 110 | 0.600164 |
11dae520c3e089f640c0d3176aa4820767ba9c9d | 381 | asm | Assembly | P5/P5_TestCode/P5_L1_testcase8/mips8.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | 1 | 2022-01-23T09:24:47.000Z | 2022-01-23T09:24:47.000Z | P5/P5_TestCode/P5_L1_testcase8/mips8.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | P5/P5_TestCode/P5_L1_testcase8/mips8.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | .data
nums: .space 4096
.text
ori $s1, $s1, 0x3000
ori $s0, $0, 15
sw $s0, nums+0x30
ori $s0, $0, 16
sw $s0, nums+0x40
ori $s0, $0, 17
sw $s0, nums+0x54
jal loop
subu $t1, $ra, $s1
ori $t0, $0, 1
loop:
lw $s3, nums($t1)
jal loop2
subu $t1, $ra, $s1
ori $t0, $0, 1
loop2:
nop
lw $s4, nums($t1)
jal loop3
subu $t1, $ra, $s1
ori $t0, $0, 1
loop3:
nop
nop
lw $s5, nums($t1) | 13.607143 | 20 | 0.580052 |
04e019b345856f3077a7a4b08eec5c8c0b8bd900 | 2,228 | swift | Swift | Sources/AlertController.swift | usecanvas/ios-v1 | c740206a294c775ebc48894b8b36ce477c5cec82 | [
"Apache-2.0"
] | 135 | 2017-04-04T21:09:22.000Z | 2020-07-03T06:28:48.000Z | Sources/AlertController.swift | usecanvas/ios-v1 | c740206a294c775ebc48894b8b36ce477c5cec82 | [
"Apache-2.0"
] | 1 | 2017-04-07T20:44:17.000Z | 2017-04-07T20:44:17.000Z | Sources/AlertController.swift | usecanvas/ios-v1 | c740206a294c775ebc48894b8b36ce477c5cec82 | [
"Apache-2.0"
] | 18 | 2017-04-04T21:07:25.000Z | 2018-10-04T10:55:41.000Z | //
// AlertController.swift
// Canvas
//
// Created by Sam Soffes on 11/27/15.
// Copyright © 2015 Canvas Labs, Inc. All rights reserved.
//
import UIKit
import CanvasCore
final class AlertController: UIAlertController {
// MARK: - Properties
/// Used when return is pressed while the controller is showing
var primaryAction: (Void -> Void)?
// MARK: - UIResponder
override func canBecomeFirstResponder() -> Bool {
return true
}
override var keyCommands: [UIKeyCommand]? {
return (super.keyCommands ?? []) + [
UIKeyCommand(input: UIKeyInputEscape, modifierFlags: [], action: #selector(cancel)),
UIKeyCommand(input: "\r", modifierFlags: [], action: #selector(selectFirstAction))
]
}
// MARK: - UIViewController
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
adjustSubviews([view])
}
// MARK: - Actions
func cancel(sender: AnyObject?) {
dismissViewControllerAnimated(true, completion: nil)
}
func selectFirstAction(sender: AnyObject?) {
dismissViewControllerAnimated(true) {
self.primaryAction?()
}
}
// MARK: - Private
private func adjustSubviews(subviews: [UIView]) {
for subview in subviews {
if let label = subview as? UILabel {
adjustLabel(label)
} else if subview.bounds.height > 0 && subview.bounds.height <= 1 {
subview.backgroundColor = Swatch.border
}
adjustSubviews(subview.subviews)
}
}
private func adjustLabel(label: UILabel) {
for action in actions {
if label.text == title {
label.attributedText = NSAttributedString(string: label.text ?? "", attributes: [
NSFontAttributeName: label.font,
NSForegroundColorAttributeName: Swatch.darkGray
])
return
}
if label.text == action.title {
switch action.style {
case .Default, .Cancel:
label.attributedText = NSAttributedString(string: label.text ?? "", attributes: [
NSFontAttributeName: label.font,
NSForegroundColorAttributeName: Swatch.brand
])
case .Destructive:
label.attributedText = NSAttributedString(string: label.text ?? "", attributes: [
NSFontAttributeName: label.font,
NSForegroundColorAttributeName: Swatch.destructive
])
}
}
}
}
}
| 22.969072 | 87 | 0.690754 |
05d2a3e39b44dc78fae7ca4ab357e4939890ba45 | 519 | sql | SQL | SQL/Working_SearchProceduralCode.sql | ColbyLithyouvong/PortfolioReferences | 59def33676a5bc9696e270cf9135b4b08908f943 | [
"MIT"
] | 1 | 2021-01-12T23:37:18.000Z | 2021-01-12T23:37:18.000Z | SQL/Working_SearchProceduralCode.sql | ColbyLithyouvong/PortfolioReferences | 59def33676a5bc9696e270cf9135b4b08908f943 | [
"MIT"
] | 2 | 2021-01-28T20:26:59.000Z | 2021-12-08T20:03:19.000Z | SQL/Working_SearchProceduralCode.sql | ColbyLithyouvong/PortfolioReferences | 59def33676a5bc9696e270cf9135b4b08908f943 | [
"MIT"
] | 1 | 2022-03-16T19:10:45.000Z | 2022-03-16T19:10:45.000Z | /*
This code is a working file used for everyday references.
This code searches SQL to identify any Procedure, View, Trigger, or Function based on Text.
The following code demonstrates SQL interpretations used in SQL Azure 2016.
This is not a copy of any current implementation of any company.
*/
SELECT DISTINCT
o.name AS Object_Name,
o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id = o.object_id
WHERE m.definition Like '%[something]%' ESCAPE '\'
| 30.529412 | 94 | 0.720617 |
16f6c540919bba17aa19030173c414780e06a8cf | 8,066 | swift | Swift | macos/FluentUIUnitTest/AvatarViewTests.swift | jasonLiu-jiacli/fluentui-apple | 28a65636589d3a0c0b02742999b74d545bf144e1 | [
"MIT"
] | 1 | 2020-08-30T09:52:39.000Z | 2020-08-30T09:52:39.000Z | macos/FluentUIUnitTest/AvatarViewTests.swift | jasonLiu-jiacli/fluentui-apple | 28a65636589d3a0c0b02742999b74d545bf144e1 | [
"MIT"
] | null | null | null | macos/FluentUIUnitTest/AvatarViewTests.swift | jasonLiu-jiacli/fluentui-apple | 28a65636589d3a0c0b02742999b74d545bf144e1 | [
"MIT"
] | null | null | null | //
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
import XCTest
@testable import FluentUI
class AvatarViewTests: XCTestCase {
func testValidInitialsCharacter () {
XCTAssertTrue(Character("A").isValidInitialsCharacter)
XCTAssertTrue(Character("Æ").isValidInitialsCharacter)
XCTAssertTrue(Character("È").isValidInitialsCharacter)
// same as above but with separate unicode scalars for the base character and the diacritic
XCTAssertTrue(Character("E\u{0300}").isValidInitialsCharacter) // È
XCTAssertTrue(Character("Å").isValidInitialsCharacter)
XCTAssertTrue(Character("Ü").isValidInitialsCharacter)
XCTAssertFalse(Character("😂").isValidInitialsCharacter)
XCTAssertFalse(Character("👑").isValidInitialsCharacter)
XCTAssertFalse(Character("王").isValidInitialsCharacter)
XCTAssertFalse(Character("肖").isValidInitialsCharacter)
XCTAssertFalse(Character("김").isValidInitialsCharacter)
XCTAssertFalse(Character("").isValidInitialsCharacter)
// Character with diacritic not available in Mac OS Roman
XCTAssertFalse(Character("U\u{0304}").isValidInitialsCharacter) // Ū
}
func testInitialsExtraction () {
// Basic cases
XCTAssertNil(AvatarView.initials(name: nil, email: nil))
XCTAssertEqual(AvatarView.initialsWithFallback(name: nil, email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie Lindqvist", email: nil), "AL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie Lindqvist", email: "Annie.Lindqvist@example.com"), "AL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: nil, email: "Annie.Lindqvist@example.com"), "A")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie Boyl Lind", email: nil), "AB")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie \"Boyl\" Lind", email: nil), "AL")
// Non-standard characters
XCTAssertEqual(AvatarView.initialsWithFallback(name: "😂", email: "happy@example.com"), "H")
XCTAssertNil(AvatarView.initials(name: "🧐", email: "😀@😬.😂"))
XCTAssertEqual(AvatarView.initialsWithFallback(name: "🧐", email: "😀@😬.😂"), "#")
XCTAssertNil(AvatarView.initials(name: "☮︎", email: nil))
XCTAssertEqual(AvatarView.initialsWithFallback(name: "☮︎", email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Maor Sharett 👑", email: "Maor.Sharett@example.com"), "MS")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Maor Sharett👑", email: "Maor.Sharett@example.com"), "MS")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Maor 👑 Sharett", email: "Maor.Sharett@example.com"), "MS")
// Complex characters
XCTAssertEqual(AvatarView.initialsWithFallback(name: "王小博", email: "email@example.com"), "E")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "王小博", email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "肖赞", email: ""), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "김보라", email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "אָדָם", email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "حسن", email: nil), "#")
XCTAssertEqual(AvatarView.initialsWithFallback(name: nil, email: "用户@例子.广告"), "#")
XCTAssertEqual(AvatarView.initials(name: "王小博", email: "email@example.com"), "E")
XCTAssertNil(AvatarView.initials(name: "王小博", email: nil))
XCTAssertNil(AvatarView.initials(name: "肖赞", email: ""))
XCTAssertNil(AvatarView.initials(name: "보라", email: nil))
XCTAssertNil(AvatarView.initials(name: "אָדָם", email: nil))
XCTAssertNil(AvatarView.initials(name: "حسن", email: nil))
XCTAssertNil(AvatarView.initials(name: nil, email: "用户@例子.广告"))
// Complex roman characters
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Êmïlÿ Çœłb", email: nil), "ÊÇ")
// Complex roman characters with alternate unicode representation
XCTAssertEqual("E\u{0300}", "È")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "E\u{0300}mïlÿ Çœłb", email: nil), "ÈÇ")
// Mixed characters
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Sean 肖", email: nil), "S")
// Whitespace
XCTAssertEqual(AvatarView.initialsWithFallback(name: " Kat Larrson ", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "\nKat Larrson\n", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "\tKat Larrson ", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "\t Kat Larrson ", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Kat Larrson\n", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Kat Larrson \n", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Kat Larrson \t", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Kat \n Larrson", email: nil), "KL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Kat \t Larrson", email: nil), "KL")
// Zero Width Space
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie\u{200B}Lindqvist", email: nil), "A")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "\u{200B}Annie\u{200B} \u{200B}Lindqvist\u{200B}", email: nil), "AL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie \u{200B} \u{200B}Lindqvist\u{200B}", email: nil), "AL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "\u{200B} Annie\u{200B} \u{200B}Lindqvist\u{200B}", email: nil), "AL")
XCTAssertEqual(AvatarView.initialsWithFallback(name: "Annie\u{200B} \u{200B}Lindqvist \u{200B}", email: nil), "AL")
}
func testAccessibility () {
// Avatar with name and email should be an accessibility element with the ax label and tooltip set to the contactName with an image role
let nameAndEmailAvatar = AvatarView(avatarSize: 0, contactName: "Annie Lindqvist", contactEmail: "Annie.Lindqvist@example.com")
XCTAssertTrue(nameAndEmailAvatar.isAccessibilityElement())
XCTAssertEqual(nameAndEmailAvatar.accessibilityLabel(), "Annie Lindqvist")
XCTAssertEqual(nameAndEmailAvatar.accessibilityRole(), NSAccessibility.Role.image)
XCTAssertEqual(nameAndEmailAvatar.toolTip, "Annie Lindqvist")
// When no name is provided, the ax label and tooltip should fallback to the contactEmail
let emailOnlyAvatar = AvatarView(avatarSize: 0, contactEmail: "Annie.Lindqvist@example.com")
XCTAssertTrue(emailOnlyAvatar.isAccessibilityElement())
XCTAssertEqual(emailOnlyAvatar.accessibilityLabel(), "Annie.Lindqvist@example.com")
XCTAssertEqual(emailOnlyAvatar.accessibilityRole(), NSAccessibility.Role.image)
XCTAssertEqual(emailOnlyAvatar.toolTip, "Annie.Lindqvist@example.com")
// When no name or email is provided, there isn't any valuable information to provide, so don't be an accessibility element
let noNameNoEmailAvatar = AvatarView(avatarSize: 0)
XCTAssertFalse(noNameNoEmailAvatar.isAccessibilityElement())
XCTAssertNil(noNameNoEmailAvatar.accessibilityLabel())
XCTAssertEqual(noNameNoEmailAvatar.accessibilityRole(), NSAccessibility.Role.unknown)
XCTAssertNil(noNameNoEmailAvatar.toolTip)
}
func testColorTable () {
// Cherry pick a few known values and test them
XCTAssertEqual(AvatarView.backgroundColor(for: 0), #colorLiteral(red: 0.6, green: 0.71, blue: 0.2, alpha: 1))
XCTAssertEqual(AvatarView.backgroundColor(for: 1887), #colorLiteral(red: 0.85, green: 0.32, blue: 0.17, alpha: 1))
XCTAssertEqual(AvatarView.backgroundColor(for: 2268), #colorLiteral(red: 0.6, green: 0.71, blue: 0.2, alpha: 1))
XCTAssertEqual(AvatarView.backgroundColor(for: 3986), #colorLiteral(red: 0.17, green: 0.34, blue: 0.59, alpha: 1))
}
func testHashAlgorithm () {
XCTAssertEqual(AvatarView.colorIndex(for: "Annie.Lindqvist@example.com"), 5881)
XCTAssertEqual(AvatarView.colorIndex(for: "Maor.Sharett@example.com"), 9659)
XCTAssertEqual(AvatarView.colorIndex(for: "email@example.com"), 1874)
XCTAssertEqual(AvatarView.colorIndex(for: "happy@example.com"), 1690)
XCTAssertEqual(AvatarView.colorIndex(for: "Kat Larrson"), 11264)
XCTAssertEqual(AvatarView.colorIndex(for: ""), 0)
}
}
| 59.748148 | 138 | 0.758244 |
b9a136fadaa3d6880ac8574fb353997a2bc6c998 | 250 | c | C | musicplayer/plugins/viceplugin/overrides/monitor/monitor_network.c | Osmose/moseamp | 8357daf2c93bc903c8041cc82bf3567e8d085a60 | [
"MIT"
] | 6 | 2017-04-19T19:06:03.000Z | 2022-01-11T14:44:14.000Z | plugins/viceplugin/overrides/monitor/monitor_network.c | sasq64/musicplayer | 372852c2f4e3231a09db2628fc4b7e7c2bfeec67 | [
"MIT"
] | 4 | 2018-04-04T20:27:32.000Z | 2020-04-25T10:46:21.000Z | musicplayer/plugins/viceplugin/overrides/monitor/monitor_network.c | Osmose/moseamp | 8357daf2c93bc903c8041cc82bf3567e8d085a60 | [
"MIT"
] | 2 | 2018-06-08T15:20:48.000Z | 2020-08-19T14:24:21.000Z | #include "vice.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "ui.h"
#include "uiapi.h"
int monitor_is_remote(void)
{
return 0;
}
ui_jam_action_t monitor_network_ui_jam_dialog(const char *format, ...)
{
return 0;
} | 14.705882 | 70 | 0.696 |
ac26591853c1c3fea3c6a58a6392b6b15a239326 | 2,689 | asm | Assembly | src/ports.asm | Codesmith512/Apex | c230c53ab8f32a5371dcf7b40d25fa9fbb85ac6b | [
"MIT"
] | 1 | 2021-04-01T09:34:26.000Z | 2021-04-01T09:34:26.000Z | src/ports.asm | Codesmith512/Apex | c230c53ab8f32a5371dcf7b40d25fa9fbb85ac6b | [
"MIT"
] | null | null | null | src/ports.asm | Codesmith512/Apex | c230c53ab8f32a5371dcf7b40d25fa9fbb85ac6b | [
"MIT"
] | null | null | null | ; ##################################
; Low-level assembly port functions
; ##################################
[bits 32]
section .text
; @function void out_8(uint16_t port, uint8_t b)
; Writes the byte to the given port
global out_8
out_8:
; standard frame setup
push ebp
mov ebp, esp
; al is used for the byte to write
mov eax, [esp + 12]
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform write
out dx, al
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @function void out_16(uint16_t port, uint8_t b)
; Writes the word to the given port
global out_16
out_16:
; standard frame setup
push ebp
mov ebp, esp
; al is used for the byte to write
mov eax, [esp + 12]
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform write
out dx, ax
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @function void out_32(uint16_t port, uint8_t b)
; Writes the dword to the given port
global out_32
out_32:
; standard frame setup
push ebp
mov ebp, esp
; al is used for the byte to write
mov eax, [esp + 12]
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform write
out dx, eax
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @function uint8_t in_8(uint16_t port)
; Returns the byte from the given port
global in_8
in_8:
; standard frame setup
push ebp
mov ebp, esp
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform read
in al, dx
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @function uint16_t in_16(uint16_t port)
; Returns the byte from the given port
global in_16
in_16:
; standard frame setup
push ebp
mov ebp, esp
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform read
in ax, dx
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @function uint32_t in_32(uint16_t port)
; Returns the byte from the given port
global in_32
in_32:
; standard frame setup
push ebp
mov ebp, esp
; dx is used for the port
push edx
mov edx, [esp+12]
; Perform read
in eax, dx
; Restore registers
pop edx
; Restore stack frame and return
mov esp, ebp
pop ebp
ret
; @func void io_wait()
; Performs an IO NOP
global io_wait
io_wait:
; Setup stack frame
push ebp
mov ebp, esp
; Write NOP
; note -- port 0x80 is only used for the BIOS, so it's not needed anymore
mov al, 0
out 0x80, al
; Restore stack frame
mov esp, ebp
pop ebp
ret
| 15.633721 | 75 | 0.651543 |
ea0f49086172ef601f48f0d46e315c0f7fd1d096 | 1,781 | sql | SQL | Speckoz.BukkitDev/BukkitDev.Desktop/dados.sql | Speckoz/BukkitDev-Desktop | a4e2aa70099cb8e4d9f669512c396ec40478ba4b | [
"MIT"
] | 3 | 2020-01-03T23:26:08.000Z | 2021-11-08T09:10:42.000Z | Speckoz.BukkitDev/BukkitDev.Desktop/dados.sql | Speckoz/BukkitDev-Desktop | a4e2aa70099cb8e4d9f669512c396ec40478ba4b | [
"MIT"
] | 3 | 2019-08-19T19:29:55.000Z | 2019-08-21T16:38:46.000Z | Speckoz.BukkitDev/BukkitDev.Desktop/dados.sql | Speckoz/BukkitDev-Desktop | a4e2aa70099cb8e4d9f669512c396ec40478ba4b | [
"MIT"
] | 1 | 2021-01-13T07:09:12.000Z | 2021-01-13T07:09:12.000Z | create database if not exists BukkitDev;
drop database if exists BukkitDev;
use BukkitDev;
##########################
######### testes #########
##########################
#====================================================================================
show tables;
select * from PluginList;# where NomePlugin like '%eco%';
select * from LicencaList;
select count(LicencaList) from LicencaList;
truncate table PluginList;
truncate table LicencaList;
delete from PluginList where ID = 999991;
select NomePlugin from PluginList where ID = 999991;
select * from LicencaList where (LicencaKey = @a || ClienteID = 99687671) && DataCriacao = '2019-07-25';
insert into PluginList values (999999, "RC_Economy", "Logikoz", "1.0.0", "Gratuito", "0", "Plugin de economia para seu servidor", false);
insert into LicencaList values (99999999, 312909, "xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", false, "2019-06-18", "06:00:00", false);
#=====================================================================================
drop table if exists PluginList;
create table if not exists PluginList(
ID MediumInt not null primary key,
NomePlugin tinytext not null,
AutorPlugin tinytext not null,
VersaoPlugin char(5) not null,
TipoPlugin char(10) not null,
PrecoPlugin char(5),
DescricaoPlugin text(1024) not null,
ImagemPadraoPersonalizada boolean not null);
drop table if exists LicencaList;
create table if not exists licencaList(
ClienteID int unsigned not null,
#cliente_nome varchar(30) not null,
PluginID MediumInt not null,
LicencaKey tinytext not null,
LicencaGlobal boolean not null,
DataCriacao date not null,
HorarioCriacao time not null,
LicencaSuspensa bool,
IPPermitido tinytext not null);
| 34.921569 | 137 | 0.633352 |
f4e6f8ad519456c743388a34919b6be984b30789 | 4,457 | kt | Kotlin | libs/docker-client/src/main/kotlin/batect/docker/build/buildkit/services/FileSyncScope.kt | exustash/batect | 2248da4cf569980b2a443e8b5cf72b9c011be837 | [
"Apache-2.0"
] | 1 | 2021-08-08T11:08:27.000Z | 2021-08-08T11:08:27.000Z | libs/docker-client/src/main/kotlin/batect/docker/build/buildkit/services/FileSyncScope.kt | exustash/batect | 2248da4cf569980b2a443e8b5cf72b9c011be837 | [
"Apache-2.0"
] | null | null | null | libs/docker-client/src/main/kotlin/batect/docker/build/buildkit/services/FileSyncScope.kt | exustash/batect | 2248da4cf569980b2a443e8b5cf72b9c011be837 | [
"Apache-2.0"
] | null | null | null | /*
Copyright 2017-2021 Charles Korn.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package batect.docker.build.buildkit.services
import batect.docker.build.ImageBuildIgnoreEntry
import batect.docker.build.MatchResult
import batect.primitives.mapToSet
import java.nio.file.Files
import java.nio.file.LinkOption
import java.nio.file.Path
import kotlin.streams.toList
// Exclude patterns: patterns of files to exclude, possibly with negation - order matters as last matching pattern wins
// Include patterns: literal file names (not patterns) to include
// Follow paths: patterns of files to include, no negation
//
// Yes, 'include patterns' and 'follow paths' seem around the wrong way, but that's how it's implemented... :shrug:
class FileSyncScope(
private val rootDirectory: Path,
excludePatterns: List<String>,
includePatterns: Set<String>,
followPaths: Set<String>
) {
private val cleanedIncludePatterns = includePatterns.mapToSet { ImageBuildIgnoreEntry.cleanPattern(it) }
private val parsedFollowPathPatterns = followPaths.mapToSet { ImageBuildIgnoreEntry.withUncleanPattern(it, true) }
private val shouldIncludeEverything = (cleanedIncludePatterns.isEmpty() && parsedFollowPathPatterns.isEmpty()) || cleanedIncludePatterns.contains(".") || parsedFollowPathPatterns.any { it.pattern == "." }
private val parsedExcludePatterns = excludePatterns.map { pattern ->
if (pattern.isNotEmpty() && pattern[0] == '!') {
ImageBuildIgnoreEntry.withUncleanPattern(pattern.substring(1), true)
} else {
ImageBuildIgnoreEntry.withUncleanPattern(pattern, false)
}
}
// Why a list and not a set? BuildKit cares about the order of entries - parents must be sent before their children,
// and children must be sorted alphabetically.
val contents: List<FileSyncScopeEntry> = resolveContents()
private fun resolveContents(): List<FileSyncScopeEntry> {
return walkDirectory(rootDirectory).sortedBy { it.relativePath }
}
// TODO: don't bother walking a directory that could never be included by includePatterns / followPaths
// TODO: don't bother walking a directory that could never be included due to excludePatterns
private fun walkDirectory(directory: Path): List<FileSyncScopeEntry> {
val contents = Files.list(directory).toList()
val entries = mutableListOf<FileSyncScopeEntry>()
contents.forEach { child ->
val entry = createEntry(child)
val childEntries = if (Files.isDirectory(child, LinkOption.NOFOLLOW_LINKS)) { walkDirectory(child) } else { emptyList() }
if (childEntries.isNotEmpty()) {
entries += entry
entries += childEntries
} else if (isIncluded(entry) && !isExcluded(entry)) {
entries += entry
}
}
return entries
}
private fun createEntry(path: Path): FileSyncScopeEntry {
val relativePath = rootDirectory.relativize(path).toUnixStyleString()
return FileSyncScopeEntry(path, relativePath)
}
private fun isIncluded(entry: FileSyncScopeEntry): Boolean {
if (shouldIncludeEverything) {
return true
}
if (cleanedIncludePatterns.contains(entry.relativePath)) {
return true
}
return parsedFollowPathPatterns.any { it.matches(entry.relativePath) == MatchResult.MatchedInclude }
}
private fun isExcluded(entry: FileSyncScopeEntry): Boolean {
for (pattern in parsedExcludePatterns.reversed()) {
val result = pattern.matches(entry.relativePath)
if (result == MatchResult.MatchedExclude) {
return true
} else if (result == MatchResult.MatchedInclude) {
return false
}
}
return false
}
private fun Path.toUnixStyleString() = this.joinToString("/")
}
| 39.442478 | 208 | 0.694413 |
e571f614e4ac8b22fda2a4de938bfe61f2612be4 | 5,077 | swift | Swift | Pods/Yams/Sources/Yams/Representer.swift | Snagajob/Sourcery | ddc70f3eed66d9bacf71874f5ca893f1b2f30cbb | [
"MIT"
] | 17 | 2017-02-19T21:30:02.000Z | 2021-01-18T14:24:08.000Z | Pods/Yams/Sources/Yams/Representer.swift | Snagajob/Sourcery | ddc70f3eed66d9bacf71874f5ca893f1b2f30cbb | [
"MIT"
] | null | null | null | Pods/Yams/Sources/Yams/Representer.swift | Snagajob/Sourcery | ddc70f3eed66d9bacf71874f5ca893f1b2f30cbb | [
"MIT"
] | null | null | null | //
// Representer.swift
// Yams
//
// Created by Norio Nomura on 1/8/17.
// Copyright (c) 2017 Yams. All rights reserved.
//
#if SWIFT_PACKAGE
import CYaml
#endif
import Foundation
public extension Node {
/// initialize `Node` with instance of `NodeRepresentable`
/// - Parameter representable: instance of `NodeRepresentable`
/// - Throws: `YamlError`
public init<T: NodeRepresentable>(_ representable: T) throws {
self = try representable.represented()
}
}
// MARK: - NodeRepresentable
public protocol NodeRepresentable {
func represented() throws -> Node
}
extension Node: NodeRepresentable {
public func represented() throws -> Node {
return self
}
}
extension Bool: NodeRepresentable {
public func represented() throws -> Node {
return Node(self ? "true" : "false", Tag(.bool))
}
}
extension Data: NodeRepresentable {
public func represented() throws -> Node {
return Node(base64EncodedString(), Tag(.binary))
}
}
extension Date: NodeRepresentable {
public func represented() throws -> Node {
return Node(iso8601string, Tag(.timestamp))
}
private var iso8601string: String {
let calendar = Calendar(identifier: .gregorian)
let nanosecond = calendar.component(.nanosecond, from: self)
#if os(Linux)
// swift-corelibs-foundation has bug with nanosecond.
// https://bugs.swift.org/browse/SR-3158
return iso8601Formatter.string(from: self)
#else
if nanosecond != 0 {
return iso8601FormatterWithNanoseconds.string(from: self)
.trimmingCharacters(in: characterSetZero) + "Z"
} else {
return iso8601Formatter.string(from: self)
}
#endif
}
}
private let characterSetZero = CharacterSet(charactersIn: "0")
private let iso8601Formatter: DateFormatter = {
var formatter = DateFormatter()
formatter.locale = Locale(identifier :"en_US_POSIX")
formatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"
formatter.timeZone = TimeZone(secondsFromGMT: 0)
return formatter
}()
private let iso8601FormatterWithNanoseconds: DateFormatter = {
var formatter = DateFormatter()
formatter.locale = Locale(identifier :"en_US_POSIX")
formatter.dateFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.SSSSSSSSS"
formatter.timeZone = TimeZone(secondsFromGMT: 0)
return formatter
}()
extension Double: NodeRepresentable {
public func represented() throws -> Node {
return Node(doubleFormatter.string(for: self)!.replacingOccurrences(of: "+-", with: "-"), Tag(.float))
}
}
extension Float: NodeRepresentable {
public func represented() throws -> Node {
return Node(floatFormatter.string(for: self)!.replacingOccurrences(of: "+-", with: "-"), Tag(.float))
}
}
private func numberFormatter(with significantDigits: Int) -> NumberFormatter {
let formatter = NumberFormatter()
formatter.locale = Locale(identifier: "en_US")
formatter.numberStyle = .scientific
formatter.usesSignificantDigits = true
formatter.maximumSignificantDigits = significantDigits
formatter.positiveInfinitySymbol = ".inf"
formatter.negativeInfinitySymbol = "-.inf"
formatter.notANumberSymbol = ".nan"
formatter.exponentSymbol = "e+"
return formatter
}
private let doubleFormatter = numberFormatter(with: 15)
private let floatFormatter = numberFormatter(with: 7)
// TODO: Support `Float80`
//extension Float80: NodeRepresentable {}
extension Integer {
public func represented() throws -> Node {
return Node(String(describing: self), Tag(.int))
}
}
extension Int: NodeRepresentable {}
extension Int16: NodeRepresentable {}
extension Int32: NodeRepresentable {}
extension Int64: NodeRepresentable {}
extension Int8: NodeRepresentable {}
extension UInt: NodeRepresentable {}
extension UInt16: NodeRepresentable {}
extension UInt32: NodeRepresentable {}
extension UInt64: NodeRepresentable {}
extension UInt8: NodeRepresentable {}
private func represent(_ value: Any) throws -> Node {
if let string = value as? String {
return Node(string)
} else if let representable = value as? NodeRepresentable {
return try representable.represented()
}
throw YamlError.representer(problem: "Fail to represent \(value)")
}
extension Optional: NodeRepresentable {
public func represented() throws -> Node {
switch self {
case let .some(wrapped):
return try represent(wrapped)
case .none:
return Node("null", Tag(.null))
}
}
}
extension Array: NodeRepresentable {
public func represented() throws -> Node {
let nodes = try flatMap(represent)
return Node(nodes, Tag(.seq))
}
}
extension Dictionary: NodeRepresentable {
public func represented() throws -> Node {
let pairs = try map { (key: try represent($0), value: try represent($1)) }
return Node(pairs.sorted { $0.key < $1.key }, Tag(.map))
}
}
| 30.220238 | 110 | 0.672247 |
92ae10a187521645aa3e4404ed0657232a105439 | 413,424 | c | C | stage0/stdlib/Init/Lean/Compiler/IR/EmitC.c | mhuisi/lean4 | dda44bc47f3e5d024508060dac2bcb59fd12e4c0 | [
"Apache-2.0"
] | null | null | null | stage0/stdlib/Init/Lean/Compiler/IR/EmitC.c | mhuisi/lean4 | dda44bc47f3e5d024508060dac2bcb59fd12e4c0 | [
"Apache-2.0"
] | 2 | 2020-10-11T19:06:55.000Z | 2020-10-11T19:06:59.000Z | stage0/stdlib/Init/Lean/Compiler/IR/EmitC.c | mhuisi/lean4 | dda44bc47f3e5d024508060dac2bcb59fd12e4c0 | [
"Apache-2.0"
] | 2 | 2020-07-07T14:51:27.000Z | 2020-07-08T10:37:07.000Z | // Lean compiler output
// Module: Init.Lean.Compiler.IR.EmitC
// Imports: Init.Control.Conditional Init.Lean.Runtime Init.Lean.Compiler.NameMangling Init.Lean.Compiler.ExportAttr Init.Lean.Compiler.InitAttr Init.Lean.Compiler.IR.CompilerM Init.Lean.Compiler.IR.EmitUtil Init.Lean.Compiler.IR.NormIds Init.Lean.Compiler.IR.SimpCase Init.Lean.Compiler.IR.Boxing
#include "runtime/lean.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
lean_object* l_List_reverse___rarg(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMarkPersistent___closed__1;
lean_object* l_Lean_IR_EmitC_emitCase___closed__1;
lean_object* l_Lean_IR_EmitC_argToCString___closed__1;
lean_object* lean_string_push(lean_object*, uint32_t);
lean_object* l_Lean_IR_EmitC_toStringArgs(lean_object*);
lean_object* l_Lean_IR_EmitC_emitSProj___closed__4;
lean_object* l_Lean_IR_EmitC_toCType___closed__7;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__1;
lean_object* l_Lean_IR_EmitC_emitCInitName(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__6;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__44;
lean_object* l_Lean_IR_EmitC_emitMarkPersistent___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitUnbox___closed__4;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__4;
lean_object* l_Lean_IR_EmitC_emitSetTag(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitProj(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDel___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__1;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__8;
lean_object* l_Lean_IR_EmitC_emitFileHeader___boxed(lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDel___closed__1;
extern lean_object* l_Lean_IR_formatFnBodyHead___closed__29;
lean_object* l_Lean_IR_EmitC_emit(lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__17;
lean_object* l_Lean_IR_EmitC_emitIsShared(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_div(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1;
lean_object* l_Lean_IR_EmitC_emitFnDecls___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__10;
lean_object* l_Lean_IR_EmitC_emitBlock___main(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareVars___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCase___closed__2;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__11;
lean_object* l_Lean_IR_EmitC_emitFnDeclAux___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitAllocCtor___closed__1;
lean_object* l_Lean_IR_EmitC_emitCName___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFnDeclAux(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__2;
lean_object* l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtor(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(uint8_t, lean_object*);
lean_object* lean_array_uget(lean_object*, size_t);
lean_object* l_Lean_IR_EmitC_emitAllocCtor___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__3;
lean_object* l_Lean_IR_EmitC_emitInc___closed__3;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__11;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__9;
lean_object* l_Lean_IR_EmitC_getDecl___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toHexDigit(lean_object*);
lean_object* l_Lean_Environment_imports(lean_object*);
uint8_t lean_name_eq(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSProj___closed__2;
lean_object* l_Lean_IR_EmitC_throwUnknownVar___rarg___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_collectUsedDecls(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___closed__6;
lean_object* lean_array_fswap(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInc___closed__5;
extern lean_object* l_Prod_HasRepr___rarg___closed__1;
lean_object* l_Lean_IR_EmitC_emitSProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDeclAux___closed__3;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__51;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__19;
lean_object* l_Lean_IR_EmitC_emitSProj___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__41;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__13;
extern lean_object* l_Array_empty___closed__1;
lean_object* l_Lean_IR_EmitC_emitSProj(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_getEnv___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__5;
lean_object* l___private_Init_Util_1__mkPanicMessage(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitUnbox___closed__2;
lean_object* l_Lean_IR_EmitC_emitVDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__47;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2;
lean_object* l_Lean_expandExternPattern(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDel(lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_closureMaxArgs;
uint8_t l_Lean_IR_IRType_isIrrelevant(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMarkPersistent(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_map___main___at_Lean_IR_EmitC_toStringArgs___spec__1(lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___closed__3;
lean_object* lean_ir_emit_c(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__35;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___closed__5;
lean_object* l_Lean_IR_EmitC_emitLhs___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitReset___closed__4;
extern lean_object* l_Unit_HasRepr___closed__1;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__19;
lean_object* l_Lean_IR_EmitC_emitFnDeclAux___closed__1;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1;
lean_object* l_Lean_IR_EmitC_emitLn___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDeclInit___closed__3;
lean_object* lean_array_get_size(lean_object*);
lean_object* l_Lean_IR_EmitC_emitReuse___closed__2;
lean_object* lean_string_append(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFnDecl(lean_object*, uint8_t, lean_object*, lean_object*);
extern lean_object* l_String_splitAux___main___closed__1;
lean_object* l_Lean_IR_EmitC_toStringArgs___boxed(lean_object*);
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1;
lean_object* l_Lean_getExternNameFor(lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__39;
extern lean_object* l_String_quote___closed__1;
lean_object* l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_quoteString___boxed(lean_object*);
lean_object* l_Lean_IR_EmitC_emitBlock___main___closed__2;
lean_object* l_Lean_IR_EmitC_emitSet(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__46;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCase___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_hasMainFn___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitUnbox___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_string_utf8_byte_size(lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtorScalarSize(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_isTailCallTo(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_throwUnknownVar___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn(lean_object*, lean_object*);
uint8_t l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareVars(lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtorSetArgs(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__25;
lean_object* l_Lean_IR_EmitC_emitUnbox___closed__1;
uint8_t l_Lean_IR_IRType_isObj(lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFnDecls(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitOffset___closed__2;
lean_object* lean_nat_add(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___closed__4;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__8;
lean_object* l_Lean_IR_EmitC_emitJmp___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__6;
lean_object* l_Lean_IR_Decl_resultType(lean_object*);
extern lean_object* l_Char_quoteCore___closed__1;
lean_object* l_Lean_IR_Decl_name(lean_object*);
lean_object* l_Lean_IR_EmitC_emitInc___closed__2;
lean_object* l_Lean_IR_EmitC_emitArg___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCInitName___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__25;
lean_object* l_Lean_IR_EmitC_emitJmp___closed__1;
lean_object* l_Lean_IR_EmitC_toCInitName___closed__1;
lean_object* l_Lean_IR_EmitC_leanMainFn___closed__1;
lean_object* lean_string_utf8_next(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_main(lean_object*, lean_object*);
extern lean_object* l_Char_quoteCore___closed__2;
lean_object* l_Lean_IR_EmitC_emit___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_IR_Arg_Inhabited;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__4;
lean_object* l_Lean_IR_EmitC_emitIf(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitReset(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__31;
lean_object* l_Lean_IR_AltCore_body(lean_object*);
lean_object* l_Lean_IR_EmitC_argToCString(lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__6;
lean_object* l_Lean_IR_EmitC_emitReset___closed__3;
uint8_t l_Lean_isExternC(lean_object*, lean_object*);
lean_object* lean_array_fget(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_isIf___boxed(lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtorScalarSize___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__43;
lean_object* l_Lean_IR_EmitC_emitCtorScalarSize___closed__1;
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___closed__2;
lean_object* l_Lean_IR_EmitC_toCInitName(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_overwriteParam___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitJPs___main(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTag___closed__1;
lean_object* l_Lean_IR_EmitC_emitTailCall(lean_object*, lean_object*, lean_object*);
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitUProj(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_sub(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitArg(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitApp___closed__1;
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__5;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFns___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__2;
lean_object* l_Array_shrink___main___rarg(lean_object*, lean_object*);
extern lean_object* l_Lean_isExport___closed__2;
lean_object* l_Lean_IR_EmitC_emitExternCall___closed__1;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toHexDigit___boxed(lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1;
lean_object* l_RBTree_toList___at_Lean_IR_usesModuleFrom___spec__1(lean_object*);
lean_object* l_Lean_IR_EmitC_emitNumLit___closed__3;
lean_object* l_Lean_IR_EmitC_emitCtor___closed__1;
lean_object* l_Lean_IR_EmitC_emitExternCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLns___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLhs(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtor___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_get(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSimpleExternalCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitBoxFn___closed__4;
lean_object* l_Lean_IR_EmitC_emitJmp(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitJmp___closed__2;
lean_object* l_Lean_IR_EmitC_emitMainFnIfNeeded(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__13;
lean_object* l_Lean_IR_EmitC_hasMainFn(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitOffset___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_FnBody_isTerminal(lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__23;
lean_object* l_Lean_IR_EmitC_emitIf___closed__2;
lean_object* l_Lean_IR_EmitC_emitArgs(lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1;
extern lean_object* l_Lean_IR_formatDecl___closed__3;
lean_object* l_Lean_IR_EmitC_emitPartialApp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitBox___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__2(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCName___closed__1;
lean_object* l_Nat_repr(lean_object*);
extern lean_object* l_Char_HasRepr___closed__1;
lean_object* l_Lean_IR_EmitC_toCType___closed__8;
extern lean_object* l_Lean_IR_paramInh;
lean_object* l_Lean_IR_EmitC_emitDeclInit___closed__2;
lean_object* l_Lean_IR_EmitC_emitDeclInit___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSet___closed__1;
lean_object* l_Lean_IR_EmitC_emitBox(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__45;
lean_object* l_Lean_IR_EmitC_emitReset___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitOffset___closed__1;
lean_object* l_Lean_IR_EmitC_emitFnBody___main(lean_object*, lean_object*, lean_object*);
lean_object* lean_name_mk_string(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDeclInit___closed__1;
lean_object* l_Lean_IR_EmitC_emitIf___closed__3;
lean_object* l_Lean_IR_EmitC_emitArgs___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__40;
lean_object* l_Lean_IR_EmitC_toCType___boxed(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__9;
lean_object* l_Lean_IR_EmitC_emitReset___closed__1;
lean_object* l_Lean_IR_EmitC_emitSProj___closed__3;
extern lean_object* l_List_reprAux___main___rarg___closed__1;
extern lean_object* l_Lean_IR_formatFnBody___main___closed__1;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__21;
extern lean_object* l_IO_println___rarg___closed__1;
lean_object* l_Lean_IR_EmitC_toCName(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__7;
lean_object* l_Lean_IR_EmitC_emitFullApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__27;
lean_object* l_Lean_IR_EmitC_emitDeclInit(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitIf___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2;
extern lean_object* l_Lean_IR_getDecl___closed__1;
lean_object* l_Lean_IR_EmitC_emitIf___closed__1;
lean_object* l_Lean_IR_EmitC_toCName___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__36;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__2;
lean_object* l_Lean_SimplePersistentEnvExtension_getEntries___rarg(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__1;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInc(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__17;
lean_object* l_Lean_IR_EmitC_leanMainFn;
uint32_t lean_string_utf8_get(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitNumLit___closed__4;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDecl___closed__1;
lean_object* l_Lean_IR_EmitC_emitInitFn___boxed(lean_object*, lean_object*);
uint32_t l_Nat_digitChar(lean_object*);
size_t lean_usize_modn(size_t, lean_object*);
lean_object* l_Lean_IR_EmitC_throwInvalidExportName(lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__16;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareVar(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__9;
uint8_t l_Array_isEmpty___rarg(lean_object*);
lean_object* l_Lean_IR_EmitC_emitIsShared___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__1;
extern lean_object* l_String_Iterator_HasRepr___closed__2;
lean_object* l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1;
lean_object* l_Lean_IR_EmitC_declareVars___main___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitBoxFn___closed__2;
lean_object* l_Lean_IR_EmitC_toCType___closed__4;
lean_object* l_Lean_IR_EmitC_emitProj___closed__1;
lean_object* l_Lean_IR_EmitC_emitIsShared___closed__1;
lean_object* l_Lean_IR_EmitC_emitDeclAux___closed__2;
lean_object* l_Lean_IR_EmitC_emitMainFn(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitVDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__32;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__10;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_RBNode_insert___at_Lean_NameSet_insert___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__14;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__20;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__7;
lean_object* l_Lean_IR_EmitC_emitUProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCInitName___boxed(lean_object*, lean_object*, lean_object*);
size_t lean_usize_of_nat(lean_object*);
lean_object* l_Lean_IR_EmitC_emitReuse___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_NameSet_empty;
lean_object* l_Lean_IR_EmitC_emitFnBody(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_ensureHasDefault(lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__14;
lean_object* l_Lean_IR_EmitC_emitUProj___closed__1;
lean_object* l_Lean_IR_EmitC_emitUnbox___closed__3;
lean_object* l_Lean_IR_EmitC_emitBoxFn___closed__3;
lean_object* l_Lean_IR_EmitC_emitNumLit(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitExternCall(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__28;
extern lean_object* l_Lean_HasToString___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__5;
lean_object* lean_ir_decl_to_string(lean_object*);
uint8_t l_Lean_hasInitAttr(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__30;
extern lean_object* l_Lean_exportAttr;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSimpleExternalCall(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Char_quoteCore___closed__3;
lean_object* l_Lean_IR_EmitC_emitUSet(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__33;
lean_object* l_Lean_IR_EmitC_emitFnDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareParams(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__3;
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitReset___closed__2;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitAllocCtor(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLn___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Option_HasRepr___rarg___closed__3;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1;
lean_object* l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2(lean_object*, lean_object*);
uint8_t l_UInt32_decEq(uint32_t, uint32_t);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2;
lean_object* l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLit(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__53;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__42;
extern lean_object* l_PersistentArray_Stats_toString___closed__4;
lean_object* l_Lean_IR_EmitC_emitExternDeclAux(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareParams___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__15;
lean_object* l_Lean_IR_EmitC_emitDec___closed__2;
lean_object* l_Lean_IR_EmitC_emitSetTag___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__37;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSetTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFnIfNeeded___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__11;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__3;
lean_object* l_Lean_IR_EmitC_emitReuse(lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLns(lean_object*);
lean_object* l_Lean_IR_EmitC_paramEqArg___boxed(lean_object*, lean_object*);
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader(lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitDeclAux(lean_object*, lean_object*, lean_object*);
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitNumLit___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitUSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__3;
lean_object* l_Lean_IR_EmitC_emitBoxFn___closed__1;
lean_object* l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInc___closed__4;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__5;
lean_object* l_Lean_IR_EmitC_emitUSet___closed__1;
lean_object* l_Lean_IR_EmitC_emitFnBody___main___closed__1;
lean_object* lean_panic_fn(lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1;
lean_object* l_Lean_IR_EmitC_emitNumLit___closed__2;
lean_object* l_Lean_IR_EmitC_isTailCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitBoxFn___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_IR_altInh;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__22;
lean_object* l_Lean_IR_EmitC_emitFileFooter___closed__1;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__18;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__12;
uint8_t l_Lean_IR_ExplicitBoxing_isBoxedName(lean_object*);
extern lean_object* l___private_Init_Util_1__mkPanicMessage___closed__2;
lean_object* l_Lean_IR_EmitC_emitIsTaggedPtr(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_IR_JoinPointId_HasToString___closed__1;
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__6;
lean_object* l_Lean_IR_EmitC_emitProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_EmitC_overwriteParam(lean_object*, lean_object*);
uint8_t l_Lean_isIOUnitInitFn(lean_object*, lean_object*);
lean_object* l_Lean_getExternEntryFor(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitNumLit___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__26;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___closed__5;
lean_object* l_Lean_IR_EmitC_emitApp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitBlock___main___closed__1;
extern lean_object* l_uint32Sz;
lean_object* l_Array_filterAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__3(lean_object*, lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTag(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareVars___main(lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__7;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1;
lean_object* l_Lean_IR_EmitC_emitDecl(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_throwUnknownVar(lean_object*);
lean_object* l_Lean_IR_EmitC_isIf(lean_object*);
lean_object* l_Lean_IR_EmitC_emitTailCall___closed__2;
lean_object* l_Lean_IR_EmitC_emitBlock(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___closed__3;
lean_object* l_Lean_IR_EmitC_emitBoxFn(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_isTailCall(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_throwInvalidExportName___rarg___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileFooter___boxed(lean_object*, lean_object*);
lean_object* lean_get_init_fn_name_for(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTailCall___closed__3;
lean_object* l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1;
lean_object* l_Lean_IR_EmitC_getModName___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInc___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTailCall___closed__1;
lean_object* l_Lean_IR_EmitC_emitInc___closed__1;
extern lean_object* l_Lean_IR_VarId_HasToString___closed__1;
lean_object* l_Lean_IR_EmitC_emit___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLit___closed__1;
lean_object* l_Lean_IR_EmitC_emitFileFooter___closed__2;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__22;
lean_object* l_Lean_IR_EmitC_emitDec(lean_object*, lean_object*, uint8_t, lean_object*, lean_object*);
lean_object* l_Array_toList___rarg(lean_object*);
lean_object* l_Lean_IR_EmitC_emitDec___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3;
lean_object* l_Lean_IR_EmitC_emitLit___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitTailCall___boxed(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__12;
lean_object* l_Lean_IR_EmitC_getJPParams___closed__1;
lean_object* lean_ir_find_env_decl(lean_object*, lean_object*);
lean_object* lean_name_mangle(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__29;
lean_object* l_Lean_IR_EmitC_emitDec___closed__1;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_mkVarJPMaps(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__52;
lean_object* l_Lean_IR_EmitC_emitPartialApp___closed__2;
lean_object* l_Lean_IR_EmitC_emitFns(lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_Decl_normalizeIds(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__21;
uint8_t l_Lean_NameSet_contains(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCName(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__38;
lean_object* l_Lean_IR_EmitC_emitFullApp(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___boxed(lean_object*, lean_object*);
uint8_t l_Lean_IR_usesModuleFrom(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitPartialApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_declareVar___closed__1;
lean_object* l_Lean_IR_EmitC_declareVar___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_mod(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileFooter(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__23;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType___closed__10;
lean_object* l_Lean_IR_EmitC_getJPParams___boxed(lean_object*, lean_object*, lean_object*);
extern lean_object* l_Char_quoteCore___closed__5;
lean_object* l_Lean_IR_EmitC_emitUnbox(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitJPs(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitOffset(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitExternDeclAux___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_System_FilePath_dirName___closed__1;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__34;
lean_object* l_Lean_IR_EmitC_emitSSet___closed__4;
lean_object* l_Lean_Name_toStringWithSep___main(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__2;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__48;
lean_object* l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLn(lean_object*);
extern lean_object* l_Lean_IR_declMapExt;
lean_object* l_Lean_IR_FnBody_body(lean_object*);
lean_object* l_Lean_IR_EmitC_emitReuse___closed__1;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1(lean_object*);
extern lean_object* l_HashMap_Inhabited___closed__1;
extern lean_object* l_Lean_getBuiltinSearchPath___closed__3;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__18;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__15;
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1___boxed(lean_object*, lean_object*, lean_object*);
extern lean_object* l_String_Inhabited;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__50;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__24;
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___closed__1;
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__8;
lean_object* l_Lean_IR_Decl_params(lean_object*);
lean_object* lean_uint32_to_nat(uint32_t);
lean_object* l_Lean_IR_EmitC_throwInvalidExportName___rarg(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__4;
uint8_t l_Lean_IR_EmitC_paramEqArg(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCase(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitLns___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__10;
extern lean_object* l_Lean_mkAppStx___closed__1;
lean_object* l_Lean_IR_EmitC_getModName(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitSSet___closed__2;
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__24;
extern lean_object* l_addParenHeuristic___closed__1;
lean_object* l_Lean_IR_EmitC_quoteString(lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__49;
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_toCType(lean_object*);
lean_object* l_Lean_IR_EmitC_emitDeclAux___closed__1;
lean_object* l_Lean_IR_EmitC_emitInitFn___closed__9;
lean_object* l_Lean_IR_EmitC_emitFileHeader___closed__20;
lean_object* l_Lean_IR_EmitC_getEnv(lean_object*, lean_object*);
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_getJPParams(lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitMainFn___closed__16;
lean_object* l_Lean_IR_EmitC_emitPartialApp___closed__1;
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitIsTaggedPtr___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_emitCtorSetArgs___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1___boxed(lean_object*, lean_object*);
lean_object* l_Lean_IR_EmitC_getDecl(lean_object*, lean_object*, lean_object*);
lean_object* _init_l_Lean_IR_EmitC_leanMainFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("_lean_main");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_leanMainFn() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_IR_EmitC_leanMainFn___closed__1;
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_getEnv(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
x_4 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_4, 0, x_3);
lean_ctor_set(x_4, 1, x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_getEnv___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_getModName(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
x_4 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_4, 0, x_3);
lean_ctor_set(x_4, 1, x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_getModName___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_getModName(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_getDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_4, 0);
lean_inc(x_1);
x_7 = lean_ir_find_env_decl(x_6, x_1);
if (lean_obj_tag(x_7) == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_8 = l_System_FilePath_dirName___closed__1;
x_9 = l_Lean_Name_toStringWithSep___main(x_8, x_1);
x_10 = l_Lean_IR_getDecl___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = l_Char_HasRepr___closed__1;
x_13 = lean_string_append(x_11, x_12);
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_13);
return x_4;
}
else
{
lean_object* x_14;
lean_dec(x_1);
x_14 = lean_ctor_get(x_7, 0);
lean_inc(x_14);
lean_dec(x_7);
lean_ctor_set(x_4, 0, x_14);
return x_4;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_4, 0);
x_16 = lean_ctor_get(x_4, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_4);
lean_inc(x_1);
x_17 = lean_ir_find_env_decl(x_15, x_1);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_18 = l_System_FilePath_dirName___closed__1;
x_19 = l_Lean_Name_toStringWithSep___main(x_18, x_1);
x_20 = l_Lean_IR_getDecl___closed__1;
x_21 = lean_string_append(x_20, x_19);
lean_dec(x_19);
x_22 = l_Char_HasRepr___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_16);
return x_24;
}
else
{
lean_object* x_25; lean_object* x_26;
lean_dec(x_1);
x_25 = lean_ctor_get(x_17, 0);
lean_inc(x_25);
lean_dec(x_17);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_16);
return x_26;
}
}
}
}
lean_object* l_Lean_IR_EmitC_getDecl___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_getDecl(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emit___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_5 = lean_apply_1(x_1, x_2);
x_6 = lean_string_append(x_4, x_5);
lean_dec(x_5);
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_6);
return x_8;
}
}
lean_object* l_Lean_IR_EmitC_emit(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_emit___rarg___boxed), 4, 0);
return x_2;
}
}
lean_object* l_Lean_IR_EmitC_emit___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emit___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitLn___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_5 = lean_apply_1(x_1, x_2);
x_6 = lean_string_append(x_4, x_5);
lean_dec(x_5);
x_7 = l_IO_println___rarg___closed__1;
x_8 = lean_string_append(x_6, x_7);
x_9 = lean_box(0);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_8);
return x_10;
}
}
lean_object* l_Lean_IR_EmitC_emitLn(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_emitLn___rarg___boxed), 4, 0);
return x_2;
}
}
lean_object* l_Lean_IR_EmitC_emitLn___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitLn___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_5; lean_object* x_6;
lean_dec(x_1);
x_5 = lean_box(0);
x_6 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_6, 0, x_5);
lean_ctor_set(x_6, 1, x_4);
return x_6;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_7 = lean_ctor_get(x_2, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_2, 1);
lean_inc(x_8);
lean_dec(x_2);
lean_inc(x_1);
x_9 = lean_apply_1(x_1, x_7);
x_10 = lean_string_append(x_4, x_9);
lean_dec(x_9);
x_11 = l_IO_println___rarg___closed__1;
x_12 = lean_string_append(x_10, x_11);
x_2 = x_8;
x_4 = x_12;
goto _start;
}
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg___boxed), 4, 0);
return x_2;
}
}
lean_object* l_Lean_IR_EmitC_emitLns___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitLns(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_emitLns___rarg___boxed), 4, 0);
return x_2;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_List_forM___main___at_Lean_IR_EmitC_emitLns___spec__1___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitLns___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitLns___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_argToCString___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box(0)");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_argToCString(lean_object* x_1) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_2 = lean_ctor_get(x_1, 0);
lean_inc(x_2);
lean_dec(x_1);
x_3 = l_Nat_repr(x_2);
x_4 = l_Lean_IR_VarId_HasToString___closed__1;
x_5 = lean_string_append(x_4, x_3);
lean_dec(x_3);
return x_5;
}
else
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_argToCString___closed__1;
return x_6;
}
}
}
lean_object* l_Lean_IR_EmitC_emitArg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_4 = l_Lean_IR_EmitC_argToCString(x_1);
x_5 = lean_string_append(x_3, x_4);
lean_dec(x_4);
x_6 = lean_box(0);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitArg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitArg(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("double");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("uint8_t");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("uint16_t");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("uint32_t");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("uint64_t");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("size_t");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object*");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__8() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("Init.Lean.Compiler.IR.EmitC");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("not implemented yet");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l_Lean_IR_EmitC_toCType___closed__8;
x_2 = lean_unsigned_to_nat(69u);
x_3 = lean_unsigned_to_nat(23u);
x_4 = l_Lean_IR_EmitC_toCType___closed__9;
x_5 = l___private_Init_Util_1__mkPanicMessage(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCType___closed__11() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l_Lean_IR_EmitC_toCType___closed__8;
x_2 = lean_unsigned_to_nat(70u);
x_3 = lean_unsigned_to_nat(23u);
x_4 = l_Lean_IR_EmitC_toCType___closed__9;
x_5 = l___private_Init_Util_1__mkPanicMessage(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_toCType(lean_object* x_1) {
_start:
{
switch (lean_obj_tag(x_1)) {
case 0:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_toCType___closed__1;
return x_2;
}
case 1:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_toCType___closed__2;
return x_3;
}
case 2:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_toCType___closed__3;
return x_4;
}
case 3:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_toCType___closed__4;
return x_5;
}
case 4:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_toCType___closed__5;
return x_6;
}
case 5:
{
lean_object* x_7;
x_7 = l_Lean_IR_EmitC_toCType___closed__6;
return x_7;
}
case 9:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = l_String_Inhabited;
x_9 = l_Lean_IR_EmitC_toCType___closed__10;
x_10 = lean_panic_fn(x_8, x_9);
return x_10;
}
case 10:
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = l_String_Inhabited;
x_12 = l_Lean_IR_EmitC_toCType___closed__11;
x_13 = lean_panic_fn(x_11, x_12);
return x_13;
}
default:
{
lean_object* x_14;
x_14 = l_Lean_IR_EmitC_toCType___closed__7;
return x_14;
}
}
}
}
lean_object* l_Lean_IR_EmitC_toCType___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_toCType(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* _init_l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("invalid export name '");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_throwInvalidExportName___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_4 = l_System_FilePath_dirName___closed__1;
x_5 = l_Lean_Name_toStringWithSep___main(x_4, x_1);
x_6 = l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1;
x_7 = lean_string_append(x_6, x_5);
lean_dec(x_5);
x_8 = l_Char_HasRepr___closed__1;
x_9 = lean_string_append(x_7, x_8);
x_10 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_3);
return x_10;
}
}
lean_object* l_Lean_IR_EmitC_throwInvalidExportName(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_throwInvalidExportName___rarg___boxed), 3, 0);
return x_2;
}
}
lean_object* l_Lean_IR_EmitC_throwInvalidExportName___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCName___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("l_");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_toCName(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = l_Lean_exportAttr;
lean_inc(x_1);
x_9 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_8, x_6, x_1);
lean_dec(x_6);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; uint8_t x_11;
x_10 = l_Lean_isExport___closed__2;
x_11 = lean_name_eq(x_1, x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13;
x_12 = l_Lean_IR_EmitC_toCName___closed__1;
x_13 = lean_name_mangle(x_1, x_12);
lean_ctor_set(x_4, 0, x_13);
return x_4;
}
else
{
lean_object* x_14;
lean_dec(x_1);
x_14 = l_Lean_IR_EmitC_leanMainFn;
lean_ctor_set(x_4, 0, x_14);
return x_4;
}
}
else
{
lean_object* x_15;
x_15 = lean_ctor_get(x_9, 0);
lean_inc(x_15);
lean_dec(x_9);
if (lean_obj_tag(x_15) == 1)
{
lean_object* x_16;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17;
lean_dec(x_1);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
lean_ctor_set(x_4, 0, x_17);
return x_4;
}
else
{
lean_object* x_18;
lean_dec(x_16);
lean_dec(x_15);
lean_free_object(x_4);
x_18 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_7);
return x_18;
}
}
else
{
lean_object* x_19;
lean_dec(x_15);
lean_free_object(x_4);
x_19 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_7);
return x_19;
}
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_20 = lean_ctor_get(x_4, 0);
x_21 = lean_ctor_get(x_4, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_4);
x_22 = l_Lean_exportAttr;
lean_inc(x_1);
x_23 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_22, x_20, x_1);
lean_dec(x_20);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24; uint8_t x_25;
x_24 = l_Lean_isExport___closed__2;
x_25 = lean_name_eq(x_1, x_24);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = l_Lean_IR_EmitC_toCName___closed__1;
x_27 = lean_name_mangle(x_1, x_26);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_21);
return x_28;
}
else
{
lean_object* x_29; lean_object* x_30;
lean_dec(x_1);
x_29 = l_Lean_IR_EmitC_leanMainFn;
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_21);
return x_30;
}
}
else
{
lean_object* x_31;
x_31 = lean_ctor_get(x_23, 0);
lean_inc(x_31);
lean_dec(x_23);
if (lean_obj_tag(x_31) == 1)
{
lean_object* x_32;
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
if (lean_obj_tag(x_32) == 0)
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_1);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_21);
return x_34;
}
else
{
lean_object* x_35;
lean_dec(x_32);
lean_dec(x_31);
x_35 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_21);
return x_35;
}
}
else
{
lean_object* x_36;
lean_dec(x_31);
x_36 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_21);
return x_36;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_toCName___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_toCName(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitCName(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_toCName(x_1, x_2, x_3);
if (lean_obj_tag(x_4) == 0)
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_box(0);
lean_ctor_set(x_4, 1, x_8);
lean_ctor_set(x_4, 0, x_9);
return x_4;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_10 = lean_ctor_get(x_4, 0);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_4);
x_12 = lean_string_append(x_11, x_10);
lean_dec(x_10);
x_13 = lean_box(0);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
}
else
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_4);
if (x_15 == 0)
{
return x_4;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_4, 0);
x_17 = lean_ctor_get(x_4, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_4);
x_18 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitCName___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitCName(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_toCInitName___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("_init_");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_toCInitName(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = l_Lean_exportAttr;
lean_inc(x_1);
x_9 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_8, x_6, x_1);
lean_dec(x_6);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = l_Lean_IR_EmitC_toCName___closed__1;
x_11 = lean_name_mangle(x_1, x_10);
x_12 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
lean_ctor_set(x_4, 0, x_13);
return x_4;
}
else
{
lean_object* x_14;
x_14 = lean_ctor_get(x_9, 0);
lean_inc(x_14);
lean_dec(x_9);
if (lean_obj_tag(x_14) == 1)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
lean_dec(x_1);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_18 = lean_string_append(x_17, x_16);
lean_dec(x_16);
lean_ctor_set(x_4, 0, x_18);
return x_4;
}
else
{
lean_object* x_19;
lean_dec(x_15);
lean_dec(x_14);
lean_free_object(x_4);
x_19 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_7);
return x_19;
}
}
else
{
lean_object* x_20;
lean_dec(x_14);
lean_free_object(x_4);
x_20 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_7);
return x_20;
}
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_21 = lean_ctor_get(x_4, 0);
x_22 = lean_ctor_get(x_4, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_4);
x_23 = l_Lean_exportAttr;
lean_inc(x_1);
x_24 = l_Lean_ParametricAttribute_getParam___at_Lean_isIOUnitInitFn___spec__1(x_23, x_21, x_1);
lean_dec(x_21);
if (lean_obj_tag(x_24) == 0)
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_25 = l_Lean_IR_EmitC_toCName___closed__1;
x_26 = lean_name_mangle(x_1, x_25);
x_27 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_28 = lean_string_append(x_27, x_26);
lean_dec(x_26);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_22);
return x_29;
}
else
{
lean_object* x_30;
x_30 = lean_ctor_get(x_24, 0);
lean_inc(x_30);
lean_dec(x_24);
if (lean_obj_tag(x_30) == 1)
{
lean_object* x_31;
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
if (lean_obj_tag(x_31) == 0)
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
lean_dec(x_1);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_34 = lean_string_append(x_33, x_32);
lean_dec(x_32);
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_34);
lean_ctor_set(x_35, 1, x_22);
return x_35;
}
else
{
lean_object* x_36;
lean_dec(x_31);
lean_dec(x_30);
x_36 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_22);
return x_36;
}
}
else
{
lean_object* x_37;
lean_dec(x_30);
x_37 = l_Lean_IR_EmitC_throwInvalidExportName___rarg(x_1, x_2, x_22);
return x_37;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_toCInitName___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_toCInitName(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitCInitName(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_toCInitName(x_1, x_2, x_3);
if (lean_obj_tag(x_4) == 0)
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_box(0);
lean_ctor_set(x_4, 1, x_8);
lean_ctor_set(x_4, 0, x_9);
return x_4;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_10 = lean_ctor_get(x_4, 0);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_4);
x_12 = lean_string_append(x_11, x_10);
lean_dec(x_10);
x_13 = lean_box(0);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
}
else
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_4);
if (x_15 == 0)
{
return x_4;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_4, 0);
x_17 = lean_ctor_get(x_4, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_4);
x_18 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitCInitName___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitCInitName(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = lean_nat_dec_lt(x_6, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_1, x_11);
lean_dec(x_11);
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
lean_dec(x_14);
x_16 = l_Lean_IR_EmitC_toCType(x_15);
lean_dec(x_15);
x_17 = lean_string_append(x_5, x_16);
lean_dec(x_16);
x_3 = x_9;
x_5 = x_17;
goto _start;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_19 = l_List_reprAux___main___rarg___closed__1;
x_20 = lean_string_append(x_5, x_19);
x_21 = l_Lean_IR_paramInh;
x_22 = lean_array_get(x_21, x_1, x_11);
lean_dec(x_11);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitC_toCType(x_23);
lean_dec(x_23);
x_25 = lean_string_append(x_20, x_24);
lean_dec(x_24);
x_3 = x_9;
x_5 = x_25;
goto _start;
}
}
else
{
lean_object* x_27; lean_object* x_28;
lean_dec(x_3);
x_27 = lean_box(0);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_5);
return x_28;
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = lean_nat_dec_lt(x_6, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_1, x_11);
lean_dec(x_11);
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
lean_dec(x_14);
x_16 = l_Lean_IR_EmitC_toCType(x_15);
lean_dec(x_15);
x_17 = lean_string_append(x_5, x_16);
lean_dec(x_16);
x_3 = x_9;
x_5 = x_17;
goto _start;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_19 = l_List_reprAux___main___rarg___closed__1;
x_20 = lean_string_append(x_5, x_19);
x_21 = l_Lean_IR_paramInh;
x_22 = lean_array_get(x_21, x_1, x_11);
lean_dec(x_11);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitC_toCType(x_23);
lean_dec(x_23);
x_25 = lean_string_append(x_20, x_24);
lean_dec(x_24);
x_3 = x_9;
x_5 = x_25;
goto _start;
}
}
else
{
lean_object* x_27; lean_object* x_28;
lean_dec(x_3);
x_27 = lean_box(0);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_5);
return x_28;
}
}
}
lean_object* l_Array_filterAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_array_get_size(x_1);
x_5 = lean_nat_dec_lt(x_2, x_4);
lean_dec(x_4);
if (x_5 == 0)
{
lean_object* x_6;
lean_dec(x_2);
x_6 = l_Array_shrink___main___rarg(x_1, x_3);
lean_dec(x_3);
return x_6;
}
else
{
lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_7 = lean_array_fget(x_1, x_2);
x_8 = lean_ctor_get(x_7, 1);
lean_inc(x_8);
lean_dec(x_7);
x_9 = l_Lean_IR_IRType_isIrrelevant(x_8);
lean_dec(x_8);
if (x_9 == 0)
{
uint8_t x_10;
x_10 = lean_nat_dec_lt(x_3, x_2);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_2, x_11);
lean_dec(x_2);
x_13 = lean_nat_add(x_3, x_11);
lean_dec(x_3);
x_2 = x_12;
x_3 = x_13;
goto _start;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_15 = lean_array_fswap(x_1, x_2, x_3);
x_16 = lean_unsigned_to_nat(1u);
x_17 = lean_nat_add(x_2, x_16);
lean_dec(x_2);
x_18 = lean_nat_add(x_3, x_16);
lean_dec(x_3);
x_1 = x_15;
x_2 = x_17;
x_3 = x_18;
goto _start;
}
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_unsigned_to_nat(1u);
x_21 = lean_nat_add(x_2, x_20);
lean_dec(x_2);
x_2 = x_21;
goto _start;
}
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFnDeclAux___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object**");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitFnDeclAux(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11; lean_object* x_12;
x_6 = l_Lean_IR_Decl_params(x_1);
x_7 = l_Lean_IR_EmitC_getEnv(x_4, x_5);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
if (lean_is_exclusive(x_7)) {
lean_ctor_release(x_7, 0);
lean_ctor_release(x_7, 1);
x_10 = x_7;
} else {
lean_dec_ref(x_7);
x_10 = lean_box(0);
}
x_11 = l_Array_isEmpty___rarg(x_6);
if (x_11 == 0)
{
x_12 = x_9;
goto block_87;
}
else
{
if (x_3 == 0)
{
x_12 = x_9;
goto block_87;
}
else
{
lean_object* x_88; lean_object* x_89;
x_88 = l_Lean_IR_formatDecl___closed__3;
x_89 = lean_string_append(x_9, x_88);
x_12 = x_89;
goto block_87;
}
}
block_87:
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_13 = l_Lean_IR_Decl_resultType(x_1);
x_14 = l_Lean_IR_EmitC_toCType(x_13);
lean_dec(x_13);
x_15 = l_String_Iterator_HasRepr___closed__2;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_string_append(x_16, x_2);
x_18 = lean_string_append(x_12, x_17);
lean_dec(x_17);
if (x_11 == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_78;
x_19 = l_Prod_HasRepr___rarg___closed__1;
x_20 = lean_string_append(x_18, x_19);
x_21 = l_Lean_IR_Decl_name(x_1);
lean_inc(x_21);
x_78 = l_Lean_isExternC(x_8, x_21);
lean_dec(x_8);
if (x_78 == 0)
{
x_22 = x_6;
goto block_77;
}
else
{
lean_object* x_79; lean_object* x_80;
x_79 = lean_unsigned_to_nat(0u);
x_80 = l_Array_filterAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__3(x_6, x_79, x_79);
x_22 = x_80;
goto block_77;
}
block_77:
{
lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_23 = lean_array_get_size(x_22);
x_24 = l_Lean_closureMaxArgs;
x_25 = lean_nat_dec_lt(x_24, x_23);
if (x_25 == 0)
{
lean_object* x_26; uint8_t x_27;
lean_dec(x_21);
lean_dec(x_10);
lean_inc(x_23);
x_26 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1(x_22, x_23, x_23, x_4, x_20);
lean_dec(x_23);
lean_dec(x_22);
x_27 = !lean_is_exclusive(x_26);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_28 = lean_ctor_get(x_26, 1);
x_29 = lean_ctor_get(x_26, 0);
lean_dec(x_29);
x_30 = l_Option_HasRepr___rarg___closed__3;
x_31 = lean_string_append(x_28, x_30);
x_32 = l_Lean_IR_formatFnBody___main___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = l_IO_println___rarg___closed__1;
x_35 = lean_string_append(x_33, x_34);
x_36 = lean_box(0);
lean_ctor_set(x_26, 1, x_35);
lean_ctor_set(x_26, 0, x_36);
return x_26;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_37 = lean_ctor_get(x_26, 1);
lean_inc(x_37);
lean_dec(x_26);
x_38 = l_Option_HasRepr___rarg___closed__3;
x_39 = lean_string_append(x_37, x_38);
x_40 = l_Lean_IR_formatFnBody___main___closed__1;
x_41 = lean_string_append(x_39, x_40);
x_42 = l_IO_println___rarg___closed__1;
x_43 = lean_string_append(x_41, x_42);
x_44 = lean_box(0);
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_43);
return x_45;
}
}
else
{
uint8_t x_46;
x_46 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_21);
lean_dec(x_21);
if (x_46 == 0)
{
lean_object* x_47; uint8_t x_48;
lean_dec(x_10);
lean_inc(x_23);
x_47 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2(x_22, x_23, x_23, x_4, x_20);
lean_dec(x_23);
lean_dec(x_22);
x_48 = !lean_is_exclusive(x_47);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_49 = lean_ctor_get(x_47, 1);
x_50 = lean_ctor_get(x_47, 0);
lean_dec(x_50);
x_51 = l_Option_HasRepr___rarg___closed__3;
x_52 = lean_string_append(x_49, x_51);
x_53 = l_Lean_IR_formatFnBody___main___closed__1;
x_54 = lean_string_append(x_52, x_53);
x_55 = l_IO_println___rarg___closed__1;
x_56 = lean_string_append(x_54, x_55);
x_57 = lean_box(0);
lean_ctor_set(x_47, 1, x_56);
lean_ctor_set(x_47, 0, x_57);
return x_47;
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_58 = lean_ctor_get(x_47, 1);
lean_inc(x_58);
lean_dec(x_47);
x_59 = l_Option_HasRepr___rarg___closed__3;
x_60 = lean_string_append(x_58, x_59);
x_61 = l_Lean_IR_formatFnBody___main___closed__1;
x_62 = lean_string_append(x_60, x_61);
x_63 = l_IO_println___rarg___closed__1;
x_64 = lean_string_append(x_62, x_63);
x_65 = lean_box(0);
x_66 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_64);
return x_66;
}
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76;
lean_dec(x_23);
lean_dec(x_22);
x_67 = l_Lean_IR_EmitC_emitFnDeclAux___closed__1;
x_68 = lean_string_append(x_20, x_67);
x_69 = l_Option_HasRepr___rarg___closed__3;
x_70 = lean_string_append(x_68, x_69);
x_71 = l_Lean_IR_formatFnBody___main___closed__1;
x_72 = lean_string_append(x_70, x_71);
x_73 = l_IO_println___rarg___closed__1;
x_74 = lean_string_append(x_72, x_73);
x_75 = lean_box(0);
if (lean_is_scalar(x_10)) {
x_76 = lean_alloc_ctor(0, 2, 0);
} else {
x_76 = x_10;
}
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_74);
return x_76;
}
}
}
}
else
{
lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86;
lean_dec(x_8);
lean_dec(x_6);
x_81 = l_Lean_IR_formatFnBody___main___closed__1;
x_82 = lean_string_append(x_18, x_81);
x_83 = l_IO_println___rarg___closed__1;
x_84 = lean_string_append(x_82, x_83);
x_85 = lean_box(0);
if (lean_is_scalar(x_10)) {
x_86 = lean_alloc_ctor(0, 2, 0);
} else {
x_86 = x_10;
}
lean_ctor_set(x_86, 0, x_85);
lean_ctor_set(x_86, 1, x_84);
return x_86;
}
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitFnDeclAux___spec__2(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitFnDeclAux___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = lean_unbox(x_3);
lean_dec(x_3);
x_7 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_6, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitFnDecl(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6;
x_5 = l_Lean_IR_Decl_name(x_1);
x_6 = l_Lean_IR_EmitC_toCName(x_5, x_3, x_4);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_7, x_2, x_3, x_8);
lean_dec(x_7);
return x_9;
}
else
{
uint8_t x_10;
x_10 = !lean_is_exclusive(x_6);
if (x_10 == 0)
{
return x_6;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_6, 0);
x_12 = lean_ctor_get(x_6, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_6);
x_13 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
return x_13;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitFnDecl___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5; lean_object* x_6;
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_EmitC_emitFnDecl(x_1, x_5, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitExternDeclAux(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_5 = l_Lean_IR_EmitC_getEnv(x_3, x_4);
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_5, 1);
lean_inc(x_7);
lean_dec(x_5);
x_8 = l_Lean_IR_Decl_name(x_1);
x_9 = l_Lean_isExternC(x_6, x_8);
lean_dec(x_6);
if (x_9 == 0)
{
uint8_t x_10; lean_object* x_11;
x_10 = 1;
x_11 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_10, x_3, x_7);
return x_11;
}
else
{
uint8_t x_12; lean_object* x_13;
x_12 = 0;
x_13 = l_Lean_IR_EmitC_emitFnDeclAux(x_1, x_2, x_12, x_3, x_7);
return x_13;
}
}
}
lean_object* l_Lean_IR_EmitC_emitExternDeclAux___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitExternDeclAux(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_3 = lean_ctor_get(x_2, 0);
x_4 = lean_ctor_get(x_2, 1);
x_5 = l_Lean_IR_Decl_name(x_3);
x_6 = lean_box(0);
x_7 = l_RBNode_insert___at_Lean_NameSet_insert___spec__1(x_1, x_5, x_6);
x_1 = x_7;
x_2 = x_4;
goto _start;
}
}
}
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_dec(x_1);
return x_2;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_3, 1);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_IR_Decl_name(x_4);
x_7 = lean_box(0);
x_8 = l_RBNode_insert___at_Lean_NameSet_insert___spec__1(x_2, x_6, x_7);
lean_inc(x_1);
x_9 = l_Lean_IR_collectUsedDecls(x_1, x_4, x_8);
x_2 = x_9;
x_3 = x_5;
goto _start;
}
}
}
lean_object* _init_l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("c");
return x_1;
}
}
lean_object* _init_l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_box(0);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_3, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
lean_dec(x_3);
lean_inc(x_8);
x_10 = l_Lean_IR_EmitC_getDecl(x_8, x_4, x_5);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_Decl_name(x_11);
x_14 = l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2;
x_15 = l_Lean_getExternNameFor(x_1, x_14, x_13);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
x_16 = l_Lean_NameSet_contains(x_2, x_8);
lean_dec(x_8);
if (x_16 == 0)
{
uint8_t x_17; lean_object* x_18;
x_17 = 1;
x_18 = l_Lean_IR_EmitC_emitFnDecl(x_11, x_17, x_4, x_12);
lean_dec(x_11);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19;
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
x_3 = x_9;
x_5 = x_19;
goto _start;
}
else
{
uint8_t x_21;
lean_dec(x_9);
x_21 = !lean_is_exclusive(x_18);
if (x_21 == 0)
{
return x_18;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_18, 0);
x_23 = lean_ctor_get(x_18, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_18);
x_24 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_24, 0, x_22);
lean_ctor_set(x_24, 1, x_23);
return x_24;
}
}
}
else
{
uint8_t x_25; lean_object* x_26;
x_25 = 0;
x_26 = l_Lean_IR_EmitC_emitFnDecl(x_11, x_25, x_4, x_12);
lean_dec(x_11);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_27;
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_3 = x_9;
x_5 = x_27;
goto _start;
}
else
{
uint8_t x_29;
lean_dec(x_9);
x_29 = !lean_is_exclusive(x_26);
if (x_29 == 0)
{
return x_26;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_26, 0);
x_31 = lean_ctor_get(x_26, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_26);
x_32 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_32, 0, x_30);
lean_ctor_set(x_32, 1, x_31);
return x_32;
}
}
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
lean_dec(x_8);
x_33 = lean_ctor_get(x_15, 0);
lean_inc(x_33);
lean_dec(x_15);
x_34 = l_Lean_IR_EmitC_emitExternDeclAux(x_11, x_33, x_4, x_12);
lean_dec(x_33);
lean_dec(x_11);
x_35 = lean_ctor_get(x_34, 1);
lean_inc(x_35);
lean_dec(x_34);
x_3 = x_9;
x_5 = x_35;
goto _start;
}
}
else
{
uint8_t x_37;
lean_dec(x_9);
lean_dec(x_8);
x_37 = !lean_is_exclusive(x_10);
if (x_37 == 0)
{
return x_10;
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_38 = lean_ctor_get(x_10, 0);
x_39 = lean_ctor_get(x_10, 1);
lean_inc(x_39);
lean_inc(x_38);
lean_dec(x_10);
x_40 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_40, 0, x_38);
lean_ctor_set(x_40, 1, x_39);
return x_40;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitFnDecls(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_3, 1);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_IR_declMapExt;
x_7 = l_Lean_SimplePersistentEnvExtension_getEntries___rarg(x_6, x_4);
x_8 = l_Lean_NameSet_empty;
x_9 = l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1(x_8, x_7);
lean_inc(x_4);
x_10 = l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__2(x_4, x_8, x_7);
x_11 = l_RBTree_toList___at_Lean_IR_usesModuleFrom___spec__1(x_10);
lean_dec(x_10);
x_12 = l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3(x_4, x_9, x_11, x_1, x_5);
lean_dec(x_9);
lean_dec(x_4);
return x_12;
}
}
lean_object* l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_List_foldl___main___at_Lean_IR_EmitC_emitFnDecls___spec__1(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitFnDecls___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitFnDecls(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_box(0);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_6 = lean_ctor_get(x_1, 0);
x_7 = lean_ctor_get(x_1, 1);
x_8 = lean_string_append(x_3, x_6);
x_9 = l_IO_println___rarg___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_1 = x_7;
x_3 = x_10;
goto _start;
}
}
}
lean_object* l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_1, x_2, x_3);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("invalid main function, incorrect arity when generating code");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("res = initialize_");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("(lean_io_mk_world());");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_init_task_manager();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__4;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_dec_ref(res);");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__5;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__8() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (lean_io_result_is_ok(res)) {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__9() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__8;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__7;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__10() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_io_mark_end_initialization();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__11() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__10;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__9;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__12() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("res = ");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__13() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__12;
x_2 = l_Lean_IR_EmitC_leanMainFn;
x_3 = lean_string_append(x_1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__14() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__13;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_3 = lean_string_append(x_1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__15() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_PersistentArray_Stats_toString___closed__4;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__16() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" return 1;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__17() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__16;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__15;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__18() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_dec_ref(res);");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__19() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__18;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__17;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__20() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_io_result_show_error(res);");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__21() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__20;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__19;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__22() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("} else {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__23() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__22;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__21;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__24() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" return ret;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__25() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__24;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__23;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__26() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__18;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__25;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__27() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" int ret = lean_unbox(lean_io_result_get_value(res));");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__28() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__27;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__26;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__29() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__8;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__28;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__30() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_getBuiltinSearchPath___closed__3;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__31() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__30;
x_2 = l_Lean_mkAppStx___closed__1;
x_3 = lean_name_mk_string(x_1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__32() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("void lean_initialize_runtime_module();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__33() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("int main(int argc, char ** argv) {\nlean_object* in; lean_object* res;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__34() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_initialize_runtime_module();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__35() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("void lean_initialize();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__36() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_initialize();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__37() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" in = n;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__38() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__37;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__15;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__39() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" n = lean_alloc_ctor(1,2,0); lean_ctor_set(n, 0, lean_mk_string(argv[i])); lean_ctor_set(n, 1, in);");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__40() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__39;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__38;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__41() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" i--;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__42() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__41;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__40;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__43() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_object* n;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__44() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__43;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__42;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__45() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("while (i > 1) {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__46() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__45;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__44;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__47() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("int i = argc;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__48() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__47;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__46;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__49() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("in = lean_box(0);");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__50() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__49;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__48;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__51() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("(in, lean_io_mk_world());");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__52() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitMainFn___closed__13;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__51;
x_3 = lean_string_append(x_1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMainFn___closed__53() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("function declaration expected");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitMainFn(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4;
x_3 = l_Lean_isExport___closed__2;
x_4 = l_Lean_IR_EmitC_getDecl(x_3, x_1, x_2);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5;
x_5 = lean_ctor_get(x_4, 0);
lean_inc(x_5);
if (lean_obj_tag(x_5) == 0)
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_4);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_7 = lean_ctor_get(x_4, 1);
x_8 = lean_ctor_get(x_4, 0);
lean_dec(x_8);
x_9 = lean_ctor_get(x_5, 1);
lean_inc(x_9);
lean_dec(x_5);
x_10 = lean_array_get_size(x_9);
lean_dec(x_9);
x_11 = lean_unsigned_to_nat(2u);
x_12 = lean_nat_dec_eq(x_10, x_11);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_dec_eq(x_10, x_13);
lean_dec(x_10);
if (x_14 == 0)
{
lean_object* x_15;
x_15 = l_Lean_IR_EmitC_emitMainFn___closed__1;
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_15);
return x_4;
}
else
{
lean_object* x_16; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; uint8_t x_56;
lean_free_object(x_4);
x_52 = l_Lean_IR_EmitC_getEnv(x_1, x_7);
x_53 = lean_ctor_get(x_52, 0);
lean_inc(x_53);
x_54 = lean_ctor_get(x_52, 1);
lean_inc(x_54);
lean_dec(x_52);
x_55 = l_Lean_IR_EmitC_emitMainFn___closed__31;
x_56 = l_Lean_IR_usesModuleFrom(x_53, x_55);
lean_dec(x_53);
if (x_56 == 0)
{
lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_57 = l_Lean_IR_EmitC_emitMainFn___closed__32;
x_58 = lean_string_append(x_54, x_57);
x_59 = l_IO_println___rarg___closed__1;
x_60 = lean_string_append(x_58, x_59);
x_61 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_62 = lean_string_append(x_60, x_61);
x_63 = lean_string_append(x_62, x_59);
x_64 = l_Lean_IR_EmitC_emitMainFn___closed__34;
x_65 = lean_string_append(x_63, x_64);
x_66 = lean_string_append(x_65, x_59);
x_16 = x_66;
goto block_51;
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76;
x_67 = l_Lean_IR_EmitC_emitMainFn___closed__35;
x_68 = lean_string_append(x_54, x_67);
x_69 = l_IO_println___rarg___closed__1;
x_70 = lean_string_append(x_68, x_69);
x_71 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_72 = lean_string_append(x_70, x_71);
x_73 = lean_string_append(x_72, x_69);
x_74 = l_Lean_IR_EmitC_emitMainFn___closed__36;
x_75 = lean_string_append(x_73, x_74);
x_76 = lean_string_append(x_75, x_69);
x_16 = x_76;
goto block_51;
}
block_51:
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; uint8_t x_40;
x_17 = l_Lean_IR_EmitC_getModName(x_1, x_16);
x_18 = lean_ctor_get(x_17, 0);
lean_inc(x_18);
x_19 = lean_ctor_get(x_17, 1);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_String_splitAux___main___closed__1;
x_21 = lean_name_mangle(x_18, x_20);
x_22 = l_Lean_IR_EmitC_emitMainFn___closed__2;
x_23 = lean_string_append(x_22, x_21);
lean_dec(x_21);
x_24 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_25 = lean_string_append(x_23, x_24);
x_26 = lean_string_append(x_19, x_25);
lean_dec(x_25);
x_27 = l_IO_println___rarg___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_Lean_IR_EmitC_emitMainFn___closed__11;
x_30 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_29, x_1, x_28);
x_31 = lean_ctor_get(x_30, 1);
lean_inc(x_31);
lean_dec(x_30);
x_32 = l_Lean_IR_EmitC_emitMainFn___closed__14;
x_33 = lean_string_append(x_31, x_32);
x_34 = lean_string_append(x_33, x_27);
x_35 = l_PersistentArray_Stats_toString___closed__4;
x_36 = lean_string_append(x_34, x_35);
x_37 = lean_string_append(x_36, x_27);
x_38 = l_Lean_IR_EmitC_emitMainFn___closed__29;
x_39 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_38, x_1, x_37);
x_40 = !lean_is_exclusive(x_39);
if (x_40 == 0)
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_41 = lean_ctor_get(x_39, 1);
x_42 = lean_ctor_get(x_39, 0);
lean_dec(x_42);
x_43 = lean_string_append(x_41, x_35);
x_44 = lean_string_append(x_43, x_27);
x_45 = lean_box(0);
lean_ctor_set(x_39, 1, x_44);
lean_ctor_set(x_39, 0, x_45);
return x_39;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_46 = lean_ctor_get(x_39, 1);
lean_inc(x_46);
lean_dec(x_39);
x_47 = lean_string_append(x_46, x_35);
x_48 = lean_string_append(x_47, x_27);
x_49 = lean_box(0);
x_50 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_50, 0, x_49);
lean_ctor_set(x_50, 1, x_48);
return x_50;
}
}
}
}
else
{
lean_object* x_77; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; uint8_t x_126;
lean_dec(x_10);
lean_free_object(x_4);
x_122 = l_Lean_IR_EmitC_getEnv(x_1, x_7);
x_123 = lean_ctor_get(x_122, 0);
lean_inc(x_123);
x_124 = lean_ctor_get(x_122, 1);
lean_inc(x_124);
lean_dec(x_122);
x_125 = l_Lean_IR_EmitC_emitMainFn___closed__31;
x_126 = l_Lean_IR_usesModuleFrom(x_123, x_125);
lean_dec(x_123);
if (x_126 == 0)
{
lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136;
x_127 = l_Lean_IR_EmitC_emitMainFn___closed__32;
x_128 = lean_string_append(x_124, x_127);
x_129 = l_IO_println___rarg___closed__1;
x_130 = lean_string_append(x_128, x_129);
x_131 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_132 = lean_string_append(x_130, x_131);
x_133 = lean_string_append(x_132, x_129);
x_134 = l_Lean_IR_EmitC_emitMainFn___closed__34;
x_135 = lean_string_append(x_133, x_134);
x_136 = lean_string_append(x_135, x_129);
x_77 = x_136;
goto block_121;
}
else
{
lean_object* x_137; lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145; lean_object* x_146;
x_137 = l_Lean_IR_EmitC_emitMainFn___closed__35;
x_138 = lean_string_append(x_124, x_137);
x_139 = l_IO_println___rarg___closed__1;
x_140 = lean_string_append(x_138, x_139);
x_141 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_142 = lean_string_append(x_140, x_141);
x_143 = lean_string_append(x_142, x_139);
x_144 = l_Lean_IR_EmitC_emitMainFn___closed__36;
x_145 = lean_string_append(x_143, x_144);
x_146 = lean_string_append(x_145, x_139);
x_77 = x_146;
goto block_121;
}
block_121:
{
lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_108; lean_object* x_109;
x_78 = l_Lean_IR_EmitC_getModName(x_1, x_77);
x_79 = lean_ctor_get(x_78, 0);
lean_inc(x_79);
x_80 = lean_ctor_get(x_78, 1);
lean_inc(x_80);
lean_dec(x_78);
x_81 = l_String_splitAux___main___closed__1;
x_82 = lean_name_mangle(x_79, x_81);
x_83 = l_Lean_IR_EmitC_emitMainFn___closed__2;
x_84 = lean_string_append(x_83, x_82);
lean_dec(x_82);
x_85 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_86 = lean_string_append(x_84, x_85);
x_87 = lean_string_append(x_80, x_86);
lean_dec(x_86);
x_88 = l_IO_println___rarg___closed__1;
x_89 = lean_string_append(x_87, x_88);
x_108 = l_Lean_IR_EmitC_emitMainFn___closed__11;
x_109 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_108, x_1, x_89);
if (x_12 == 0)
{
lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113;
x_110 = lean_ctor_get(x_109, 1);
lean_inc(x_110);
lean_dec(x_109);
x_111 = l_Lean_IR_EmitC_emitMainFn___closed__14;
x_112 = lean_string_append(x_110, x_111);
x_113 = lean_string_append(x_112, x_88);
x_90 = x_113;
goto block_107;
}
else
{
lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120;
x_114 = lean_ctor_get(x_109, 1);
lean_inc(x_114);
lean_dec(x_109);
x_115 = l_Lean_IR_EmitC_emitMainFn___closed__50;
x_116 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_115, x_1, x_114);
x_117 = lean_ctor_get(x_116, 1);
lean_inc(x_117);
lean_dec(x_116);
x_118 = l_Lean_IR_EmitC_emitMainFn___closed__52;
x_119 = lean_string_append(x_117, x_118);
x_120 = lean_string_append(x_119, x_88);
x_90 = x_120;
goto block_107;
}
block_107:
{
lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; uint8_t x_96;
x_91 = l_PersistentArray_Stats_toString___closed__4;
x_92 = lean_string_append(x_90, x_91);
x_93 = lean_string_append(x_92, x_88);
x_94 = l_Lean_IR_EmitC_emitMainFn___closed__29;
x_95 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_94, x_1, x_93);
x_96 = !lean_is_exclusive(x_95);
if (x_96 == 0)
{
lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101;
x_97 = lean_ctor_get(x_95, 1);
x_98 = lean_ctor_get(x_95, 0);
lean_dec(x_98);
x_99 = lean_string_append(x_97, x_91);
x_100 = lean_string_append(x_99, x_88);
x_101 = lean_box(0);
lean_ctor_set(x_95, 1, x_100);
lean_ctor_set(x_95, 0, x_101);
return x_95;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106;
x_102 = lean_ctor_get(x_95, 1);
lean_inc(x_102);
lean_dec(x_95);
x_103 = lean_string_append(x_102, x_91);
x_104 = lean_string_append(x_103, x_88);
x_105 = lean_box(0);
x_106 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_106, 0, x_105);
lean_ctor_set(x_106, 1, x_104);
return x_106;
}
}
}
}
}
else
{
lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150; uint8_t x_151;
x_147 = lean_ctor_get(x_4, 1);
lean_inc(x_147);
lean_dec(x_4);
x_148 = lean_ctor_get(x_5, 1);
lean_inc(x_148);
lean_dec(x_5);
x_149 = lean_array_get_size(x_148);
lean_dec(x_148);
x_150 = lean_unsigned_to_nat(2u);
x_151 = lean_nat_dec_eq(x_149, x_150);
if (x_151 == 0)
{
lean_object* x_152; uint8_t x_153;
x_152 = lean_unsigned_to_nat(1u);
x_153 = lean_nat_dec_eq(x_149, x_152);
lean_dec(x_149);
if (x_153 == 0)
{
lean_object* x_154; lean_object* x_155;
x_154 = l_Lean_IR_EmitC_emitMainFn___closed__1;
x_155 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_155, 0, x_154);
lean_ctor_set(x_155, 1, x_147);
return x_155;
}
else
{
lean_object* x_156; lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190; uint8_t x_191;
x_187 = l_Lean_IR_EmitC_getEnv(x_1, x_147);
x_188 = lean_ctor_get(x_187, 0);
lean_inc(x_188);
x_189 = lean_ctor_get(x_187, 1);
lean_inc(x_189);
lean_dec(x_187);
x_190 = l_Lean_IR_EmitC_emitMainFn___closed__31;
x_191 = l_Lean_IR_usesModuleFrom(x_188, x_190);
lean_dec(x_188);
if (x_191 == 0)
{
lean_object* x_192; lean_object* x_193; lean_object* x_194; lean_object* x_195; lean_object* x_196; lean_object* x_197; lean_object* x_198; lean_object* x_199; lean_object* x_200; lean_object* x_201;
x_192 = l_Lean_IR_EmitC_emitMainFn___closed__32;
x_193 = lean_string_append(x_189, x_192);
x_194 = l_IO_println___rarg___closed__1;
x_195 = lean_string_append(x_193, x_194);
x_196 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_197 = lean_string_append(x_195, x_196);
x_198 = lean_string_append(x_197, x_194);
x_199 = l_Lean_IR_EmitC_emitMainFn___closed__34;
x_200 = lean_string_append(x_198, x_199);
x_201 = lean_string_append(x_200, x_194);
x_156 = x_201;
goto block_186;
}
else
{
lean_object* x_202; lean_object* x_203; lean_object* x_204; lean_object* x_205; lean_object* x_206; lean_object* x_207; lean_object* x_208; lean_object* x_209; lean_object* x_210; lean_object* x_211;
x_202 = l_Lean_IR_EmitC_emitMainFn___closed__35;
x_203 = lean_string_append(x_189, x_202);
x_204 = l_IO_println___rarg___closed__1;
x_205 = lean_string_append(x_203, x_204);
x_206 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_207 = lean_string_append(x_205, x_206);
x_208 = lean_string_append(x_207, x_204);
x_209 = l_Lean_IR_EmitC_emitMainFn___closed__36;
x_210 = lean_string_append(x_208, x_209);
x_211 = lean_string_append(x_210, x_204);
x_156 = x_211;
goto block_186;
}
block_186:
{
lean_object* x_157; lean_object* x_158; lean_object* x_159; lean_object* x_160; lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165; lean_object* x_166; lean_object* x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170; lean_object* x_171; lean_object* x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175; lean_object* x_176; lean_object* x_177; lean_object* x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; lean_object* x_182; lean_object* x_183; lean_object* x_184; lean_object* x_185;
x_157 = l_Lean_IR_EmitC_getModName(x_1, x_156);
x_158 = lean_ctor_get(x_157, 0);
lean_inc(x_158);
x_159 = lean_ctor_get(x_157, 1);
lean_inc(x_159);
lean_dec(x_157);
x_160 = l_String_splitAux___main___closed__1;
x_161 = lean_name_mangle(x_158, x_160);
x_162 = l_Lean_IR_EmitC_emitMainFn___closed__2;
x_163 = lean_string_append(x_162, x_161);
lean_dec(x_161);
x_164 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_165 = lean_string_append(x_163, x_164);
x_166 = lean_string_append(x_159, x_165);
lean_dec(x_165);
x_167 = l_IO_println___rarg___closed__1;
x_168 = lean_string_append(x_166, x_167);
x_169 = l_Lean_IR_EmitC_emitMainFn___closed__11;
x_170 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_169, x_1, x_168);
x_171 = lean_ctor_get(x_170, 1);
lean_inc(x_171);
lean_dec(x_170);
x_172 = l_Lean_IR_EmitC_emitMainFn___closed__14;
x_173 = lean_string_append(x_171, x_172);
x_174 = lean_string_append(x_173, x_167);
x_175 = l_PersistentArray_Stats_toString___closed__4;
x_176 = lean_string_append(x_174, x_175);
x_177 = lean_string_append(x_176, x_167);
x_178 = l_Lean_IR_EmitC_emitMainFn___closed__29;
x_179 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_178, x_1, x_177);
x_180 = lean_ctor_get(x_179, 1);
lean_inc(x_180);
if (lean_is_exclusive(x_179)) {
lean_ctor_release(x_179, 0);
lean_ctor_release(x_179, 1);
x_181 = x_179;
} else {
lean_dec_ref(x_179);
x_181 = lean_box(0);
}
x_182 = lean_string_append(x_180, x_175);
x_183 = lean_string_append(x_182, x_167);
x_184 = lean_box(0);
if (lean_is_scalar(x_181)) {
x_185 = lean_alloc_ctor(0, 2, 0);
} else {
x_185 = x_181;
}
lean_ctor_set(x_185, 0, x_184);
lean_ctor_set(x_185, 1, x_183);
return x_185;
}
}
}
else
{
lean_object* x_212; lean_object* x_252; lean_object* x_253; lean_object* x_254; lean_object* x_255; uint8_t x_256;
lean_dec(x_149);
x_252 = l_Lean_IR_EmitC_getEnv(x_1, x_147);
x_253 = lean_ctor_get(x_252, 0);
lean_inc(x_253);
x_254 = lean_ctor_get(x_252, 1);
lean_inc(x_254);
lean_dec(x_252);
x_255 = l_Lean_IR_EmitC_emitMainFn___closed__31;
x_256 = l_Lean_IR_usesModuleFrom(x_253, x_255);
lean_dec(x_253);
if (x_256 == 0)
{
lean_object* x_257; lean_object* x_258; lean_object* x_259; lean_object* x_260; lean_object* x_261; lean_object* x_262; lean_object* x_263; lean_object* x_264; lean_object* x_265; lean_object* x_266;
x_257 = l_Lean_IR_EmitC_emitMainFn___closed__32;
x_258 = lean_string_append(x_254, x_257);
x_259 = l_IO_println___rarg___closed__1;
x_260 = lean_string_append(x_258, x_259);
x_261 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_262 = lean_string_append(x_260, x_261);
x_263 = lean_string_append(x_262, x_259);
x_264 = l_Lean_IR_EmitC_emitMainFn___closed__34;
x_265 = lean_string_append(x_263, x_264);
x_266 = lean_string_append(x_265, x_259);
x_212 = x_266;
goto block_251;
}
else
{
lean_object* x_267; lean_object* x_268; lean_object* x_269; lean_object* x_270; lean_object* x_271; lean_object* x_272; lean_object* x_273; lean_object* x_274; lean_object* x_275; lean_object* x_276;
x_267 = l_Lean_IR_EmitC_emitMainFn___closed__35;
x_268 = lean_string_append(x_254, x_267);
x_269 = l_IO_println___rarg___closed__1;
x_270 = lean_string_append(x_268, x_269);
x_271 = l_Lean_IR_EmitC_emitMainFn___closed__33;
x_272 = lean_string_append(x_270, x_271);
x_273 = lean_string_append(x_272, x_269);
x_274 = l_Lean_IR_EmitC_emitMainFn___closed__36;
x_275 = lean_string_append(x_273, x_274);
x_276 = lean_string_append(x_275, x_269);
x_212 = x_276;
goto block_251;
}
block_251:
{
lean_object* x_213; lean_object* x_214; lean_object* x_215; lean_object* x_216; lean_object* x_217; lean_object* x_218; lean_object* x_219; lean_object* x_220; lean_object* x_221; lean_object* x_222; lean_object* x_223; lean_object* x_224; lean_object* x_225; lean_object* x_238; lean_object* x_239;
x_213 = l_Lean_IR_EmitC_getModName(x_1, x_212);
x_214 = lean_ctor_get(x_213, 0);
lean_inc(x_214);
x_215 = lean_ctor_get(x_213, 1);
lean_inc(x_215);
lean_dec(x_213);
x_216 = l_String_splitAux___main___closed__1;
x_217 = lean_name_mangle(x_214, x_216);
x_218 = l_Lean_IR_EmitC_emitMainFn___closed__2;
x_219 = lean_string_append(x_218, x_217);
lean_dec(x_217);
x_220 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_221 = lean_string_append(x_219, x_220);
x_222 = lean_string_append(x_215, x_221);
lean_dec(x_221);
x_223 = l_IO_println___rarg___closed__1;
x_224 = lean_string_append(x_222, x_223);
x_238 = l_Lean_IR_EmitC_emitMainFn___closed__11;
x_239 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_238, x_1, x_224);
if (x_151 == 0)
{
lean_object* x_240; lean_object* x_241; lean_object* x_242; lean_object* x_243;
x_240 = lean_ctor_get(x_239, 1);
lean_inc(x_240);
lean_dec(x_239);
x_241 = l_Lean_IR_EmitC_emitMainFn___closed__14;
x_242 = lean_string_append(x_240, x_241);
x_243 = lean_string_append(x_242, x_223);
x_225 = x_243;
goto block_237;
}
else
{
lean_object* x_244; lean_object* x_245; lean_object* x_246; lean_object* x_247; lean_object* x_248; lean_object* x_249; lean_object* x_250;
x_244 = lean_ctor_get(x_239, 1);
lean_inc(x_244);
lean_dec(x_239);
x_245 = l_Lean_IR_EmitC_emitMainFn___closed__50;
x_246 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_245, x_1, x_244);
x_247 = lean_ctor_get(x_246, 1);
lean_inc(x_247);
lean_dec(x_246);
x_248 = l_Lean_IR_EmitC_emitMainFn___closed__52;
x_249 = lean_string_append(x_247, x_248);
x_250 = lean_string_append(x_249, x_223);
x_225 = x_250;
goto block_237;
}
block_237:
{
lean_object* x_226; lean_object* x_227; lean_object* x_228; lean_object* x_229; lean_object* x_230; lean_object* x_231; lean_object* x_232; lean_object* x_233; lean_object* x_234; lean_object* x_235; lean_object* x_236;
x_226 = l_PersistentArray_Stats_toString___closed__4;
x_227 = lean_string_append(x_225, x_226);
x_228 = lean_string_append(x_227, x_223);
x_229 = l_Lean_IR_EmitC_emitMainFn___closed__29;
x_230 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_229, x_1, x_228);
x_231 = lean_ctor_get(x_230, 1);
lean_inc(x_231);
if (lean_is_exclusive(x_230)) {
lean_ctor_release(x_230, 0);
lean_ctor_release(x_230, 1);
x_232 = x_230;
} else {
lean_dec_ref(x_230);
x_232 = lean_box(0);
}
x_233 = lean_string_append(x_231, x_226);
x_234 = lean_string_append(x_233, x_223);
x_235 = lean_box(0);
if (lean_is_scalar(x_232)) {
x_236 = lean_alloc_ctor(0, 2, 0);
} else {
x_236 = x_232;
}
lean_ctor_set(x_236, 0, x_235);
lean_ctor_set(x_236, 1, x_234);
return x_236;
}
}
}
}
}
else
{
uint8_t x_277;
lean_dec(x_5);
x_277 = !lean_is_exclusive(x_4);
if (x_277 == 0)
{
lean_object* x_278; lean_object* x_279;
x_278 = lean_ctor_get(x_4, 0);
lean_dec(x_278);
x_279 = l_Lean_IR_EmitC_emitMainFn___closed__53;
lean_ctor_set_tag(x_4, 1);
lean_ctor_set(x_4, 0, x_279);
return x_4;
}
else
{
lean_object* x_280; lean_object* x_281; lean_object* x_282;
x_280 = lean_ctor_get(x_4, 1);
lean_inc(x_280);
lean_dec(x_4);
x_281 = l_Lean_IR_EmitC_emitMainFn___closed__53;
x_282 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_282, 0, x_281);
lean_ctor_set(x_282, 1, x_280);
return x_282;
}
}
}
else
{
uint8_t x_283;
x_283 = !lean_is_exclusive(x_4);
if (x_283 == 0)
{
return x_4;
}
else
{
lean_object* x_284; lean_object* x_285; lean_object* x_286;
x_284 = lean_ctor_get(x_4, 0);
x_285 = lean_ctor_get(x_4, 1);
lean_inc(x_285);
lean_inc(x_284);
lean_dec(x_4);
x_286 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_286, 0, x_284);
lean_ctor_set(x_286, 1, x_285);
return x_286;
}
}
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitLns___at_Lean_IR_EmitC_emitMainFn___spec__1(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitMainFn___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitMainFn(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
uint8_t l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(uint8_t x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
return x_1;
}
else
{
lean_object* x_3; lean_object* x_4; uint8_t x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_3 = lean_ctor_get(x_2, 0);
x_4 = lean_ctor_get(x_2, 1);
x_5 = l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(x_1, x_4);
x_6 = l_Lean_IR_Decl_name(x_3);
x_7 = l_Lean_isExport___closed__2;
x_8 = lean_name_eq(x_6, x_7);
lean_dec(x_6);
if (x_8 == 0)
{
return x_5;
}
else
{
uint8_t x_9;
x_9 = 1;
return x_9;
}
}
}
}
lean_object* l_Lean_IR_EmitC_hasMainFn(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8; uint8_t x_9; lean_object* x_10;
x_5 = lean_ctor_get(x_3, 0);
x_6 = l_Lean_IR_declMapExt;
x_7 = l_Lean_SimplePersistentEnvExtension_getEntries___rarg(x_6, x_5);
lean_dec(x_5);
x_8 = 0;
x_9 = l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(x_8, x_7);
lean_dec(x_7);
x_10 = lean_box(x_9);
lean_ctor_set(x_3, 0, x_10);
return x_3;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15; uint8_t x_16; lean_object* x_17; lean_object* x_18;
x_11 = lean_ctor_get(x_3, 0);
x_12 = lean_ctor_get(x_3, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_3);
x_13 = l_Lean_IR_declMapExt;
x_14 = l_Lean_SimplePersistentEnvExtension_getEntries___rarg(x_13, x_11);
lean_dec(x_11);
x_15 = 0;
x_16 = l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(x_15, x_14);
lean_dec(x_14);
x_17 = lean_box(x_16);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_12);
return x_18;
}
}
}
lean_object* l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; uint8_t x_4; lean_object* x_5;
x_3 = lean_unbox(x_1);
lean_dec(x_1);
x_4 = l_List_foldr___main___at_Lean_IR_EmitC_hasMainFn___spec__1(x_3, x_2);
lean_dec(x_2);
x_5 = lean_box(x_4);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_hasMainFn___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_hasMainFn(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_emitMainFnIfNeeded(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = l_Lean_IR_EmitC_hasMainFn(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_unbox(x_4);
lean_dec(x_4);
if (x_5 == 0)
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_3);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
x_7 = lean_ctor_get(x_3, 0);
lean_dec(x_7);
x_8 = lean_box(0);
lean_ctor_set(x_3, 0, x_8);
return x_3;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_9 = lean_ctor_get(x_3, 1);
lean_inc(x_9);
lean_dec(x_3);
x_10 = lean_box(0);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_9);
return x_11;
}
}
else
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_3, 1);
lean_inc(x_12);
lean_dec(x_3);
x_13 = l_Lean_IR_EmitC_emitMainFn(x_1, x_12);
return x_13;
}
}
}
lean_object* l_Lean_IR_EmitC_emitMainFnIfNeeded___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitMainFnIfNeeded(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_array_get_size(x_1);
x_6 = lean_nat_dec_lt(x_2, x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
lean_dec(x_2);
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_4);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_9 = lean_array_fget(x_1, x_2);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = l_System_FilePath_dirName___closed__1;
x_12 = l_Lean_Name_toStringWithSep___main(x_11, x_10);
x_13 = lean_ctor_get_uint8(x_9, sizeof(void*)*1);
lean_dec(x_9);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_14 = l_String_splitAux___main___closed__1;
x_15 = lean_string_append(x_12, x_14);
x_16 = l_String_Iterator_HasRepr___closed__2;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = lean_string_append(x_4, x_17);
lean_dec(x_17);
x_19 = lean_unsigned_to_nat(1u);
x_20 = lean_nat_add(x_2, x_19);
lean_dec(x_2);
x_2 = x_20;
x_4 = x_18;
goto _start;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_22 = l_Lean_HasToString___closed__1;
x_23 = lean_string_append(x_12, x_22);
x_24 = l_String_Iterator_HasRepr___closed__2;
x_25 = lean_string_append(x_24, x_23);
lean_dec(x_23);
x_26 = lean_string_append(x_4, x_25);
lean_dec(x_25);
x_27 = lean_unsigned_to_nat(1u);
x_28 = lean_nat_add(x_2, x_27);
lean_dec(x_2);
x_2 = x_28;
x_4 = x_26;
goto _start;
}
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("// Lean compiler output");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("// Module: ");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("// Imports:");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#include \"runtime/lean.h\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#endif");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__5;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("extern \"C\" {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__7;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__6;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#ifdef __cplusplus");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__9;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__8;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__11() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__5;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__10;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__12() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#pragma GCC diagnostic ignored \"-Wunused-but-set-variable\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__13() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__12;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__11;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__14() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#pragma GCC diagnostic ignored \"-Wunused-label\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__15() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__14;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__13;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__16() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#pragma GCC diagnostic ignored \"-Wunused-parameter\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__17() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__16;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__15;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__18() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#elif defined(__GNUC__) && !defined(__CLANG__)");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__19() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__18;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__17;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__20() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#pragma clang diagnostic ignored \"-Wunused-label\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__21() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__20;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__19;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__22() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#pragma clang diagnostic ignored \"-Wunused-parameter\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__23() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__22;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__21;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__24() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("#if defined(__clang__)");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileHeader___closed__25() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__24;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__23;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_emitFileHeader(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_3, 1);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_IR_EmitC_getModName(x_1, x_5);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_IR_EmitC_emitFileHeader___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = l_IO_println___rarg___closed__1;
x_12 = lean_string_append(x_10, x_11);
x_13 = l_System_FilePath_dirName___closed__1;
x_14 = l_Lean_Name_toStringWithSep___main(x_13, x_7);
x_15 = l_Lean_IR_EmitC_emitFileHeader___closed__2;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = lean_string_append(x_12, x_16);
lean_dec(x_16);
x_18 = lean_string_append(x_17, x_11);
x_19 = l_Lean_IR_EmitC_emitFileHeader___closed__3;
x_20 = lean_string_append(x_18, x_19);
x_21 = l_Lean_Environment_imports(x_4);
lean_dec(x_4);
x_22 = lean_unsigned_to_nat(0u);
x_23 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1(x_21, x_22, x_1, x_20);
lean_dec(x_21);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = l_String_splitAux___main___closed__1;
x_26 = lean_string_append(x_24, x_25);
x_27 = lean_string_append(x_26, x_11);
x_28 = l_Lean_IR_EmitC_emitFileHeader___closed__4;
x_29 = lean_string_append(x_27, x_28);
x_30 = lean_string_append(x_29, x_11);
x_31 = l_Lean_IR_EmitC_emitFileHeader___closed__25;
x_32 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_31, x_1, x_30);
return x_32;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitFileHeader___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitFileHeader___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitFileHeader(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileFooter___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_PersistentArray_Stats_toString___closed__4;
x_2 = l_Lean_IR_EmitC_emitFileHeader___closed__6;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFileFooter___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitFileHeader___closed__9;
x_2 = l_Lean_IR_EmitC_emitFileFooter___closed__1;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_emitFileFooter(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4;
x_3 = l_Lean_IR_EmitC_emitFileFooter___closed__2;
x_4 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_3, x_1, x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitFileFooter___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitFileFooter(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("unknown variable '");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_throwUnknownVar___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_4 = l_Nat_repr(x_1);
x_5 = l_Lean_IR_VarId_HasToString___closed__1;
x_6 = lean_string_append(x_5, x_4);
lean_dec(x_4);
x_7 = l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = l_Char_HasRepr___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_3);
return x_11;
}
}
lean_object* l_Lean_IR_EmitC_throwUnknownVar(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_throwUnknownVar___rarg___boxed), 3, 0);
return x_2;
}
}
lean_object* l_Lean_IR_EmitC_throwUnknownVar___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_throwUnknownVar___rarg(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_4 = lean_ctor_get(x_2, 0);
x_5 = lean_ctor_get(x_2, 1);
x_6 = lean_ctor_get(x_2, 2);
x_7 = lean_nat_dec_eq(x_4, x_1);
if (x_7 == 0)
{
x_2 = x_6;
goto _start;
}
else
{
lean_object* x_9;
lean_inc(x_5);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_5);
return x_9;
}
}
}
}
lean_object* l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; size_t x_5; size_t x_6; lean_object* x_7; lean_object* x_8;
x_3 = lean_ctor_get(x_1, 1);
x_4 = lean_array_get_size(x_3);
x_5 = lean_usize_of_nat(x_2);
x_6 = lean_usize_modn(x_5, x_4);
lean_dec(x_4);
x_7 = lean_array_uget(x_3, x_6);
x_8 = l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2(x_2, x_7);
lean_dec(x_7);
return x_8;
}
}
lean_object* _init_l_Lean_IR_EmitC_getJPParams___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("unknown join point");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_getJPParams(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_ctor_get(x_2, 2);
x_5 = l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1(x_4, x_1);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7;
x_6 = l_Lean_IR_EmitC_getJPParams___closed__1;
x_7 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_3);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_5, 0);
lean_inc(x_8);
lean_dec(x_5);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_3);
return x_9;
}
}
}
lean_object* l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_AssocList_find_x3f___main___at_Lean_IR_EmitC_getJPParams___spec__2(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_HashMapImp_find_x3f___at_Lean_IR_EmitC_getJPParams___spec__1(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_getJPParams___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_getJPParams(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_declareVar___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("; ");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_declareVar(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_5 = l_Lean_IR_EmitC_toCType(x_2);
x_6 = lean_string_append(x_4, x_5);
lean_dec(x_5);
x_7 = l_String_Iterator_HasRepr___closed__2;
x_8 = lean_string_append(x_6, x_7);
x_9 = l_Nat_repr(x_1);
x_10 = l_Lean_IR_VarId_HasToString___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = lean_string_append(x_8, x_11);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_declareVar___closed__1;
x_14 = lean_string_append(x_12, x_13);
x_15 = lean_box(0);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
}
lean_object* l_Lean_IR_EmitC_declareVar___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_declareVar(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_array_get_size(x_1);
x_6 = lean_nat_dec_lt(x_2, x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
lean_dec(x_2);
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_4);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_9 = lean_array_fget(x_1, x_2);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_9, 1);
lean_inc(x_11);
lean_dec(x_9);
x_12 = l_Lean_IR_EmitC_declareVar(x_10, x_11, x_3, x_4);
lean_dec(x_11);
x_13 = lean_ctor_get(x_12, 1);
lean_inc(x_13);
lean_dec(x_12);
x_14 = lean_unsigned_to_nat(1u);
x_15 = lean_nat_add(x_2, x_14);
lean_dec(x_2);
x_2 = x_15;
x_4 = x_13;
goto _start;
}
}
}
lean_object* l_Lean_IR_EmitC_declareParams(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_unsigned_to_nat(0u);
x_5 = l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1(x_1, x_4, x_2, x_3);
return x_5;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_declareParams___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_declareParams(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_declareVars___main(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
switch (lean_obj_tag(x_1)) {
case 0:
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_12 = lean_ctor_get(x_1, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_1, 1);
lean_inc(x_13);
x_14 = lean_ctor_get(x_1, 3);
lean_inc(x_14);
x_15 = lean_ctor_get(x_3, 3);
x_16 = l_Lean_IR_isTailCallTo(x_15, x_1);
lean_dec(x_1);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_17 = l_Lean_IR_EmitC_declareVar(x_12, x_13, x_3, x_4);
lean_dec(x_13);
x_18 = lean_ctor_get(x_17, 1);
lean_inc(x_18);
lean_dec(x_17);
x_19 = 1;
x_1 = x_14;
x_2 = x_19;
x_4 = x_18;
goto _start;
}
else
{
lean_object* x_21; lean_object* x_22;
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
x_21 = lean_box(x_2);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_4);
return x_22;
}
}
case 1:
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_23 = lean_ctor_get(x_1, 1);
lean_inc(x_23);
x_24 = lean_ctor_get(x_1, 3);
lean_inc(x_24);
lean_dec(x_1);
x_25 = lean_unsigned_to_nat(0u);
x_26 = l_Array_forMAux___main___at_Lean_IR_EmitC_declareParams___spec__1(x_23, x_25, x_3, x_4);
if (x_2 == 0)
{
lean_object* x_27; lean_object* x_28; uint8_t x_29;
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_28 = lean_array_get_size(x_23);
lean_dec(x_23);
x_29 = lean_nat_dec_lt(x_25, x_28);
lean_dec(x_28);
x_1 = x_24;
x_2 = x_29;
x_4 = x_27;
goto _start;
}
else
{
lean_object* x_31; uint8_t x_32;
lean_dec(x_23);
x_31 = lean_ctor_get(x_26, 1);
lean_inc(x_31);
lean_dec(x_26);
x_32 = 1;
x_1 = x_24;
x_2 = x_32;
x_4 = x_31;
goto _start;
}
}
default:
{
lean_object* x_34;
x_34 = lean_box(0);
x_5 = x_34;
goto block_11;
}
}
block_11:
{
uint8_t x_6;
lean_dec(x_5);
x_6 = l_Lean_IR_FnBody_isTerminal(x_1);
if (x_6 == 0)
{
lean_object* x_7;
x_7 = l_Lean_IR_FnBody_body(x_1);
lean_dec(x_1);
x_1 = x_7;
goto _start;
}
else
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_1);
x_9 = lean_box(x_2);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_4);
return x_10;
}
}
}
}
lean_object* l_Lean_IR_EmitC_declareVars___main___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5; lean_object* x_6;
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_EmitC_declareVars___main(x_1, x_5, x_3, x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_declareVars(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_declareVars___main(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_declareVars___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5; lean_object* x_6;
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_EmitC_declareVars(x_1, x_5, x_3, x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitTag___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_obj_tag(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitTag(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_Lean_IR_IRType_isObj(x_2);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_6 = l_Nat_repr(x_1);
x_7 = l_Lean_IR_VarId_HasToString___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_string_append(x_4, x_8);
lean_dec(x_8);
x_10 = lean_box(0);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_9);
return x_11;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_12 = l_Lean_IR_EmitC_emitTag___closed__1;
x_13 = lean_string_append(x_4, x_12);
x_14 = l_Nat_repr(x_1);
x_15 = l_Lean_IR_VarId_HasToString___closed__1;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = lean_string_append(x_13, x_16);
lean_dec(x_16);
x_18 = l_Option_HasRepr___rarg___closed__3;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_box(0);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_19);
return x_21;
}
}
}
lean_object* l_Lean_IR_EmitC_emitTag___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitTag(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_isIf(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; uint8_t x_4;
x_2 = lean_array_get_size(x_1);
x_3 = lean_unsigned_to_nat(2u);
x_4 = lean_nat_dec_eq(x_2, x_3);
lean_dec(x_2);
if (x_4 == 0)
{
lean_object* x_5;
x_5 = lean_box(0);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = l_Lean_IR_altInh;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_array_get(x_6, x_1, x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
lean_dec(x_8);
x_11 = lean_ctor_get(x_9, 1);
lean_inc(x_11);
lean_dec(x_9);
x_12 = lean_unsigned_to_nat(1u);
x_13 = lean_array_get(x_6, x_1, x_12);
x_14 = l_Lean_IR_AltCore_body(x_13);
lean_dec(x_13);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_10);
lean_ctor_set(x_15, 1, x_14);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_11);
lean_ctor_set(x_16, 1, x_15);
x_17 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_17, 0, x_16);
return x_17;
}
else
{
lean_object* x_18;
lean_dec(x_8);
x_18 = lean_box(0);
return x_18;
}
}
}
}
lean_object* l_Lean_IR_EmitC_isIf___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_isIf(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitIf___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitIf___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" == ");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitIf___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("else");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitIf(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_9 = l_Lean_IR_EmitC_emitIf___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = l_Lean_IR_EmitC_emitTag(x_2, x_3, x_7, x_10);
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_emitIf___closed__2;
x_14 = lean_string_append(x_12, x_13);
x_15 = l_Nat_repr(x_4);
x_16 = lean_string_append(x_14, x_15);
lean_dec(x_15);
x_17 = l_Option_HasRepr___rarg___closed__3;
x_18 = lean_string_append(x_16, x_17);
x_19 = l_IO_println___rarg___closed__1;
x_20 = lean_string_append(x_18, x_19);
lean_inc(x_1);
lean_inc(x_7);
x_21 = lean_apply_3(x_1, x_5, x_7, x_20);
if (lean_obj_tag(x_21) == 0)
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_22 = lean_ctor_get(x_21, 1);
lean_inc(x_22);
lean_dec(x_21);
x_23 = l_Lean_IR_EmitC_emitIf___closed__3;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_string_append(x_24, x_19);
x_26 = lean_apply_3(x_1, x_6, x_7, x_25);
return x_26;
}
else
{
uint8_t x_27;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_1);
x_27 = !lean_is_exclusive(x_21);
if (x_27 == 0)
{
return x_21;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_21, 0);
x_29 = lean_ctor_get(x_21, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_21);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitIf___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = l_Lean_IR_EmitC_emitIf(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_3);
return x_9;
}
}
lean_object* _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("default: ");
return x_1;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_get_size(x_2);
x_7 = lean_nat_dec_lt(x_3, x_6);
lean_dec(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_1);
x_8 = lean_box(0);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_5);
return x_9;
}
else
{
lean_object* x_10;
x_10 = lean_array_fget(x_2, x_3);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_formatFnBodyHead___closed__29;
x_15 = lean_string_append(x_5, x_14);
x_16 = l_Nat_repr(x_13);
x_17 = lean_string_append(x_15, x_16);
lean_dec(x_16);
x_18 = l___private_Init_Util_1__mkPanicMessage___closed__2;
x_19 = lean_string_append(x_17, x_18);
x_20 = l_IO_println___rarg___closed__1;
x_21 = lean_string_append(x_19, x_20);
lean_inc(x_1);
lean_inc(x_4);
x_22 = lean_apply_3(x_1, x_12, x_4, x_21);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = lean_unsigned_to_nat(1u);
x_25 = lean_nat_add(x_3, x_24);
lean_dec(x_3);
x_3 = x_25;
x_5 = x_23;
goto _start;
}
else
{
uint8_t x_27;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_1);
x_27 = !lean_is_exclusive(x_22);
if (x_27 == 0)
{
return x_22;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_22, 0);
x_29 = lean_ctor_get(x_22, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_22);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_31 = lean_ctor_get(x_10, 0);
lean_inc(x_31);
lean_dec(x_10);
x_32 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1;
x_33 = lean_string_append(x_5, x_32);
x_34 = l_IO_println___rarg___closed__1;
x_35 = lean_string_append(x_33, x_34);
lean_inc(x_1);
lean_inc(x_4);
x_36 = lean_apply_3(x_1, x_31, x_4, x_35);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_36, 1);
lean_inc(x_37);
lean_dec(x_36);
x_38 = lean_unsigned_to_nat(1u);
x_39 = lean_nat_add(x_3, x_38);
lean_dec(x_3);
x_3 = x_39;
x_5 = x_37;
goto _start;
}
else
{
uint8_t x_41;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_1);
x_41 = !lean_is_exclusive(x_36);
if (x_41 == 0)
{
return x_36;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_42 = lean_ctor_get(x_36, 0);
x_43 = lean_ctor_get(x_36, 1);
lean_inc(x_43);
lean_inc(x_42);
lean_dec(x_36);
x_44 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_44, 0, x_42);
lean_ctor_set(x_44, 1, x_43);
return x_44;
}
}
}
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitCase___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("switch (");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitCase___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(") {");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitCase(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Lean_IR_EmitC_isIf(x_4);
if (lean_obj_tag(x_7) == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_8 = l_Lean_IR_EmitC_emitCase___closed__1;
x_9 = lean_string_append(x_6, x_8);
x_10 = l_Lean_IR_EmitC_emitTag(x_2, x_3, x_5, x_9);
x_11 = lean_ctor_get(x_10, 1);
lean_inc(x_11);
lean_dec(x_10);
x_12 = l_Lean_IR_EmitC_emitCase___closed__2;
x_13 = lean_string_append(x_11, x_12);
x_14 = l_IO_println___rarg___closed__1;
x_15 = lean_string_append(x_13, x_14);
x_16 = l_Lean_IR_ensureHasDefault(x_4);
x_17 = lean_unsigned_to_nat(0u);
x_18 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1(x_1, x_16, x_17, x_5, x_15);
lean_dec(x_16);
if (lean_obj_tag(x_18) == 0)
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_20 = lean_ctor_get(x_18, 1);
x_21 = lean_ctor_get(x_18, 0);
lean_dec(x_21);
x_22 = l_PersistentArray_Stats_toString___closed__4;
x_23 = lean_string_append(x_20, x_22);
x_24 = lean_string_append(x_23, x_14);
x_25 = lean_box(0);
lean_ctor_set(x_18, 1, x_24);
lean_ctor_set(x_18, 0, x_25);
return x_18;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_26 = lean_ctor_get(x_18, 1);
lean_inc(x_26);
lean_dec(x_18);
x_27 = l_PersistentArray_Stats_toString___closed__4;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_string_append(x_28, x_14);
x_30 = lean_box(0);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_29);
return x_31;
}
}
else
{
uint8_t x_32;
x_32 = !lean_is_exclusive(x_18);
if (x_32 == 0)
{
return x_18;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_18, 0);
x_34 = lean_ctor_get(x_18, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_18);
x_35 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_35, 0, x_33);
lean_ctor_set(x_35, 1, x_34);
return x_35;
}
}
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
lean_dec(x_4);
x_36 = lean_ctor_get(x_7, 0);
lean_inc(x_36);
lean_dec(x_7);
x_37 = lean_ctor_get(x_36, 1);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 0);
lean_inc(x_38);
lean_dec(x_36);
x_39 = lean_ctor_get(x_37, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_37, 1);
lean_inc(x_40);
lean_dec(x_37);
x_41 = l_Lean_IR_EmitC_emitIf(x_1, x_2, x_3, x_38, x_39, x_40, x_5, x_6);
return x_41;
}
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_2);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitCase___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Lean_IR_EmitC_emitCase(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_3);
return x_7;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInc___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(");");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInc___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_inc_ref_n");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInc___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_inc_ref");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInc___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_inc_n");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInc___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_inc");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitInc(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10; lean_object* x_11;
x_6 = l_Nat_repr(x_1);
x_7 = l_Lean_IR_VarId_HasToString___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_dec_eq(x_2, x_9);
if (x_3 == 0)
{
if (x_10 == 0)
{
lean_object* x_33;
x_33 = l_Lean_IR_EmitC_emitInc___closed__2;
x_11 = x_33;
goto block_32;
}
else
{
lean_object* x_34;
x_34 = l_Lean_IR_EmitC_emitInc___closed__3;
x_11 = x_34;
goto block_32;
}
}
else
{
if (x_10 == 0)
{
lean_object* x_35;
x_35 = l_Lean_IR_EmitC_emitInc___closed__4;
x_11 = x_35;
goto block_32;
}
else
{
lean_object* x_36;
x_36 = l_Lean_IR_EmitC_emitInc___closed__5;
x_11 = x_36;
goto block_32;
}
}
block_32:
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_12 = lean_string_append(x_5, x_11);
lean_dec(x_11);
x_13 = l_Prod_HasRepr___rarg___closed__1;
x_14 = lean_string_append(x_12, x_13);
x_15 = lean_string_append(x_14, x_8);
lean_dec(x_8);
if (x_10 == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_16 = l_List_reprAux___main___rarg___closed__1;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Nat_repr(x_2);
x_19 = lean_string_append(x_17, x_18);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitInc___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = l_IO_println___rarg___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_2);
x_26 = l_Lean_IR_EmitC_emitInc___closed__1;
x_27 = lean_string_append(x_15, x_26);
x_28 = l_IO_println___rarg___closed__1;
x_29 = lean_string_append(x_27, x_28);
x_30 = lean_box(0);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_29);
return x_31;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitInc___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = lean_unbox(x_3);
lean_dec(x_3);
x_7 = l_Lean_IR_EmitC_emitInc(x_1, x_2, x_6, x_4, x_5);
lean_dec(x_4);
return x_7;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDec___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_dec_ref");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDec___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_dec");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitDec(lean_object* x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_6 = l_Nat_repr(x_1);
x_7 = l_Lean_IR_VarId_HasToString___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_dec_eq(x_2, x_9);
if (x_3 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_11 = l_Lean_IR_EmitC_emitDec___closed__1;
x_12 = lean_string_append(x_5, x_11);
x_13 = l_Prod_HasRepr___rarg___closed__1;
x_14 = lean_string_append(x_12, x_13);
x_15 = lean_string_append(x_14, x_8);
lean_dec(x_8);
if (x_10 == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_16 = l_List_reprAux___main___rarg___closed__1;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Nat_repr(x_2);
x_19 = lean_string_append(x_17, x_18);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitInc___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = l_IO_println___rarg___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_2);
x_26 = l_Lean_IR_EmitC_emitInc___closed__1;
x_27 = lean_string_append(x_15, x_26);
x_28 = l_IO_println___rarg___closed__1;
x_29 = lean_string_append(x_27, x_28);
x_30 = lean_box(0);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_29);
return x_31;
}
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_32 = l_Lean_IR_EmitC_emitDec___closed__2;
x_33 = lean_string_append(x_5, x_32);
x_34 = l_Prod_HasRepr___rarg___closed__1;
x_35 = lean_string_append(x_33, x_34);
x_36 = lean_string_append(x_35, x_8);
lean_dec(x_8);
if (x_10 == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_37 = l_List_reprAux___main___rarg___closed__1;
x_38 = lean_string_append(x_36, x_37);
x_39 = l_Nat_repr(x_2);
x_40 = lean_string_append(x_38, x_39);
lean_dec(x_39);
x_41 = l_Lean_IR_EmitC_emitInc___closed__1;
x_42 = lean_string_append(x_40, x_41);
x_43 = l_IO_println___rarg___closed__1;
x_44 = lean_string_append(x_42, x_43);
x_45 = lean_box(0);
x_46 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_46, 0, x_45);
lean_ctor_set(x_46, 1, x_44);
return x_46;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52;
lean_dec(x_2);
x_47 = l_Lean_IR_EmitC_emitInc___closed__1;
x_48 = lean_string_append(x_36, x_47);
x_49 = l_IO_println___rarg___closed__1;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_box(0);
x_52 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_52, 1, x_50);
return x_52;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitDec___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = lean_unbox(x_3);
lean_dec(x_3);
x_7 = l_Lean_IR_EmitC_emitDec(x_1, x_2, x_6, x_4, x_5);
lean_dec(x_4);
return x_7;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDel___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_free_object(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitDel(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_4 = l_Lean_IR_EmitC_emitDel___closed__1;
x_5 = lean_string_append(x_3, x_4);
x_6 = l_Nat_repr(x_1);
x_7 = l_Lean_IR_VarId_HasToString___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = lean_string_append(x_5, x_8);
lean_dec(x_8);
x_10 = l_Lean_IR_EmitC_emitInc___closed__1;
x_11 = lean_string_append(x_9, x_10);
x_12 = l_IO_println___rarg___closed__1;
x_13 = lean_string_append(x_11, x_12);
x_14 = lean_box(0);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_13);
return x_15;
}
}
lean_object* l_Lean_IR_EmitC_emitDel___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitDel(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSetTag___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_tag(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitSetTag(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_5 = l_Lean_IR_EmitC_emitSetTag___closed__1;
x_6 = lean_string_append(x_4, x_5);
x_7 = l_Nat_repr(x_1);
x_8 = l_Lean_IR_VarId_HasToString___closed__1;
x_9 = lean_string_append(x_8, x_7);
lean_dec(x_7);
x_10 = lean_string_append(x_6, x_9);
lean_dec(x_9);
x_11 = l_List_reprAux___main___rarg___closed__1;
x_12 = lean_string_append(x_10, x_11);
x_13 = l_Nat_repr(x_2);
x_14 = lean_string_append(x_12, x_13);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitC_emitInc___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_IO_println___rarg___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_18);
return x_20;
}
}
lean_object* l_Lean_IR_EmitC_emitSetTag___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitSetTag(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitSet(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_6 = l_Lean_IR_EmitC_emitSet___closed__1;
x_7 = lean_string_append(x_5, x_6);
x_8 = l_Nat_repr(x_1);
x_9 = l_Lean_IR_VarId_HasToString___closed__1;
x_10 = lean_string_append(x_9, x_8);
lean_dec(x_8);
x_11 = lean_string_append(x_7, x_10);
lean_dec(x_10);
x_12 = l_List_reprAux___main___rarg___closed__1;
x_13 = lean_string_append(x_11, x_12);
x_14 = l_Nat_repr(x_2);
x_15 = lean_string_append(x_13, x_14);
lean_dec(x_14);
x_16 = lean_string_append(x_15, x_12);
x_17 = l_Lean_IR_EmitC_emitArg(x_3, x_4, x_16);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_19 = lean_ctor_get(x_17, 1);
x_20 = lean_ctor_get(x_17, 0);
lean_dec(x_20);
x_21 = l_Lean_IR_EmitC_emitInc___closed__1;
x_22 = lean_string_append(x_19, x_21);
x_23 = l_IO_println___rarg___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_box(0);
lean_ctor_set(x_17, 1, x_24);
lean_ctor_set(x_17, 0, x_25);
return x_17;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_26 = lean_ctor_get(x_17, 1);
lean_inc(x_26);
lean_dec(x_17);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_30);
return x_32;
}
}
}
lean_object* l_Lean_IR_EmitC_emitSet___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitSet(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitOffset___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("sizeof(void*)*");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitOffset___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" + ");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitOffset(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_lt(x_5, x_1);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
lean_dec(x_1);
x_7 = l_Nat_repr(x_2);
x_8 = lean_string_append(x_4, x_7);
lean_dec(x_7);
x_9 = lean_box(0);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_8);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15;
x_11 = l_Lean_IR_EmitC_emitOffset___closed__1;
x_12 = lean_string_append(x_4, x_11);
x_13 = l_Nat_repr(x_1);
x_14 = lean_string_append(x_12, x_13);
lean_dec(x_13);
x_15 = lean_nat_dec_lt(x_5, x_2);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
lean_dec(x_2);
x_16 = lean_box(0);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_14);
return x_17;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_18 = l_Lean_IR_EmitC_emitOffset___closed__2;
x_19 = lean_string_append(x_14, x_18);
x_20 = l_Nat_repr(x_2);
x_21 = lean_string_append(x_19, x_20);
lean_dec(x_20);
x_22 = lean_box(0);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_21);
return x_23;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitOffset___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitOffset(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_usize(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitUSet(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_6 = l_Lean_IR_EmitC_emitUSet___closed__1;
x_7 = lean_string_append(x_5, x_6);
x_8 = l_Nat_repr(x_1);
x_9 = l_Lean_IR_VarId_HasToString___closed__1;
x_10 = lean_string_append(x_9, x_8);
lean_dec(x_8);
x_11 = lean_string_append(x_7, x_10);
lean_dec(x_10);
x_12 = l_List_reprAux___main___rarg___closed__1;
x_13 = lean_string_append(x_11, x_12);
x_14 = l_Nat_repr(x_2);
x_15 = lean_string_append(x_13, x_14);
lean_dec(x_14);
x_16 = lean_string_append(x_15, x_12);
x_17 = l_Nat_repr(x_3);
x_18 = lean_string_append(x_9, x_17);
lean_dec(x_17);
x_19 = lean_string_append(x_16, x_18);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitInc___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = l_IO_println___rarg___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
}
lean_object* l_Lean_IR_EmitC_emitUSet___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitUSet(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("floats are not supported yet");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_uint8");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_uint16");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_uint32");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_set_uint64");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSSet___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("invalid instruction");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitSSet(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
switch (lean_obj_tag(x_5)) {
case 0:
{
lean_object* x_42; lean_object* x_43;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_42 = l_Lean_IR_EmitC_emitSSet___closed__1;
x_43 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_7);
return x_43;
}
case 1:
{
lean_object* x_44; lean_object* x_45;
x_44 = l_Lean_IR_EmitC_emitSSet___closed__2;
x_45 = lean_string_append(x_7, x_44);
x_8 = x_45;
goto block_41;
}
case 2:
{
lean_object* x_46; lean_object* x_47;
x_46 = l_Lean_IR_EmitC_emitSSet___closed__3;
x_47 = lean_string_append(x_7, x_46);
x_8 = x_47;
goto block_41;
}
case 3:
{
lean_object* x_48; lean_object* x_49;
x_48 = l_Lean_IR_EmitC_emitSSet___closed__4;
x_49 = lean_string_append(x_7, x_48);
x_8 = x_49;
goto block_41;
}
case 4:
{
lean_object* x_50; lean_object* x_51;
x_50 = l_Lean_IR_EmitC_emitSSet___closed__5;
x_51 = lean_string_append(x_7, x_50);
x_8 = x_51;
goto block_41;
}
default:
{
lean_object* x_52; lean_object* x_53;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_52 = l_Lean_IR_EmitC_emitSSet___closed__6;
x_53 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_7);
return x_53;
}
}
block_41:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_9 = l_Prod_HasRepr___rarg___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = l_Nat_repr(x_1);
x_12 = l_Lean_IR_VarId_HasToString___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = lean_string_append(x_10, x_13);
lean_dec(x_13);
x_15 = l_List_reprAux___main___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_Lean_IR_EmitC_emitOffset(x_2, x_3, x_6, x_16);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_19 = lean_ctor_get(x_17, 1);
x_20 = lean_ctor_get(x_17, 0);
lean_dec(x_20);
x_21 = lean_string_append(x_19, x_15);
x_22 = l_Nat_repr(x_4);
x_23 = lean_string_append(x_12, x_22);
lean_dec(x_22);
x_24 = lean_string_append(x_21, x_23);
lean_dec(x_23);
x_25 = l_Lean_IR_EmitC_emitInc___closed__1;
x_26 = lean_string_append(x_24, x_25);
x_27 = l_IO_println___rarg___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_box(0);
lean_ctor_set(x_17, 1, x_28);
lean_ctor_set(x_17, 0, x_29);
return x_17;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_30 = lean_ctor_get(x_17, 1);
lean_inc(x_30);
lean_dec(x_17);
x_31 = lean_string_append(x_30, x_15);
x_32 = l_Nat_repr(x_4);
x_33 = lean_string_append(x_12, x_32);
lean_dec(x_32);
x_34 = lean_string_append(x_31, x_33);
lean_dec(x_33);
x_35 = l_Lean_IR_EmitC_emitInc___closed__1;
x_36 = lean_string_append(x_34, x_35);
x_37 = l_IO_println___rarg___closed__1;
x_38 = lean_string_append(x_36, x_37);
x_39 = lean_box(0);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_38);
return x_40;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitSSet___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_IR_EmitC_emitSSet(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_8;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" = ");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_2, x_12);
x_15 = l_Lean_IR_Arg_Inhabited;
x_16 = lean_array_get(x_15, x_1, x_12);
lean_dec(x_12);
x_17 = lean_ctor_get(x_14, 0);
lean_inc(x_17);
lean_dec(x_14);
x_18 = l_Nat_repr(x_17);
x_19 = l_Lean_IR_VarId_HasToString___closed__1;
x_20 = lean_string_append(x_19, x_18);
lean_dec(x_18);
x_21 = lean_string_append(x_6, x_20);
lean_dec(x_20);
x_22 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = l_Lean_IR_EmitC_emitArg(x_16, x_5, x_23);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = l_Lean_IR_formatFnBody___main___closed__1;
x_27 = lean_string_append(x_25, x_26);
x_28 = l_IO_println___rarg___closed__1;
x_29 = lean_string_append(x_27, x_28);
x_4 = x_10;
x_6 = x_29;
goto _start;
}
else
{
lean_object* x_31; lean_object* x_32;
lean_dec(x_4);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_6);
return x_32;
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitJmp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("invalid goto");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitJmp___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("goto ");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitJmp(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_getJPParams(x_1, x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_7 = lean_ctor_get(x_5, 0);
x_8 = lean_ctor_get(x_5, 1);
x_9 = lean_array_get_size(x_2);
x_10 = lean_array_get_size(x_7);
x_11 = lean_nat_dec_eq(x_9, x_10);
lean_dec(x_10);
if (x_11 == 0)
{
lean_object* x_12;
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_1);
x_12 = l_Lean_IR_EmitC_emitJmp___closed__1;
lean_ctor_set_tag(x_5, 1);
lean_ctor_set(x_5, 0, x_12);
return x_5;
}
else
{
lean_object* x_13; uint8_t x_14;
lean_free_object(x_5);
lean_inc(x_9);
x_13 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1(x_2, x_7, x_9, x_9, x_3, x_8);
lean_dec(x_9);
lean_dec(x_7);
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_15 = lean_ctor_get(x_13, 1);
x_16 = lean_ctor_get(x_13, 0);
lean_dec(x_16);
x_17 = l_Lean_IR_EmitC_emitJmp___closed__2;
x_18 = lean_string_append(x_15, x_17);
x_19 = l_Nat_repr(x_1);
x_20 = l_Lean_IR_JoinPointId_HasToString___closed__1;
x_21 = lean_string_append(x_20, x_19);
lean_dec(x_19);
x_22 = lean_string_append(x_18, x_21);
lean_dec(x_21);
x_23 = l_Lean_IR_formatFnBody___main___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = l_IO_println___rarg___closed__1;
x_26 = lean_string_append(x_24, x_25);
x_27 = lean_box(0);
lean_ctor_set(x_13, 1, x_26);
lean_ctor_set(x_13, 0, x_27);
return x_13;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_dec(x_13);
x_29 = l_Lean_IR_EmitC_emitJmp___closed__2;
x_30 = lean_string_append(x_28, x_29);
x_31 = l_Nat_repr(x_1);
x_32 = l_Lean_IR_JoinPointId_HasToString___closed__1;
x_33 = lean_string_append(x_32, x_31);
lean_dec(x_31);
x_34 = lean_string_append(x_30, x_33);
lean_dec(x_33);
x_35 = l_Lean_IR_formatFnBody___main___closed__1;
x_36 = lean_string_append(x_34, x_35);
x_37 = l_IO_println___rarg___closed__1;
x_38 = lean_string_append(x_36, x_37);
x_39 = lean_box(0);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_38);
return x_40;
}
}
}
else
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45;
x_41 = lean_ctor_get(x_5, 0);
x_42 = lean_ctor_get(x_5, 1);
lean_inc(x_42);
lean_inc(x_41);
lean_dec(x_5);
x_43 = lean_array_get_size(x_2);
x_44 = lean_array_get_size(x_41);
x_45 = lean_nat_dec_eq(x_43, x_44);
lean_dec(x_44);
if (x_45 == 0)
{
lean_object* x_46; lean_object* x_47;
lean_dec(x_43);
lean_dec(x_41);
lean_dec(x_1);
x_46 = l_Lean_IR_EmitC_emitJmp___closed__1;
x_47 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_42);
return x_47;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
lean_inc(x_43);
x_48 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1(x_2, x_41, x_43, x_43, x_3, x_42);
lean_dec(x_43);
lean_dec(x_41);
x_49 = lean_ctor_get(x_48, 1);
lean_inc(x_49);
if (lean_is_exclusive(x_48)) {
lean_ctor_release(x_48, 0);
lean_ctor_release(x_48, 1);
x_50 = x_48;
} else {
lean_dec_ref(x_48);
x_50 = lean_box(0);
}
x_51 = l_Lean_IR_EmitC_emitJmp___closed__2;
x_52 = lean_string_append(x_49, x_51);
x_53 = l_Nat_repr(x_1);
x_54 = l_Lean_IR_JoinPointId_HasToString___closed__1;
x_55 = lean_string_append(x_54, x_53);
lean_dec(x_53);
x_56 = lean_string_append(x_52, x_55);
lean_dec(x_55);
x_57 = l_Lean_IR_formatFnBody___main___closed__1;
x_58 = lean_string_append(x_56, x_57);
x_59 = l_IO_println___rarg___closed__1;
x_60 = lean_string_append(x_58, x_59);
x_61 = lean_box(0);
if (lean_is_scalar(x_50)) {
x_62 = lean_alloc_ctor(0, 2, 0);
} else {
x_62 = x_50;
}
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_60);
return x_62;
}
}
}
else
{
uint8_t x_63;
lean_dec(x_1);
x_63 = !lean_is_exclusive(x_5);
if (x_63 == 0)
{
return x_5;
}
else
{
lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_64 = lean_ctor_get(x_5, 0);
x_65 = lean_ctor_get(x_5, 1);
lean_inc(x_65);
lean_inc(x_64);
lean_dec(x_5);
x_66 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_66, 0, x_64);
lean_ctor_set(x_66, 1, x_65);
return x_66;
}
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitJmp___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitJmp(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitLhs(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_4 = l_Nat_repr(x_1);
x_5 = l_Lean_IR_VarId_HasToString___closed__1;
x_6 = lean_string_append(x_5, x_4);
lean_dec(x_4);
x_7 = lean_string_append(x_3, x_6);
lean_dec(x_6);
x_8 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_9 = lean_string_append(x_7, x_8);
x_10 = lean_box(0);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_9);
return x_11;
}
}
lean_object* l_Lean_IR_EmitC_emitLhs___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitLhs(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = lean_nat_dec_lt(x_6, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = l_Lean_IR_Arg_Inhabited;
x_14 = lean_array_get(x_13, x_1, x_11);
lean_dec(x_11);
x_15 = l_Lean_IR_EmitC_emitArg(x_14, x_4, x_5);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_3 = x_9;
x_5 = x_16;
goto _start;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_18 = l_List_reprAux___main___rarg___closed__1;
x_19 = lean_string_append(x_5, x_18);
x_20 = l_Lean_IR_Arg_Inhabited;
x_21 = lean_array_get(x_20, x_1, x_11);
lean_dec(x_11);
x_22 = l_Lean_IR_EmitC_emitArg(x_21, x_4, x_19);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_3 = x_9;
x_5 = x_23;
goto _start;
}
}
else
{
lean_object* x_25; lean_object* x_26;
lean_dec(x_3);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_5);
return x_26;
}
}
}
lean_object* l_Lean_IR_EmitC_emitArgs(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_array_get_size(x_1);
lean_inc(x_4);
x_5 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1(x_1, x_4, x_4, x_2, x_3);
lean_dec(x_4);
return x_5;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitArgs___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitArgs___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitArgs(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitCtorScalarSize___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("sizeof(size_t)*");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitCtorScalarSize(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_eq(x_1, x_5);
if (x_6 == 0)
{
uint8_t x_7;
x_7 = lean_nat_dec_eq(x_2, x_5);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_8 = l_Lean_IR_EmitC_emitCtorScalarSize___closed__1;
x_9 = lean_string_append(x_4, x_8);
x_10 = l_Nat_repr(x_1);
x_11 = lean_string_append(x_9, x_10);
lean_dec(x_10);
x_12 = l_Lean_IR_EmitC_emitOffset___closed__2;
x_13 = lean_string_append(x_11, x_12);
x_14 = l_Nat_repr(x_2);
x_15 = lean_string_append(x_13, x_14);
lean_dec(x_14);
x_16 = lean_box(0);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_15);
return x_17;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
lean_dec(x_2);
x_18 = l_Lean_IR_EmitC_emitCtorScalarSize___closed__1;
x_19 = lean_string_append(x_4, x_18);
x_20 = l_Nat_repr(x_1);
x_21 = lean_string_append(x_19, x_20);
lean_dec(x_20);
x_22 = lean_box(0);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_21);
return x_23;
}
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
lean_dec(x_1);
x_24 = l_Nat_repr(x_2);
x_25 = lean_string_append(x_4, x_24);
lean_dec(x_24);
x_26 = lean_box(0);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_25);
return x_27;
}
}
}
lean_object* l_Lean_IR_EmitC_emitCtorScalarSize___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitCtorScalarSize(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitAllocCtor___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_alloc_ctor(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitAllocCtor(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_4 = l_Lean_IR_EmitC_emitAllocCtor___closed__1;
x_5 = lean_string_append(x_3, x_4);
x_6 = lean_ctor_get(x_1, 1);
lean_inc(x_6);
x_7 = l_Nat_repr(x_6);
x_8 = lean_string_append(x_5, x_7);
lean_dec(x_7);
x_9 = l_List_reprAux___main___rarg___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = lean_ctor_get(x_1, 2);
lean_inc(x_11);
x_12 = l_Nat_repr(x_11);
x_13 = lean_string_append(x_10, x_12);
lean_dec(x_12);
x_14 = lean_string_append(x_13, x_9);
x_15 = lean_ctor_get(x_1, 3);
lean_inc(x_15);
x_16 = lean_ctor_get(x_1, 4);
lean_inc(x_16);
lean_dec(x_1);
x_17 = l_Lean_IR_EmitC_emitCtorScalarSize(x_15, x_16, x_2, x_14);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_19 = lean_ctor_get(x_17, 1);
x_20 = lean_ctor_get(x_17, 0);
lean_dec(x_20);
x_21 = l_Lean_IR_EmitC_emitInc___closed__1;
x_22 = lean_string_append(x_19, x_21);
x_23 = l_IO_println___rarg___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_box(0);
lean_ctor_set(x_17, 1, x_24);
lean_ctor_set(x_17, 0, x_25);
return x_17;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_26 = lean_ctor_get(x_17, 1);
lean_inc(x_26);
lean_dec(x_17);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_30);
return x_32;
}
}
}
lean_object* l_Lean_IR_EmitC_emitAllocCtor___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitAllocCtor(x_1, x_2, x_3);
lean_dec(x_2);
return x_4;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_emitSet___closed__1;
x_14 = lean_string_append(x_6, x_13);
lean_inc(x_1);
x_15 = l_Nat_repr(x_1);
x_16 = l_Lean_IR_VarId_HasToString___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = lean_string_append(x_14, x_17);
lean_dec(x_17);
x_19 = l_List_reprAux___main___rarg___closed__1;
x_20 = lean_string_append(x_18, x_19);
lean_inc(x_12);
x_21 = l_Nat_repr(x_12);
x_22 = lean_string_append(x_20, x_21);
lean_dec(x_21);
x_23 = lean_string_append(x_22, x_19);
x_24 = l_Lean_IR_Arg_Inhabited;
x_25 = lean_array_get(x_24, x_2, x_12);
lean_dec(x_12);
x_26 = l_Lean_IR_EmitC_emitArg(x_25, x_5, x_23);
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_28 = l_Lean_IR_EmitC_emitInc___closed__1;
x_29 = lean_string_append(x_27, x_28);
x_30 = l_IO_println___rarg___closed__1;
x_31 = lean_string_append(x_29, x_30);
x_4 = x_10;
x_6 = x_31;
goto _start;
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_4);
lean_dec(x_1);
x_33 = lean_box(0);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_6);
return x_34;
}
}
}
lean_object* l_Lean_IR_EmitC_emitCtorSetArgs(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; lean_object* x_6;
x_5 = lean_array_get_size(x_2);
lean_inc(x_5);
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1(x_1, x_2, x_5, x_5, x_3, x_4);
lean_dec(x_5);
return x_6;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitCtorSetArgs___spec__1(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitCtorSetArgs___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitCtor___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitCtor(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
lean_inc(x_1);
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_ctor_get(x_6, 1);
x_9 = lean_ctor_get(x_6, 0);
lean_dec(x_9);
x_10 = lean_ctor_get(x_2, 2);
lean_inc(x_10);
x_11 = lean_unsigned_to_nat(0u);
x_12 = lean_nat_dec_eq(x_10, x_11);
lean_dec(x_10);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15;
lean_free_object(x_6);
x_13 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_8);
x_14 = lean_ctor_get(x_13, 1);
lean_inc(x_14);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_14);
return x_15;
}
else
{
lean_object* x_16; uint8_t x_17;
x_16 = lean_ctor_get(x_2, 3);
lean_inc(x_16);
x_17 = lean_nat_dec_eq(x_16, x_11);
lean_dec(x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
lean_free_object(x_6);
x_18 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_8);
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_19);
return x_20;
}
else
{
lean_object* x_21; uint8_t x_22;
x_21 = lean_ctor_get(x_2, 4);
lean_inc(x_21);
x_22 = lean_nat_dec_eq(x_21, x_11);
lean_dec(x_21);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
lean_free_object(x_6);
x_23 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_8);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_24);
return x_25;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
lean_dec(x_1);
x_26 = l_Lean_IR_EmitC_emitCtor___closed__1;
x_27 = lean_string_append(x_8, x_26);
x_28 = lean_ctor_get(x_2, 1);
lean_inc(x_28);
lean_dec(x_2);
x_29 = l_Nat_repr(x_28);
x_30 = lean_string_append(x_27, x_29);
lean_dec(x_29);
x_31 = l_Lean_IR_EmitC_emitInc___closed__1;
x_32 = lean_string_append(x_30, x_31);
x_33 = l_IO_println___rarg___closed__1;
x_34 = lean_string_append(x_32, x_33);
x_35 = lean_box(0);
lean_ctor_set(x_6, 1, x_34);
lean_ctor_set(x_6, 0, x_35);
return x_6;
}
}
}
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; uint8_t x_39;
x_36 = lean_ctor_get(x_6, 1);
lean_inc(x_36);
lean_dec(x_6);
x_37 = lean_ctor_get(x_2, 2);
lean_inc(x_37);
x_38 = lean_unsigned_to_nat(0u);
x_39 = lean_nat_dec_eq(x_37, x_38);
lean_dec(x_37);
if (x_39 == 0)
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_36);
x_41 = lean_ctor_get(x_40, 1);
lean_inc(x_41);
lean_dec(x_40);
x_42 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_41);
return x_42;
}
else
{
lean_object* x_43; uint8_t x_44;
x_43 = lean_ctor_get(x_2, 3);
lean_inc(x_43);
x_44 = lean_nat_dec_eq(x_43, x_38);
lean_dec(x_43);
if (x_44 == 0)
{
lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_45 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_36);
x_46 = lean_ctor_get(x_45, 1);
lean_inc(x_46);
lean_dec(x_45);
x_47 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_46);
return x_47;
}
else
{
lean_object* x_48; uint8_t x_49;
x_48 = lean_ctor_get(x_2, 4);
lean_inc(x_48);
x_49 = lean_nat_dec_eq(x_48, x_38);
lean_dec(x_48);
if (x_49 == 0)
{
lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_50 = l_Lean_IR_EmitC_emitAllocCtor(x_2, x_4, x_36);
x_51 = lean_ctor_get(x_50, 1);
lean_inc(x_51);
lean_dec(x_50);
x_52 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_3, x_4, x_51);
return x_52;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63;
lean_dec(x_1);
x_53 = l_Lean_IR_EmitC_emitCtor___closed__1;
x_54 = lean_string_append(x_36, x_53);
x_55 = lean_ctor_get(x_2, 1);
lean_inc(x_55);
lean_dec(x_2);
x_56 = l_Nat_repr(x_55);
x_57 = lean_string_append(x_54, x_56);
lean_dec(x_56);
x_58 = l_Lean_IR_EmitC_emitInc___closed__1;
x_59 = lean_string_append(x_57, x_58);
x_60 = l_IO_println___rarg___closed__1;
x_61 = lean_string_append(x_59, x_60);
x_62 = lean_box(0);
x_63 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_63, 0, x_62);
lean_ctor_set(x_63, 1, x_61);
return x_63;
}
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitCtor___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitCtor(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_ctor_release(");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1;
x_13 = lean_string_append(x_5, x_12);
x_14 = lean_string_append(x_13, x_1);
x_15 = l_List_reprAux___main___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_Nat_repr(x_11);
x_18 = lean_string_append(x_16, x_17);
lean_dec(x_17);
x_19 = l_Lean_IR_EmitC_emitInc___closed__1;
x_20 = lean_string_append(x_18, x_19);
x_21 = l_IO_println___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_3 = x_9;
x_5 = x_22;
goto _start;
}
else
{
lean_object* x_24; lean_object* x_25;
lean_dec(x_3);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_5);
return x_25;
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReset___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (lean_is_exclusive(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReset___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(")) {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReset___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_dec_ref(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReset___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box(0);");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitReset(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint8_t x_37;
x_6 = l_Lean_IR_EmitC_emitReset___closed__1;
x_7 = lean_string_append(x_5, x_6);
x_8 = l_Nat_repr(x_3);
x_9 = l_Lean_IR_VarId_HasToString___closed__1;
x_10 = lean_string_append(x_9, x_8);
lean_dec(x_8);
x_11 = lean_string_append(x_7, x_10);
x_12 = l_Lean_IR_EmitC_emitReset___closed__2;
x_13 = lean_string_append(x_11, x_12);
x_14 = l_IO_println___rarg___closed__1;
x_15 = lean_string_append(x_13, x_14);
lean_inc(x_2);
x_16 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1(x_10, x_2, x_2, x_4, x_15);
lean_dec(x_2);
x_17 = lean_ctor_get(x_16, 1);
lean_inc(x_17);
lean_dec(x_16);
x_18 = l_String_Iterator_HasRepr___closed__2;
x_19 = lean_string_append(x_17, x_18);
lean_inc(x_1);
x_20 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_19);
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
lean_dec(x_20);
x_22 = lean_string_append(x_21, x_10);
x_23 = l_Lean_IR_formatFnBody___main___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_string_append(x_24, x_14);
x_26 = l_Lean_IR_EmitC_emitMainFn___closed__22;
x_27 = lean_string_append(x_25, x_26);
x_28 = lean_string_append(x_27, x_14);
x_29 = l_Lean_IR_EmitC_emitReset___closed__3;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_string_append(x_30, x_10);
lean_dec(x_10);
x_32 = l_Lean_IR_EmitC_emitInc___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = lean_string_append(x_33, x_14);
x_35 = lean_string_append(x_34, x_18);
x_36 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_35);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_38 = lean_ctor_get(x_36, 1);
x_39 = lean_ctor_get(x_36, 0);
lean_dec(x_39);
x_40 = l_Lean_IR_EmitC_emitReset___closed__4;
x_41 = lean_string_append(x_38, x_40);
x_42 = lean_string_append(x_41, x_14);
x_43 = l_PersistentArray_Stats_toString___closed__4;
x_44 = lean_string_append(x_42, x_43);
x_45 = lean_string_append(x_44, x_14);
x_46 = lean_box(0);
lean_ctor_set(x_36, 1, x_45);
lean_ctor_set(x_36, 0, x_46);
return x_36;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_47 = lean_ctor_get(x_36, 1);
lean_inc(x_47);
lean_dec(x_36);
x_48 = l_Lean_IR_EmitC_emitReset___closed__4;
x_49 = lean_string_append(x_47, x_48);
x_50 = lean_string_append(x_49, x_14);
x_51 = l_PersistentArray_Stats_toString___closed__4;
x_52 = lean_string_append(x_50, x_51);
x_53 = lean_string_append(x_52, x_14);
x_54 = lean_box(0);
x_55 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_53);
return x_55;
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitReset___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitReset(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReuse___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (lean_is_scalar(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitReuse___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" lean_ctor_set_tag(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitReuse(lean_object* x_1, lean_object* x_2, lean_object* x_3, uint8_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_8 = l_Lean_IR_EmitC_emitReuse___closed__1;
x_9 = lean_string_append(x_7, x_8);
x_10 = l_Nat_repr(x_2);
x_11 = l_Lean_IR_VarId_HasToString___closed__1;
x_12 = lean_string_append(x_11, x_10);
lean_dec(x_10);
x_13 = lean_string_append(x_9, x_12);
x_14 = l_Lean_IR_EmitC_emitReset___closed__2;
x_15 = lean_string_append(x_13, x_14);
x_16 = l_IO_println___rarg___closed__1;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_String_Iterator_HasRepr___closed__2;
x_19 = lean_string_append(x_17, x_18);
lean_inc(x_1);
x_20 = l_Lean_IR_EmitC_emitLhs(x_1, x_6, x_19);
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
lean_dec(x_20);
lean_inc(x_3);
x_22 = l_Lean_IR_EmitC_emitAllocCtor(x_3, x_6, x_21);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitC_emitMainFn___closed__22;
x_25 = lean_string_append(x_23, x_24);
x_26 = lean_string_append(x_25, x_16);
x_27 = lean_string_append(x_26, x_18);
lean_inc(x_1);
x_28 = l_Lean_IR_EmitC_emitLhs(x_1, x_6, x_27);
x_29 = lean_ctor_get(x_28, 1);
lean_inc(x_29);
lean_dec(x_28);
x_30 = lean_string_append(x_29, x_12);
lean_dec(x_12);
x_31 = l_Lean_IR_formatFnBody___main___closed__1;
x_32 = lean_string_append(x_30, x_31);
x_33 = lean_string_append(x_32, x_16);
if (x_4 == 0)
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
lean_dec(x_3);
x_34 = l_PersistentArray_Stats_toString___closed__4;
x_35 = lean_string_append(x_33, x_34);
x_36 = lean_string_append(x_35, x_16);
x_37 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_5, x_6, x_36);
return x_37;
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_38 = l_Lean_IR_EmitC_emitReuse___closed__2;
x_39 = lean_string_append(x_33, x_38);
lean_inc(x_1);
x_40 = l_Nat_repr(x_1);
x_41 = lean_string_append(x_11, x_40);
lean_dec(x_40);
x_42 = lean_string_append(x_39, x_41);
lean_dec(x_41);
x_43 = l_List_reprAux___main___rarg___closed__1;
x_44 = lean_string_append(x_42, x_43);
x_45 = lean_ctor_get(x_3, 1);
lean_inc(x_45);
lean_dec(x_3);
x_46 = l_Nat_repr(x_45);
x_47 = lean_string_append(x_44, x_46);
lean_dec(x_46);
x_48 = l_Lean_IR_EmitC_emitInc___closed__1;
x_49 = lean_string_append(x_47, x_48);
x_50 = lean_string_append(x_49, x_16);
x_51 = l_PersistentArray_Stats_toString___closed__4;
x_52 = lean_string_append(x_50, x_51);
x_53 = lean_string_append(x_52, x_16);
x_54 = l_Lean_IR_EmitC_emitCtorSetArgs(x_1, x_5, x_6, x_53);
return x_54;
}
}
}
lean_object* l_Lean_IR_EmitC_emitReuse___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8; lean_object* x_9;
x_8 = lean_unbox(x_4);
lean_dec(x_4);
x_9 = l_Lean_IR_EmitC_emitReuse(x_1, x_2, x_3, x_8, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_9;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitProj___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitProj(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_8 = lean_ctor_get(x_6, 1);
x_9 = lean_ctor_get(x_6, 0);
lean_dec(x_9);
x_10 = l_Lean_IR_EmitC_emitProj___closed__1;
x_11 = lean_string_append(x_8, x_10);
x_12 = l_Nat_repr(x_3);
x_13 = l_Lean_IR_VarId_HasToString___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = lean_string_append(x_11, x_14);
lean_dec(x_14);
x_16 = l_List_reprAux___main___rarg___closed__1;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Nat_repr(x_2);
x_19 = lean_string_append(x_17, x_18);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitInc___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = l_IO_println___rarg___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_box(0);
lean_ctor_set(x_6, 1, x_23);
lean_ctor_set(x_6, 0, x_24);
return x_6;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_25 = lean_ctor_get(x_6, 1);
lean_inc(x_25);
lean_dec(x_6);
x_26 = l_Lean_IR_EmitC_emitProj___closed__1;
x_27 = lean_string_append(x_25, x_26);
x_28 = l_Nat_repr(x_3);
x_29 = l_Lean_IR_VarId_HasToString___closed__1;
x_30 = lean_string_append(x_29, x_28);
lean_dec(x_28);
x_31 = lean_string_append(x_27, x_30);
lean_dec(x_30);
x_32 = l_List_reprAux___main___rarg___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = l_Nat_repr(x_2);
x_35 = lean_string_append(x_33, x_34);
lean_dec(x_34);
x_36 = l_Lean_IR_EmitC_emitInc___closed__1;
x_37 = lean_string_append(x_35, x_36);
x_38 = l_IO_println___rarg___closed__1;
x_39 = lean_string_append(x_37, x_38);
x_40 = lean_box(0);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_39);
return x_41;
}
}
}
lean_object* l_Lean_IR_EmitC_emitProj___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitProj(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUProj___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get_usize(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitUProj(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_8 = lean_ctor_get(x_6, 1);
x_9 = lean_ctor_get(x_6, 0);
lean_dec(x_9);
x_10 = l_Lean_IR_EmitC_emitUProj___closed__1;
x_11 = lean_string_append(x_8, x_10);
x_12 = l_Nat_repr(x_3);
x_13 = l_Lean_IR_VarId_HasToString___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = lean_string_append(x_11, x_14);
lean_dec(x_14);
x_16 = l_List_reprAux___main___rarg___closed__1;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Nat_repr(x_2);
x_19 = lean_string_append(x_17, x_18);
lean_dec(x_18);
x_20 = l_Lean_IR_EmitC_emitInc___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = l_IO_println___rarg___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = lean_box(0);
lean_ctor_set(x_6, 1, x_23);
lean_ctor_set(x_6, 0, x_24);
return x_6;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_25 = lean_ctor_get(x_6, 1);
lean_inc(x_25);
lean_dec(x_6);
x_26 = l_Lean_IR_EmitC_emitUProj___closed__1;
x_27 = lean_string_append(x_25, x_26);
x_28 = l_Nat_repr(x_3);
x_29 = l_Lean_IR_VarId_HasToString___closed__1;
x_30 = lean_string_append(x_29, x_28);
lean_dec(x_28);
x_31 = lean_string_append(x_27, x_30);
lean_dec(x_30);
x_32 = l_List_reprAux___main___rarg___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = l_Nat_repr(x_2);
x_35 = lean_string_append(x_33, x_34);
lean_dec(x_34);
x_36 = l_Lean_IR_EmitC_emitInc___closed__1;
x_37 = lean_string_append(x_35, x_36);
x_38 = l_IO_println___rarg___closed__1;
x_39 = lean_string_append(x_37, x_38);
x_40 = lean_box(0);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_39);
return x_41;
}
}
}
lean_object* l_Lean_IR_EmitC_emitUProj___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitUProj(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSProj___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get_uint8");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSProj___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get_uint16");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSProj___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get_uint32");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitSProj___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_ctor_get_uint64");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitSProj(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_34;
x_34 = l_Lean_IR_EmitC_emitLhs(x_1, x_6, x_7);
switch (lean_obj_tag(x_2)) {
case 0:
{
uint8_t x_35;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_35 = !lean_is_exclusive(x_34);
if (x_35 == 0)
{
lean_object* x_36; lean_object* x_37;
x_36 = lean_ctor_get(x_34, 0);
lean_dec(x_36);
x_37 = l_Lean_IR_EmitC_emitSSet___closed__1;
lean_ctor_set_tag(x_34, 1);
lean_ctor_set(x_34, 0, x_37);
return x_34;
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_38 = lean_ctor_get(x_34, 1);
lean_inc(x_38);
lean_dec(x_34);
x_39 = l_Lean_IR_EmitC_emitSSet___closed__1;
x_40 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_38);
return x_40;
}
}
case 1:
{
lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_41 = lean_ctor_get(x_34, 1);
lean_inc(x_41);
lean_dec(x_34);
x_42 = l_Lean_IR_EmitC_emitSProj___closed__1;
x_43 = lean_string_append(x_41, x_42);
x_8 = x_43;
goto block_33;
}
case 2:
{
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_34, 1);
lean_inc(x_44);
lean_dec(x_34);
x_45 = l_Lean_IR_EmitC_emitSProj___closed__2;
x_46 = lean_string_append(x_44, x_45);
x_8 = x_46;
goto block_33;
}
case 3:
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_34, 1);
lean_inc(x_47);
lean_dec(x_34);
x_48 = l_Lean_IR_EmitC_emitSProj___closed__3;
x_49 = lean_string_append(x_47, x_48);
x_8 = x_49;
goto block_33;
}
case 4:
{
lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_50 = lean_ctor_get(x_34, 1);
lean_inc(x_50);
lean_dec(x_34);
x_51 = l_Lean_IR_EmitC_emitSProj___closed__4;
x_52 = lean_string_append(x_50, x_51);
x_8 = x_52;
goto block_33;
}
default:
{
uint8_t x_53;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_53 = !lean_is_exclusive(x_34);
if (x_53 == 0)
{
lean_object* x_54; lean_object* x_55;
x_54 = lean_ctor_get(x_34, 0);
lean_dec(x_54);
x_55 = l_Lean_IR_EmitC_emitSSet___closed__6;
lean_ctor_set_tag(x_34, 1);
lean_ctor_set(x_34, 0, x_55);
return x_34;
}
else
{
lean_object* x_56; lean_object* x_57; lean_object* x_58;
x_56 = lean_ctor_get(x_34, 1);
lean_inc(x_56);
lean_dec(x_34);
x_57 = l_Lean_IR_EmitC_emitSSet___closed__6;
x_58 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_56);
return x_58;
}
}
}
block_33:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_9 = l_Prod_HasRepr___rarg___closed__1;
x_10 = lean_string_append(x_8, x_9);
x_11 = l_Nat_repr(x_5);
x_12 = l_Lean_IR_VarId_HasToString___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = lean_string_append(x_10, x_13);
lean_dec(x_13);
x_15 = l_List_reprAux___main___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_Lean_IR_EmitC_emitOffset(x_3, x_4, x_6, x_16);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_19 = lean_ctor_get(x_17, 1);
x_20 = lean_ctor_get(x_17, 0);
lean_dec(x_20);
x_21 = l_Lean_IR_EmitC_emitInc___closed__1;
x_22 = lean_string_append(x_19, x_21);
x_23 = l_IO_println___rarg___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_box(0);
lean_ctor_set(x_17, 1, x_24);
lean_ctor_set(x_17, 0, x_25);
return x_17;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_26 = lean_ctor_get(x_17, 1);
lean_inc(x_26);
lean_dec(x_17);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_30);
return x_32;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitSProj___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_IR_EmitC_emitSProj(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_2);
return x_8;
}
}
lean_object* l_List_map___main___at_Lean_IR_EmitC_toStringArgs___spec__1(lean_object* x_1) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_2;
x_2 = lean_box(0);
return x_2;
}
else
{
uint8_t x_3;
x_3 = !lean_is_exclusive(x_1);
if (x_3 == 0)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = l_Lean_IR_EmitC_argToCString(x_4);
x_7 = l_List_map___main___at_Lean_IR_EmitC_toStringArgs___spec__1(x_5);
lean_ctor_set(x_1, 1, x_7);
lean_ctor_set(x_1, 0, x_6);
return x_1;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_8 = lean_ctor_get(x_1, 0);
x_9 = lean_ctor_get(x_1, 1);
lean_inc(x_9);
lean_inc(x_8);
lean_dec(x_1);
x_10 = l_Lean_IR_EmitC_argToCString(x_8);
x_11 = l_List_map___main___at_Lean_IR_EmitC_toStringArgs___spec__1(x_9);
x_12 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_12, 0, x_10);
lean_ctor_set(x_12, 1, x_11);
return x_12;
}
}
}
}
lean_object* l_Lean_IR_EmitC_toStringArgs(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = l_Array_toList___rarg(x_1);
x_3 = l_List_map___main___at_Lean_IR_EmitC_toStringArgs___spec__1(x_2);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_toStringArgs___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_toStringArgs(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; uint8_t x_9;
x_8 = lean_unsigned_to_nat(0u);
x_9 = lean_nat_dec_eq(x_4, x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_10 = lean_unsigned_to_nat(1u);
x_11 = lean_nat_sub(x_4, x_10);
lean_dec(x_4);
x_12 = lean_nat_sub(x_3, x_11);
x_13 = lean_nat_sub(x_12, x_10);
lean_dec(x_12);
x_14 = l_Lean_IR_paramInh;
x_15 = lean_array_get(x_14, x_1, x_13);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = l_Lean_IR_IRType_isIrrelevant(x_16);
lean_dec(x_16);
if (x_17 == 0)
{
if (x_5 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; uint8_t x_24;
x_18 = l_List_reprAux___main___rarg___closed__1;
x_19 = lean_string_append(x_7, x_18);
x_20 = l_Lean_IR_Arg_Inhabited;
x_21 = lean_array_get(x_20, x_2, x_13);
lean_dec(x_13);
x_22 = l_Lean_IR_EmitC_emitArg(x_21, x_6, x_19);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = 0;
x_4 = x_11;
x_5 = x_24;
x_7 = x_23;
goto _start;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; uint8_t x_30;
x_26 = l_Lean_IR_Arg_Inhabited;
x_27 = lean_array_get(x_26, x_2, x_13);
lean_dec(x_13);
x_28 = l_Lean_IR_EmitC_emitArg(x_27, x_6, x_7);
x_29 = lean_ctor_get(x_28, 1);
lean_inc(x_29);
lean_dec(x_28);
x_30 = 0;
x_4 = x_11;
x_5 = x_30;
x_7 = x_29;
goto _start;
}
}
else
{
lean_dec(x_13);
x_4 = x_11;
goto _start;
}
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_4);
x_33 = lean_box(x_5);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_7);
return x_34;
}
}
}
lean_object* l_Lean_IR_EmitC_emitSimpleExternalCall(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10; lean_object* x_11; uint8_t x_12;
x_6 = lean_string_append(x_5, x_1);
x_7 = l_Prod_HasRepr___rarg___closed__1;
x_8 = lean_string_append(x_6, x_7);
x_9 = lean_array_get_size(x_3);
x_10 = 1;
lean_inc(x_9);
x_11 = l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1(x_2, x_3, x_9, x_9, x_10, x_4, x_8);
lean_dec(x_9);
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_13 = lean_ctor_get(x_11, 1);
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = l_Lean_IR_EmitC_emitInc___closed__1;
x_16 = lean_string_append(x_13, x_15);
x_17 = l_IO_println___rarg___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
lean_ctor_set(x_11, 1, x_18);
lean_ctor_set(x_11, 0, x_19);
return x_11;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_20 = lean_ctor_get(x_11, 1);
lean_inc(x_20);
lean_dec(x_11);
x_21 = l_Lean_IR_EmitC_emitInc___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_IO_println___rarg___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_24);
return x_26;
}
}
}
lean_object* l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8; lean_object* x_9;
x_8 = lean_unbox(x_5);
lean_dec(x_5);
x_9 = l_Nat_foldMAux___main___at_Lean_IR_EmitC_emitSimpleExternalCall___spec__1(x_1, x_2, x_3, x_4, x_8, x_6, x_7);
lean_dec(x_6);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_9;
}
}
lean_object* l_Lean_IR_EmitC_emitSimpleExternalCall___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitSimpleExternalCall(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitExternCall___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("failed to emit extern application '");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitExternCall(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_16; lean_object* x_17;
x_16 = l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2;
x_17 = l_Lean_getExternEntryFor(x_3, x_16);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18;
x_18 = lean_box(0);
x_7 = x_18;
goto block_15;
}
else
{
lean_object* x_19;
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
switch (lean_obj_tag(x_19)) {
case 0:
{
lean_object* x_20;
lean_dec(x_19);
x_20 = lean_box(0);
x_7 = x_20;
goto block_15;
}
case 1:
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
lean_dec(x_1);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_Lean_IR_EmitC_toStringArgs(x_4);
x_23 = l_Lean_expandExternPattern(x_21, x_22);
lean_dec(x_22);
x_24 = lean_string_append(x_6, x_23);
lean_dec(x_23);
x_25 = l_Lean_IR_formatFnBody___main___closed__1;
x_26 = lean_string_append(x_24, x_25);
x_27 = l_IO_println___rarg___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_box(0);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_28);
return x_30;
}
default:
{
lean_object* x_31; lean_object* x_32;
lean_dec(x_1);
x_31 = lean_ctor_get(x_19, 1);
lean_inc(x_31);
lean_dec(x_19);
x_32 = l_Lean_IR_EmitC_emitSimpleExternalCall(x_31, x_2, x_4, x_5, x_6);
lean_dec(x_31);
return x_32;
}
}
}
block_15:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_7);
x_8 = l_System_FilePath_dirName___closed__1;
x_9 = l_Lean_Name_toStringWithSep___main(x_8, x_1);
x_10 = l_Lean_IR_EmitC_emitExternCall___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = l_Char_HasRepr___closed__1;
x_13 = lean_string_append(x_11, x_12);
x_14 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_6);
return x_14;
}
}
}
lean_object* l_Lean_IR_EmitC_emitExternCall___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Lean_IR_EmitC_emitExternCall(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitFullApp(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_7 = lean_ctor_get(x_6, 1);
lean_inc(x_7);
lean_dec(x_6);
lean_inc(x_2);
x_8 = l_Lean_IR_EmitC_getDecl(x_2, x_4, x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11;
lean_dec(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
lean_dec(x_8);
x_11 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_10);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_13 = lean_ctor_get(x_11, 1);
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = lean_array_get_size(x_3);
x_16 = lean_unsigned_to_nat(0u);
x_17 = lean_nat_dec_lt(x_16, x_15);
lean_dec(x_15);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_18 = l_Lean_IR_formatFnBody___main___closed__1;
x_19 = lean_string_append(x_13, x_18);
x_20 = l_IO_println___rarg___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = lean_box(0);
lean_ctor_set(x_11, 1, x_21);
lean_ctor_set(x_11, 0, x_22);
return x_11;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
lean_free_object(x_11);
x_23 = l_Prod_HasRepr___rarg___closed__1;
x_24 = lean_string_append(x_13, x_23);
x_25 = l_Lean_IR_EmitC_emitArgs(x_3, x_4, x_24);
x_26 = !lean_is_exclusive(x_25);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_27 = lean_ctor_get(x_25, 1);
x_28 = lean_ctor_get(x_25, 0);
lean_dec(x_28);
x_29 = l_Option_HasRepr___rarg___closed__3;
x_30 = lean_string_append(x_27, x_29);
x_31 = l_Lean_IR_formatFnBody___main___closed__1;
x_32 = lean_string_append(x_30, x_31);
x_33 = l_IO_println___rarg___closed__1;
x_34 = lean_string_append(x_32, x_33);
x_35 = lean_box(0);
lean_ctor_set(x_25, 1, x_34);
lean_ctor_set(x_25, 0, x_35);
return x_25;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_36 = lean_ctor_get(x_25, 1);
lean_inc(x_36);
lean_dec(x_25);
x_37 = l_Option_HasRepr___rarg___closed__3;
x_38 = lean_string_append(x_36, x_37);
x_39 = l_Lean_IR_formatFnBody___main___closed__1;
x_40 = lean_string_append(x_38, x_39);
x_41 = l_IO_println___rarg___closed__1;
x_42 = lean_string_append(x_40, x_41);
x_43 = lean_box(0);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_42);
return x_44;
}
}
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; uint8_t x_48;
x_45 = lean_ctor_get(x_11, 1);
lean_inc(x_45);
lean_dec(x_11);
x_46 = lean_array_get_size(x_3);
x_47 = lean_unsigned_to_nat(0u);
x_48 = lean_nat_dec_lt(x_47, x_46);
lean_dec(x_46);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_49 = l_Lean_IR_formatFnBody___main___closed__1;
x_50 = lean_string_append(x_45, x_49);
x_51 = l_IO_println___rarg___closed__1;
x_52 = lean_string_append(x_50, x_51);
x_53 = lean_box(0);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_53);
lean_ctor_set(x_54, 1, x_52);
return x_54;
}
else
{
lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_55 = l_Prod_HasRepr___rarg___closed__1;
x_56 = lean_string_append(x_45, x_55);
x_57 = l_Lean_IR_EmitC_emitArgs(x_3, x_4, x_56);
x_58 = lean_ctor_get(x_57, 1);
lean_inc(x_58);
if (lean_is_exclusive(x_57)) {
lean_ctor_release(x_57, 0);
lean_ctor_release(x_57, 1);
x_59 = x_57;
} else {
lean_dec_ref(x_57);
x_59 = lean_box(0);
}
x_60 = l_Option_HasRepr___rarg___closed__3;
x_61 = lean_string_append(x_58, x_60);
x_62 = l_Lean_IR_formatFnBody___main___closed__1;
x_63 = lean_string_append(x_61, x_62);
x_64 = l_IO_println___rarg___closed__1;
x_65 = lean_string_append(x_63, x_64);
x_66 = lean_box(0);
if (lean_is_scalar(x_59)) {
x_67 = lean_alloc_ctor(0, 2, 0);
} else {
x_67 = x_59;
}
lean_ctor_set(x_67, 0, x_66);
lean_ctor_set(x_67, 1, x_65);
return x_67;
}
}
}
else
{
uint8_t x_68;
x_68 = !lean_is_exclusive(x_11);
if (x_68 == 0)
{
return x_11;
}
else
{
lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_69 = lean_ctor_get(x_11, 0);
x_70 = lean_ctor_get(x_11, 1);
lean_inc(x_70);
lean_inc(x_69);
lean_dec(x_11);
x_71 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_71, 0, x_69);
lean_ctor_set(x_71, 1, x_70);
return x_71;
}
}
}
else
{
lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75;
x_72 = lean_ctor_get(x_8, 1);
lean_inc(x_72);
lean_dec(x_8);
x_73 = lean_ctor_get(x_9, 1);
lean_inc(x_73);
x_74 = lean_ctor_get(x_9, 3);
lean_inc(x_74);
lean_dec(x_9);
x_75 = l_Lean_IR_EmitC_emitExternCall(x_2, x_73, x_74, x_3, x_4, x_72);
lean_dec(x_74);
lean_dec(x_73);
return x_75;
}
}
else
{
uint8_t x_76;
lean_dec(x_2);
x_76 = !lean_is_exclusive(x_8);
if (x_76 == 0)
{
return x_8;
}
else
{
lean_object* x_77; lean_object* x_78; lean_object* x_79;
x_77 = lean_ctor_get(x_8, 0);
x_78 = lean_ctor_get(x_8, 1);
lean_inc(x_78);
lean_inc(x_77);
lean_dec(x_8);
x_79 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_79, 0, x_77);
lean_ctor_set(x_79, 1, x_78);
return x_79;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitFullApp___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitFullApp(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_closure_set(");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_Arg_Inhabited;
x_14 = lean_array_get(x_13, x_2, x_12);
x_15 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1;
x_16 = lean_string_append(x_6, x_15);
lean_inc(x_1);
x_17 = l_Nat_repr(x_1);
x_18 = l_Lean_IR_VarId_HasToString___closed__1;
x_19 = lean_string_append(x_18, x_17);
lean_dec(x_17);
x_20 = lean_string_append(x_16, x_19);
lean_dec(x_19);
x_21 = l_List_reprAux___main___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Nat_repr(x_12);
x_24 = lean_string_append(x_22, x_23);
lean_dec(x_23);
x_25 = lean_string_append(x_24, x_21);
x_26 = l_Lean_IR_EmitC_emitArg(x_14, x_5, x_25);
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_28 = l_Lean_IR_EmitC_emitInc___closed__1;
x_29 = lean_string_append(x_27, x_28);
x_30 = l_IO_println___rarg___closed__1;
x_31 = lean_string_append(x_29, x_30);
x_4 = x_10;
x_6 = x_31;
goto _start;
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_4);
lean_dec(x_1);
x_33 = lean_box(0);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_6);
return x_34;
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitPartialApp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_alloc_closure((void*)(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitPartialApp___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("), ");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitPartialApp(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
lean_inc(x_2);
x_6 = l_Lean_IR_EmitC_getDecl(x_2, x_4, x_5);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_IR_Decl_params(x_7);
lean_dec(x_7);
x_10 = lean_array_get_size(x_9);
lean_dec(x_9);
lean_inc(x_1);
x_11 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_8);
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_emitPartialApp___closed__1;
x_14 = lean_string_append(x_12, x_13);
x_15 = l_Lean_IR_EmitC_emitCName(x_2, x_4, x_14);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = l_Lean_IR_EmitC_emitPartialApp___closed__2;
x_18 = lean_string_append(x_16, x_17);
x_19 = l_Nat_repr(x_10);
x_20 = lean_string_append(x_18, x_19);
lean_dec(x_19);
x_21 = l_List_reprAux___main___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = lean_array_get_size(x_3);
lean_inc(x_23);
x_24 = l_Nat_repr(x_23);
x_25 = lean_string_append(x_22, x_24);
lean_dec(x_24);
x_26 = l_Lean_IR_EmitC_emitInc___closed__1;
x_27 = lean_string_append(x_25, x_26);
x_28 = l_IO_println___rarg___closed__1;
x_29 = lean_string_append(x_27, x_28);
lean_inc(x_23);
x_30 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1(x_1, x_3, x_23, x_23, x_4, x_29);
lean_dec(x_23);
return x_30;
}
else
{
uint8_t x_31;
lean_dec(x_10);
lean_dec(x_1);
x_31 = !lean_is_exclusive(x_15);
if (x_31 == 0)
{
return x_15;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_32 = lean_ctor_get(x_15, 0);
x_33 = lean_ctor_get(x_15, 1);
lean_inc(x_33);
lean_inc(x_32);
lean_dec(x_15);
x_34 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_34, 0, x_32);
lean_ctor_set(x_34, 1, x_33);
return x_34;
}
}
}
else
{
uint8_t x_35;
lean_dec(x_2);
lean_dec(x_1);
x_35 = !lean_is_exclusive(x_6);
if (x_35 == 0)
{
return x_6;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_6, 0);
x_37 = lean_ctor_get(x_6, 1);
lean_inc(x_37);
lean_inc(x_36);
lean_dec(x_6);
x_38 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_38, 0, x_36);
lean_ctor_set(x_38, 1, x_37);
return x_38;
}
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitPartialApp___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitPartialApp(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitApp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_apply_");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitApp___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("{ lean_object* _aargs[] = {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitApp___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("};");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitApp___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_apply_m(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitApp___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(", _aargs); }");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitApp(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_6 = lean_array_get_size(x_3);
x_7 = l_Lean_closureMaxArgs;
x_8 = lean_nat_dec_lt(x_7, x_6);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; uint8_t x_24;
x_9 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_10 = lean_ctor_get(x_9, 1);
lean_inc(x_10);
lean_dec(x_9);
x_11 = l_Lean_IR_EmitC_emitApp___closed__1;
x_12 = lean_string_append(x_10, x_11);
x_13 = l_Nat_repr(x_6);
x_14 = lean_string_append(x_12, x_13);
lean_dec(x_13);
x_15 = l_Prod_HasRepr___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_Nat_repr(x_2);
x_18 = l_Lean_IR_VarId_HasToString___closed__1;
x_19 = lean_string_append(x_18, x_17);
lean_dec(x_17);
x_20 = lean_string_append(x_16, x_19);
lean_dec(x_19);
x_21 = l_List_reprAux___main___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Lean_IR_EmitC_emitArgs(x_3, x_4, x_22);
x_24 = !lean_is_exclusive(x_23);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_25 = lean_ctor_get(x_23, 1);
x_26 = lean_ctor_get(x_23, 0);
lean_dec(x_26);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_25, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
lean_ctor_set(x_23, 1, x_30);
lean_ctor_set(x_23, 0, x_31);
return x_23;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_32 = lean_ctor_get(x_23, 1);
lean_inc(x_32);
lean_dec(x_23);
x_33 = l_Lean_IR_EmitC_emitInc___closed__1;
x_34 = lean_string_append(x_32, x_33);
x_35 = l_IO_println___rarg___closed__1;
x_36 = lean_string_append(x_34, x_35);
x_37 = lean_box(0);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_36);
return x_38;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; uint8_t x_48;
x_39 = l_Lean_IR_EmitC_emitApp___closed__2;
x_40 = lean_string_append(x_5, x_39);
x_41 = l_Lean_IR_EmitC_emitArgs(x_3, x_4, x_40);
x_42 = lean_ctor_get(x_41, 1);
lean_inc(x_42);
lean_dec(x_41);
x_43 = l_Lean_IR_EmitC_emitApp___closed__3;
x_44 = lean_string_append(x_42, x_43);
x_45 = l_IO_println___rarg___closed__1;
x_46 = lean_string_append(x_44, x_45);
x_47 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_46);
x_48 = !lean_is_exclusive(x_47);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_49 = lean_ctor_get(x_47, 1);
x_50 = lean_ctor_get(x_47, 0);
lean_dec(x_50);
x_51 = l_Lean_IR_EmitC_emitApp___closed__4;
x_52 = lean_string_append(x_49, x_51);
x_53 = l_Nat_repr(x_2);
x_54 = l_Lean_IR_VarId_HasToString___closed__1;
x_55 = lean_string_append(x_54, x_53);
lean_dec(x_53);
x_56 = lean_string_append(x_52, x_55);
lean_dec(x_55);
x_57 = l_List_reprAux___main___rarg___closed__1;
x_58 = lean_string_append(x_56, x_57);
x_59 = l_Nat_repr(x_6);
x_60 = lean_string_append(x_58, x_59);
lean_dec(x_59);
x_61 = l_Lean_IR_EmitC_emitApp___closed__5;
x_62 = lean_string_append(x_60, x_61);
x_63 = lean_string_append(x_62, x_45);
x_64 = lean_box(0);
lean_ctor_set(x_47, 1, x_63);
lean_ctor_set(x_47, 0, x_64);
return x_47;
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80;
x_65 = lean_ctor_get(x_47, 1);
lean_inc(x_65);
lean_dec(x_47);
x_66 = l_Lean_IR_EmitC_emitApp___closed__4;
x_67 = lean_string_append(x_65, x_66);
x_68 = l_Nat_repr(x_2);
x_69 = l_Lean_IR_VarId_HasToString___closed__1;
x_70 = lean_string_append(x_69, x_68);
lean_dec(x_68);
x_71 = lean_string_append(x_67, x_70);
lean_dec(x_70);
x_72 = l_List_reprAux___main___rarg___closed__1;
x_73 = lean_string_append(x_71, x_72);
x_74 = l_Nat_repr(x_6);
x_75 = lean_string_append(x_73, x_74);
lean_dec(x_74);
x_76 = l_Lean_IR_EmitC_emitApp___closed__5;
x_77 = lean_string_append(x_75, x_76);
x_78 = lean_string_append(x_77, x_45);
x_79 = lean_box(0);
x_80 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_80, 0, x_79);
lean_ctor_set(x_80, 1, x_78);
return x_80;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitApp___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitApp(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBoxFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBoxFn___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box_uint32");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBoxFn___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box_uint64");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBoxFn___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_box_usize");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitBoxFn(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
switch (lean_obj_tag(x_1)) {
case 0:
{
lean_object* x_4; lean_object* x_5;
x_4 = l_Lean_IR_EmitC_emitSSet___closed__1;
x_5 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
case 3:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = l_Lean_IR_EmitC_emitBoxFn___closed__2;
x_7 = lean_string_append(x_3, x_6);
x_8 = lean_box(0);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_7);
return x_9;
}
case 4:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = l_Lean_IR_EmitC_emitBoxFn___closed__3;
x_11 = lean_string_append(x_3, x_10);
x_12 = lean_box(0);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
case 5:
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_14 = l_Lean_IR_EmitC_emitBoxFn___closed__4;
x_15 = lean_string_append(x_3, x_14);
x_16 = lean_box(0);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_15);
return x_17;
}
default:
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_18 = l_Lean_IR_EmitC_emitBoxFn___closed__1;
x_19 = lean_string_append(x_3, x_18);
x_20 = lean_box(0);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_19);
return x_21;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitBoxFn___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitBoxFn(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitBox(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
x_7 = lean_ctor_get(x_6, 1);
lean_inc(x_7);
lean_dec(x_6);
x_8 = l_Lean_IR_EmitC_emitBoxFn(x_3, x_4, x_7);
if (lean_obj_tag(x_8) == 0)
{
uint8_t x_9;
x_9 = !lean_is_exclusive(x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_10 = lean_ctor_get(x_8, 1);
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = l_Prod_HasRepr___rarg___closed__1;
x_13 = lean_string_append(x_10, x_12);
x_14 = l_Nat_repr(x_2);
x_15 = l_Lean_IR_VarId_HasToString___closed__1;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = lean_string_append(x_13, x_16);
lean_dec(x_16);
x_18 = l_Lean_IR_EmitC_emitInc___closed__1;
x_19 = lean_string_append(x_17, x_18);
x_20 = l_IO_println___rarg___closed__1;
x_21 = lean_string_append(x_19, x_20);
x_22 = lean_box(0);
lean_ctor_set(x_8, 1, x_21);
lean_ctor_set(x_8, 0, x_22);
return x_8;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_23 = lean_ctor_get(x_8, 1);
lean_inc(x_23);
lean_dec(x_8);
x_24 = l_Prod_HasRepr___rarg___closed__1;
x_25 = lean_string_append(x_23, x_24);
x_26 = l_Nat_repr(x_2);
x_27 = l_Lean_IR_VarId_HasToString___closed__1;
x_28 = lean_string_append(x_27, x_26);
lean_dec(x_26);
x_29 = lean_string_append(x_25, x_28);
lean_dec(x_28);
x_30 = l_Lean_IR_EmitC_emitInc___closed__1;
x_31 = lean_string_append(x_29, x_30);
x_32 = l_IO_println___rarg___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = lean_box(0);
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_34);
lean_ctor_set(x_35, 1, x_33);
return x_35;
}
}
else
{
uint8_t x_36;
lean_dec(x_2);
x_36 = !lean_is_exclusive(x_8);
if (x_36 == 0)
{
return x_8;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_8, 0);
x_38 = lean_ctor_get(x_8, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_8);
x_39 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_39, 0, x_37);
lean_ctor_set(x_39, 1, x_38);
return x_39;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitBox___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitBox(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUnbox___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_unbox");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUnbox___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_unbox_uint32");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUnbox___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_unbox_uint64");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitUnbox___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_unbox_usize");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitUnbox(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_20;
x_20 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
switch (lean_obj_tag(x_2)) {
case 0:
{
uint8_t x_21;
lean_dec(x_3);
x_21 = !lean_is_exclusive(x_20);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23;
x_22 = lean_ctor_get(x_20, 0);
lean_dec(x_22);
x_23 = l_Lean_IR_EmitC_emitSSet___closed__1;
lean_ctor_set_tag(x_20, 1);
lean_ctor_set(x_20, 0, x_23);
return x_20;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_20, 1);
lean_inc(x_24);
lean_dec(x_20);
x_25 = l_Lean_IR_EmitC_emitSSet___closed__1;
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_24);
return x_26;
}
}
case 3:
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_20, 1);
lean_inc(x_27);
lean_dec(x_20);
x_28 = l_Lean_IR_EmitC_emitUnbox___closed__2;
x_29 = lean_string_append(x_27, x_28);
x_6 = x_29;
goto block_19;
}
case 4:
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_20, 1);
lean_inc(x_30);
lean_dec(x_20);
x_31 = l_Lean_IR_EmitC_emitUnbox___closed__3;
x_32 = lean_string_append(x_30, x_31);
x_6 = x_32;
goto block_19;
}
case 5:
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_20, 1);
lean_inc(x_33);
lean_dec(x_20);
x_34 = l_Lean_IR_EmitC_emitUnbox___closed__4;
x_35 = lean_string_append(x_33, x_34);
x_6 = x_35;
goto block_19;
}
default:
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_20, 1);
lean_inc(x_36);
lean_dec(x_20);
x_37 = l_Lean_IR_EmitC_emitUnbox___closed__1;
x_38 = lean_string_append(x_36, x_37);
x_6 = x_38;
goto block_19;
}
}
block_19:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_7 = l_Prod_HasRepr___rarg___closed__1;
x_8 = lean_string_append(x_6, x_7);
x_9 = l_Nat_repr(x_3);
x_10 = l_Lean_IR_VarId_HasToString___closed__1;
x_11 = lean_string_append(x_10, x_9);
lean_dec(x_9);
x_12 = lean_string_append(x_8, x_11);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_emitInc___closed__1;
x_14 = lean_string_append(x_12, x_13);
x_15 = l_IO_println___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_box(0);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
}
}
lean_object* l_Lean_IR_EmitC_emitUnbox___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitUnbox(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitIsShared___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("!lean_is_exclusive(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitIsShared(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = l_Lean_IR_EmitC_emitLhs(x_1, x_3, x_4);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_7 = lean_ctor_get(x_5, 1);
x_8 = lean_ctor_get(x_5, 0);
lean_dec(x_8);
x_9 = l_Lean_IR_EmitC_emitIsShared___closed__1;
x_10 = lean_string_append(x_7, x_9);
x_11 = l_Nat_repr(x_2);
x_12 = l_Lean_IR_VarId_HasToString___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = lean_string_append(x_10, x_13);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitC_emitInc___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_IO_println___rarg___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
lean_ctor_set(x_5, 1, x_18);
lean_ctor_set(x_5, 0, x_19);
return x_5;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_20 = lean_ctor_get(x_5, 1);
lean_inc(x_20);
lean_dec(x_5);
x_21 = l_Lean_IR_EmitC_emitIsShared___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Nat_repr(x_2);
x_24 = l_Lean_IR_VarId_HasToString___closed__1;
x_25 = lean_string_append(x_24, x_23);
lean_dec(x_23);
x_26 = lean_string_append(x_22, x_25);
lean_dec(x_25);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_30);
return x_32;
}
}
}
lean_object* l_Lean_IR_EmitC_emitIsShared___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitIsShared(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("!lean_is_scalar(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitIsTaggedPtr(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = l_Lean_IR_EmitC_emitLhs(x_1, x_3, x_4);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_7 = lean_ctor_get(x_5, 1);
x_8 = lean_ctor_get(x_5, 0);
lean_dec(x_8);
x_9 = l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1;
x_10 = lean_string_append(x_7, x_9);
x_11 = l_Nat_repr(x_2);
x_12 = l_Lean_IR_VarId_HasToString___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = lean_string_append(x_10, x_13);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitC_emitInc___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_IO_println___rarg___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
lean_ctor_set(x_5, 1, x_18);
lean_ctor_set(x_5, 0, x_19);
return x_5;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_20 = lean_ctor_get(x_5, 1);
lean_inc(x_20);
lean_dec(x_5);
x_21 = l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Nat_repr(x_2);
x_24 = l_Lean_IR_VarId_HasToString___closed__1;
x_25 = lean_string_append(x_24, x_23);
lean_dec(x_23);
x_26 = lean_string_append(x_22, x_25);
lean_dec(x_25);
x_27 = l_Lean_IR_EmitC_emitInc___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_30);
return x_32;
}
}
}
lean_object* l_Lean_IR_EmitC_emitIsTaggedPtr___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitIsTaggedPtr(x_1, x_2, x_3, x_4);
lean_dec(x_3);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_toHexDigit(lean_object* x_1) {
_start:
{
uint32_t x_2; lean_object* x_3; lean_object* x_4;
x_2 = l_Nat_digitChar(x_1);
x_3 = l_String_splitAux___main___closed__1;
x_4 = lean_string_push(x_3, x_2);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_toHexDigit___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_toHexDigit(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_nat_dec_eq(x_3, x_2);
if (x_5 == 0)
{
lean_object* x_6; uint32_t x_7; uint32_t x_8; uint8_t x_9;
x_6 = lean_string_utf8_next(x_1, x_3);
x_7 = lean_string_utf8_get(x_1, x_3);
lean_dec(x_3);
x_8 = 10;
x_9 = x_7 == x_8;
if (x_9 == 0)
{
uint32_t x_10; uint8_t x_11; uint8_t x_38;
x_10 = 92;
x_38 = x_7 == x_10;
if (x_38 == 0)
{
uint8_t x_39;
x_39 = 0;
x_11 = x_39;
goto block_37;
}
else
{
uint8_t x_40;
x_40 = 1;
x_11 = x_40;
goto block_37;
}
block_37:
{
if (x_11 == 0)
{
uint32_t x_12; uint8_t x_13;
x_12 = 34;
x_13 = x_7 == x_12;
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_14 = lean_uint32_to_nat(x_7);
x_15 = lean_unsigned_to_nat(31u);
x_16 = lean_nat_dec_le(x_14, x_15);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
lean_dec(x_14);
x_17 = l_String_splitAux___main___closed__1;
x_18 = lean_string_push(x_17, x_7);
x_19 = lean_string_append(x_4, x_18);
lean_dec(x_18);
x_3 = x_6;
x_4 = x_19;
goto _start;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_21 = lean_unsigned_to_nat(16u);
x_22 = lean_nat_div(x_14, x_21);
x_23 = l_Lean_IR_EmitC_toHexDigit(x_22);
lean_dec(x_22);
x_24 = l_Char_quoteCore___closed__1;
x_25 = lean_string_append(x_24, x_23);
lean_dec(x_23);
x_26 = lean_nat_mod(x_14, x_21);
lean_dec(x_14);
x_27 = l_Lean_IR_EmitC_toHexDigit(x_26);
lean_dec(x_26);
x_28 = lean_string_append(x_25, x_27);
lean_dec(x_27);
x_29 = lean_string_append(x_4, x_28);
lean_dec(x_28);
x_3 = x_6;
x_4 = x_29;
goto _start;
}
}
else
{
lean_object* x_31; lean_object* x_32;
x_31 = l_Char_quoteCore___closed__2;
x_32 = lean_string_append(x_4, x_31);
x_3 = x_6;
x_4 = x_32;
goto _start;
}
}
else
{
lean_object* x_34; lean_object* x_35;
x_34 = l_Char_quoteCore___closed__3;
x_35 = lean_string_append(x_4, x_34);
x_3 = x_6;
x_4 = x_35;
goto _start;
}
}
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = l_Char_quoteCore___closed__5;
x_42 = lean_string_append(x_4, x_41);
x_3 = x_6;
x_4 = x_42;
goto _start;
}
}
else
{
lean_dec(x_3);
return x_4;
}
}
}
lean_object* l_Lean_IR_EmitC_quoteString(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_2 = lean_string_utf8_byte_size(x_1);
x_3 = lean_unsigned_to_nat(0u);
x_4 = l_String_quote___closed__1;
x_5 = l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_2);
x_6 = lean_string_append(x_5, x_4);
return x_6;
}
}
lean_object* l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_String_foldlAux___main___at_Lean_IR_EmitC_quoteString___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_quoteString___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitC_quoteString(x_1);
lean_dec(x_1);
return x_2;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitNumLit___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_cstr_to_nat(\"");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitNumLit___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("\")");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitNumLit___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_unsigned_to_nat(");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitNumLit___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("u)");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitNumLit(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_Lean_IR_IRType_isObj(x_1);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_6 = l_Nat_repr(x_2);
x_7 = lean_string_append(x_4, x_6);
lean_dec(x_6);
x_8 = lean_box(0);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_7);
return x_9;
}
else
{
lean_object* x_10; uint8_t x_11;
x_10 = l_uint32Sz;
x_11 = lean_nat_dec_lt(x_2, x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_12 = l_Lean_IR_EmitC_emitNumLit___closed__1;
x_13 = lean_string_append(x_4, x_12);
x_14 = l_Nat_repr(x_2);
x_15 = lean_string_append(x_13, x_14);
lean_dec(x_14);
x_16 = l_Lean_IR_EmitC_emitNumLit___closed__2;
x_17 = lean_string_append(x_15, x_16);
x_18 = lean_box(0);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_17);
return x_19;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_20 = l_Lean_IR_EmitC_emitNumLit___closed__3;
x_21 = lean_string_append(x_4, x_20);
x_22 = l_Nat_repr(x_2);
x_23 = lean_string_append(x_21, x_22);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitC_emitNumLit___closed__4;
x_25 = lean_string_append(x_23, x_24);
x_26 = lean_box(0);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_25);
return x_27;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitNumLit___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitNumLit(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitLit___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_mk_string(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitLit(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitLhs(x_1, x_4, x_5);
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_7 = lean_ctor_get(x_6, 1);
lean_inc(x_7);
lean_dec(x_6);
x_8 = lean_ctor_get(x_3, 0);
lean_inc(x_8);
lean_dec(x_3);
x_9 = l_Lean_IR_EmitC_emitNumLit(x_2, x_8, x_4, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_11 = lean_ctor_get(x_9, 1);
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = l_Lean_IR_formatFnBody___main___closed__1;
x_14 = lean_string_append(x_11, x_13);
x_15 = l_IO_println___rarg___closed__1;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_box(0);
lean_ctor_set(x_9, 1, x_16);
lean_ctor_set(x_9, 0, x_17);
return x_9;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_18 = lean_ctor_get(x_9, 1);
lean_inc(x_18);
lean_dec(x_9);
x_19 = l_Lean_IR_formatFnBody___main___closed__1;
x_20 = lean_string_append(x_18, x_19);
x_21 = l_IO_println___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = lean_box(0);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_22);
return x_24;
}
}
else
{
uint8_t x_25;
x_25 = !lean_is_exclusive(x_6);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_26 = lean_ctor_get(x_6, 1);
x_27 = lean_ctor_get(x_6, 0);
lean_dec(x_27);
x_28 = lean_ctor_get(x_3, 0);
lean_inc(x_28);
lean_dec(x_3);
x_29 = l_Lean_IR_EmitC_emitLit___closed__1;
x_30 = lean_string_append(x_26, x_29);
x_31 = l_Lean_IR_EmitC_quoteString(x_28);
lean_dec(x_28);
x_32 = lean_string_append(x_30, x_31);
lean_dec(x_31);
x_33 = l_Lean_IR_EmitC_emitInc___closed__1;
x_34 = lean_string_append(x_32, x_33);
x_35 = l_IO_println___rarg___closed__1;
x_36 = lean_string_append(x_34, x_35);
x_37 = lean_box(0);
lean_ctor_set(x_6, 1, x_36);
lean_ctor_set(x_6, 0, x_37);
return x_6;
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_38 = lean_ctor_get(x_6, 1);
lean_inc(x_38);
lean_dec(x_6);
x_39 = lean_ctor_get(x_3, 0);
lean_inc(x_39);
lean_dec(x_3);
x_40 = l_Lean_IR_EmitC_emitLit___closed__1;
x_41 = lean_string_append(x_38, x_40);
x_42 = l_Lean_IR_EmitC_quoteString(x_39);
lean_dec(x_39);
x_43 = lean_string_append(x_41, x_42);
lean_dec(x_42);
x_44 = l_Lean_IR_EmitC_emitInc___closed__1;
x_45 = lean_string_append(x_43, x_44);
x_46 = l_IO_println___rarg___closed__1;
x_47 = lean_string_append(x_45, x_46);
x_48 = lean_box(0);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_49, 1, x_47);
return x_49;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitLit___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitLit(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_emitVDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
switch (lean_obj_tag(x_3)) {
case 0:
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = lean_ctor_get(x_3, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_3, 1);
lean_inc(x_7);
lean_dec(x_3);
x_8 = l_Lean_IR_EmitC_emitCtor(x_1, x_6, x_7, x_4, x_5);
lean_dec(x_7);
return x_8;
}
case 1:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_9 = lean_ctor_get(x_3, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_3, 1);
lean_inc(x_10);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitC_emitReset(x_1, x_9, x_10, x_4, x_5);
return x_11;
}
case 2:
{
lean_object* x_12; lean_object* x_13; uint8_t x_14; lean_object* x_15; lean_object* x_16;
x_12 = lean_ctor_get(x_3, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_3, 1);
lean_inc(x_13);
x_14 = lean_ctor_get_uint8(x_3, sizeof(void*)*3);
x_15 = lean_ctor_get(x_3, 2);
lean_inc(x_15);
lean_dec(x_3);
x_16 = l_Lean_IR_EmitC_emitReuse(x_1, x_12, x_13, x_14, x_15, x_4, x_5);
lean_dec(x_15);
return x_16;
}
case 3:
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_3, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_3, 1);
lean_inc(x_18);
lean_dec(x_3);
x_19 = l_Lean_IR_EmitC_emitProj(x_1, x_17, x_18, x_4, x_5);
return x_19;
}
case 4:
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_3, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_3, 1);
lean_inc(x_21);
lean_dec(x_3);
x_22 = l_Lean_IR_EmitC_emitUProj(x_1, x_20, x_21, x_4, x_5);
return x_22;
}
case 5:
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_23 = lean_ctor_get(x_3, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_3, 1);
lean_inc(x_24);
x_25 = lean_ctor_get(x_3, 2);
lean_inc(x_25);
lean_dec(x_3);
x_26 = l_Lean_IR_EmitC_emitSProj(x_1, x_2, x_23, x_24, x_25, x_4, x_5);
return x_26;
}
case 6:
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_3, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_3, 1);
lean_inc(x_28);
lean_dec(x_3);
x_29 = l_Lean_IR_EmitC_emitFullApp(x_1, x_27, x_28, x_4, x_5);
lean_dec(x_28);
return x_29;
}
case 7:
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_3, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_3, 1);
lean_inc(x_31);
lean_dec(x_3);
x_32 = l_Lean_IR_EmitC_emitPartialApp(x_1, x_30, x_31, x_4, x_5);
lean_dec(x_31);
return x_32;
}
case 8:
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_3, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_3, 1);
lean_inc(x_34);
lean_dec(x_3);
x_35 = l_Lean_IR_EmitC_emitApp(x_1, x_33, x_34, x_4, x_5);
lean_dec(x_34);
return x_35;
}
case 9:
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_3, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_3, 1);
lean_inc(x_37);
lean_dec(x_3);
x_38 = l_Lean_IR_EmitC_emitBox(x_1, x_37, x_36, x_4, x_5);
lean_dec(x_36);
return x_38;
}
case 10:
{
lean_object* x_39; lean_object* x_40;
x_39 = lean_ctor_get(x_3, 0);
lean_inc(x_39);
lean_dec(x_3);
x_40 = l_Lean_IR_EmitC_emitUnbox(x_1, x_2, x_39, x_4, x_5);
return x_40;
}
case 11:
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_3, 0);
lean_inc(x_41);
lean_dec(x_3);
x_42 = l_Lean_IR_EmitC_emitLit(x_1, x_2, x_41, x_4, x_5);
return x_42;
}
case 12:
{
lean_object* x_43; lean_object* x_44;
x_43 = lean_ctor_get(x_3, 0);
lean_inc(x_43);
lean_dec(x_3);
x_44 = l_Lean_IR_EmitC_emitIsShared(x_1, x_43, x_4, x_5);
return x_44;
}
default:
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_3, 0);
lean_inc(x_45);
lean_dec(x_3);
x_46 = l_Lean_IR_EmitC_emitIsTaggedPtr(x_1, x_45, x_4, x_5);
return x_46;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitVDecl___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_emitVDecl(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
return x_6;
}
}
lean_object* l_Lean_IR_EmitC_isTailCall(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
if (lean_obj_tag(x_2) == 6)
{
if (lean_obj_tag(x_3) == 11)
{
lean_object* x_6;
x_6 = lean_ctor_get(x_3, 0);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_7 = lean_ctor_get(x_2, 0);
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_4, 3);
x_10 = lean_name_eq(x_7, x_9);
if (x_10 == 0)
{
uint8_t x_11; lean_object* x_12; lean_object* x_13;
x_11 = 0;
x_12 = lean_box(x_11);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_5);
return x_13;
}
else
{
uint8_t x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_nat_dec_eq(x_1, x_8);
x_15 = lean_box(x_14);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_5);
return x_16;
}
}
else
{
uint8_t x_17; lean_object* x_18; lean_object* x_19;
x_17 = 0;
x_18 = lean_box(x_17);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_5);
return x_19;
}
}
else
{
uint8_t x_20; lean_object* x_21; lean_object* x_22;
x_20 = 0;
x_21 = lean_box(x_20);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_5);
return x_22;
}
}
else
{
uint8_t x_23; lean_object* x_24; lean_object* x_25;
x_23 = 0;
x_24 = lean_box(x_23);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_5);
return x_25;
}
}
}
lean_object* l_Lean_IR_EmitC_isTailCall___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Lean_IR_EmitC_isTailCall(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
uint8_t l_Lean_IR_EmitC_paramEqArg(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; lean_object* x_4; uint8_t x_5;
x_3 = lean_ctor_get(x_2, 0);
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_nat_dec_eq(x_4, x_3);
return x_5;
}
else
{
uint8_t x_6;
x_6 = 0;
return x_6;
}
}
}
lean_object* l_Lean_IR_EmitC_paramEqArg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_IR_EmitC_paramEqArg(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
uint8_t l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_eq(x_4, x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_7 = lean_unsigned_to_nat(1u);
x_8 = lean_nat_sub(x_4, x_7);
x_9 = lean_nat_sub(x_3, x_4);
lean_dec(x_4);
x_10 = l_Lean_IR_Arg_Inhabited;
x_11 = lean_array_get(x_10, x_1, x_9);
lean_dec(x_9);
x_12 = l_Lean_IR_EmitC_paramEqArg(x_2, x_11);
lean_dec(x_11);
if (x_12 == 0)
{
x_4 = x_8;
goto _start;
}
else
{
uint8_t x_14;
lean_dec(x_8);
x_14 = 1;
return x_14;
}
}
else
{
uint8_t x_15;
lean_dec(x_4);
x_15 = 0;
return x_15;
}
}
}
uint8_t l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_5, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_5, x_8);
x_10 = lean_nat_sub(x_4, x_5);
lean_dec(x_5);
x_11 = l_Lean_IR_paramInh;
x_12 = lean_array_get(x_11, x_1, x_10);
x_13 = lean_nat_add(x_10, x_8);
lean_dec(x_10);
x_14 = lean_nat_sub(x_3, x_13);
lean_dec(x_13);
x_15 = l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1(x_2, x_12, x_3, x_14);
lean_dec(x_12);
if (x_15 == 0)
{
x_5 = x_9;
goto _start;
}
else
{
uint8_t x_17;
lean_dec(x_9);
x_17 = 1;
return x_17;
}
}
else
{
uint8_t x_18;
lean_dec(x_5);
x_18 = 0;
return x_18;
}
}
}
uint8_t l_Lean_IR_EmitC_overwriteParam(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = lean_array_get_size(x_1);
lean_inc(x_3);
x_4 = l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2(x_1, x_2, x_3, x_3, x_3);
lean_dec(x_3);
return x_4;
}
}
lean_object* l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5; lean_object* x_6;
x_5 = l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_6 = lean_box(x_5);
return x_6;
}
}
lean_object* l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6; lean_object* x_7;
x_6 = l_Nat_anyAux___main___at_Lean_IR_EmitC_overwriteParam___spec__2(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_7 = lean_box(x_6);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_overwriteParam___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_IR_EmitC_overwriteParam(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_2, x_12);
x_15 = l_Lean_IR_Arg_Inhabited;
x_16 = lean_array_get(x_15, x_1, x_12);
lean_dec(x_12);
x_17 = l_Lean_IR_EmitC_paramEqArg(x_14, x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = l_Nat_repr(x_18);
x_20 = l_Lean_IR_VarId_HasToString___closed__1;
x_21 = lean_string_append(x_20, x_19);
lean_dec(x_19);
x_22 = lean_string_append(x_6, x_21);
lean_dec(x_21);
x_23 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = l_Lean_IR_EmitC_emitArg(x_16, x_5, x_24);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
x_27 = l_Lean_IR_formatFnBody___main___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_4 = x_10;
x_6 = x_30;
goto _start;
}
else
{
lean_dec(x_16);
lean_dec(x_14);
x_4 = x_10;
goto _start;
}
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_4);
x_33 = lean_box(0);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_6);
return x_34;
}
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" _tmp_");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_2, x_12);
x_15 = l_Lean_IR_Arg_Inhabited;
x_16 = lean_array_get(x_15, x_1, x_12);
x_17 = l_Lean_IR_EmitC_paramEqArg(x_14, x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_18 = lean_ctor_get(x_14, 1);
lean_inc(x_18);
lean_dec(x_14);
x_19 = l_Lean_IR_EmitC_toCType(x_18);
lean_dec(x_18);
x_20 = lean_string_append(x_6, x_19);
lean_dec(x_19);
x_21 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Nat_repr(x_12);
x_24 = lean_string_append(x_22, x_23);
lean_dec(x_23);
x_25 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_26 = lean_string_append(x_24, x_25);
x_27 = l_Lean_IR_EmitC_emitArg(x_16, x_5, x_26);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
x_29 = l_Lean_IR_formatFnBody___main___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_31 = l_IO_println___rarg___closed__1;
x_32 = lean_string_append(x_30, x_31);
x_4 = x_10;
x_6 = x_32;
goto _start;
}
else
{
lean_dec(x_16);
lean_dec(x_14);
lean_dec(x_12);
x_4 = x_10;
goto _start;
}
}
else
{
lean_object* x_35; lean_object* x_36;
lean_dec(x_4);
x_35 = lean_box(0);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_6);
return x_36;
}
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" = _tmp_");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_eq(x_4, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_sub(x_4, x_9);
lean_dec(x_4);
x_11 = lean_nat_sub(x_3, x_10);
x_12 = lean_nat_sub(x_11, x_9);
lean_dec(x_11);
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_2, x_12);
x_15 = l_Lean_IR_Arg_Inhabited;
x_16 = lean_array_get(x_15, x_1, x_12);
x_17 = l_Lean_IR_EmitC_paramEqArg(x_14, x_16);
lean_dec(x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = l_Nat_repr(x_18);
x_20 = l_Lean_IR_VarId_HasToString___closed__1;
x_21 = lean_string_append(x_20, x_19);
lean_dec(x_19);
x_22 = lean_string_append(x_6, x_21);
lean_dec(x_21);
x_23 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = l_Nat_repr(x_12);
x_26 = lean_string_append(x_24, x_25);
lean_dec(x_25);
x_27 = l_Lean_IR_formatFnBody___main___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_29 = l_IO_println___rarg___closed__1;
x_30 = lean_string_append(x_28, x_29);
x_4 = x_10;
x_6 = x_30;
goto _start;
}
else
{
lean_dec(x_14);
lean_dec(x_12);
x_4 = x_10;
goto _start;
}
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_4);
x_33 = lean_box(0);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_34, 1, x_6);
return x_34;
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitTailCall___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("bug at emitTailCall");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitTailCall___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("invalid tail call");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitTailCall___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("goto _start;");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitTailCall(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 6)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 1);
x_5 = lean_ctor_get(x_2, 4);
x_6 = lean_array_get_size(x_5);
x_7 = lean_array_get_size(x_4);
x_8 = lean_nat_dec_eq(x_6, x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_7);
lean_dec(x_6);
x_9 = l_Lean_IR_EmitC_emitTailCall___closed__2;
x_10 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_3);
return x_10;
}
else
{
uint8_t x_11;
x_11 = l_Lean_IR_EmitC_overwriteParam(x_5, x_4);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
lean_dec(x_6);
lean_inc(x_7);
x_12 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1(x_4, x_5, x_7, x_7, x_2, x_3);
lean_dec(x_7);
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_14 = lean_ctor_get(x_12, 1);
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = l_Lean_IR_EmitC_emitTailCall___closed__3;
x_17 = lean_string_append(x_14, x_16);
x_18 = l_IO_println___rarg___closed__1;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_box(0);
lean_ctor_set(x_12, 1, x_19);
lean_ctor_set(x_12, 0, x_20);
return x_12;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_21 = lean_ctor_get(x_12, 1);
lean_inc(x_21);
lean_dec(x_12);
x_22 = l_Lean_IR_EmitC_emitTailCall___closed__3;
x_23 = lean_string_append(x_21, x_22);
x_24 = l_IO_println___rarg___closed__1;
x_25 = lean_string_append(x_23, x_24);
x_26 = lean_box(0);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_25);
return x_27;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; uint8_t x_35;
lean_dec(x_7);
x_28 = l_addParenHeuristic___closed__1;
x_29 = lean_string_append(x_3, x_28);
x_30 = l_IO_println___rarg___closed__1;
x_31 = lean_string_append(x_29, x_30);
lean_inc(x_6);
x_32 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2(x_4, x_5, x_6, x_6, x_2, x_31);
x_33 = lean_ctor_get(x_32, 1);
lean_inc(x_33);
lean_dec(x_32);
lean_inc(x_6);
x_34 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3(x_4, x_5, x_6, x_6, x_2, x_33);
lean_dec(x_6);
x_35 = !lean_is_exclusive(x_34);
if (x_35 == 0)
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_36 = lean_ctor_get(x_34, 1);
x_37 = lean_ctor_get(x_34, 0);
lean_dec(x_37);
x_38 = l_PersistentArray_Stats_toString___closed__4;
x_39 = lean_string_append(x_36, x_38);
x_40 = lean_string_append(x_39, x_30);
x_41 = l_Lean_IR_EmitC_emitTailCall___closed__3;
x_42 = lean_string_append(x_40, x_41);
x_43 = lean_string_append(x_42, x_30);
x_44 = lean_box(0);
lean_ctor_set(x_34, 1, x_43);
lean_ctor_set(x_34, 0, x_44);
return x_34;
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_45 = lean_ctor_get(x_34, 1);
lean_inc(x_45);
lean_dec(x_34);
x_46 = l_PersistentArray_Stats_toString___closed__4;
x_47 = lean_string_append(x_45, x_46);
x_48 = lean_string_append(x_47, x_30);
x_49 = l_Lean_IR_EmitC_emitTailCall___closed__3;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_string_append(x_50, x_30);
x_52 = lean_box(0);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_51);
return x_53;
}
}
}
}
else
{
lean_object* x_54; lean_object* x_55;
x_54 = l_Lean_IR_EmitC_emitTailCall___closed__1;
x_55 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_3);
return x_55;
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__1(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
lean_object* l_Lean_IR_EmitC_emitTailCall___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitTailCall(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBlock___main___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("return ");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitBlock___main___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_panic_unreachable();");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitBlock___main(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
switch (lean_obj_tag(x_2)) {
case 0:
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_5 = lean_ctor_get(x_2, 0);
lean_inc(x_5);
x_6 = lean_ctor_get(x_2, 1);
lean_inc(x_6);
x_7 = lean_ctor_get(x_2, 2);
lean_inc(x_7);
x_8 = lean_ctor_get(x_2, 3);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 3);
lean_inc(x_9);
x_10 = l_Lean_IR_isTailCallTo(x_9, x_2);
lean_dec(x_2);
lean_dec(x_9);
if (x_10 == 0)
{
lean_object* x_11;
x_11 = l_Lean_IR_EmitC_emitVDecl(x_5, x_6, x_7, x_3, x_4);
lean_dec(x_6);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12;
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_2 = x_8;
x_4 = x_12;
goto _start;
}
else
{
uint8_t x_14;
lean_dec(x_8);
lean_dec(x_3);
lean_dec(x_1);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_11;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_11, 0);
x_16 = lean_ctor_get(x_11, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_11);
x_17 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_17, 0, x_15);
lean_ctor_set(x_17, 1, x_16);
return x_17;
}
}
}
else
{
lean_object* x_18;
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_1);
x_18 = l_Lean_IR_EmitC_emitTailCall(x_7, x_3, x_4);
lean_dec(x_3);
lean_dec(x_7);
return x_18;
}
}
case 1:
{
lean_object* x_19;
x_19 = lean_ctor_get(x_2, 3);
lean_inc(x_19);
lean_dec(x_2);
x_2 = x_19;
goto _start;
}
case 2:
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_21 = lean_ctor_get(x_2, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_2, 1);
lean_inc(x_22);
x_23 = lean_ctor_get(x_2, 2);
lean_inc(x_23);
x_24 = lean_ctor_get(x_2, 3);
lean_inc(x_24);
lean_dec(x_2);
x_25 = l_Lean_IR_EmitC_emitSet(x_21, x_22, x_23, x_3, x_4);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
x_2 = x_24;
x_4 = x_26;
goto _start;
}
case 3:
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_28 = lean_ctor_get(x_2, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_2, 1);
lean_inc(x_29);
x_30 = lean_ctor_get(x_2, 2);
lean_inc(x_30);
lean_dec(x_2);
x_31 = l_Lean_IR_EmitC_emitSetTag(x_28, x_29, x_3, x_4);
x_32 = lean_ctor_get(x_31, 1);
lean_inc(x_32);
lean_dec(x_31);
x_2 = x_30;
x_4 = x_32;
goto _start;
}
case 4:
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_34 = lean_ctor_get(x_2, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_2, 1);
lean_inc(x_35);
x_36 = lean_ctor_get(x_2, 2);
lean_inc(x_36);
x_37 = lean_ctor_get(x_2, 3);
lean_inc(x_37);
lean_dec(x_2);
x_38 = l_Lean_IR_EmitC_emitUSet(x_34, x_35, x_36, x_3, x_4);
x_39 = lean_ctor_get(x_38, 1);
lean_inc(x_39);
lean_dec(x_38);
x_2 = x_37;
x_4 = x_39;
goto _start;
}
case 5:
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_41 = lean_ctor_get(x_2, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_2, 1);
lean_inc(x_42);
x_43 = lean_ctor_get(x_2, 2);
lean_inc(x_43);
x_44 = lean_ctor_get(x_2, 3);
lean_inc(x_44);
x_45 = lean_ctor_get(x_2, 4);
lean_inc(x_45);
x_46 = lean_ctor_get(x_2, 5);
lean_inc(x_46);
lean_dec(x_2);
x_47 = l_Lean_IR_EmitC_emitSSet(x_41, x_42, x_43, x_44, x_45, x_3, x_4);
lean_dec(x_45);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48;
x_48 = lean_ctor_get(x_47, 1);
lean_inc(x_48);
lean_dec(x_47);
x_2 = x_46;
x_4 = x_48;
goto _start;
}
else
{
uint8_t x_50;
lean_dec(x_46);
lean_dec(x_3);
lean_dec(x_1);
x_50 = !lean_is_exclusive(x_47);
if (x_50 == 0)
{
return x_47;
}
else
{
lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_51 = lean_ctor_get(x_47, 0);
x_52 = lean_ctor_get(x_47, 1);
lean_inc(x_52);
lean_inc(x_51);
lean_dec(x_47);
x_53 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_53, 0, x_51);
lean_ctor_set(x_53, 1, x_52);
return x_53;
}
}
}
case 6:
{
uint8_t x_54;
x_54 = lean_ctor_get_uint8(x_2, sizeof(void*)*3 + 1);
if (x_54 == 0)
{
lean_object* x_55; lean_object* x_56; uint8_t x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60;
x_55 = lean_ctor_get(x_2, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_2, 1);
lean_inc(x_56);
x_57 = lean_ctor_get_uint8(x_2, sizeof(void*)*3);
x_58 = lean_ctor_get(x_2, 2);
lean_inc(x_58);
lean_dec(x_2);
x_59 = l_Lean_IR_EmitC_emitInc(x_55, x_56, x_57, x_3, x_4);
x_60 = lean_ctor_get(x_59, 1);
lean_inc(x_60);
lean_dec(x_59);
x_2 = x_58;
x_4 = x_60;
goto _start;
}
else
{
lean_object* x_62;
x_62 = lean_ctor_get(x_2, 2);
lean_inc(x_62);
lean_dec(x_2);
x_2 = x_62;
goto _start;
}
}
case 7:
{
uint8_t x_64;
x_64 = lean_ctor_get_uint8(x_2, sizeof(void*)*3 + 1);
if (x_64 == 0)
{
lean_object* x_65; lean_object* x_66; uint8_t x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_65 = lean_ctor_get(x_2, 0);
lean_inc(x_65);
x_66 = lean_ctor_get(x_2, 1);
lean_inc(x_66);
x_67 = lean_ctor_get_uint8(x_2, sizeof(void*)*3);
x_68 = lean_ctor_get(x_2, 2);
lean_inc(x_68);
lean_dec(x_2);
x_69 = l_Lean_IR_EmitC_emitDec(x_65, x_66, x_67, x_3, x_4);
x_70 = lean_ctor_get(x_69, 1);
lean_inc(x_70);
lean_dec(x_69);
x_2 = x_68;
x_4 = x_70;
goto _start;
}
else
{
lean_object* x_72;
x_72 = lean_ctor_get(x_2, 2);
lean_inc(x_72);
lean_dec(x_2);
x_2 = x_72;
goto _start;
}
}
case 8:
{
lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_74 = lean_ctor_get(x_2, 0);
lean_inc(x_74);
x_75 = lean_ctor_get(x_2, 1);
lean_inc(x_75);
lean_dec(x_2);
x_76 = l_Lean_IR_EmitC_emitDel(x_74, x_3, x_4);
x_77 = lean_ctor_get(x_76, 1);
lean_inc(x_77);
lean_dec(x_76);
x_2 = x_75;
x_4 = x_77;
goto _start;
}
case 9:
{
lean_object* x_79;
x_79 = lean_ctor_get(x_2, 1);
lean_inc(x_79);
lean_dec(x_2);
x_2 = x_79;
goto _start;
}
case 10:
{
lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_81 = lean_ctor_get(x_2, 1);
lean_inc(x_81);
x_82 = lean_ctor_get(x_2, 2);
lean_inc(x_82);
x_83 = lean_ctor_get(x_2, 3);
lean_inc(x_83);
lean_dec(x_2);
x_84 = l_Lean_IR_EmitC_emitCase(x_1, x_81, x_82, x_83, x_3, x_4);
lean_dec(x_82);
return x_84;
}
case 11:
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; uint8_t x_89;
lean_dec(x_1);
x_85 = lean_ctor_get(x_2, 0);
lean_inc(x_85);
lean_dec(x_2);
x_86 = l_Lean_IR_EmitC_emitBlock___main___closed__1;
x_87 = lean_string_append(x_4, x_86);
x_88 = l_Lean_IR_EmitC_emitArg(x_85, x_3, x_87);
lean_dec(x_3);
x_89 = !lean_is_exclusive(x_88);
if (x_89 == 0)
{
lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96;
x_90 = lean_ctor_get(x_88, 1);
x_91 = lean_ctor_get(x_88, 0);
lean_dec(x_91);
x_92 = l_Lean_IR_formatFnBody___main___closed__1;
x_93 = lean_string_append(x_90, x_92);
x_94 = l_IO_println___rarg___closed__1;
x_95 = lean_string_append(x_93, x_94);
x_96 = lean_box(0);
lean_ctor_set(x_88, 1, x_95);
lean_ctor_set(x_88, 0, x_96);
return x_88;
}
else
{
lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103;
x_97 = lean_ctor_get(x_88, 1);
lean_inc(x_97);
lean_dec(x_88);
x_98 = l_Lean_IR_formatFnBody___main___closed__1;
x_99 = lean_string_append(x_97, x_98);
x_100 = l_IO_println___rarg___closed__1;
x_101 = lean_string_append(x_99, x_100);
x_102 = lean_box(0);
x_103 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_103, 0, x_102);
lean_ctor_set(x_103, 1, x_101);
return x_103;
}
}
case 12:
{
lean_object* x_104; lean_object* x_105; lean_object* x_106;
lean_dec(x_1);
x_104 = lean_ctor_get(x_2, 0);
lean_inc(x_104);
x_105 = lean_ctor_get(x_2, 1);
lean_inc(x_105);
lean_dec(x_2);
x_106 = l_Lean_IR_EmitC_emitJmp(x_104, x_105, x_3, x_4);
lean_dec(x_3);
lean_dec(x_105);
return x_106;
}
default:
{
lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112;
lean_dec(x_3);
lean_dec(x_1);
x_107 = l_Lean_IR_EmitC_emitBlock___main___closed__2;
x_108 = lean_string_append(x_4, x_107);
x_109 = l_IO_println___rarg___closed__1;
x_110 = lean_string_append(x_108, x_109);
x_111 = lean_box(0);
x_112 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_112, 0, x_111);
lean_ctor_set(x_112, 1, x_110);
return x_112;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitBlock(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitBlock___main(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* l_Lean_IR_EmitC_emitJPs___main(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
if (lean_obj_tag(x_2) == 1)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_12 = lean_ctor_get(x_2, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_2, 2);
lean_inc(x_13);
x_14 = lean_ctor_get(x_2, 3);
lean_inc(x_14);
lean_dec(x_2);
x_15 = l_Nat_repr(x_12);
x_16 = l_Lean_IR_JoinPointId_HasToString___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = lean_string_append(x_4, x_17);
lean_dec(x_17);
x_19 = l___private_Init_Util_1__mkPanicMessage___closed__2;
x_20 = lean_string_append(x_18, x_19);
x_21 = l_IO_println___rarg___closed__1;
x_22 = lean_string_append(x_20, x_21);
lean_inc(x_1);
lean_inc(x_3);
x_23 = lean_apply_3(x_1, x_13, x_3, x_22);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24;
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_2 = x_14;
x_4 = x_24;
goto _start;
}
else
{
uint8_t x_26;
lean_dec(x_14);
lean_dec(x_3);
lean_dec(x_1);
x_26 = !lean_is_exclusive(x_23);
if (x_26 == 0)
{
return x_23;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_23, 0);
x_28 = lean_ctor_get(x_23, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_23);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
else
{
lean_object* x_30;
x_30 = lean_box(0);
x_5 = x_30;
goto block_11;
}
block_11:
{
uint8_t x_6;
lean_dec(x_5);
x_6 = l_Lean_IR_FnBody_isTerminal(x_2);
if (x_6 == 0)
{
lean_object* x_7;
x_7 = l_Lean_IR_FnBody_body(x_2);
lean_dec(x_2);
x_2 = x_7;
goto _start;
}
else
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_9 = lean_box(0);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_4);
return x_10;
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitJPs(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitJPs___main(x_1, x_2, x_3, x_4);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitFnBody___main___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_IR_EmitC_emitFnBody___main), 3, 0);
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitFnBody___main(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11;
x_4 = l_addParenHeuristic___closed__1;
x_5 = lean_string_append(x_3, x_4);
x_6 = l_IO_println___rarg___closed__1;
x_7 = lean_string_append(x_5, x_6);
x_8 = 0;
lean_inc(x_1);
x_9 = l_Lean_IR_EmitC_declareVars___main(x_1, x_8, x_2, x_7);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_unbox(x_10);
lean_dec(x_10);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = lean_ctor_get(x_9, 1);
lean_inc(x_12);
lean_dec(x_9);
x_13 = l_Lean_IR_EmitC_emitFnBody___main___closed__1;
lean_inc(x_2);
lean_inc(x_1);
x_14 = l_Lean_IR_EmitC_emitBlock___main(x_13, x_1, x_2, x_12);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
lean_dec(x_14);
x_16 = l_Lean_IR_EmitC_emitJPs___main(x_13, x_1, x_2, x_15);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_18 = lean_ctor_get(x_16, 1);
x_19 = lean_ctor_get(x_16, 0);
lean_dec(x_19);
x_20 = l_PersistentArray_Stats_toString___closed__4;
x_21 = lean_string_append(x_18, x_20);
x_22 = lean_string_append(x_21, x_6);
x_23 = lean_box(0);
lean_ctor_set(x_16, 1, x_22);
lean_ctor_set(x_16, 0, x_23);
return x_16;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_24 = lean_ctor_get(x_16, 1);
lean_inc(x_24);
lean_dec(x_16);
x_25 = l_PersistentArray_Stats_toString___closed__4;
x_26 = lean_string_append(x_24, x_25);
x_27 = lean_string_append(x_26, x_6);
x_28 = lean_box(0);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_27);
return x_29;
}
}
else
{
uint8_t x_30;
x_30 = !lean_is_exclusive(x_16);
if (x_30 == 0)
{
return x_16;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_16, 0);
x_32 = lean_ctor_get(x_16, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_16);
x_33 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_33, 0, x_31);
lean_ctor_set(x_33, 1, x_32);
return x_33;
}
}
}
else
{
uint8_t x_34;
lean_dec(x_2);
lean_dec(x_1);
x_34 = !lean_is_exclusive(x_14);
if (x_34 == 0)
{
return x_14;
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_35 = lean_ctor_get(x_14, 0);
x_36 = lean_ctor_get(x_14, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_14);
x_37 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_37, 0, x_35);
lean_ctor_set(x_37, 1, x_36);
return x_37;
}
}
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_38 = lean_ctor_get(x_9, 1);
lean_inc(x_38);
lean_dec(x_9);
x_39 = l_String_splitAux___main___closed__1;
x_40 = lean_string_append(x_38, x_39);
x_41 = lean_string_append(x_40, x_6);
x_42 = l_Lean_IR_EmitC_emitFnBody___main___closed__1;
lean_inc(x_2);
lean_inc(x_1);
x_43 = l_Lean_IR_EmitC_emitBlock___main(x_42, x_1, x_2, x_41);
if (lean_obj_tag(x_43) == 0)
{
lean_object* x_44; lean_object* x_45;
x_44 = lean_ctor_get(x_43, 1);
lean_inc(x_44);
lean_dec(x_43);
x_45 = l_Lean_IR_EmitC_emitJPs___main(x_42, x_1, x_2, x_44);
if (lean_obj_tag(x_45) == 0)
{
uint8_t x_46;
x_46 = !lean_is_exclusive(x_45);
if (x_46 == 0)
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_47 = lean_ctor_get(x_45, 1);
x_48 = lean_ctor_get(x_45, 0);
lean_dec(x_48);
x_49 = l_PersistentArray_Stats_toString___closed__4;
x_50 = lean_string_append(x_47, x_49);
x_51 = lean_string_append(x_50, x_6);
x_52 = lean_box(0);
lean_ctor_set(x_45, 1, x_51);
lean_ctor_set(x_45, 0, x_52);
return x_45;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58;
x_53 = lean_ctor_get(x_45, 1);
lean_inc(x_53);
lean_dec(x_45);
x_54 = l_PersistentArray_Stats_toString___closed__4;
x_55 = lean_string_append(x_53, x_54);
x_56 = lean_string_append(x_55, x_6);
x_57 = lean_box(0);
x_58 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_56);
return x_58;
}
}
else
{
uint8_t x_59;
x_59 = !lean_is_exclusive(x_45);
if (x_59 == 0)
{
return x_45;
}
else
{
lean_object* x_60; lean_object* x_61; lean_object* x_62;
x_60 = lean_ctor_get(x_45, 0);
x_61 = lean_ctor_get(x_45, 1);
lean_inc(x_61);
lean_inc(x_60);
lean_dec(x_45);
x_62 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_62, 0, x_60);
lean_ctor_set(x_62, 1, x_61);
return x_62;
}
}
}
else
{
uint8_t x_63;
lean_dec(x_2);
lean_dec(x_1);
x_63 = !lean_is_exclusive(x_43);
if (x_63 == 0)
{
return x_43;
}
else
{
lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_64 = lean_ctor_get(x_43, 0);
x_65 = lean_ctor_get(x_43, 1);
lean_inc(x_65);
lean_inc(x_64);
lean_dec(x_43);
x_66 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_66, 0, x_64);
lean_ctor_set(x_66, 1, x_65);
return x_66;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitFnBody(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitFnBody___main(x_1, x_2, x_3);
return x_4;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object* ");
return x_1;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" = _args[");
return x_1;
}
}
lean_object* _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("];");
return x_1;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = l_Lean_IR_paramInh;
x_13 = lean_array_get(x_12, x_1, x_11);
x_14 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1;
x_15 = lean_string_append(x_5, x_14);
x_16 = lean_ctor_get(x_13, 0);
lean_inc(x_16);
lean_dec(x_13);
x_17 = l_Nat_repr(x_16);
x_18 = l_Lean_IR_VarId_HasToString___closed__1;
x_19 = lean_string_append(x_18, x_17);
lean_dec(x_17);
x_20 = lean_string_append(x_15, x_19);
lean_dec(x_19);
x_21 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_Nat_repr(x_11);
x_24 = lean_string_append(x_22, x_23);
lean_dec(x_23);
x_25 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3;
x_26 = lean_string_append(x_24, x_25);
x_27 = l_IO_println___rarg___closed__1;
x_28 = lean_string_append(x_26, x_27);
x_3 = x_9;
x_5 = x_28;
goto _start;
}
else
{
lean_object* x_30; lean_object* x_31;
lean_dec(x_3);
x_30 = lean_box(0);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_5);
return x_31;
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_unsigned_to_nat(0u);
x_7 = lean_nat_dec_eq(x_3, x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_unsigned_to_nat(1u);
x_9 = lean_nat_sub(x_3, x_8);
lean_dec(x_3);
x_10 = lean_nat_sub(x_2, x_9);
x_11 = lean_nat_sub(x_10, x_8);
lean_dec(x_10);
x_12 = lean_nat_dec_lt(x_6, x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_13 = l_Lean_IR_paramInh;
x_14 = lean_array_get(x_13, x_1, x_11);
lean_dec(x_11);
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
x_16 = l_Lean_IR_EmitC_toCType(x_15);
lean_dec(x_15);
x_17 = lean_string_append(x_5, x_16);
lean_dec(x_16);
x_18 = l_String_Iterator_HasRepr___closed__2;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_ctor_get(x_14, 0);
lean_inc(x_20);
lean_dec(x_14);
x_21 = l_Nat_repr(x_20);
x_22 = l_Lean_IR_VarId_HasToString___closed__1;
x_23 = lean_string_append(x_22, x_21);
lean_dec(x_21);
x_24 = lean_string_append(x_19, x_23);
lean_dec(x_23);
x_3 = x_9;
x_5 = x_24;
goto _start;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_26 = l_List_reprAux___main___rarg___closed__1;
x_27 = lean_string_append(x_5, x_26);
x_28 = l_Lean_IR_paramInh;
x_29 = lean_array_get(x_28, x_1, x_11);
lean_dec(x_11);
x_30 = lean_ctor_get(x_29, 1);
lean_inc(x_30);
x_31 = l_Lean_IR_EmitC_toCType(x_30);
lean_dec(x_30);
x_32 = lean_string_append(x_27, x_31);
lean_dec(x_31);
x_33 = l_String_Iterator_HasRepr___closed__2;
x_34 = lean_string_append(x_32, x_33);
x_35 = lean_ctor_get(x_29, 0);
lean_inc(x_35);
lean_dec(x_29);
x_36 = l_Nat_repr(x_35);
x_37 = l_Lean_IR_VarId_HasToString___closed__1;
x_38 = lean_string_append(x_37, x_36);
lean_dec(x_36);
x_39 = lean_string_append(x_34, x_38);
lean_dec(x_38);
x_3 = x_9;
x_5 = x_39;
goto _start;
}
}
else
{
lean_object* x_41; lean_object* x_42;
lean_dec(x_3);
x_41 = lean_box(0);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_5);
return x_42;
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclAux___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclAux___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("_start:");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclAux___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object** _args");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitDeclAux(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11; uint8_t x_12;
x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3);
x_5 = lean_ctor_get(x_4, 0);
lean_inc(x_5);
x_6 = lean_ctor_get(x_4, 1);
lean_inc(x_6);
if (lean_is_exclusive(x_4)) {
lean_ctor_release(x_4, 0);
lean_ctor_release(x_4, 1);
x_7 = x_4;
} else {
lean_dec_ref(x_4);
x_7 = lean_box(0);
}
lean_inc(x_1);
x_8 = l_Lean_IR_mkVarJPMaps(x_1);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = l_Lean_IR_Decl_name(x_1);
lean_inc(x_10);
x_11 = l_Lean_hasInitAttr(x_5, x_10);
if (x_11 == 0)
{
uint8_t x_241;
x_241 = 0;
x_12 = x_241;
goto block_240;
}
else
{
uint8_t x_242;
x_242 = 1;
x_12 = x_242;
goto block_240;
}
block_240:
{
if (x_12 == 0)
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
lean_dec(x_7);
x_13 = lean_ctor_get(x_1, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_1, 1);
lean_inc(x_14);
x_15 = lean_ctor_get(x_1, 2);
lean_inc(x_15);
x_16 = lean_ctor_get(x_1, 3);
lean_inc(x_16);
lean_dec(x_1);
x_17 = !lean_is_exclusive(x_2);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_18 = lean_ctor_get(x_2, 0);
x_19 = lean_ctor_get(x_2, 1);
x_20 = lean_ctor_get(x_2, 2);
lean_dec(x_20);
lean_inc(x_9);
lean_inc(x_19);
lean_inc(x_18);
lean_ctor_set(x_2, 2, x_9);
lean_inc(x_13);
x_21 = l_Lean_IR_EmitC_toCName(x_13, x_2, x_6);
if (lean_obj_tag(x_21) == 0)
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_106; uint8_t x_107;
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
x_24 = l_Lean_IR_EmitC_toCType(x_15);
lean_dec(x_15);
x_25 = lean_string_append(x_23, x_24);
lean_dec(x_24);
x_26 = l_String_Iterator_HasRepr___closed__2;
x_27 = lean_string_append(x_25, x_26);
x_28 = lean_array_get_size(x_14);
x_106 = lean_unsigned_to_nat(0u);
x_107 = lean_nat_dec_lt(x_106, x_28);
if (x_107 == 0)
{
lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112;
x_108 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_109 = lean_string_append(x_108, x_22);
lean_dec(x_22);
x_110 = l_Unit_HasRepr___closed__1;
x_111 = lean_string_append(x_109, x_110);
x_112 = lean_string_append(x_27, x_111);
lean_dec(x_111);
x_29 = x_112;
goto block_105;
}
else
{
lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_122; uint8_t x_123;
x_113 = lean_string_append(x_27, x_22);
lean_dec(x_22);
x_114 = l_Prod_HasRepr___rarg___closed__1;
x_115 = lean_string_append(x_113, x_114);
x_122 = l_Lean_closureMaxArgs;
x_123 = lean_nat_dec_lt(x_122, x_28);
if (x_123 == 0)
{
lean_object* x_124;
x_124 = lean_box(0);
x_116 = x_124;
goto block_121;
}
else
{
uint8_t x_125;
x_125 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_10);
if (x_125 == 0)
{
lean_object* x_126;
x_126 = lean_box(0);
x_116 = x_126;
goto block_121;
}
else
{
lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130;
x_127 = l_Lean_IR_EmitC_emitDeclAux___closed__3;
x_128 = lean_string_append(x_115, x_127);
x_129 = l_Option_HasRepr___rarg___closed__3;
x_130 = lean_string_append(x_128, x_129);
x_29 = x_130;
goto block_105;
}
}
block_121:
{
lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120;
lean_dec(x_116);
lean_inc(x_28);
x_117 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_14, x_28, x_28, x_2, x_115);
x_118 = lean_ctor_get(x_117, 1);
lean_inc(x_118);
lean_dec(x_117);
x_119 = l_Option_HasRepr___rarg___closed__3;
x_120 = lean_string_append(x_118, x_119);
x_29 = x_120;
goto block_105;
}
}
block_105:
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; uint8_t x_35;
x_30 = l_Lean_IR_EmitC_emitDeclAux___closed__1;
x_31 = lean_string_append(x_29, x_30);
x_32 = l_IO_println___rarg___closed__1;
x_33 = lean_string_append(x_31, x_32);
x_34 = l_Lean_closureMaxArgs;
x_35 = lean_nat_dec_lt(x_34, x_28);
if (x_35 == 0)
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
lean_dec(x_28);
lean_dec(x_2);
lean_dec(x_10);
x_36 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_37 = lean_string_append(x_33, x_36);
x_38 = lean_string_append(x_37, x_32);
x_39 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_39, 0, x_18);
lean_ctor_set(x_39, 1, x_19);
lean_ctor_set(x_39, 2, x_9);
lean_ctor_set(x_39, 3, x_13);
lean_ctor_set(x_39, 4, x_14);
x_40 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_39, x_38);
if (lean_obj_tag(x_40) == 0)
{
uint8_t x_41;
x_41 = !lean_is_exclusive(x_40);
if (x_41 == 0)
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_42 = lean_ctor_get(x_40, 1);
x_43 = lean_ctor_get(x_40, 0);
lean_dec(x_43);
x_44 = l_PersistentArray_Stats_toString___closed__4;
x_45 = lean_string_append(x_42, x_44);
x_46 = lean_string_append(x_45, x_32);
x_47 = lean_box(0);
lean_ctor_set(x_40, 1, x_46);
lean_ctor_set(x_40, 0, x_47);
return x_40;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_48 = lean_ctor_get(x_40, 1);
lean_inc(x_48);
lean_dec(x_40);
x_49 = l_PersistentArray_Stats_toString___closed__4;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_string_append(x_50, x_32);
x_52 = lean_box(0);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_51);
return x_53;
}
}
else
{
uint8_t x_54;
x_54 = !lean_is_exclusive(x_40);
if (x_54 == 0)
{
return x_40;
}
else
{
lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_55 = lean_ctor_get(x_40, 0);
x_56 = lean_ctor_get(x_40, 1);
lean_inc(x_56);
lean_inc(x_55);
lean_dec(x_40);
x_57 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_57, 0, x_55);
lean_ctor_set(x_57, 1, x_56);
return x_57;
}
}
}
else
{
uint8_t x_58;
x_58 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_10);
lean_dec(x_10);
if (x_58 == 0)
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63;
lean_dec(x_28);
lean_dec(x_2);
x_59 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_60 = lean_string_append(x_33, x_59);
x_61 = lean_string_append(x_60, x_32);
x_62 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_62, 0, x_18);
lean_ctor_set(x_62, 1, x_19);
lean_ctor_set(x_62, 2, x_9);
lean_ctor_set(x_62, 3, x_13);
lean_ctor_set(x_62, 4, x_14);
x_63 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_62, x_61);
if (lean_obj_tag(x_63) == 0)
{
uint8_t x_64;
x_64 = !lean_is_exclusive(x_63);
if (x_64 == 0)
{
lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_65 = lean_ctor_get(x_63, 1);
x_66 = lean_ctor_get(x_63, 0);
lean_dec(x_66);
x_67 = l_PersistentArray_Stats_toString___closed__4;
x_68 = lean_string_append(x_65, x_67);
x_69 = lean_string_append(x_68, x_32);
x_70 = lean_box(0);
lean_ctor_set(x_63, 1, x_69);
lean_ctor_set(x_63, 0, x_70);
return x_63;
}
else
{
lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76;
x_71 = lean_ctor_get(x_63, 1);
lean_inc(x_71);
lean_dec(x_63);
x_72 = l_PersistentArray_Stats_toString___closed__4;
x_73 = lean_string_append(x_71, x_72);
x_74 = lean_string_append(x_73, x_32);
x_75 = lean_box(0);
x_76 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_74);
return x_76;
}
}
else
{
uint8_t x_77;
x_77 = !lean_is_exclusive(x_63);
if (x_77 == 0)
{
return x_63;
}
else
{
lean_object* x_78; lean_object* x_79; lean_object* x_80;
x_78 = lean_ctor_get(x_63, 0);
x_79 = lean_ctor_get(x_63, 1);
lean_inc(x_79);
lean_inc(x_78);
lean_dec(x_63);
x_80 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_80, 0, x_78);
lean_ctor_set(x_80, 1, x_79);
return x_80;
}
}
}
else
{
lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87;
lean_inc(x_28);
x_81 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_14, x_28, x_28, x_2, x_33);
lean_dec(x_2);
lean_dec(x_28);
x_82 = lean_ctor_get(x_81, 1);
lean_inc(x_82);
lean_dec(x_81);
x_83 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_84 = lean_string_append(x_82, x_83);
x_85 = lean_string_append(x_84, x_32);
x_86 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_86, 0, x_18);
lean_ctor_set(x_86, 1, x_19);
lean_ctor_set(x_86, 2, x_9);
lean_ctor_set(x_86, 3, x_13);
lean_ctor_set(x_86, 4, x_14);
x_87 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_86, x_85);
if (lean_obj_tag(x_87) == 0)
{
uint8_t x_88;
x_88 = !lean_is_exclusive(x_87);
if (x_88 == 0)
{
lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94;
x_89 = lean_ctor_get(x_87, 1);
x_90 = lean_ctor_get(x_87, 0);
lean_dec(x_90);
x_91 = l_PersistentArray_Stats_toString___closed__4;
x_92 = lean_string_append(x_89, x_91);
x_93 = lean_string_append(x_92, x_32);
x_94 = lean_box(0);
lean_ctor_set(x_87, 1, x_93);
lean_ctor_set(x_87, 0, x_94);
return x_87;
}
else
{
lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100;
x_95 = lean_ctor_get(x_87, 1);
lean_inc(x_95);
lean_dec(x_87);
x_96 = l_PersistentArray_Stats_toString___closed__4;
x_97 = lean_string_append(x_95, x_96);
x_98 = lean_string_append(x_97, x_32);
x_99 = lean_box(0);
x_100 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_100, 0, x_99);
lean_ctor_set(x_100, 1, x_98);
return x_100;
}
}
else
{
uint8_t x_101;
x_101 = !lean_is_exclusive(x_87);
if (x_101 == 0)
{
return x_87;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_102 = lean_ctor_get(x_87, 0);
x_103 = lean_ctor_get(x_87, 1);
lean_inc(x_103);
lean_inc(x_102);
lean_dec(x_87);
x_104 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_104, 0, x_102);
lean_ctor_set(x_104, 1, x_103);
return x_104;
}
}
}
}
}
}
else
{
uint8_t x_131;
lean_dec(x_2);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_16);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_10);
lean_dec(x_9);
x_131 = !lean_is_exclusive(x_21);
if (x_131 == 0)
{
return x_21;
}
else
{
lean_object* x_132; lean_object* x_133; lean_object* x_134;
x_132 = lean_ctor_get(x_21, 0);
x_133 = lean_ctor_get(x_21, 1);
lean_inc(x_133);
lean_inc(x_132);
lean_dec(x_21);
x_134 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_134, 0, x_132);
lean_ctor_set(x_134, 1, x_133);
return x_134;
}
}
}
else
{
lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138; lean_object* x_139; lean_object* x_140;
x_135 = lean_ctor_get(x_2, 0);
x_136 = lean_ctor_get(x_2, 1);
x_137 = lean_ctor_get(x_2, 3);
x_138 = lean_ctor_get(x_2, 4);
lean_inc(x_138);
lean_inc(x_137);
lean_inc(x_136);
lean_inc(x_135);
lean_dec(x_2);
lean_inc(x_9);
lean_inc(x_136);
lean_inc(x_135);
x_139 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_139, 0, x_135);
lean_ctor_set(x_139, 1, x_136);
lean_ctor_set(x_139, 2, x_9);
lean_ctor_set(x_139, 3, x_137);
lean_ctor_set(x_139, 4, x_138);
lean_inc(x_13);
x_140 = l_Lean_IR_EmitC_toCName(x_13, x_139, x_6);
if (lean_obj_tag(x_140) == 0)
{
lean_object* x_141; lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145; lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_207; uint8_t x_208;
x_141 = lean_ctor_get(x_140, 0);
lean_inc(x_141);
x_142 = lean_ctor_get(x_140, 1);
lean_inc(x_142);
lean_dec(x_140);
x_143 = l_Lean_IR_EmitC_toCType(x_15);
lean_dec(x_15);
x_144 = lean_string_append(x_142, x_143);
lean_dec(x_143);
x_145 = l_String_Iterator_HasRepr___closed__2;
x_146 = lean_string_append(x_144, x_145);
x_147 = lean_array_get_size(x_14);
x_207 = lean_unsigned_to_nat(0u);
x_208 = lean_nat_dec_lt(x_207, x_147);
if (x_208 == 0)
{
lean_object* x_209; lean_object* x_210; lean_object* x_211; lean_object* x_212; lean_object* x_213;
x_209 = l_Lean_IR_EmitC_toCInitName___closed__1;
x_210 = lean_string_append(x_209, x_141);
lean_dec(x_141);
x_211 = l_Unit_HasRepr___closed__1;
x_212 = lean_string_append(x_210, x_211);
x_213 = lean_string_append(x_146, x_212);
lean_dec(x_212);
x_148 = x_213;
goto block_206;
}
else
{
lean_object* x_214; lean_object* x_215; lean_object* x_216; lean_object* x_217; lean_object* x_223; uint8_t x_224;
x_214 = lean_string_append(x_146, x_141);
lean_dec(x_141);
x_215 = l_Prod_HasRepr___rarg___closed__1;
x_216 = lean_string_append(x_214, x_215);
x_223 = l_Lean_closureMaxArgs;
x_224 = lean_nat_dec_lt(x_223, x_147);
if (x_224 == 0)
{
lean_object* x_225;
x_225 = lean_box(0);
x_217 = x_225;
goto block_222;
}
else
{
uint8_t x_226;
x_226 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_10);
if (x_226 == 0)
{
lean_object* x_227;
x_227 = lean_box(0);
x_217 = x_227;
goto block_222;
}
else
{
lean_object* x_228; lean_object* x_229; lean_object* x_230; lean_object* x_231;
x_228 = l_Lean_IR_EmitC_emitDeclAux___closed__3;
x_229 = lean_string_append(x_216, x_228);
x_230 = l_Option_HasRepr___rarg___closed__3;
x_231 = lean_string_append(x_229, x_230);
x_148 = x_231;
goto block_206;
}
}
block_222:
{
lean_object* x_218; lean_object* x_219; lean_object* x_220; lean_object* x_221;
lean_dec(x_217);
lean_inc(x_147);
x_218 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_14, x_147, x_147, x_139, x_216);
x_219 = lean_ctor_get(x_218, 1);
lean_inc(x_219);
lean_dec(x_218);
x_220 = l_Option_HasRepr___rarg___closed__3;
x_221 = lean_string_append(x_219, x_220);
x_148 = x_221;
goto block_206;
}
}
block_206:
{
lean_object* x_149; lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; uint8_t x_154;
x_149 = l_Lean_IR_EmitC_emitDeclAux___closed__1;
x_150 = lean_string_append(x_148, x_149);
x_151 = l_IO_println___rarg___closed__1;
x_152 = lean_string_append(x_150, x_151);
x_153 = l_Lean_closureMaxArgs;
x_154 = lean_nat_dec_lt(x_153, x_147);
if (x_154 == 0)
{
lean_object* x_155; lean_object* x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159;
lean_dec(x_147);
lean_dec(x_139);
lean_dec(x_10);
x_155 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_156 = lean_string_append(x_152, x_155);
x_157 = lean_string_append(x_156, x_151);
x_158 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_158, 0, x_135);
lean_ctor_set(x_158, 1, x_136);
lean_ctor_set(x_158, 2, x_9);
lean_ctor_set(x_158, 3, x_13);
lean_ctor_set(x_158, 4, x_14);
x_159 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_158, x_157);
if (lean_obj_tag(x_159) == 0)
{
lean_object* x_160; lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165; lean_object* x_166;
x_160 = lean_ctor_get(x_159, 1);
lean_inc(x_160);
if (lean_is_exclusive(x_159)) {
lean_ctor_release(x_159, 0);
lean_ctor_release(x_159, 1);
x_161 = x_159;
} else {
lean_dec_ref(x_159);
x_161 = lean_box(0);
}
x_162 = l_PersistentArray_Stats_toString___closed__4;
x_163 = lean_string_append(x_160, x_162);
x_164 = lean_string_append(x_163, x_151);
x_165 = lean_box(0);
if (lean_is_scalar(x_161)) {
x_166 = lean_alloc_ctor(0, 2, 0);
} else {
x_166 = x_161;
}
lean_ctor_set(x_166, 0, x_165);
lean_ctor_set(x_166, 1, x_164);
return x_166;
}
else
{
lean_object* x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170;
x_167 = lean_ctor_get(x_159, 0);
lean_inc(x_167);
x_168 = lean_ctor_get(x_159, 1);
lean_inc(x_168);
if (lean_is_exclusive(x_159)) {
lean_ctor_release(x_159, 0);
lean_ctor_release(x_159, 1);
x_169 = x_159;
} else {
lean_dec_ref(x_159);
x_169 = lean_box(0);
}
if (lean_is_scalar(x_169)) {
x_170 = lean_alloc_ctor(1, 2, 0);
} else {
x_170 = x_169;
}
lean_ctor_set(x_170, 0, x_167);
lean_ctor_set(x_170, 1, x_168);
return x_170;
}
}
else
{
uint8_t x_171;
x_171 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_10);
lean_dec(x_10);
if (x_171 == 0)
{
lean_object* x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175; lean_object* x_176;
lean_dec(x_147);
lean_dec(x_139);
x_172 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_173 = lean_string_append(x_152, x_172);
x_174 = lean_string_append(x_173, x_151);
x_175 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_175, 0, x_135);
lean_ctor_set(x_175, 1, x_136);
lean_ctor_set(x_175, 2, x_9);
lean_ctor_set(x_175, 3, x_13);
lean_ctor_set(x_175, 4, x_14);
x_176 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_175, x_174);
if (lean_obj_tag(x_176) == 0)
{
lean_object* x_177; lean_object* x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; lean_object* x_182; lean_object* x_183;
x_177 = lean_ctor_get(x_176, 1);
lean_inc(x_177);
if (lean_is_exclusive(x_176)) {
lean_ctor_release(x_176, 0);
lean_ctor_release(x_176, 1);
x_178 = x_176;
} else {
lean_dec_ref(x_176);
x_178 = lean_box(0);
}
x_179 = l_PersistentArray_Stats_toString___closed__4;
x_180 = lean_string_append(x_177, x_179);
x_181 = lean_string_append(x_180, x_151);
x_182 = lean_box(0);
if (lean_is_scalar(x_178)) {
x_183 = lean_alloc_ctor(0, 2, 0);
} else {
x_183 = x_178;
}
lean_ctor_set(x_183, 0, x_182);
lean_ctor_set(x_183, 1, x_181);
return x_183;
}
else
{
lean_object* x_184; lean_object* x_185; lean_object* x_186; lean_object* x_187;
x_184 = lean_ctor_get(x_176, 0);
lean_inc(x_184);
x_185 = lean_ctor_get(x_176, 1);
lean_inc(x_185);
if (lean_is_exclusive(x_176)) {
lean_ctor_release(x_176, 0);
lean_ctor_release(x_176, 1);
x_186 = x_176;
} else {
lean_dec_ref(x_176);
x_186 = lean_box(0);
}
if (lean_is_scalar(x_186)) {
x_187 = lean_alloc_ctor(1, 2, 0);
} else {
x_187 = x_186;
}
lean_ctor_set(x_187, 0, x_184);
lean_ctor_set(x_187, 1, x_185);
return x_187;
}
}
else
{
lean_object* x_188; lean_object* x_189; lean_object* x_190; lean_object* x_191; lean_object* x_192; lean_object* x_193; lean_object* x_194;
lean_inc(x_147);
x_188 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_14, x_147, x_147, x_139, x_152);
lean_dec(x_139);
lean_dec(x_147);
x_189 = lean_ctor_get(x_188, 1);
lean_inc(x_189);
lean_dec(x_188);
x_190 = l_Lean_IR_EmitC_emitDeclAux___closed__2;
x_191 = lean_string_append(x_189, x_190);
x_192 = lean_string_append(x_191, x_151);
x_193 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_193, 0, x_135);
lean_ctor_set(x_193, 1, x_136);
lean_ctor_set(x_193, 2, x_9);
lean_ctor_set(x_193, 3, x_13);
lean_ctor_set(x_193, 4, x_14);
x_194 = l_Lean_IR_EmitC_emitFnBody___main(x_16, x_193, x_192);
if (lean_obj_tag(x_194) == 0)
{
lean_object* x_195; lean_object* x_196; lean_object* x_197; lean_object* x_198; lean_object* x_199; lean_object* x_200; lean_object* x_201;
x_195 = lean_ctor_get(x_194, 1);
lean_inc(x_195);
if (lean_is_exclusive(x_194)) {
lean_ctor_release(x_194, 0);
lean_ctor_release(x_194, 1);
x_196 = x_194;
} else {
lean_dec_ref(x_194);
x_196 = lean_box(0);
}
x_197 = l_PersistentArray_Stats_toString___closed__4;
x_198 = lean_string_append(x_195, x_197);
x_199 = lean_string_append(x_198, x_151);
x_200 = lean_box(0);
if (lean_is_scalar(x_196)) {
x_201 = lean_alloc_ctor(0, 2, 0);
} else {
x_201 = x_196;
}
lean_ctor_set(x_201, 0, x_200);
lean_ctor_set(x_201, 1, x_199);
return x_201;
}
else
{
lean_object* x_202; lean_object* x_203; lean_object* x_204; lean_object* x_205;
x_202 = lean_ctor_get(x_194, 0);
lean_inc(x_202);
x_203 = lean_ctor_get(x_194, 1);
lean_inc(x_203);
if (lean_is_exclusive(x_194)) {
lean_ctor_release(x_194, 0);
lean_ctor_release(x_194, 1);
x_204 = x_194;
} else {
lean_dec_ref(x_194);
x_204 = lean_box(0);
}
if (lean_is_scalar(x_204)) {
x_205 = lean_alloc_ctor(1, 2, 0);
} else {
x_205 = x_204;
}
lean_ctor_set(x_205, 0, x_202);
lean_ctor_set(x_205, 1, x_203);
return x_205;
}
}
}
}
}
else
{
lean_object* x_232; lean_object* x_233; lean_object* x_234; lean_object* x_235;
lean_dec(x_139);
lean_dec(x_136);
lean_dec(x_135);
lean_dec(x_16);
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_10);
lean_dec(x_9);
x_232 = lean_ctor_get(x_140, 0);
lean_inc(x_232);
x_233 = lean_ctor_get(x_140, 1);
lean_inc(x_233);
if (lean_is_exclusive(x_140)) {
lean_ctor_release(x_140, 0);
lean_ctor_release(x_140, 1);
x_234 = x_140;
} else {
lean_dec_ref(x_140);
x_234 = lean_box(0);
}
if (lean_is_scalar(x_234)) {
x_235 = lean_alloc_ctor(1, 2, 0);
} else {
x_235 = x_234;
}
lean_ctor_set(x_235, 0, x_232);
lean_ctor_set(x_235, 1, x_233);
return x_235;
}
}
}
else
{
lean_object* x_236; lean_object* x_237;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_2);
lean_dec(x_1);
x_236 = lean_box(0);
if (lean_is_scalar(x_7)) {
x_237 = lean_alloc_ctor(0, 2, 0);
} else {
x_237 = x_7;
}
lean_ctor_set(x_237, 0, x_236);
lean_ctor_set(x_237, 1, x_6);
return x_237;
}
}
else
{
lean_object* x_238; lean_object* x_239;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_2);
lean_dec(x_1);
x_238 = lean_box(0);
if (lean_is_scalar(x_7)) {
x_239 = lean_alloc_ctor(0, 2, 0);
} else {
x_239 = x_7;
}
lean_ctor_set(x_239, 0, x_238);
lean_ctor_set(x_239, 1, x_6);
return x_239;
}
}
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__2(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_6;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDecl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("\ncompiling:\n");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitDecl(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5;
x_4 = l_Lean_IR_Decl_normalizeIds(x_1);
lean_inc(x_4);
x_5 = l_Lean_IR_EmitC_emitDeclAux(x_4, x_2, x_3);
if (lean_obj_tag(x_5) == 0)
{
lean_dec(x_4);
return x_5;
}
else
{
uint8_t x_6;
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_7 = lean_ctor_get(x_5, 0);
x_8 = l_Lean_IR_EmitC_emitDecl___closed__1;
x_9 = lean_string_append(x_7, x_8);
x_10 = lean_ir_decl_to_string(x_4);
x_11 = lean_string_append(x_9, x_10);
lean_dec(x_10);
lean_ctor_set(x_5, 0, x_11);
return x_5;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_12 = lean_ctor_get(x_5, 0);
x_13 = lean_ctor_get(x_5, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitC_emitDecl___closed__1;
x_15 = lean_string_append(x_12, x_14);
x_16 = lean_ir_decl_to_string(x_4);
x_17 = lean_string_append(x_15, x_16);
lean_dec(x_16);
x_18 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_13);
return x_18;
}
}
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitFns___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; lean_object* x_5;
lean_dec(x_2);
x_4 = lean_box(0);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = lean_ctor_get(x_1, 0);
lean_inc(x_6);
x_7 = lean_ctor_get(x_1, 1);
lean_inc(x_7);
lean_dec(x_1);
lean_inc(x_2);
x_8 = l_Lean_IR_EmitC_emitDecl(x_6, x_2, x_3);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_1 = x_7;
x_3 = x_9;
goto _start;
}
else
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_2);
x_11 = !lean_is_exclusive(x_8);
if (x_11 == 0)
{
return x_8;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = lean_ctor_get(x_8, 0);
x_13 = lean_ctor_get(x_8, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_8);
x_14 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_14, 0, x_12);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitFns(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_3, 1);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_IR_declMapExt;
x_7 = l_Lean_SimplePersistentEnvExtension_getEntries___rarg(x_6, x_4);
lean_dec(x_4);
x_8 = l_List_reverse___rarg(x_7);
x_9 = l_List_forM___main___at_Lean_IR_EmitC_emitFns___spec__1(x_8, x_1, x_5);
return x_9;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitMarkPersistent___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_mark_persistent(");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitMarkPersistent(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = l_Lean_IR_Decl_resultType(x_1);
x_6 = l_Lean_IR_IRType_isObj(x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
lean_dec(x_2);
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_4);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11;
x_9 = l_Lean_IR_EmitC_emitMarkPersistent___closed__1;
x_10 = lean_string_append(x_4, x_9);
x_11 = l_Lean_IR_EmitC_emitCName(x_2, x_3, x_10);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_13 = lean_ctor_get(x_11, 1);
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = l_Lean_IR_EmitC_emitInc___closed__1;
x_16 = lean_string_append(x_13, x_15);
x_17 = l_IO_println___rarg___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
lean_ctor_set(x_11, 1, x_18);
lean_ctor_set(x_11, 0, x_19);
return x_11;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_20 = lean_ctor_get(x_11, 1);
lean_inc(x_20);
lean_dec(x_11);
x_21 = l_Lean_IR_EmitC_emitInc___closed__1;
x_22 = lean_string_append(x_20, x_21);
x_23 = l_IO_println___rarg___closed__1;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_box(0);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_24);
return x_26;
}
}
else
{
uint8_t x_27;
x_27 = !lean_is_exclusive(x_11);
if (x_27 == 0)
{
return x_11;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_11, 0);
x_29 = lean_ctor_get(x_11, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_11);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitMarkPersistent___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Lean_IR_EmitC_emitMarkPersistent(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_5;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclInit___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("();");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclInit___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (lean_io_result_is_error(res)) return res;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitDeclInit___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string(" = lean_io_result_get_value(res);");
return x_1;
}
}
lean_object* l_Lean_IR_EmitC_emitDeclInit(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = l_Lean_IR_EmitC_getEnv(x_2, x_3);
x_5 = !lean_is_exclusive(x_4);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 1);
x_8 = l_Lean_IR_Decl_name(x_1);
lean_inc(x_8);
x_9 = l_Lean_isIOUnitInitFn(x_6, x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_10 = l_Lean_IR_Decl_params(x_1);
x_11 = lean_array_get_size(x_10);
lean_dec(x_10);
x_12 = lean_unsigned_to_nat(0u);
x_13 = lean_nat_dec_eq(x_11, x_12);
lean_dec(x_11);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_8);
lean_dec(x_6);
x_14 = lean_box(0);
lean_ctor_set(x_4, 0, x_14);
return x_4;
}
else
{
lean_object* x_15;
lean_free_object(x_4);
lean_inc(x_8);
x_15 = lean_get_init_fn_name_for(x_6, x_8);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16;
lean_inc(x_8);
x_16 = l_Lean_IR_EmitC_emitCName(x_8, x_2, x_7);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_17 = lean_ctor_get(x_16, 1);
lean_inc(x_17);
lean_dec(x_16);
x_18 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_19 = lean_string_append(x_17, x_18);
lean_inc(x_8);
x_20 = l_Lean_IR_EmitC_emitCInitName(x_8, x_2, x_19);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
lean_dec(x_20);
x_22 = l_Lean_IR_EmitC_emitDeclInit___closed__1;
x_23 = lean_string_append(x_21, x_22);
x_24 = l_IO_println___rarg___closed__1;
x_25 = lean_string_append(x_23, x_24);
x_26 = l_Lean_IR_EmitC_emitMarkPersistent(x_1, x_8, x_2, x_25);
return x_26;
}
else
{
uint8_t x_27;
lean_dec(x_8);
x_27 = !lean_is_exclusive(x_20);
if (x_27 == 0)
{
return x_20;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_20, 0);
x_29 = lean_ctor_get(x_20, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_20);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
else
{
uint8_t x_31;
lean_dec(x_8);
x_31 = !lean_is_exclusive(x_16);
if (x_31 == 0)
{
return x_16;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_32 = lean_ctor_get(x_16, 0);
x_33 = lean_ctor_get(x_16, 1);
lean_inc(x_33);
lean_inc(x_32);
lean_dec(x_16);
x_34 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_34, 0, x_32);
lean_ctor_set(x_34, 1, x_33);
return x_34;
}
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_35 = lean_ctor_get(x_15, 0);
lean_inc(x_35);
lean_dec(x_15);
x_36 = l_Lean_IR_EmitC_emitMainFn___closed__12;
x_37 = lean_string_append(x_7, x_36);
x_38 = l_Lean_IR_EmitC_emitCName(x_35, x_2, x_37);
if (lean_obj_tag(x_38) == 0)
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_39 = lean_ctor_get(x_38, 1);
lean_inc(x_39);
lean_dec(x_38);
x_40 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_41 = lean_string_append(x_39, x_40);
x_42 = l_IO_println___rarg___closed__1;
x_43 = lean_string_append(x_41, x_42);
x_44 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_45 = lean_string_append(x_43, x_44);
x_46 = lean_string_append(x_45, x_42);
lean_inc(x_8);
x_47 = l_Lean_IR_EmitC_emitCName(x_8, x_2, x_46);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_48 = lean_ctor_get(x_47, 1);
lean_inc(x_48);
lean_dec(x_47);
x_49 = l_Lean_IR_EmitC_emitDeclInit___closed__3;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_string_append(x_50, x_42);
x_52 = l_Lean_IR_EmitC_emitMarkPersistent(x_1, x_8, x_2, x_51);
if (lean_obj_tag(x_52) == 0)
{
uint8_t x_53;
x_53 = !lean_is_exclusive(x_52);
if (x_53 == 0)
{
lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59;
x_54 = lean_ctor_get(x_52, 1);
x_55 = lean_ctor_get(x_52, 0);
lean_dec(x_55);
x_56 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_57 = lean_string_append(x_54, x_56);
x_58 = lean_string_append(x_57, x_42);
x_59 = lean_box(0);
lean_ctor_set(x_52, 1, x_58);
lean_ctor_set(x_52, 0, x_59);
return x_52;
}
else
{
lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65;
x_60 = lean_ctor_get(x_52, 1);
lean_inc(x_60);
lean_dec(x_52);
x_61 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_62 = lean_string_append(x_60, x_61);
x_63 = lean_string_append(x_62, x_42);
x_64 = lean_box(0);
x_65 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_65, 0, x_64);
lean_ctor_set(x_65, 1, x_63);
return x_65;
}
}
else
{
uint8_t x_66;
x_66 = !lean_is_exclusive(x_52);
if (x_66 == 0)
{
return x_52;
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69;
x_67 = lean_ctor_get(x_52, 0);
x_68 = lean_ctor_get(x_52, 1);
lean_inc(x_68);
lean_inc(x_67);
lean_dec(x_52);
x_69 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_69, 0, x_67);
lean_ctor_set(x_69, 1, x_68);
return x_69;
}
}
}
else
{
uint8_t x_70;
lean_dec(x_8);
x_70 = !lean_is_exclusive(x_47);
if (x_70 == 0)
{
return x_47;
}
else
{
lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_71 = lean_ctor_get(x_47, 0);
x_72 = lean_ctor_get(x_47, 1);
lean_inc(x_72);
lean_inc(x_71);
lean_dec(x_47);
x_73 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_73, 0, x_71);
lean_ctor_set(x_73, 1, x_72);
return x_73;
}
}
}
else
{
uint8_t x_74;
lean_dec(x_8);
x_74 = !lean_is_exclusive(x_38);
if (x_74 == 0)
{
return x_38;
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_38, 0);
x_76 = lean_ctor_get(x_38, 1);
lean_inc(x_76);
lean_inc(x_75);
lean_dec(x_38);
x_77 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_77, 0, x_75);
lean_ctor_set(x_77, 1, x_76);
return x_77;
}
}
}
}
}
else
{
lean_object* x_78; lean_object* x_79; lean_object* x_80;
lean_free_object(x_4);
lean_dec(x_6);
x_78 = l_Lean_IR_EmitC_emitMainFn___closed__12;
x_79 = lean_string_append(x_7, x_78);
x_80 = l_Lean_IR_EmitC_emitCName(x_8, x_2, x_79);
if (lean_obj_tag(x_80) == 0)
{
uint8_t x_81;
x_81 = !lean_is_exclusive(x_80);
if (x_81 == 0)
{
lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94;
x_82 = lean_ctor_get(x_80, 1);
x_83 = lean_ctor_get(x_80, 0);
lean_dec(x_83);
x_84 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_85 = lean_string_append(x_82, x_84);
x_86 = l_IO_println___rarg___closed__1;
x_87 = lean_string_append(x_85, x_86);
x_88 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_89 = lean_string_append(x_87, x_88);
x_90 = lean_string_append(x_89, x_86);
x_91 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_92 = lean_string_append(x_90, x_91);
x_93 = lean_string_append(x_92, x_86);
x_94 = lean_box(0);
lean_ctor_set(x_80, 1, x_93);
lean_ctor_set(x_80, 0, x_94);
return x_80;
}
else
{
lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107;
x_95 = lean_ctor_get(x_80, 1);
lean_inc(x_95);
lean_dec(x_80);
x_96 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_97 = lean_string_append(x_95, x_96);
x_98 = l_IO_println___rarg___closed__1;
x_99 = lean_string_append(x_97, x_98);
x_100 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_101 = lean_string_append(x_99, x_100);
x_102 = lean_string_append(x_101, x_98);
x_103 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_104 = lean_string_append(x_102, x_103);
x_105 = lean_string_append(x_104, x_98);
x_106 = lean_box(0);
x_107 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_107, 0, x_106);
lean_ctor_set(x_107, 1, x_105);
return x_107;
}
}
else
{
uint8_t x_108;
x_108 = !lean_is_exclusive(x_80);
if (x_108 == 0)
{
return x_80;
}
else
{
lean_object* x_109; lean_object* x_110; lean_object* x_111;
x_109 = lean_ctor_get(x_80, 0);
x_110 = lean_ctor_get(x_80, 1);
lean_inc(x_110);
lean_inc(x_109);
lean_dec(x_80);
x_111 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_111, 0, x_109);
lean_ctor_set(x_111, 1, x_110);
return x_111;
}
}
}
}
else
{
lean_object* x_112; lean_object* x_113; lean_object* x_114; uint8_t x_115;
x_112 = lean_ctor_get(x_4, 0);
x_113 = lean_ctor_get(x_4, 1);
lean_inc(x_113);
lean_inc(x_112);
lean_dec(x_4);
x_114 = l_Lean_IR_Decl_name(x_1);
lean_inc(x_114);
x_115 = l_Lean_isIOUnitInitFn(x_112, x_114);
if (x_115 == 0)
{
lean_object* x_116; lean_object* x_117; lean_object* x_118; uint8_t x_119;
x_116 = l_Lean_IR_Decl_params(x_1);
x_117 = lean_array_get_size(x_116);
lean_dec(x_116);
x_118 = lean_unsigned_to_nat(0u);
x_119 = lean_nat_dec_eq(x_117, x_118);
lean_dec(x_117);
if (x_119 == 0)
{
lean_object* x_120; lean_object* x_121;
lean_dec(x_114);
lean_dec(x_112);
x_120 = lean_box(0);
x_121 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_121, 0, x_120);
lean_ctor_set(x_121, 1, x_113);
return x_121;
}
else
{
lean_object* x_122;
lean_inc(x_114);
x_122 = lean_get_init_fn_name_for(x_112, x_114);
if (lean_obj_tag(x_122) == 0)
{
lean_object* x_123;
lean_inc(x_114);
x_123 = l_Lean_IR_EmitC_emitCName(x_114, x_2, x_113);
if (lean_obj_tag(x_123) == 0)
{
lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127;
x_124 = lean_ctor_get(x_123, 1);
lean_inc(x_124);
lean_dec(x_123);
x_125 = l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1;
x_126 = lean_string_append(x_124, x_125);
lean_inc(x_114);
x_127 = l_Lean_IR_EmitC_emitCInitName(x_114, x_2, x_126);
if (lean_obj_tag(x_127) == 0)
{
lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133;
x_128 = lean_ctor_get(x_127, 1);
lean_inc(x_128);
lean_dec(x_127);
x_129 = l_Lean_IR_EmitC_emitDeclInit___closed__1;
x_130 = lean_string_append(x_128, x_129);
x_131 = l_IO_println___rarg___closed__1;
x_132 = lean_string_append(x_130, x_131);
x_133 = l_Lean_IR_EmitC_emitMarkPersistent(x_1, x_114, x_2, x_132);
return x_133;
}
else
{
lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137;
lean_dec(x_114);
x_134 = lean_ctor_get(x_127, 0);
lean_inc(x_134);
x_135 = lean_ctor_get(x_127, 1);
lean_inc(x_135);
if (lean_is_exclusive(x_127)) {
lean_ctor_release(x_127, 0);
lean_ctor_release(x_127, 1);
x_136 = x_127;
} else {
lean_dec_ref(x_127);
x_136 = lean_box(0);
}
if (lean_is_scalar(x_136)) {
x_137 = lean_alloc_ctor(1, 2, 0);
} else {
x_137 = x_136;
}
lean_ctor_set(x_137, 0, x_134);
lean_ctor_set(x_137, 1, x_135);
return x_137;
}
}
else
{
lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141;
lean_dec(x_114);
x_138 = lean_ctor_get(x_123, 0);
lean_inc(x_138);
x_139 = lean_ctor_get(x_123, 1);
lean_inc(x_139);
if (lean_is_exclusive(x_123)) {
lean_ctor_release(x_123, 0);
lean_ctor_release(x_123, 1);
x_140 = x_123;
} else {
lean_dec_ref(x_123);
x_140 = lean_box(0);
}
if (lean_is_scalar(x_140)) {
x_141 = lean_alloc_ctor(1, 2, 0);
} else {
x_141 = x_140;
}
lean_ctor_set(x_141, 0, x_138);
lean_ctor_set(x_141, 1, x_139);
return x_141;
}
}
else
{
lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145;
x_142 = lean_ctor_get(x_122, 0);
lean_inc(x_142);
lean_dec(x_122);
x_143 = l_Lean_IR_EmitC_emitMainFn___closed__12;
x_144 = lean_string_append(x_113, x_143);
x_145 = l_Lean_IR_EmitC_emitCName(x_142, x_2, x_144);
if (lean_obj_tag(x_145) == 0)
{
lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154;
x_146 = lean_ctor_get(x_145, 1);
lean_inc(x_146);
lean_dec(x_145);
x_147 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_148 = lean_string_append(x_146, x_147);
x_149 = l_IO_println___rarg___closed__1;
x_150 = lean_string_append(x_148, x_149);
x_151 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_152 = lean_string_append(x_150, x_151);
x_153 = lean_string_append(x_152, x_149);
lean_inc(x_114);
x_154 = l_Lean_IR_EmitC_emitCName(x_114, x_2, x_153);
if (lean_obj_tag(x_154) == 0)
{
lean_object* x_155; lean_object* x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159;
x_155 = lean_ctor_get(x_154, 1);
lean_inc(x_155);
lean_dec(x_154);
x_156 = l_Lean_IR_EmitC_emitDeclInit___closed__3;
x_157 = lean_string_append(x_155, x_156);
x_158 = lean_string_append(x_157, x_149);
x_159 = l_Lean_IR_EmitC_emitMarkPersistent(x_1, x_114, x_2, x_158);
if (lean_obj_tag(x_159) == 0)
{
lean_object* x_160; lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165; lean_object* x_166;
x_160 = lean_ctor_get(x_159, 1);
lean_inc(x_160);
if (lean_is_exclusive(x_159)) {
lean_ctor_release(x_159, 0);
lean_ctor_release(x_159, 1);
x_161 = x_159;
} else {
lean_dec_ref(x_159);
x_161 = lean_box(0);
}
x_162 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_163 = lean_string_append(x_160, x_162);
x_164 = lean_string_append(x_163, x_149);
x_165 = lean_box(0);
if (lean_is_scalar(x_161)) {
x_166 = lean_alloc_ctor(0, 2, 0);
} else {
x_166 = x_161;
}
lean_ctor_set(x_166, 0, x_165);
lean_ctor_set(x_166, 1, x_164);
return x_166;
}
else
{
lean_object* x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170;
x_167 = lean_ctor_get(x_159, 0);
lean_inc(x_167);
x_168 = lean_ctor_get(x_159, 1);
lean_inc(x_168);
if (lean_is_exclusive(x_159)) {
lean_ctor_release(x_159, 0);
lean_ctor_release(x_159, 1);
x_169 = x_159;
} else {
lean_dec_ref(x_159);
x_169 = lean_box(0);
}
if (lean_is_scalar(x_169)) {
x_170 = lean_alloc_ctor(1, 2, 0);
} else {
x_170 = x_169;
}
lean_ctor_set(x_170, 0, x_167);
lean_ctor_set(x_170, 1, x_168);
return x_170;
}
}
else
{
lean_object* x_171; lean_object* x_172; lean_object* x_173; lean_object* x_174;
lean_dec(x_114);
x_171 = lean_ctor_get(x_154, 0);
lean_inc(x_171);
x_172 = lean_ctor_get(x_154, 1);
lean_inc(x_172);
if (lean_is_exclusive(x_154)) {
lean_ctor_release(x_154, 0);
lean_ctor_release(x_154, 1);
x_173 = x_154;
} else {
lean_dec_ref(x_154);
x_173 = lean_box(0);
}
if (lean_is_scalar(x_173)) {
x_174 = lean_alloc_ctor(1, 2, 0);
} else {
x_174 = x_173;
}
lean_ctor_set(x_174, 0, x_171);
lean_ctor_set(x_174, 1, x_172);
return x_174;
}
}
else
{
lean_object* x_175; lean_object* x_176; lean_object* x_177; lean_object* x_178;
lean_dec(x_114);
x_175 = lean_ctor_get(x_145, 0);
lean_inc(x_175);
x_176 = lean_ctor_get(x_145, 1);
lean_inc(x_176);
if (lean_is_exclusive(x_145)) {
lean_ctor_release(x_145, 0);
lean_ctor_release(x_145, 1);
x_177 = x_145;
} else {
lean_dec_ref(x_145);
x_177 = lean_box(0);
}
if (lean_is_scalar(x_177)) {
x_178 = lean_alloc_ctor(1, 2, 0);
} else {
x_178 = x_177;
}
lean_ctor_set(x_178, 0, x_175);
lean_ctor_set(x_178, 1, x_176);
return x_178;
}
}
}
}
else
{
lean_object* x_179; lean_object* x_180; lean_object* x_181;
lean_dec(x_112);
x_179 = l_Lean_IR_EmitC_emitMainFn___closed__12;
x_180 = lean_string_append(x_113, x_179);
x_181 = l_Lean_IR_EmitC_emitCName(x_114, x_2, x_180);
if (lean_obj_tag(x_181) == 0)
{
lean_object* x_182; lean_object* x_183; lean_object* x_184; lean_object* x_185; lean_object* x_186; lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190; lean_object* x_191; lean_object* x_192; lean_object* x_193; lean_object* x_194; lean_object* x_195;
x_182 = lean_ctor_get(x_181, 1);
lean_inc(x_182);
if (lean_is_exclusive(x_181)) {
lean_ctor_release(x_181, 0);
lean_ctor_release(x_181, 1);
x_183 = x_181;
} else {
lean_dec_ref(x_181);
x_183 = lean_box(0);
}
x_184 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_185 = lean_string_append(x_182, x_184);
x_186 = l_IO_println___rarg___closed__1;
x_187 = lean_string_append(x_185, x_186);
x_188 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_189 = lean_string_append(x_187, x_188);
x_190 = lean_string_append(x_189, x_186);
x_191 = l_Lean_IR_EmitC_emitMainFn___closed__6;
x_192 = lean_string_append(x_190, x_191);
x_193 = lean_string_append(x_192, x_186);
x_194 = lean_box(0);
if (lean_is_scalar(x_183)) {
x_195 = lean_alloc_ctor(0, 2, 0);
} else {
x_195 = x_183;
}
lean_ctor_set(x_195, 0, x_194);
lean_ctor_set(x_195, 1, x_193);
return x_195;
}
else
{
lean_object* x_196; lean_object* x_197; lean_object* x_198; lean_object* x_199;
x_196 = lean_ctor_get(x_181, 0);
lean_inc(x_196);
x_197 = lean_ctor_get(x_181, 1);
lean_inc(x_197);
if (lean_is_exclusive(x_181)) {
lean_ctor_release(x_181, 0);
lean_ctor_release(x_181, 1);
x_198 = x_181;
} else {
lean_dec_ref(x_181);
x_198 = lean_box(0);
}
if (lean_is_scalar(x_198)) {
x_199 = lean_alloc_ctor(1, 2, 0);
} else {
x_199 = x_198;
}
lean_ctor_set(x_199, 0, x_196);
lean_ctor_set(x_199, 1, x_197);
return x_199;
}
}
}
}
}
lean_object* l_Lean_IR_EmitC_emitDeclInit___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitC_emitDeclInit(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object* initialize_");
return x_1;
}
}
lean_object* _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("(lean_object*);");
return x_1;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_array_get_size(x_1);
x_6 = lean_nat_dec_lt(x_2, x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
lean_dec(x_2);
x_7 = lean_box(0);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_4);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_9 = lean_array_fget(x_1, x_2);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
lean_dec(x_9);
x_11 = l_String_splitAux___main___closed__1;
x_12 = lean_name_mangle(x_10, x_11);
x_13 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_string_append(x_4, x_16);
lean_dec(x_16);
x_18 = l_IO_println___rarg___closed__1;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_unsigned_to_nat(1u);
x_21 = lean_nat_add(x_2, x_20);
lean_dec(x_2);
x_2 = x_21;
x_4 = x_19;
goto _start;
}
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_get_size(x_2);
x_7 = lean_nat_dec_lt(x_3, x_6);
lean_dec(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_3);
lean_dec(x_1);
x_8 = lean_box(0);
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_5);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_10 = lean_array_fget(x_2, x_3);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
lean_dec(x_10);
x_12 = l_String_splitAux___main___closed__1;
x_13 = lean_name_mangle(x_11, x_12);
x_14 = l_Lean_IR_EmitC_emitMainFn___closed__2;
x_15 = lean_string_append(x_14, x_13);
lean_dec(x_13);
x_16 = l_Lean_IR_EmitC_emitMainFn___closed__3;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Lean_IR_EmitC_emitMainFn___closed__6;
lean_inc(x_1);
x_19 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_1);
x_20 = l_Lean_IR_EmitC_emitDeclInit___closed__2;
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_19);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_17);
lean_ctor_set(x_22, 1, x_21);
x_23 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_22, x_4, x_5);
lean_dec(x_22);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = lean_unsigned_to_nat(1u);
x_26 = lean_nat_add(x_3, x_25);
lean_dec(x_3);
x_3 = x_26;
x_5 = x_24;
goto _start;
}
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_4; lean_object* x_5;
x_4 = lean_box(0);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_3);
return x_5;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_6 = lean_ctor_get(x_1, 0);
x_7 = lean_ctor_get(x_1, 1);
x_8 = l_Lean_IR_EmitC_emitDeclInit(x_6, x_2, x_3);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9;
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_1 = x_7;
x_3 = x_9;
goto _start;
}
else
{
uint8_t x_11;
x_11 = !lean_is_exclusive(x_8);
if (x_11 == 0)
{
return x_8;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = lean_ctor_get(x_8, 0);
x_13 = lean_ctor_get(x_8, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_8);
x_14 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_14, 0, x_12);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("(lean_object* w) {");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("_G_initialized = true;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_IR_EmitC_emitInitFn___closed__2;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("if (_G_initialized) return lean_mk_io_result(lean_box(0));");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitInitFn___closed__4;
x_2 = l_Lean_IR_EmitC_emitInitFn___closed__3;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("lean_object * res;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__7() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitInitFn___closed__6;
x_2 = l_Lean_IR_EmitC_emitInitFn___closed__5;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__8() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("static bool _G_initialized = false;");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string("return lean_mk_io_result(lean_box(0));");
return x_1;
}
}
lean_object* _init_l_Lean_IR_EmitC_emitInitFn___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = l_Lean_IR_EmitC_emitInitFn___closed__9;
x_2 = l_Lean_IR_EmitC_emitMainFn___closed__15;
x_3 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_emitInitFn(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_3 = l_Lean_IR_EmitC_getEnv(x_1, x_2);
x_4 = lean_ctor_get(x_3, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_3, 1);
lean_inc(x_5);
lean_dec(x_3);
x_6 = l_Lean_IR_EmitC_getModName(x_1, x_5);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_6, 1);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_Environment_imports(x_4);
x_10 = lean_unsigned_to_nat(0u);
x_11 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1(x_9, x_10, x_1, x_8);
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = l_String_splitAux___main___closed__1;
x_14 = lean_name_mangle(x_7, x_13);
x_15 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitC_emitInitFn___closed__1;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_box(0);
x_20 = l_Lean_IR_EmitC_emitInitFn___closed__7;
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_18);
lean_ctor_set(x_21, 1, x_20);
x_22 = l_Lean_IR_EmitC_emitInitFn___closed__8;
x_23 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_21);
x_24 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_23, x_1, x_12);
lean_dec(x_23);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2(x_19, x_9, x_10, x_1, x_25);
lean_dec(x_9);
x_27 = lean_ctor_get(x_26, 1);
lean_inc(x_27);
lean_dec(x_26);
x_28 = l_Lean_IR_declMapExt;
x_29 = l_Lean_SimplePersistentEnvExtension_getEntries___rarg(x_28, x_4);
lean_dec(x_4);
x_30 = l_List_reverse___rarg(x_29);
x_31 = l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3(x_30, x_1, x_27);
lean_dec(x_30);
if (lean_obj_tag(x_31) == 0)
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_32 = lean_ctor_get(x_31, 1);
lean_inc(x_32);
lean_dec(x_31);
x_33 = l_Lean_IR_EmitC_emitInitFn___closed__10;
x_34 = l_List_forM___main___at_Lean_IR_EmitC_emitMainFn___spec__2(x_33, x_1, x_32);
return x_34;
}
else
{
uint8_t x_35;
x_35 = !lean_is_exclusive(x_31);
if (x_35 == 0)
{
return x_31;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_31, 0);
x_37 = lean_ctor_get(x_31, 1);
lean_inc(x_37);
lean_inc(x_36);
lean_dec(x_31);
x_38 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_38, 0, x_36);
lean_ctor_set(x_38, 1, x_37);
return x_38;
}
}
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_1);
return x_5;
}
}
lean_object* l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6;
x_6 = l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__2(x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_2);
return x_6;
}
}
lean_object* l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_List_forM___main___at_Lean_IR_EmitC_emitInitFn___spec__3(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
lean_object* l_Lean_IR_EmitC_emitInitFn___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitC_emitInitFn(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
lean_object* l_Lean_IR_EmitC_main(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = l_Lean_IR_EmitC_emitFileHeader(x_1, x_2);
x_4 = lean_ctor_get(x_3, 1);
lean_inc(x_4);
lean_dec(x_3);
x_5 = l_Lean_IR_EmitC_emitFnDecls(x_1, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6; lean_object* x_7;
x_6 = lean_ctor_get(x_5, 1);
lean_inc(x_6);
lean_dec(x_5);
lean_inc(x_1);
x_7 = l_Lean_IR_EmitC_emitFns(x_1, x_6);
if (lean_obj_tag(x_7) == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_7, 1);
lean_inc(x_8);
lean_dec(x_7);
x_9 = l_Lean_IR_EmitC_emitInitFn(x_1, x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_9, 1);
lean_inc(x_10);
lean_dec(x_9);
x_11 = l_Lean_IR_EmitC_emitMainFnIfNeeded(x_1, x_10);
if (lean_obj_tag(x_11) == 0)
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitC_emitFileFooter(x_1, x_12);
lean_dec(x_1);
return x_13;
}
else
{
uint8_t x_14;
lean_dec(x_1);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_11;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_11, 0);
x_16 = lean_ctor_get(x_11, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_11);
x_17 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_17, 0, x_15);
lean_ctor_set(x_17, 1, x_16);
return x_17;
}
}
}
else
{
uint8_t x_18;
lean_dec(x_1);
x_18 = !lean_is_exclusive(x_9);
if (x_18 == 0)
{
return x_9;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_9, 0);
x_20 = lean_ctor_get(x_9, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_9);
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_19);
lean_ctor_set(x_21, 1, x_20);
return x_21;
}
}
}
else
{
uint8_t x_22;
lean_dec(x_1);
x_22 = !lean_is_exclusive(x_7);
if (x_22 == 0)
{
return x_7;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_7, 0);
x_24 = lean_ctor_get(x_7, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_7);
x_25 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_25, 0, x_23);
lean_ctor_set(x_25, 1, x_24);
return x_25;
}
}
}
else
{
uint8_t x_26;
lean_dec(x_1);
x_26 = !lean_is_exclusive(x_5);
if (x_26 == 0)
{
return x_5;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_5, 0);
x_28 = lean_ctor_get(x_5, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_5);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
}
lean_object* lean_ir_emit_c(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8;
x_3 = l_HashMap_Inhabited___closed__1;
x_4 = lean_box(0);
x_5 = l_Array_empty___closed__1;
x_6 = lean_alloc_ctor(0, 5, 0);
lean_ctor_set(x_6, 0, x_1);
lean_ctor_set(x_6, 1, x_2);
lean_ctor_set(x_6, 2, x_3);
lean_ctor_set(x_6, 3, x_4);
lean_ctor_set(x_6, 4, x_5);
x_7 = l_String_splitAux___main___closed__1;
x_8 = l_Lean_IR_EmitC_main(x_6, x_7);
if (lean_obj_tag(x_8) == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_9);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_inc(x_11);
lean_dec(x_8);
x_12 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_12, 0, x_11);
return x_12;
}
}
}
lean_object* initialize_Init_Control_Conditional(lean_object*);
lean_object* initialize_Init_Lean_Runtime(lean_object*);
lean_object* initialize_Init_Lean_Compiler_NameMangling(lean_object*);
lean_object* initialize_Init_Lean_Compiler_ExportAttr(lean_object*);
lean_object* initialize_Init_Lean_Compiler_InitAttr(lean_object*);
lean_object* initialize_Init_Lean_Compiler_IR_CompilerM(lean_object*);
lean_object* initialize_Init_Lean_Compiler_IR_EmitUtil(lean_object*);
lean_object* initialize_Init_Lean_Compiler_IR_NormIds(lean_object*);
lean_object* initialize_Init_Lean_Compiler_IR_SimpCase(lean_object*);
lean_object* initialize_Init_Lean_Compiler_IR_Boxing(lean_object*);
static bool _G_initialized = false;
lean_object* initialize_Init_Lean_Compiler_IR_EmitC(lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_mk_io_result(lean_box(0));
_G_initialized = true;
res = initialize_Init_Control_Conditional(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Runtime(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_NameMangling(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_ExportAttr(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_InitAttr(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_IR_CompilerM(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_IR_EmitUtil(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_IR_NormIds(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_IR_SimpCase(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Init_Lean_Compiler_IR_Boxing(lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_IR_EmitC_leanMainFn___closed__1 = _init_l_Lean_IR_EmitC_leanMainFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_leanMainFn___closed__1);
l_Lean_IR_EmitC_leanMainFn = _init_l_Lean_IR_EmitC_leanMainFn();
lean_mark_persistent(l_Lean_IR_EmitC_leanMainFn);
l_Lean_IR_EmitC_argToCString___closed__1 = _init_l_Lean_IR_EmitC_argToCString___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_argToCString___closed__1);
l_Lean_IR_EmitC_toCType___closed__1 = _init_l_Lean_IR_EmitC_toCType___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__1);
l_Lean_IR_EmitC_toCType___closed__2 = _init_l_Lean_IR_EmitC_toCType___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__2);
l_Lean_IR_EmitC_toCType___closed__3 = _init_l_Lean_IR_EmitC_toCType___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__3);
l_Lean_IR_EmitC_toCType___closed__4 = _init_l_Lean_IR_EmitC_toCType___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__4);
l_Lean_IR_EmitC_toCType___closed__5 = _init_l_Lean_IR_EmitC_toCType___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__5);
l_Lean_IR_EmitC_toCType___closed__6 = _init_l_Lean_IR_EmitC_toCType___closed__6();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__6);
l_Lean_IR_EmitC_toCType___closed__7 = _init_l_Lean_IR_EmitC_toCType___closed__7();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__7);
l_Lean_IR_EmitC_toCType___closed__8 = _init_l_Lean_IR_EmitC_toCType___closed__8();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__8);
l_Lean_IR_EmitC_toCType___closed__9 = _init_l_Lean_IR_EmitC_toCType___closed__9();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__9);
l_Lean_IR_EmitC_toCType___closed__10 = _init_l_Lean_IR_EmitC_toCType___closed__10();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__10);
l_Lean_IR_EmitC_toCType___closed__11 = _init_l_Lean_IR_EmitC_toCType___closed__11();
lean_mark_persistent(l_Lean_IR_EmitC_toCType___closed__11);
l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1 = _init_l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_throwInvalidExportName___rarg___closed__1);
l_Lean_IR_EmitC_toCName___closed__1 = _init_l_Lean_IR_EmitC_toCName___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_toCName___closed__1);
l_Lean_IR_EmitC_toCInitName___closed__1 = _init_l_Lean_IR_EmitC_toCInitName___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_toCInitName___closed__1);
l_Lean_IR_EmitC_emitFnDeclAux___closed__1 = _init_l_Lean_IR_EmitC_emitFnDeclAux___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitFnDeclAux___closed__1);
l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1 = _init_l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1();
lean_mark_persistent(l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__1);
l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2 = _init_l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2();
lean_mark_persistent(l_List_forM___main___at_Lean_IR_EmitC_emitFnDecls___spec__3___closed__2);
l_Lean_IR_EmitC_emitMainFn___closed__1 = _init_l_Lean_IR_EmitC_emitMainFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__1);
l_Lean_IR_EmitC_emitMainFn___closed__2 = _init_l_Lean_IR_EmitC_emitMainFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__2);
l_Lean_IR_EmitC_emitMainFn___closed__3 = _init_l_Lean_IR_EmitC_emitMainFn___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__3);
l_Lean_IR_EmitC_emitMainFn___closed__4 = _init_l_Lean_IR_EmitC_emitMainFn___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__4);
l_Lean_IR_EmitC_emitMainFn___closed__5 = _init_l_Lean_IR_EmitC_emitMainFn___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__5);
l_Lean_IR_EmitC_emitMainFn___closed__6 = _init_l_Lean_IR_EmitC_emitMainFn___closed__6();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__6);
l_Lean_IR_EmitC_emitMainFn___closed__7 = _init_l_Lean_IR_EmitC_emitMainFn___closed__7();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__7);
l_Lean_IR_EmitC_emitMainFn___closed__8 = _init_l_Lean_IR_EmitC_emitMainFn___closed__8();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__8);
l_Lean_IR_EmitC_emitMainFn___closed__9 = _init_l_Lean_IR_EmitC_emitMainFn___closed__9();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__9);
l_Lean_IR_EmitC_emitMainFn___closed__10 = _init_l_Lean_IR_EmitC_emitMainFn___closed__10();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__10);
l_Lean_IR_EmitC_emitMainFn___closed__11 = _init_l_Lean_IR_EmitC_emitMainFn___closed__11();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__11);
l_Lean_IR_EmitC_emitMainFn___closed__12 = _init_l_Lean_IR_EmitC_emitMainFn___closed__12();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__12);
l_Lean_IR_EmitC_emitMainFn___closed__13 = _init_l_Lean_IR_EmitC_emitMainFn___closed__13();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__13);
l_Lean_IR_EmitC_emitMainFn___closed__14 = _init_l_Lean_IR_EmitC_emitMainFn___closed__14();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__14);
l_Lean_IR_EmitC_emitMainFn___closed__15 = _init_l_Lean_IR_EmitC_emitMainFn___closed__15();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__15);
l_Lean_IR_EmitC_emitMainFn___closed__16 = _init_l_Lean_IR_EmitC_emitMainFn___closed__16();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__16);
l_Lean_IR_EmitC_emitMainFn___closed__17 = _init_l_Lean_IR_EmitC_emitMainFn___closed__17();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__17);
l_Lean_IR_EmitC_emitMainFn___closed__18 = _init_l_Lean_IR_EmitC_emitMainFn___closed__18();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__18);
l_Lean_IR_EmitC_emitMainFn___closed__19 = _init_l_Lean_IR_EmitC_emitMainFn___closed__19();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__19);
l_Lean_IR_EmitC_emitMainFn___closed__20 = _init_l_Lean_IR_EmitC_emitMainFn___closed__20();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__20);
l_Lean_IR_EmitC_emitMainFn___closed__21 = _init_l_Lean_IR_EmitC_emitMainFn___closed__21();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__21);
l_Lean_IR_EmitC_emitMainFn___closed__22 = _init_l_Lean_IR_EmitC_emitMainFn___closed__22();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__22);
l_Lean_IR_EmitC_emitMainFn___closed__23 = _init_l_Lean_IR_EmitC_emitMainFn___closed__23();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__23);
l_Lean_IR_EmitC_emitMainFn___closed__24 = _init_l_Lean_IR_EmitC_emitMainFn___closed__24();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__24);
l_Lean_IR_EmitC_emitMainFn___closed__25 = _init_l_Lean_IR_EmitC_emitMainFn___closed__25();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__25);
l_Lean_IR_EmitC_emitMainFn___closed__26 = _init_l_Lean_IR_EmitC_emitMainFn___closed__26();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__26);
l_Lean_IR_EmitC_emitMainFn___closed__27 = _init_l_Lean_IR_EmitC_emitMainFn___closed__27();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__27);
l_Lean_IR_EmitC_emitMainFn___closed__28 = _init_l_Lean_IR_EmitC_emitMainFn___closed__28();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__28);
l_Lean_IR_EmitC_emitMainFn___closed__29 = _init_l_Lean_IR_EmitC_emitMainFn___closed__29();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__29);
l_Lean_IR_EmitC_emitMainFn___closed__30 = _init_l_Lean_IR_EmitC_emitMainFn___closed__30();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__30);
l_Lean_IR_EmitC_emitMainFn___closed__31 = _init_l_Lean_IR_EmitC_emitMainFn___closed__31();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__31);
l_Lean_IR_EmitC_emitMainFn___closed__32 = _init_l_Lean_IR_EmitC_emitMainFn___closed__32();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__32);
l_Lean_IR_EmitC_emitMainFn___closed__33 = _init_l_Lean_IR_EmitC_emitMainFn___closed__33();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__33);
l_Lean_IR_EmitC_emitMainFn___closed__34 = _init_l_Lean_IR_EmitC_emitMainFn___closed__34();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__34);
l_Lean_IR_EmitC_emitMainFn___closed__35 = _init_l_Lean_IR_EmitC_emitMainFn___closed__35();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__35);
l_Lean_IR_EmitC_emitMainFn___closed__36 = _init_l_Lean_IR_EmitC_emitMainFn___closed__36();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__36);
l_Lean_IR_EmitC_emitMainFn___closed__37 = _init_l_Lean_IR_EmitC_emitMainFn___closed__37();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__37);
l_Lean_IR_EmitC_emitMainFn___closed__38 = _init_l_Lean_IR_EmitC_emitMainFn___closed__38();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__38);
l_Lean_IR_EmitC_emitMainFn___closed__39 = _init_l_Lean_IR_EmitC_emitMainFn___closed__39();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__39);
l_Lean_IR_EmitC_emitMainFn___closed__40 = _init_l_Lean_IR_EmitC_emitMainFn___closed__40();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__40);
l_Lean_IR_EmitC_emitMainFn___closed__41 = _init_l_Lean_IR_EmitC_emitMainFn___closed__41();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__41);
l_Lean_IR_EmitC_emitMainFn___closed__42 = _init_l_Lean_IR_EmitC_emitMainFn___closed__42();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__42);
l_Lean_IR_EmitC_emitMainFn___closed__43 = _init_l_Lean_IR_EmitC_emitMainFn___closed__43();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__43);
l_Lean_IR_EmitC_emitMainFn___closed__44 = _init_l_Lean_IR_EmitC_emitMainFn___closed__44();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__44);
l_Lean_IR_EmitC_emitMainFn___closed__45 = _init_l_Lean_IR_EmitC_emitMainFn___closed__45();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__45);
l_Lean_IR_EmitC_emitMainFn___closed__46 = _init_l_Lean_IR_EmitC_emitMainFn___closed__46();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__46);
l_Lean_IR_EmitC_emitMainFn___closed__47 = _init_l_Lean_IR_EmitC_emitMainFn___closed__47();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__47);
l_Lean_IR_EmitC_emitMainFn___closed__48 = _init_l_Lean_IR_EmitC_emitMainFn___closed__48();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__48);
l_Lean_IR_EmitC_emitMainFn___closed__49 = _init_l_Lean_IR_EmitC_emitMainFn___closed__49();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__49);
l_Lean_IR_EmitC_emitMainFn___closed__50 = _init_l_Lean_IR_EmitC_emitMainFn___closed__50();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__50);
l_Lean_IR_EmitC_emitMainFn___closed__51 = _init_l_Lean_IR_EmitC_emitMainFn___closed__51();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__51);
l_Lean_IR_EmitC_emitMainFn___closed__52 = _init_l_Lean_IR_EmitC_emitMainFn___closed__52();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__52);
l_Lean_IR_EmitC_emitMainFn___closed__53 = _init_l_Lean_IR_EmitC_emitMainFn___closed__53();
lean_mark_persistent(l_Lean_IR_EmitC_emitMainFn___closed__53);
l_Lean_IR_EmitC_emitFileHeader___closed__1 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__1);
l_Lean_IR_EmitC_emitFileHeader___closed__2 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__2);
l_Lean_IR_EmitC_emitFileHeader___closed__3 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__3);
l_Lean_IR_EmitC_emitFileHeader___closed__4 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__4);
l_Lean_IR_EmitC_emitFileHeader___closed__5 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__5);
l_Lean_IR_EmitC_emitFileHeader___closed__6 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__6();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__6);
l_Lean_IR_EmitC_emitFileHeader___closed__7 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__7();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__7);
l_Lean_IR_EmitC_emitFileHeader___closed__8 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__8();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__8);
l_Lean_IR_EmitC_emitFileHeader___closed__9 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__9();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__9);
l_Lean_IR_EmitC_emitFileHeader___closed__10 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__10();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__10);
l_Lean_IR_EmitC_emitFileHeader___closed__11 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__11();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__11);
l_Lean_IR_EmitC_emitFileHeader___closed__12 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__12();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__12);
l_Lean_IR_EmitC_emitFileHeader___closed__13 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__13();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__13);
l_Lean_IR_EmitC_emitFileHeader___closed__14 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__14();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__14);
l_Lean_IR_EmitC_emitFileHeader___closed__15 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__15();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__15);
l_Lean_IR_EmitC_emitFileHeader___closed__16 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__16();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__16);
l_Lean_IR_EmitC_emitFileHeader___closed__17 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__17();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__17);
l_Lean_IR_EmitC_emitFileHeader___closed__18 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__18();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__18);
l_Lean_IR_EmitC_emitFileHeader___closed__19 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__19();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__19);
l_Lean_IR_EmitC_emitFileHeader___closed__20 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__20();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__20);
l_Lean_IR_EmitC_emitFileHeader___closed__21 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__21();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__21);
l_Lean_IR_EmitC_emitFileHeader___closed__22 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__22();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__22);
l_Lean_IR_EmitC_emitFileHeader___closed__23 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__23();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__23);
l_Lean_IR_EmitC_emitFileHeader___closed__24 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__24();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__24);
l_Lean_IR_EmitC_emitFileHeader___closed__25 = _init_l_Lean_IR_EmitC_emitFileHeader___closed__25();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileHeader___closed__25);
l_Lean_IR_EmitC_emitFileFooter___closed__1 = _init_l_Lean_IR_EmitC_emitFileFooter___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileFooter___closed__1);
l_Lean_IR_EmitC_emitFileFooter___closed__2 = _init_l_Lean_IR_EmitC_emitFileFooter___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitFileFooter___closed__2);
l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1 = _init_l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_throwUnknownVar___rarg___closed__1);
l_Lean_IR_EmitC_getJPParams___closed__1 = _init_l_Lean_IR_EmitC_getJPParams___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_getJPParams___closed__1);
l_Lean_IR_EmitC_declareVar___closed__1 = _init_l_Lean_IR_EmitC_declareVar___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_declareVar___closed__1);
l_Lean_IR_EmitC_emitTag___closed__1 = _init_l_Lean_IR_EmitC_emitTag___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitTag___closed__1);
l_Lean_IR_EmitC_emitIf___closed__1 = _init_l_Lean_IR_EmitC_emitIf___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitIf___closed__1);
l_Lean_IR_EmitC_emitIf___closed__2 = _init_l_Lean_IR_EmitC_emitIf___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitIf___closed__2);
l_Lean_IR_EmitC_emitIf___closed__3 = _init_l_Lean_IR_EmitC_emitIf___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitIf___closed__3);
l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1 = _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1();
lean_mark_persistent(l_Array_forMAux___main___at_Lean_IR_EmitC_emitCase___spec__1___closed__1);
l_Lean_IR_EmitC_emitCase___closed__1 = _init_l_Lean_IR_EmitC_emitCase___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitCase___closed__1);
l_Lean_IR_EmitC_emitCase___closed__2 = _init_l_Lean_IR_EmitC_emitCase___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitCase___closed__2);
l_Lean_IR_EmitC_emitInc___closed__1 = _init_l_Lean_IR_EmitC_emitInc___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitInc___closed__1);
l_Lean_IR_EmitC_emitInc___closed__2 = _init_l_Lean_IR_EmitC_emitInc___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitInc___closed__2);
l_Lean_IR_EmitC_emitInc___closed__3 = _init_l_Lean_IR_EmitC_emitInc___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitInc___closed__3);
l_Lean_IR_EmitC_emitInc___closed__4 = _init_l_Lean_IR_EmitC_emitInc___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitInc___closed__4);
l_Lean_IR_EmitC_emitInc___closed__5 = _init_l_Lean_IR_EmitC_emitInc___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitInc___closed__5);
l_Lean_IR_EmitC_emitDec___closed__1 = _init_l_Lean_IR_EmitC_emitDec___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitDec___closed__1);
l_Lean_IR_EmitC_emitDec___closed__2 = _init_l_Lean_IR_EmitC_emitDec___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitDec___closed__2);
l_Lean_IR_EmitC_emitDel___closed__1 = _init_l_Lean_IR_EmitC_emitDel___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitDel___closed__1);
l_Lean_IR_EmitC_emitSetTag___closed__1 = _init_l_Lean_IR_EmitC_emitSetTag___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitSetTag___closed__1);
l_Lean_IR_EmitC_emitSet___closed__1 = _init_l_Lean_IR_EmitC_emitSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitSet___closed__1);
l_Lean_IR_EmitC_emitOffset___closed__1 = _init_l_Lean_IR_EmitC_emitOffset___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitOffset___closed__1);
l_Lean_IR_EmitC_emitOffset___closed__2 = _init_l_Lean_IR_EmitC_emitOffset___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitOffset___closed__2);
l_Lean_IR_EmitC_emitUSet___closed__1 = _init_l_Lean_IR_EmitC_emitUSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitUSet___closed__1);
l_Lean_IR_EmitC_emitSSet___closed__1 = _init_l_Lean_IR_EmitC_emitSSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__1);
l_Lean_IR_EmitC_emitSSet___closed__2 = _init_l_Lean_IR_EmitC_emitSSet___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__2);
l_Lean_IR_EmitC_emitSSet___closed__3 = _init_l_Lean_IR_EmitC_emitSSet___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__3);
l_Lean_IR_EmitC_emitSSet___closed__4 = _init_l_Lean_IR_EmitC_emitSSet___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__4);
l_Lean_IR_EmitC_emitSSet___closed__5 = _init_l_Lean_IR_EmitC_emitSSet___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__5);
l_Lean_IR_EmitC_emitSSet___closed__6 = _init_l_Lean_IR_EmitC_emitSSet___closed__6();
lean_mark_persistent(l_Lean_IR_EmitC_emitSSet___closed__6);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitJmp___spec__1___closed__1);
l_Lean_IR_EmitC_emitJmp___closed__1 = _init_l_Lean_IR_EmitC_emitJmp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitJmp___closed__1);
l_Lean_IR_EmitC_emitJmp___closed__2 = _init_l_Lean_IR_EmitC_emitJmp___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitJmp___closed__2);
l_Lean_IR_EmitC_emitCtorScalarSize___closed__1 = _init_l_Lean_IR_EmitC_emitCtorScalarSize___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitCtorScalarSize___closed__1);
l_Lean_IR_EmitC_emitAllocCtor___closed__1 = _init_l_Lean_IR_EmitC_emitAllocCtor___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitAllocCtor___closed__1);
l_Lean_IR_EmitC_emitCtor___closed__1 = _init_l_Lean_IR_EmitC_emitCtor___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitCtor___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitReset___spec__1___closed__1);
l_Lean_IR_EmitC_emitReset___closed__1 = _init_l_Lean_IR_EmitC_emitReset___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitReset___closed__1);
l_Lean_IR_EmitC_emitReset___closed__2 = _init_l_Lean_IR_EmitC_emitReset___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitReset___closed__2);
l_Lean_IR_EmitC_emitReset___closed__3 = _init_l_Lean_IR_EmitC_emitReset___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitReset___closed__3);
l_Lean_IR_EmitC_emitReset___closed__4 = _init_l_Lean_IR_EmitC_emitReset___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitReset___closed__4);
l_Lean_IR_EmitC_emitReuse___closed__1 = _init_l_Lean_IR_EmitC_emitReuse___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitReuse___closed__1);
l_Lean_IR_EmitC_emitReuse___closed__2 = _init_l_Lean_IR_EmitC_emitReuse___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitReuse___closed__2);
l_Lean_IR_EmitC_emitProj___closed__1 = _init_l_Lean_IR_EmitC_emitProj___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitProj___closed__1);
l_Lean_IR_EmitC_emitUProj___closed__1 = _init_l_Lean_IR_EmitC_emitUProj___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitUProj___closed__1);
l_Lean_IR_EmitC_emitSProj___closed__1 = _init_l_Lean_IR_EmitC_emitSProj___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitSProj___closed__1);
l_Lean_IR_EmitC_emitSProj___closed__2 = _init_l_Lean_IR_EmitC_emitSProj___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitSProj___closed__2);
l_Lean_IR_EmitC_emitSProj___closed__3 = _init_l_Lean_IR_EmitC_emitSProj___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitSProj___closed__3);
l_Lean_IR_EmitC_emitSProj___closed__4 = _init_l_Lean_IR_EmitC_emitSProj___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitSProj___closed__4);
l_Lean_IR_EmitC_emitExternCall___closed__1 = _init_l_Lean_IR_EmitC_emitExternCall___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitExternCall___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitPartialApp___spec__1___closed__1);
l_Lean_IR_EmitC_emitPartialApp___closed__1 = _init_l_Lean_IR_EmitC_emitPartialApp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitPartialApp___closed__1);
l_Lean_IR_EmitC_emitPartialApp___closed__2 = _init_l_Lean_IR_EmitC_emitPartialApp___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitPartialApp___closed__2);
l_Lean_IR_EmitC_emitApp___closed__1 = _init_l_Lean_IR_EmitC_emitApp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitApp___closed__1);
l_Lean_IR_EmitC_emitApp___closed__2 = _init_l_Lean_IR_EmitC_emitApp___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitApp___closed__2);
l_Lean_IR_EmitC_emitApp___closed__3 = _init_l_Lean_IR_EmitC_emitApp___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitApp___closed__3);
l_Lean_IR_EmitC_emitApp___closed__4 = _init_l_Lean_IR_EmitC_emitApp___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitApp___closed__4);
l_Lean_IR_EmitC_emitApp___closed__5 = _init_l_Lean_IR_EmitC_emitApp___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitApp___closed__5);
l_Lean_IR_EmitC_emitBoxFn___closed__1 = _init_l_Lean_IR_EmitC_emitBoxFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitBoxFn___closed__1);
l_Lean_IR_EmitC_emitBoxFn___closed__2 = _init_l_Lean_IR_EmitC_emitBoxFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitBoxFn___closed__2);
l_Lean_IR_EmitC_emitBoxFn___closed__3 = _init_l_Lean_IR_EmitC_emitBoxFn___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitBoxFn___closed__3);
l_Lean_IR_EmitC_emitBoxFn___closed__4 = _init_l_Lean_IR_EmitC_emitBoxFn___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitBoxFn___closed__4);
l_Lean_IR_EmitC_emitUnbox___closed__1 = _init_l_Lean_IR_EmitC_emitUnbox___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitUnbox___closed__1);
l_Lean_IR_EmitC_emitUnbox___closed__2 = _init_l_Lean_IR_EmitC_emitUnbox___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitUnbox___closed__2);
l_Lean_IR_EmitC_emitUnbox___closed__3 = _init_l_Lean_IR_EmitC_emitUnbox___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitUnbox___closed__3);
l_Lean_IR_EmitC_emitUnbox___closed__4 = _init_l_Lean_IR_EmitC_emitUnbox___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitUnbox___closed__4);
l_Lean_IR_EmitC_emitIsShared___closed__1 = _init_l_Lean_IR_EmitC_emitIsShared___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitIsShared___closed__1);
l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1 = _init_l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitIsTaggedPtr___closed__1);
l_Lean_IR_EmitC_emitNumLit___closed__1 = _init_l_Lean_IR_EmitC_emitNumLit___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitNumLit___closed__1);
l_Lean_IR_EmitC_emitNumLit___closed__2 = _init_l_Lean_IR_EmitC_emitNumLit___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitNumLit___closed__2);
l_Lean_IR_EmitC_emitNumLit___closed__3 = _init_l_Lean_IR_EmitC_emitNumLit___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitNumLit___closed__3);
l_Lean_IR_EmitC_emitNumLit___closed__4 = _init_l_Lean_IR_EmitC_emitNumLit___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitNumLit___closed__4);
l_Lean_IR_EmitC_emitLit___closed__1 = _init_l_Lean_IR_EmitC_emitLit___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitLit___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__2___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitTailCall___spec__3___closed__1);
l_Lean_IR_EmitC_emitTailCall___closed__1 = _init_l_Lean_IR_EmitC_emitTailCall___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitTailCall___closed__1);
l_Lean_IR_EmitC_emitTailCall___closed__2 = _init_l_Lean_IR_EmitC_emitTailCall___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitTailCall___closed__2);
l_Lean_IR_EmitC_emitTailCall___closed__3 = _init_l_Lean_IR_EmitC_emitTailCall___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitTailCall___closed__3);
l_Lean_IR_EmitC_emitBlock___main___closed__1 = _init_l_Lean_IR_EmitC_emitBlock___main___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitBlock___main___closed__1);
l_Lean_IR_EmitC_emitBlock___main___closed__2 = _init_l_Lean_IR_EmitC_emitBlock___main___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitBlock___main___closed__2);
l_Lean_IR_EmitC_emitFnBody___main___closed__1 = _init_l_Lean_IR_EmitC_emitFnBody___main___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitFnBody___main___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__1);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__2);
l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3 = _init_l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3();
lean_mark_persistent(l_Nat_forMAux___main___at_Lean_IR_EmitC_emitDeclAux___spec__1___closed__3);
l_Lean_IR_EmitC_emitDeclAux___closed__1 = _init_l_Lean_IR_EmitC_emitDeclAux___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__1);
l_Lean_IR_EmitC_emitDeclAux___closed__2 = _init_l_Lean_IR_EmitC_emitDeclAux___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__2);
l_Lean_IR_EmitC_emitDeclAux___closed__3 = _init_l_Lean_IR_EmitC_emitDeclAux___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclAux___closed__3);
l_Lean_IR_EmitC_emitDecl___closed__1 = _init_l_Lean_IR_EmitC_emitDecl___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitDecl___closed__1);
l_Lean_IR_EmitC_emitMarkPersistent___closed__1 = _init_l_Lean_IR_EmitC_emitMarkPersistent___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitMarkPersistent___closed__1);
l_Lean_IR_EmitC_emitDeclInit___closed__1 = _init_l_Lean_IR_EmitC_emitDeclInit___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclInit___closed__1);
l_Lean_IR_EmitC_emitDeclInit___closed__2 = _init_l_Lean_IR_EmitC_emitDeclInit___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclInit___closed__2);
l_Lean_IR_EmitC_emitDeclInit___closed__3 = _init_l_Lean_IR_EmitC_emitDeclInit___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitDeclInit___closed__3);
l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1 = _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1();
lean_mark_persistent(l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__1);
l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2 = _init_l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2();
lean_mark_persistent(l_Array_forMAux___main___at_Lean_IR_EmitC_emitInitFn___spec__1___closed__2);
l_Lean_IR_EmitC_emitInitFn___closed__1 = _init_l_Lean_IR_EmitC_emitInitFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__1);
l_Lean_IR_EmitC_emitInitFn___closed__2 = _init_l_Lean_IR_EmitC_emitInitFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__2);
l_Lean_IR_EmitC_emitInitFn___closed__3 = _init_l_Lean_IR_EmitC_emitInitFn___closed__3();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__3);
l_Lean_IR_EmitC_emitInitFn___closed__4 = _init_l_Lean_IR_EmitC_emitInitFn___closed__4();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__4);
l_Lean_IR_EmitC_emitInitFn___closed__5 = _init_l_Lean_IR_EmitC_emitInitFn___closed__5();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__5);
l_Lean_IR_EmitC_emitInitFn___closed__6 = _init_l_Lean_IR_EmitC_emitInitFn___closed__6();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__6);
l_Lean_IR_EmitC_emitInitFn___closed__7 = _init_l_Lean_IR_EmitC_emitInitFn___closed__7();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__7);
l_Lean_IR_EmitC_emitInitFn___closed__8 = _init_l_Lean_IR_EmitC_emitInitFn___closed__8();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__8);
l_Lean_IR_EmitC_emitInitFn___closed__9 = _init_l_Lean_IR_EmitC_emitInitFn___closed__9();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__9);
l_Lean_IR_EmitC_emitInitFn___closed__10 = _init_l_Lean_IR_EmitC_emitInitFn___closed__10();
lean_mark_persistent(l_Lean_IR_EmitC_emitInitFn___closed__10);
return lean_mk_io_result(lean_box(0));
}
#ifdef __cplusplus
}
#endif
| 30.254226 | 599 | 0.789033 |
685394b0c4cdccde6303a04869b430d0e0cf77f4 | 791 | sql | SQL | backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5428601_sys_09342_AddPaymentWriteOff_make_it_mandatory.sql | dram/metasfresh | a1b881a5b7df8b108d4c4ac03082b72c323873eb | [
"RSA-MD"
] | 1,144 | 2016-02-14T10:29:35.000Z | 2022-03-30T09:50:41.000Z | backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5428601_sys_09342_AddPaymentWriteOff_make_it_mandatory.sql | vestigegroup/metasfresh | 4b2d48c091fb2a73e6f186260a06c715f5e2fe96 | [
"RSA-MD"
] | 8,283 | 2016-04-28T17:41:34.000Z | 2022-03-30T13:30:12.000Z | backend/de.metas.adempiere.adempiere/migration/src/main/sql/postgresql/system/10-de.metas.adempiere/5428601_sys_09342_AddPaymentWriteOff_make_it_mandatory.sql | vestigegroup/metasfresh | 4b2d48c091fb2a73e6f186260a06c715f5e2fe96 | [
"RSA-MD"
] | 441 | 2016-04-29T08:06:07.000Z | 2022-03-28T06:09:56.000Z | -- 29.09.2015 10:23
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsMandatory='Y', IsUpdateable='Y',Updated=TO_TIMESTAMP('2015-09-29 10:23:36','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=552756
;
-- 29.09.2015 10:23
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO t_alter_column values('c_allocationline','PaymentWriteOffAmt','NUMERIC',null,'0')
;
-- 29.09.2015 10:23
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE C_AllocationLine SET PaymentWriteOffAmt=0 WHERE PaymentWriteOffAmt IS NULL
;
-- 29.09.2015 10:23
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO t_alter_column values('c_allocationline','PaymentWriteOffAmt',null,'NOT NULL',null)
;
| 37.666667 | 162 | 0.787611 |
16bfec54ccd4dcb7b790f61b1daa995b04978a8e | 205 | ts | TypeScript | extensions/slack/src/connections/slackConnection.ts | r2m1/Extensions | 289679a5336e5fe4793ddf25c073fba80b7f6a71 | [
"MIT"
] | 10 | 2020-10-10T18:10:58.000Z | 2021-12-02T14:54:42.000Z | extensions/slack/src/connections/slackConnection.ts | r2m1/Extensions | 289679a5336e5fe4793ddf25c073fba80b7f6a71 | [
"MIT"
] | 21 | 2020-09-01T09:49:23.000Z | 2022-03-16T10:45:08.000Z | extensions/slack/src/connections/slackConnection.ts | r2m1/Extensions | 289679a5336e5fe4793ddf25c073fba80b7f6a71 | [
"MIT"
] | 18 | 2020-12-02T12:01:23.000Z | 2022-03-14T11:47:12.000Z | import { IConnectionSchema } from "@cognigy/extension-tools";
export const slackConnection: IConnectionSchema = {
type: "slack",
label: "Slack Connection",
fields: [
{ fieldName: "webhookUrl" }
]
}; | 22.777778 | 61 | 0.707317 |
40b87655016cd1560189bafcde94f86f065f3a01 | 932 | py | Python | harness.py | todrzywolek/word-learner | 87d290991357e26d40e44b06a50ce78d7a4c1f59 | [
"MIT"
] | null | null | null | harness.py | todrzywolek/word-learner | 87d290991357e26d40e44b06a50ce78d7a4c1f59 | [
"MIT"
] | null | null | null | harness.py | todrzywolek/word-learner | 87d290991357e26d40e44b06a50ce78d7a4c1f59 | [
"MIT"
] | null | null | null | from logic import Logic
import hints
from gui import open_file
class Harness:
FILE_OPEN_OPTIONS = dict(defaultextension='.txt',
filetypes=[('text files', '*.txt')],
title='Wybierz plik z listą słówek')
def __init__(self):
self._logic = Logic()
self._language = '[GER]'
def start(self):
print('Program do slowek.\nWybierz plik')
f = open_file()
self._logic.load_file(f)
while not self._logic.empty():
word = self._logic.rand_word()
answer = word.get_translation()
user_input = input('Your Answer: ')
if user_input == '0':
hints.show_hint(word.hint_info(), word.get_word(), self._language)
else:
self._logic.correct(user_input, answer)
def main():
word_prog = Harness()
word_prog.start()
main()
| 23.3 | 82 | 0.550429 |
6ba37f8f79ecd20a22bc077d99026b2c22804415 | 38,147 | h | C | src/Molecule_Lib/rxn_file.h | michaelweiss092/LillyMol | a2b7d1d8a07ef338c754a0a2e3b2624aac694cc9 | [
"Apache-2.0"
] | 53 | 2018-06-01T13:16:15.000Z | 2022-02-23T21:04:28.000Z | src/Molecule_Lib/rxn_file.h | michaelweiss092/LillyMol | a2b7d1d8a07ef338c754a0a2e3b2624aac694cc9 | [
"Apache-2.0"
] | 19 | 2018-08-14T13:43:18.000Z | 2021-09-24T12:53:11.000Z | src/Molecule_Lib/rxn_file.h | michaelweiss092/LillyMol | a2b7d1d8a07ef338c754a0a2e3b2624aac694cc9 | [
"Apache-2.0"
] | 19 | 2018-10-23T19:41:01.000Z | 2022-02-17T08:14:00.000Z | #ifndef IWRXN_FILE_H
#define IWRXN_FILE_H
#include "sparse_fp_creator.h"
#include "iw_stl_hash_map.h"
#include "iwreaction.h"
#include <iostream>
#include <iomanip>
#include <fstream>
#include "mdl_molecule.h"
class Atom_Typing_Specification;
class ISIS_RXN_FILE_Molecule;
class Product_Atom_Types;
/*
When creating a reaction from a subset of an input file, there
is quite a lot of book-keeping to keeping track of which atom
goes where.
*/
class Reaction_Subset
{
private:
const int _nr;
int * _xref;
int * _reagent_offset;
// Turns out that sometimes we need a cross reference array, and sometimes we need an include/exclude
// flag, so we have two variables.
int * _include_atom;
int _total_atoms;
public:
Reaction_Subset(const int nr);
~Reaction_Subset();
int debug_print(std::ostream &) const;
const int * include_atom (const int i) const { if (NULL == _include_atom)
return NULL;
return _include_atom + _reagent_offset[i];}
void convert_cross_reference_to_boolean_include();
int build(const ISIS_RXN_FILE_Molecule * reagent, const int * reagent_locator,
const int * include_these_atom_map_numbers, const int highest_atom_map);
atom_number_t atom_number_in_subset (const atom_number_t a, const int r) const;
};
struct Aprop;
class Atom_in_Fragment
{
private:
atom_number_t _a;
int _fragment;
public:
Atom_in_Fragment (atom_number_t zatom, int f) : _a (zatom), _fragment (f) {};
atom_number_t atom () const { return _a;}
int fragment () const { return _fragment;}
void set_atom (atom_number_t s) { _a = s;}
void set_fragment (int s) { _fragment = s;}
};
class RXN_File_Create_Reaction_Options
{
public:
int _only_create_query_from_first_reagent;
int _write_agent;
public:
RXN_File_Create_Reaction_Options();
~RXN_File_Create_Reaction_Options(){};
void set_only_create_query_from_first_reagent(const int s) { _only_create_query_from_first_reagent = s;}
int only_create_query_from_first_reagent() const { return _only_create_query_from_first_reagent;}
};
class Reaction_Site;
class ISIS_RXN_FILE_Molecule : public MDL_Molecule
{
private:
int * _atom_map;
// Because of the various bonding possibilities (like double or aromatic), it can
// sometimes be challenging to compute the number of attached hydrogens. We do it once
// and store the result
int * _explicit_hydrogen_count;
int * _computed_implicit_hydrogen_count;
// We remove any explicit Hydrogens found in the input file. We need to
// know how many explicit Hydrogens have been removed from each atom so we
// can make inferences about hcount in the query
int * _explicit_hydrogen_atom_removed;
// With link atoms, we need to keep track of the atoms that have lost a connection
int * _connections_lost;
// Some of the bonds will be valid bonds, but some will be OR bonds. Store all
// bonding info
bond_type_t * _btype;
// NOT atom lists need special care so check whether any are present or not
int _not_atom_lists_present;
// If we have OR aromatic bonds present, some of the rings drawn may be aromatic,
// but since we've put single bonds into our Molecule, we have lost the aromaticity.
// The funciton _look_for_rings_that_are_supposed_to_be_aromatic discerns hidden aromaticity
int * _aromatic;
// People expect to enter A atoms in aromatic rings, but since A is a non-periodic table
// element, such a ring cannot be aromatic. We temporarily convert to Carbon to get aromaticity
int _convert_A_to_C_for_aromaticity;
// When deciding whether we need to toggle Kekule forms, we need to know whether
// ring membership changes or not
resizable_array_p<Bond> _toggle_kekule_form;
// For some reactions, it is better to forget Kekule forms.
int _aromatic_bonds_lose_kekule_identity;
// Aug 2016. Sometimes we really do want to keep the existing Kekule form
int _preserve_kekule_forms;
// Since I strip off explicit Hydrogens, it becomes much easier to compute the number of
// bonds before any of that happens
int * _nbonds;
// When doing automatic atom mapping, we need to know symmetry. If an atom
// is set in this array, it is either unique (value 1) or a representative
// of a symmetry class, with the value being the number of symmetrically equivalent atoms
int * _use_as_representative;
// We can speed things up by putting a heteroatom first
int _swap_atoms_to_put_rare_atoms_first;
// Sometimes we will have a reaction where the thing drawn is the (only) reagent,
// rather than a query
int _molecule_is_sole_reagent;
int _remove_explicit_hydrogens;
// If we have identical molecules as products, then _use_as_representative needs to span
// molecules. Fragments that have the same structure will have the same non-zero structure_value
int _structure_value;
int _is_duplicate_fragment;
IWString _unique_smiles;
int _interpret_atom_alias_as_smarts; // sept 2014
// It can be convenient to do atom typing across a reaction - does not come from a file
int * _atype;
// private functions
int _compute_implicit_hydrogens ();
int _aromatic_bonds_attached (atom_number_t zatom) const;
int _number_atoms_with_substitution_directives() const;
int _number_atoms_with_unsaturation_directives() const;
int _number_atoms_with_ring_bond_directives() const;
int _adjust_computed_implicit_hydrogens_for_unstautration (atom_number_t zatom);
int _set_unsaturation_specifications (const Aprop * atom_properties, int ntokens);
int _set_substitution_specifications (const Aprop * atom_properties, int ntokens);
int _set_ring_bond_specifications (const Aprop * atom_properties, int ntokens);
int _grow_symmetry_class (atom_number_t zatom, int * symmetry_equivalent_atoms);
int _common_set_from_aprop (const Aprop * atom_properties, int ntokens, int * dest);
int _parse_atom_list (const IWString &);
int _parse_link_record (const IWString &);
int _check_non_periodic_table_elements_and_atom_lists ();
int _create_query (Reaction_Site & r,
Molecule_to_Query_Specifications & mqs,
int ndx);
int _create_query (Reaction_Site & r,
Molecule_to_Query_Specifications & mqs,
const int * include_these_atoms);
// int _do_remove_explicit_hydrogens (Set_of_Atoms & contains_explicit_hydrogen);
int _identify_explicit_hydrogens_to_be_removed (Set_of_Atoms & to_be_removed, int * xref);
int _identify_link_atoms_to_be_removed (Set_of_Atoms & to_be_removed, int * xref);
int _do_atom_removals (Set_of_Atoms & to_be_removed, const int * xref);
int _look_for_rings_that_are_supposed_to_be_aromatic ();
int __look_for_rings_that_are_supposed_to_be_aromatic (int *);
int _back_to_single_bonds (bond_type_t);
int _change_explicit_kekule_forms_to_aromatic (const Ring & r);
int _change_explicit_kekule_forms_to_aromatic ();
int _do_aromatic_bonds_lose_kekule_identity ();
int _do_swap_atoms_to_put_rare_atoms_first ();
int _write_m_sub_records (int n, std::ostream & output) const;
int _write_m_uns_records (int n, std::ostream & output) const;
int _write_m_rbc_records (int n, std::ostream & output) const;
public:
ISIS_RXN_FILE_Molecule ();
~ISIS_RXN_FILE_Molecule ();
ISIS_RXN_FILE_Molecule & operator=(ISIS_RXN_FILE_Molecule&& rhs);
int do_read (iwstring_data_source &);
int allocate_arrays (int na, int nb);
int highest_atom_map_number () const;
int remove_atoms (const int * to_remove);
int remove_atom (const int * to_remove);
int identify_which_atoms_we_have (int * locator_array, int mark, int * atom_map_to_atom_number) const;
void recompute_unique_smiles ();
int add (const Element *);
int identify_symmetry_classes ();
int use_atom_as_symmetry_representative (atom_number_t a) const { return _use_as_representative[a];}
void set_use_as_symmetry_representative (atom_number_t a, int s) { _use_as_representative[a] = s;}
int fill_bonds_between_mapped_atoms_array (atom_type_t * b, const int);
int break_symmetry (atom_number_t);
void discard_atom_map ();
// Sometimes callers will need to know whether a particular atom is a list
int is_an_atom_list (atom_number_t) const;
int structure_value () const { return _structure_value;}
void set_structure_value (int s) { _structure_value = s;}
int is_duplicate_fragment () const { return _is_duplicate_fragment;}
void set_is_duplicate_fragment (int s) { _is_duplicate_fragment = s;}
void set_interpret_atom_alias_as_smarts(int s) { _interpret_atom_alias_as_smarts = s;}
const IWString & unique_smiles () const { return _unique_smiles;}
bond_type_t mapped_atoms_are_bonded (int, int) const;
const int * atom_map () const { return _atom_map;}
int atom_map (atom_number_t a) const { return _atom_map[a];}
int number_mapped_atoms () const;
void set_atom_map (atom_number_t a, int m) {assert (ok_atom_number (a)); _atom_map[a] = m;}
int transfer_atom_map_data_to_global_array();
int allocate_mdl_atom_array();
void set_aromatic_bonds_lose_kekule_identity (int s) { _aromatic_bonds_lose_kekule_identity = s;}
void set_preserve_kekule_forms (int s) { _preserve_kekule_forms= s;}
void set_swap_atoms_to_put_rare_atoms_first (int s) { _swap_atoms_to_put_rare_atoms_first = s;}
void set_molecule_is_sole_reagent (int s) { _molecule_is_sole_reagent = s;}
void set_remove_explicit_hydrogens (int s) { _remove_explicit_hydrogens = s;}
void set_convert_A_to_C_for_aromaticity (int s) { _convert_A_to_C_for_aromaticity = s;}
int single_reagent_only () const { return _molecule_is_sole_reagent;}
int which_is_mapped_atom (int) const;
int identify_unmapped_neighbour (int m, atom_number_t & n, int &);
int identify_unmapped_neighbours (int m, Set_of_Atoms & neighbour);
int identify_mapped_neighbours (atom_number_t zatom, resizable_array<int> & neighbour) const;
int identify_singly_bonded_mapped_neighbours (atom_number_t zatom, resizable_array<int> & neighbour) const;
int identify_connected_mapped_atoms (atom_number_t zatom, resizable_array<int> & connected_to) const;
// int transfer_isis_info_to_mqs (Molecule_to_Query_Specifications &) const;
int swap_atoms_to_put_rare_atoms_first ();
int create_query (Reaction_Site & r,
const int * include_these_atoms,
std::ofstream *queryOutStream);
int create_query (Reaction_Site & r,
const int * include_these_atoms,
Molecule_to_Query_Specifications & mqs,
std::ofstream *queryOutStream);
int add_chiral_centres_to_be_inverted (Reaction_Site &) const;
int nbonds_for_mapped_atom (int);
int discern_initial_conditions (int m, int final_nbonds);
int do_write (std::ostream &) const;
int add_toggle_kekule_form (atom_number_t, atom_number_t, bond_type_t);
int add_toggle_kekule_forms (Reaction_Site & rxn, const Reaction_Subset & subset, const int ndx,
const RXN_File_Create_Reaction_Options & rxnfcro) const;
int has_inter_fragment_changes () const;
int transfer_atom_alias_to_isotope ();
int assign_atom_types (Atom_Typing_Specification &);
const int * atom_type () const { return _atype;}
int gather_mapped_neighbours (const atom_number_t zatom, resizable_array<int> & nbrs) const;
};
/*
When working out the number of changing atoms in a reaction, we may want to impose
some conditions on what gets counted
*/
class Changing_Atom_Conditions
{
private:
// feb 2016. An atom is changing if the mapped atoms attached to it change during the reaction
int _is_changing_if_different_neighbours;
// may 2016. Sometimes we want to be able to ignore small fragments
int _ignore_lost_atom_if_isolated;
// jul 2016. We can have atoms in small fragments that really do not matter
int _only_consider_largest_reagent_fragment;
// Sep 2016. Sometimes it is useful to include changing bonds in determining changing atoms,
// but frequently not. Especially in the case where the only difference might be a Kekule
// representation
int _include_changing_bonds_in_changing_atom_count;
// Oct 2016. If we have previously added orphan atoms to the reagents, we may want to
// exclude those atoms when computing the changing atom count
int _discern_changing_atoms_only_in_first_fragment;
// Nov 2017. Sometimes we only consider bond aromaticity
int _consider_aromatic_bonds;
public:
Changing_Atom_Conditions();
void set_is_changing_if_different_neighbours (int s) { _is_changing_if_different_neighbours = s;}
void set_ignore_lost_atom_if_isolated (const int s) { _ignore_lost_atom_if_isolated = s;}
void set_only_consider_largest_reagent_fragment (const int s) { _only_consider_largest_reagent_fragment = s;}
void set_include_changing_bonds_in_changing_atom_count(const int s) { _include_changing_bonds_in_changing_atom_count = s;}
void set_discern_changing_atoms_only_in_first_fragment(const int s) { _discern_changing_atoms_only_in_first_fragment = s;}
void set_consider_aromatic_bonds(const int s) { _consider_aromatic_bonds = s;}
int is_changing_if_different_neighbours () const { return _is_changing_if_different_neighbours;}
int ignore_lost_atom_if_isolated () const { return _ignore_lost_atom_if_isolated;}
int only_consider_largest_reagent_fragment () const { return _only_consider_largest_reagent_fragment;}
int include_changing_bonds_in_changing_atom_count() const { return _include_changing_bonds_in_changing_atom_count;}
int discern_changing_atoms_only_in_first_fragment() const { return _discern_changing_atoms_only_in_first_fragment;}
int consider_aromatic_bonds() const { return _consider_aromatic_bonds;}
};
/*
When looking across from reagents to products, we need a data structure to make those
cross references faster. Otherwise we have to use the atom map to find the product locator,
then ask that product to fetch the atom number with that atom map.
For each atom map encountered in reagents, we store a 32 bit number. The first 16 bits are
the product number, and the last 16 bits are the atom number
*/
class Atom_Locations
{
private:
std::unordered_map<int, unsigned int> _reagent_to_product;
public:
Atom_Locations();
~Atom_Locations();
int initialise(ISIS_RXN_FILE_Molecule * reagents, const int nr, ISIS_RXN_FILE_Molecule * products, const int np, const int * product_locator);
int get_product_and_atom_number(const int amap, int & product, atom_number_t & zatom) const;
};
class Reaction_Smiles_Options
{
public:
int _reagent_product_plus_rather_than_dot;
//int _orphan_plus_rather_than_dot;
int _write_reaction_name;
int _write_agent;
//IWString _output_separator;
public:
Reaction_Smiles_Options();
void set_reagent_product_plus_rather_than_dot(const bool s) { _reagent_product_plus_rather_than_dot = s;}
//void set_orphan_plus_rather_than_dot(const int s) { _orphan_plus_rather_than_dot = s;}
void set_write_reaction_name(const int s) { _write_reaction_name = s;}
//void set_output_separator(const const_IWSubstring & s) { _output_separator = s;}
void set_write_agent (const int s) { _write_agent = s;}
bool reagent_product_plus_rather_than_dot() const { return _reagent_product_plus_rather_than_dot;}
//int orphan_plus_rather_than_dot() const { return _orphan_plus_rather_than_dot;}
int write_reaction_name() const { return _write_reaction_name;}
int write_agent() const { return _write_agent;}
//const IWString & output_separator() const { return _output_separator;}
};
class RXN_File
{
private:
IWString _fname;
IWString _comment;
int _nr;
ISIS_RXN_FILE_Molecule * _reagent;
int _np;
ISIS_RXN_FILE_Molecule * _product;
int _na;
ISIS_RXN_FILE_Molecule * _agent;
// If we have a reaction that produces atoms that are not present in the LHS
// we need somewhere to store those atoms. I do not want to store those
// atoms with any reagent since they would become part of the query
ISIS_RXN_FILE_Molecule _orphan_atoms;
// It is convenient to know the reagent for each mapped atom.
int * _reagent_locator;
int * _product_locator;
// for a given atom map number, what is the corresponding atom number. Note that
// the atom number will be in whatever reagent/product has that atom map
int * _atom_map_to_reagent_atom_number;
int * _atom_map_to_product_atom_number;
// Saves time to know the bonding status both before and after. But because we may extend the atom
// map, we need to keep the dimensionality of these arrays
int _btype_dim;
bond_type_t * _initial_bond_type;
bond_type_t * _final_bond_type;
// We can optionally remove all product fragments except the first
int _remove_product_fragments;
// These variables are only used during initial construction. We put them in the
// object just to avoid passing them around as arguments
int _unmapped_atoms_in_reagents;
int _unmapped_atoms_in_products;
// What if there is an unmapped atom of a given kind on the LHS but absent on the RHS
int _remove_unmapped_atoms_that_disappear;
int _aromatic_bonds_lose_kekule_identity;
int _preserve_kekule_forms;
int _swap_atoms_to_put_rare_atoms_first;
// Since we get told which reagent is a single reagent before we have read the .rxn file,
// we don't know the max number of reagents in advance. Therefore an extending array...
extending_resizable_array<int> _molecule_is_sole_reagent;
// If we need to echo the reaction after atom mapping
IWString _fname_for_echo;
int _do_automatic_atom_mapping;
// make removal of explicit Hydrogens optional
int _remove_explicit_hydrogens;
// Need to identify cases where a rearrangement across two bonds takes place
int * _involved_in_square_bond;
// We can optionally unconnect unmapped atoms that, which if left in place,
// would violate the valence of the product.
int _unconnect_unmapped_atoms_that_exceed_product_valence;
int _convert_A_to_C_for_aromaticity;
int _convert_atom_aliases_to_isotopes;
// Sept 2014. When processing files from Marvin, we need to NOT interpret
// atom aliases as smarts
int _interpret_atom_alias_as_smarts;
// Sept 2014. What do we do when we see a reaction with an atom list on the LHS
// and a carbon on the RHS. Did they mean to transform whatever matched in the
// reagent into a carbon atom, or was the carbon atom just a placeholder.
int _interpret_carbon_on_rhs_of_list_as_no_change;
int _auto_fix_orphans; // jan 2016
// Mar 2016. When creating subsets, we need to pass info to the molecule_to_query object that
// controls generation of the substructure query. But the Molecule_to_Query_Specifications object is
// not visible outside. Rather than changing a whole bunch of signatures to allow it, we have
// a bit of a kludge
int _mol2qry_isotope_special_meaning;
// Mar 2018. retrosynthetic_quick had a core dump when atoms that are parts of a bond that only changed
// its kekule form were NOT considered changed atoms. However, this code is used in many programs, and could
// cause changes in expected hehavior. A complete test of regression tests did NOT reveal any issues, so the default
// has been set to make these atoms as changed.
// Tad Hurst
int _mark_atoms_changed_when_kekule_form_of_bond_changes;
//
std::ofstream *_queryOutStream;
// private functions
int _identify_square_bonding_changes (int highest_atom_map);
int _identify_square (int m1, int m2, int m3) const;
int _create_reaction (IWReaction & rxn,
const RXN_File_Create_Reaction_Options & rxnfcro,
Molecule_to_Query_Specifications & mqs,
int highest_atom_map, const int * include_these_atoms);
int _looks_like_atom_replacement (int m,
resizable_array<int> & initial_connections,
resizable_array<int> & final_connections) const;
int _look_for_unmapped_atoms_that_exceed_product_valence (int highest_atom_map, IWReaction & rxn) const;
int _identify_bonds_to_be_broken (int highest_atom_map,
resizable_array_p<Bond> & bonds_to_be_broken,
const resizable_array_p<Bond> & connections_involved_in_substitutions,
const int * include_these_atom_map_numbers) const;
int _identify_bonds_to_be_made (int highest_atom_map,
resizable_array_p<Bond> & bonds_to_be_made,
const resizable_array_p<Bond> & connections_involved_in_substitutions,
const int * include_these_atom_map_numbers);
int _identify_isotopes_to_be_placed (int highest_atom_map, resizable_array_p<Reaction_Place_Isotope> & isotopes) const;
int _identify_atom_substitutions (int highest_atom_map,
resizable_array<Replace_Atom *> & atom_substitutions,
resizable_array_p<Bond> & connections_involved_in_substitutions) const;
void _specify_stereo_centre_component (Stereo_Centre_Component & s,
int centre_atom_reagent,
int our_reagent,
int mapped) const;
int _remove_unmapped_components (ISIS_RXN_FILE_Molecule * component, int & n);
#ifdef COMPILING_RXN_FILE
int _number_reagent_atoms () const;
int _number_product_atoms () const;
int _parse_ChemAxon_Extensions(const_IWSubstring buffer, IWString & smiles);
int _establish_atom_mapping (int & highest_atom_map_number);
int _establish_atom_mapping (const IW_Hash_Map<int, int> & unmapped_occurrences_in_reagents,
const IW_Hash_Map<int, int> & unmapped_occurrences_in_products,
int & highest_atom_map_number);
int _mapped_atoms_bonded_in_products (int m1, int m2) const;
int _reestablish_reagent_locator_array();
int _reestablish_locator_array(ISIS_RXN_FILE_Molecule * x, const int n, int * locator);
int _all_atoms_still_aromatic(ISIS_RXN_FILE_Molecule & m, const Ring & r);
int _fix_kekule_differences_reagent(const int rgnt);
template <typename CMP> int _identify_atoms_with_different_bonding (const ISIS_RXN_FILE_Molecule & m,
const Ring & r,
atom_number_t & a1,
atom_number_t & a2,
CMP compare,
const Set_of_Atoms & already_found) const;
// int _map_corresponding_atom_list (int highest_atom_map_number, const ISIS_Atom_List & als);
int _identify_corresponding_list_in_products (const ISIS_Atom_List & als, int &, atom_number_t &) const;
int _map_any_atom_lists_on_either_side (int & highest_atom_map_number);
int _map_symmetry_equivalent_atoms (int & highest_atom_map_number,
int r,
atom_number_t ar,
int p,
atom_number_t ap);
int _set_atom_map (int & highest_atom_map_number,
int r,
atom_number_t ar,
int p,
atom_number_t ap);
int _identify_kekule_forms_to_be_toggled (const int * include_these_atom_numbers);
int _changes_in_ring_membership (ISIS_RXN_FILE_Molecule & mfrom, const Ring & r) const;
void _fill_reagent_and_product_locator_arrays ();
int _setup_reagent_product_locator_arrays();
int _look_for_unmapped_atoms_that_disappear (int & highest_atom_map,
IWReaction & rxn,
const Reaction_Subset & subset,
const RXN_File_Create_Reaction_Options & rxnfcro);
int _identify_small_fragments_showing_up_in_products(const int rgnt, int * not_in_largest_fragment) const;
int _all_atoms_in_fragment_in_products(ISIS_RXN_FILE_Molecule & r, const int f, int * not_in_largest_fragment) const;
int _add_atom_removals (IWReaction & rxn, int h) const;
int _add_atom_removal (Reaction_Site & r, int h) const;
int _different_mapped_atoms_attached(const ISIS_RXN_FILE_Molecule & r, const atom_number_t zatom, const int zmap) const;
int _map_unmapped_surrounded_by_mapped (int & highest_atom_map_number);
int _identify_product_with_same_mapped_neighbours (int h,
const resizable_array<int> & mapped_neighbours,
int & pm,
atom_number_t & pa) const;
int _do_read_v3000(iwstring_data_source & input);
int _fix_orphan_condition (const Set_of_Atoms & orphans, const int p);
int _identify_bonding_changes_involving_matched_atom (const int mstart,
ISIS_RXN_FILE_Molecule & reagent,
ISIS_RXN_FILE_Molecule & product,
const int highest_atom_map,
resizable_array_p<Bond> & bonds_to_be_made,
const resizable_array_p<Bond> & connections_involved_in_substitutions,
const int * include_these_atom_map_numbers) const;
int _identify_bonds_to_be_made_involving_orphan (const resizable_array<int> & orphan,
resizable_array_p<Bond> & bonds_to_be_made,
const resizable_array_p<Bond> & connections_involved_in_substitutions);
int _identify_bonds_to_be_made_involving_orphan(resizable_array_p<Bond> & bonds_to_be_made,
const resizable_array_p<Bond> & connections_involved_in_substitutions) const;
int _identify_bonds_to_be_made_involving_orphan_atom(const int oi, // atom map number of the orphan atom
resizable_array_p<Bond> & bonds_to_be_made,
const resizable_array_p<Bond> & connections_involved_in_substitutions) const;
int _all_atom_maps_only_here (const ISIS_RXN_FILE_Molecule & m, const int * locator) const;
int _remove_common_fragments(ISIS_RXN_FILE_Molecule & r, ISIS_RXN_FILE_Molecule & p);
int _same_atoms_and_bonds(ISIS_RXN_FILE_Molecule & r, const int rf, ISIS_RXN_FILE_Molecule & p, const int pf) const;
int _atoms_the_same(ISIS_RXN_FILE_Molecule & m1, const atom_number_t a1, ISIS_RXN_FILE_Molecule & m2, const atom_number_t a2) const;
int _remove_non_participating_fragments (ISIS_RXN_FILE_Molecule & r);
int _identify_atoms_changing_by_bond_reagent(ISIS_RXN_FILE_Molecule & r, int * changed, const Changing_Atom_Conditions & cac) const;;
int _identify_just_changed_kekule_form(ISIS_RXN_FILE_Molecule & r, const atom_number_t zatom) const;
int _identify_just_changed_kekule_form(ISIS_RXN_FILE_Molecule & r, const int * changed, int * just_changed_kekule_form) const;
int _identify_atoms_in_rings_separated_from_changing_atoms(ISIS_RXN_FILE_Molecule & r, const int * changed, int * just_changed_kekule_form) const;
int _identify_atoms_in_rings_separated_from_changing_atoms(ISIS_RXN_FILE_Molecule & reagent, const Ring & r, const int * changed, int * just_changed_kekule_form) const;
int _involves_exocyclic_bonding_changes(const int rgnt, const Ring & r) const;
int _bond_the_same_in_product(const ISIS_RXN_FILE_Molecule & r, const Bond & b) const;
int _same_connectivity_and_bonds_in_product(const ISIS_RXN_FILE_Molecule & r, const atom_number_t x1) const;
int _loss_or_gain_of_singly_bonded_atom (const int rgnt, const int am) const;
template <typename T>
int _reaction_fingerprint_rev(const int p, // processing product molecule P
const T * reagent_atom_type,
const Product_Atom_Types & product_atom_type,
const Set_of_Atoms & changing_in_reagent,
const Set_of_Atoms & changing_in_product,
Sparse_Fingerprint_Creator & sfc);
template <typename T> int _form_possible_lost_or_changed_bond_fingerprint(const int m1, const int m2,
const Bond * b1, const T * reagent_atom_type, // in the reagent
const Bond * b2, const Product_Atom_Types & pat, // in the product
Sparse_Fingerprint_Creator & sfc) const;
/* template <typename T>
int _form_possible_lost_or_changed_bond_fingerprint(const int m1, const int m2,
const Bond * b1, const T * reagent_atom_type, // in the reagent
const Bond * b2, const Product_Atom_Types & pat, // in the product
Sparse_Fingerprint_Creator & sfc) const;*/
template <typename T>
int _reaction_fingerprint_bonds(const T * reagent_atom_type,
const Product_Atom_Types & product_atom_type,
Sparse_Fingerprint_Creator & sfc) const;
#endif
int _create_query (Reaction_Site & r,
ISIS_RXN_FILE_Molecule & m,
Molecule_to_Query_Specifications & mqs,
const int * include_these_atoms);
int _look_for_stereo_centres_made (IWReaction &);
int _map_unmapped_atoms (int & highest_atom_map_number);
int __map_unmapped_atoms (int & highest_atom_map_number);
int _aggressively_map_unmapped_atoms (int highest_atom_map_number);
int _highest_atom_map_number_or_atoms_in_reagents () const;
int _max_rings_in_any_reagent() const;
int _reagent_ring_contains_adjacent_mapped_atoms (const ISIS_RXN_FILE_Molecule & m,
const Ring & r, atom_number_t & a1, atom_number_t & a2,
const int * include_these_atom_map_numbers) const;
int _identify_changing_aromatic_systems(const int reagent_number, int * changed, const Changing_Atom_Conditions & cac) const;
int _all_bonds_unchanged(const ISIS_RXN_FILE_Molecule & m, const Ring & r) const;
void _update_aromatic_ring_system(ISIS_RXN_FILE_Molecule & m, const Ring & r, int * changed, const int flag, int * ring_already_done) const;
public:
RXN_File ();
~RXN_File ();
const IWString & name() const { return _comment;}
void set_name (const IWString & s) { _comment = s;}
int debug_print (std::ostream &) const;
int write_mapped_reaction (std::ostream & os) const;
int print_atom_map_into (std::ostream & output) const;
const IWString & fname () const { return _fname;}
void set_fname (const char * s) { _fname = s;}
int number_reagents() const { return _nr;}
int number_products() const { return _np;}
int number_agents() const { return _na;}
void setQueryOutStream(std::ofstream *thisStream){_queryOutStream = thisStream;}
//std::ofstream *queryOutStream() { return _queryOutStream;}
void set_remove_product_fragments (int s) { _remove_product_fragments = s;}
void set_remove_unmapped_atoms_that_disappear (int s) { _remove_unmapped_atoms_that_disappear = s;}
void set_aromatic_bonds_lose_kekule_identity (int s);
void set_preserve_kekule_forms (int s);
void set_swap_atoms_to_put_rare_atoms_first (int s) { _swap_atoms_to_put_rare_atoms_first = s;}
void set_molecule_is_sole_reagent (int, int);
void set_do_automatic_atom_mapping (int s) { _do_automatic_atom_mapping = s;}
void set_remove_explicit_hydrogens (int s) { _remove_explicit_hydrogens = s;}
void set_unconnect_unmapped_atoms_that_exceed_product_valence (int s) { _unconnect_unmapped_atoms_that_exceed_product_valence = s;}
void set_convert_A_to_C_for_aromaticity (int s) { _convert_A_to_C_for_aromaticity = s;}
void set_convert_atom_aliases_to_isotopes (int s) { _convert_atom_aliases_to_isotopes = s;}
void set_interpret_atom_alias_as_smarts (int s) { _interpret_atom_alias_as_smarts = s;}
void set_interpret_carbon_on_rhs_of_list_as_no_change (int s) { _interpret_carbon_on_rhs_of_list_as_no_change = s;}
void set_auto_fix_orphans (int s) { _auto_fix_orphans = s;}
// void set_is_changing_if_different_neighbours (int s) { _is_changing_if_different_neighbours = s;}
void set_mol2qry_isotope_special_meaning (int s) { _mol2qry_isotope_special_meaning = s;}
void set_mark_atoms_changed_when_kekule_form_of_bond_changes (int s) { _mark_atoms_changed_when_kekule_form_of_bond_changes = s;}
int contains_orphan_atoms() const { return _orphan_atoms.natoms();}
int check_for_widows_and_orphans ();
int all_reagents_the_same(); // identify duplicated reagents (drawing errors we have encountered). Will reset _nr to 1 if everything the same
int remove_duplicate_reagents_ignore_atom_map();
int remove_duplicate_products_ignore_atom_map();
int remove_duplicate_agents();
int remove_all_agents();
int reduce_to_largest_product();
int reduce_to_largest_reactant();
int reduce_to_largest_component(ISIS_RXN_FILE_Molecule *component, int &n);
int eliminate_reagents_not_participating();
int remove_fragments_not_participating ();
int remove_non_participating_fragments ();
int remove_unchanging_fragments();
int remove_unchanging_components();
int move_small_counterions_to_orphan_status();
int remove_cis_trans_bonding();
int contains_duplicate_atom_map_numbers() const;
int unmap_duplicate_atom_map_numbers();
void assign_unmapped_atoms();
int max_atom_in_any_reagent() const;
int max_atom_in_any_product() const;
int fix_kekule_differences();
int remove_duplicate_reagents_atom_maps_scrambled ();
void discard_atom_map ();
void set_fname_for_echo (const const_IWSubstring & s) { _fname_for_echo = s;}
int highest_atom_map_number () const;
int do_read (iwstring_data_source &);
int do_read (const const_IWSubstring &);
int build_from_reaction_smiles (const const_IWSubstring & buffer);
int do_write (std::ostream &) const;
int do_write (const char * fname) const;
template <typename T> int write_rxn_smiles(const Reaction_Smiles_Options &, T & output);
int prepare_for_reaction_construction (); // allocates arrays, filly reagent/product locator arrays, does atom mapping
int create_reaction (IWReaction &, const RXN_File_Create_Reaction_Options & rxnfcro, const int * include_these_atoms = NULL);
int create_reaction (IWReaction &, const RXN_File_Create_Reaction_Options & rxnfcro, Molecule_to_Query_Specifications & mqs, const int * include_these_atoms = NULL);
int transfer_atom_aliases_to_isotopes ();
int convert_unchanging_fragments_to_agents ();
ISIS_RXN_FILE_Molecule & reagent (const int i) { return _reagent[i];}
ISIS_RXN_FILE_Molecule & product (const int i) { return _product[i];}
int identify_atoms_changing_reagent (const int r, int *, const Changing_Atom_Conditions & cac);
int identify_atoms_changing_product (const int p, int *, const Changing_Atom_Conditions & cac);
int identify_atoms_changing_reagent (const int r, Atom_Typing_Specification & ats, int *, const Changing_Atom_Conditions & cac);
int identify_atoms_changing_product (const int p, Atom_Typing_Specification & ats, int *, const Changing_Atom_Conditions & cac);
int contains_isotopic_reagent_atoms() const;
int at_least_some_mapped_atoms_common_btw_reagents_and_products();
int largest_fragment_is_changed() const;
template <typename T> int reaction_fingerprint(const int * changing_atoms,
const T * reagent_atom_type,
const Product_Atom_Types & pat,
const int expand,
Sparse_Fingerprint_Creator & sfc);
int remove_unmapped_components ();
};
/*
Whereas the reagents will be a single molecule, the products may contain multiple different molecules.
We need a means of keeping track of their atom types
*/
class Product_Atom_Types
{
private:
int * _pstart;
int * _atom_type;
public:
Product_Atom_Types();
~Product_Atom_Types();
int initialise(RXN_File &, Atom_Typing_Specification & ats);
int atom_type(const int f, const atom_number_t a) const;
};
extern void set_warn_no_mapped_atoms(const int s);
extern int
parse_isis_rxn_file_options (Command_Line & cl,
char flag,
RXN_File & ISIS_rxn);
extern int
write_isis_reaction_file_header (int nr,
int np,
std::ostream &);
#endif
| 41.827851 | 172 | 0.709414 |
6dea5eac771508774777fc4cb4623c3ca1def088 | 969 | asm | Assembly | u7si/conversationKeys.asm | JohnGlassmyer/UltimaHacks | f9a114e00c4a1edf1ac7792b465feff2c9b88ced | [
"MIT"
] | 68 | 2018-03-04T22:34:22.000Z | 2022-03-10T15:18:32.000Z | u7si/conversationKeys.asm | ptrie/UltimaHacks | 2c3557a86d94ad8b54b26bc395b9aed1604f8be1 | [
"MIT"
] | 19 | 2018-11-20T04:06:49.000Z | 2021-11-08T16:37:10.000Z | u7si/conversationKeys.asm | ptrie/UltimaHacks | 2c3557a86d94ad8b54b26bc395b9aed1604f8be1 | [
"MIT"
] | 4 | 2020-09-01T17:57:36.000Z | 2022-01-04T20:51:11.000Z | %include "include/u7si-all-includes.asm"
defineAddress 323, 0x05C2, prepareConversationGump
defineAddress 323, 0x0C88, textLoop_procStart
defineAddress 323, 0x0CDD, textLoop_procEnd
defineAddress 323, 0x0C10, optionsLoop_beforeLoop
defineAddress 323, 0x0C65, optionsLoop_loopEnd
defineAddress 323, 0x0DC7, signLoop_start
defineAddress 323, 0x0DDB, signLoop_end
defineAddress 322, 0x0AA3, ConversationGump_checkGumpBounds
defineAddress 322, 0x0AFE, ConversationGump_callOptionsGump
defineAddress 322, 0x056E, OptionsGump_checkGumpBounds
defineAddress 322, 0x05E2, OptionsGump_notInBounds
defineAddress 322, 0x05E5, OptionsGump_considerOptions
defineAddress 322, 0x06D3, OptionsGump_checkOptionBounds
defineAddress 322, 0x073F, OptionsGump_withinOptionBounds
defineAddress 322, 0x07AC, OptionsGump_forOption
%macro callFunctionsInLoop 0
callFromOverlay playAmbientSounds
callFromOverlay cyclePalette
%endmacro
%include "../u7-common/patch-conversationKeys.asm"
| 32.3 | 59 | 0.864809 |
6c0b60f309590b65808b4c98654c55786a788278 | 7,752 | go | Go | server/source.go | mikedewar/st-core | 7211c25e6c543987c38f9a7c0efe55c24c9ee58d | [
"Apache-2.0"
] | 42 | 2015-01-07T14:01:06.000Z | 2021-06-12T07:14:32.000Z | server/source.go | mikedewar/st-core | 7211c25e6c543987c38f9a7c0efe55c24c9ee58d | [
"Apache-2.0"
] | 198 | 2015-01-02T15:47:49.000Z | 2016-06-09T19:11:40.000Z | server/source.go | mikedewar/st-core | 7211c25e6c543987c38f9a7c0efe55c24c9ee58d | [
"Apache-2.0"
] | 9 | 2015-04-13T14:48:08.000Z | 2021-07-25T11:43:19.000Z | package server
import (
"encoding/json"
"errors"
"io/ioutil"
"net/http"
"github.com/gorilla/mux"
"github.com/nytlabs/st-core/core"
"github.com/thejerf/suture"
)
type SourceLedger struct {
Label string `json:"label"`
Type string `json:"type"`
Id int `json:"id"`
Source core.Source `json:"-"`
Parent *Group `json:"-"`
Token suture.ServiceToken `json:"-"`
Position Position `json:"position"`
Parameters []map[string]string `json:"params"`
}
type ProtoSource struct {
Label string `json:"label"`
Type string `json:"type"`
Position Position `json:"position"`
Parent int `json:"parent"`
Parameters map[string]string `json:"params"`
}
func (sl *SourceLedger) GetID() int {
return sl.Id
}
func (sl *SourceLedger) GetParent() *Group {
return sl.Parent
}
func (sl *SourceLedger) SetParent(group *Group) {
sl.Parent = group
}
func (s *Server) ListSources() []SourceLedger {
sources := []SourceLedger{}
for _, source := range s.sources {
sources = append(sources, *source)
}
return sources
}
func (s *Server) SourceIndexHandler(w http.ResponseWriter, r *http.Request) {
s.Lock()
defer s.Unlock()
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
if err := json.NewEncoder(w).Encode(s.ListSources()); err != nil {
panic(err)
}
}
func (s *Server) SourceHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
s.Lock()
defer s.Unlock()
source, ok := s.sources[id]
if !ok {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not find source"})
return
}
w.WriteHeader(http.StatusOK)
writeJSON(w, source)
}
func (s *Server) CreateSource(p ProtoSource) (*SourceLedger, error) {
f, ok := s.sourceLibrary[p.Type]
if !ok {
return nil, errors.New("source type " + p.Type + " does not exist")
}
source := f.New()
sl := &SourceLedger{
Label: p.Label,
Position: p.Position,
Source: source,
Type: p.Type,
Id: s.GetNextID(),
Parameters: make([]map[string]string, 0), // this will get overwritten if we have parameters
}
if i, ok := source.(core.Interface); ok {
go i.Serve()
}
s.sources[sl.Id] = sl
s.websocketBroadcast(Update{Action: CREATE, Type: SOURCE, Data: wsSource{*sl}})
err := s.AddChildToGroup(p.Parent, sl)
if err != nil {
return nil, err
}
return sl, nil
}
func (s *Server) DeleteSource(id int) error {
source, ok := s.sources[id]
if !ok {
return errors.New("could not find source")
}
for _, l := range s.links {
if l.Source.Id == id {
err := s.DeleteLink(l.Id)
if err != nil {
return err
}
}
}
if si, ok := source.Source.(core.Interface); ok {
si.Stop()
}
s.DetachChild(source)
s.websocketBroadcast(Update{Action: DELETE, Type: SOURCE, Data: wsSource{wsId{id}}})
delete(s.sources, source.Id)
return nil
}
func (s *Server) SourceCreateHandler(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not read request body"})
return
}
var m ProtoSource
err = json.Unmarshal(body, &m)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"no ID supplied"})
return
}
s.Lock()
defer s.Unlock()
b, err := s.CreateSource(m)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{err.Error()})
return
}
w.WriteHeader(http.StatusOK)
writeJSON(w, b)
}
func (s *Server) SourceDeleteHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
s.Lock()
defer s.Unlock()
err = s.DeleteSource(id)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{err.Error()})
return
}
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) SourceGetValueHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
s.Lock()
defer s.Unlock()
val, err := s.GetSourceValue(id)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{err.Error()})
return
}
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(http.StatusOK)
w.Write(val)
}
func (s *Server) SourceModifyPositionHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not read request body"})
return
}
var p Position
err = json.Unmarshal(body, &p)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not read JSON"})
return
}
s.Lock()
defer s.Unlock()
b, ok := s.sources[id]
if !ok {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not find block"})
return
}
b.Position = p
s.websocketBroadcast(Update{Action: UPDATE, Type: SOURCE, Data: wsSource{wsPosition{wsId{id}, p}}})
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) SourceModifyNameHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not read request body"})
return
}
s.Lock()
defer s.Unlock()
_, ok := s.sources[id]
if !ok {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"block not found"})
return
}
var label string
err = json.Unmarshal(body, &label)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not unmarshal value"})
return
}
s.sources[id].Label = label
s.websocketBroadcast(Update{Action: UPDATE, Type: SOURCE, Data: wsSource{wsLabel{wsId{id}, label}}})
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) SourceSetValueHandler(w http.ResponseWriter, r *http.Request) {
id, err := getIDFromMux(mux.Vars(r))
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, err)
return
}
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{"could not read request body"})
return
}
s.Lock()
defer s.Unlock()
err = s.SetSourceValue(id, body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
writeJSON(w, Error{err.Error()})
return
}
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) GetSourceValue(id int) ([]byte, error) {
source, ok := s.sources[id]
if !ok {
return nil, errors.New("source does not exist")
}
store, ok := source.Source.(core.Store)
if !ok {
return nil, errors.New("can only get values from stores")
}
store.Lock()
defer store.Unlock()
out, err := json.Marshal(store.Get())
if err != nil {
return nil, err
}
return out, nil
}
func (s *Server) SetSourceValue(id int, body []byte) error {
source, ok := s.sources[id]
if !ok {
return errors.New("source does not exist")
}
store, ok := source.Source.(core.Store)
if !ok {
return errors.New("can only get values from stores")
}
var m interface{}
err := json.Unmarshal(body, &m)
if err != nil {
return err
}
store.Lock()
defer store.Unlock()
err = store.Set(m)
if err != nil {
return err
}
return nil
}
| 21.065217 | 101 | 0.659701 |
f3ccd5c22afef10b26083e3d85656a947b73db25 | 1,256 | asm | Assembly | programs/oeis/168/A168014.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/168/A168014.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/168/A168014.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A168014: Sum of all parts of all partitions of n into equal parts that do not contain 1 as a part.
; 0,0,2,3,8,5,18,7,24,18,30,11,60,13,42,45,64,17,90,19,100,63,66,23,168,50,78,81,140,29,210,31,160,99,102,105,288,37,114,117,280,41,294,43,220,225,138,47,432,98,250,153,260,53,378,165,392,171,174,59,660,61,186,315,384,195,462,67,340,207,490,71,792,73,222,375,380,231,546,79,720,324,246,83,924,255,258,261,616,89,990,273,460,279,282,285,1056,97,490,495,800,101,714,103,728,735,318,107,1188,109,770,333,1008,113,798,345,580,585,354,357,1800,242,366,369,620,375,1386,127,896,387,910,131,1452,399,402,945,952,137,966,139,1540,423,426,429,2016,435,438,735,740,149,1650,151,1064,765,1078,465,1716,157,474,477,1760,483,1458,163,820,1155,498,167,2520,338,1190,855,860,173,1218,875,1584,531,534,179,3060,181,1274,549,1288,555,1302,561,940,1323,1330,191,2496,193,582,1365,1568,197,2178,199,2200,603,606,609,2244,615,618,1035,1872,627,3150,211,1060,639,642,645,3240,651,654,657,2420,663,1554,223,2464,1800,678,227,2508,229,1610,1617,1624,233,2574,705,1180,711,1666,239,4560,241,1210,1215,1220,1225,1722,741,1736,747
mov $3,$0
sub $0,1
mov $2,$0
cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
mul $0,$3
mov $1,$0
sub $1,$2
sub $1,1
| 104.666667 | 1,004 | 0.730096 |
d944a5f70dbe111995e4efe2c6bc1f79cfe47b55 | 722 | swift | Swift | Sources/TDLibKit/Generated/Models/ToggleSupergroupSignMessages.swift | Swiftgram/TDLibKit | e78aef926cdd92323755bcb72309aa5afed1f02a | [
"MIT"
] | 7 | 2021-09-05T13:16:45.000Z | 2021-12-23T17:45:30.000Z | Sources/TDLibKit/Generated/Models/ToggleSupergroupSignMessages.swift | Swiftgram/TDLibKit | e78aef926cdd92323755bcb72309aa5afed1f02a | [
"MIT"
] | 4 | 2021-09-18T11:01:12.000Z | 2022-03-13T16:00:46.000Z | Sources/TDLibKit/Generated/Models/ToggleSupergroupSignMessages.swift | Swiftgram/TDLibKit | e78aef926cdd92323755bcb72309aa5afed1f02a | [
"MIT"
] | 1 | 2022-02-01T07:10:17.000Z | 2022-02-01T07:10:17.000Z | //
// ToggleSupergroupSignMessages.swift
// tl2swift
//
// Generated automatically. Any changes will be lost!
// Based on TDLib 1.8.0-fa8feefe
// https://github.com/tdlib/td/tree/fa8feefe
//
import Foundation
/// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right
public struct ToggleSupergroupSignMessages: Codable, Equatable {
/// New value of sign_messages
public let signMessages: Bool?
/// Identifier of the channel
public let supergroupId: Int64?
public init(
signMessages: Bool?,
supergroupId: Int64?
) {
self.signMessages = signMessages
self.supergroupId = supergroupId
}
}
| 22.5625 | 121 | 0.702216 |
f9d3c84ea329a805270da6b575d0ab4b7c4d695b | 325 | go | Go | engine/constants/economy.go | dadleyy/charlestown | 2d400ac51431efdc8e379a5e026f278dd0219545 | [
"MIT"
] | 1 | 2019-08-03T21:04:22.000Z | 2019-08-03T21:04:22.000Z | engine/constants/economy.go | dadleyy/charlestown | 2d400ac51431efdc8e379a5e026f278dd0219545 | [
"MIT"
] | null | null | null | engine/constants/economy.go | dadleyy/charlestown | 2d400ac51431efdc8e379a5e026f278dd0219545 | [
"MIT"
] | null | null | null | package constants
import "time"
const (
// EconomyMultiplier offsets building costs and income to make more sense.
EconomyMultiplier = 1000
// BaseTurnCardinality the amount of turns offered regardless of pop.
BaseTurnCardinality = 4
// TurnDuration is how many seconds turns are.
TurnDuration = time.Second * 10
)
| 21.666667 | 75 | 0.769231 |
fb65b26f17432cb7a33f9c6f0cc1d052f8055742 | 397 | c | C | library/usergroup/setgrent.c | sodero/clib2-1 | f1f328909735c88ec2e1d4059d1b941ba859ba91 | [
"Unlicense",
"BSD-3-Clause"
] | null | null | null | library/usergroup/setgrent.c | sodero/clib2-1 | f1f328909735c88ec2e1d4059d1b941ba859ba91 | [
"Unlicense",
"BSD-3-Clause"
] | null | null | null | library/usergroup/setgrent.c | sodero/clib2-1 | f1f328909735c88ec2e1d4059d1b941ba859ba91 | [
"Unlicense",
"BSD-3-Clause"
] | null | null | null | /*
* $Id: usergroup_setgrent.c,v 1.3 2006-01-08 12:04:27 clib2devs Exp $
*/
#ifndef _USERGROUP_HEADERS_H
#include "usergroup_headers.h"
#endif /* _USERGROUP_HEADERS_H */
/****************************************************************************/
void setgrent(void)
{
ENTER();
assert(__UserGroupBase != NULL);
__setgrent();
if (__check_abort_enabled)
__check_abort();
LEAVE();
}
| 16.541667 | 78 | 0.561713 |
0eda470dfb490e80d33bebd993f5d3d3e07a354c | 4,337 | c | C | sdk/sdk/codec/amrcodec/decode/lsp_avg.c | doyaGu/C0501Q_HWJL01 | 07a71328bd9038453cbb1cf9c276a3dd1e416d63 | [
"MIT"
] | 1 | 2021-10-09T08:05:50.000Z | 2021-10-09T08:05:50.000Z | sdk/sdk/codec/amrcodec/decode/lsp_avg.c | doyaGu/C0501Q_HWJL01 | 07a71328bd9038453cbb1cf9c276a3dd1e416d63 | [
"MIT"
] | null | null | null | sdk/sdk/codec/amrcodec/decode/lsp_avg.c | doyaGu/C0501Q_HWJL01 | 07a71328bd9038453cbb1cf9c276a3dd1e416d63 | [
"MIT"
] | null | null | null | /* OK
*****************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
* R99 Version 3.3.0
* REL-4 Version 4.1.0
*
*****************************************************************************
*
* File : lsp_avg.c
* Purpose: : LSP averaging and history
*
*****************************************************************************
*/
/*
*****************************************************************************
* MODULE INCLUDE FILE AND VERSION ID
*****************************************************************************
*/
#include "lsp_avg.h"
const char lsp_avg_id[] = "@(#)$Id $" lsp_avg_h;
/*
*****************************************************************************
* INCLUDE FILES
*****************************************************************************
*/
//#include <stdlib.h>
//#include <stdio.h>
#include "basic_op.h"
//#include "oper_32b.h"
//#include "count.h"
#include "q_plsf_5.tab"
#include "copy.h"
/*
*****************************************************************************
* LOCAL VARIABLES AND TABLES
*****************************************************************************
*/
lsp_avgState lsp_avgS;
/*
*****************************************************************************
* PUBLIC PROGRAM CODE
*****************************************************************************
*/
/*
**************************************************************************
*
* Function : lsp_avg_init
* Purpose : Allocates memory and initializes state variables
*
**************************************************************************
*/
void lsp_avg_init (lsp_avgState **state)
{
lsp_avgState* s;
// if (state == (lsp_avgState **) NULL){
// fprintf(stderr, "lsp_avg_init: invalid parameter\n");
// return -1;
// }
// *state = NULL;
/* allocate memory */
// if ((s = (lsp_avgState *) malloc(sizeof(lsp_avgState))) == NULL){
// fprintf(stderr, "lsp_avg_init: can not malloc state structure\n");
// return -1;
// }
s = &lsp_avgS;
lsp_avg_reset(s);
*state = s;
return;
}
/*
**************************************************************************
*
* Function : lsp_avg_reset
* Purpose : Resets state memory
*
**************************************************************************
*/
void lsp_avg_reset (lsp_avgState *st)
{
// if (st == (lsp_avgState *) NULL){
// fprintf(stderr, "lsp_avg_reset: invalid parameter\n");
// return -1;
// }
Copy(mean_lsf, &st->lsp_meanSave[0], M);
return;
}
/*
**************************************************************************
*
* Function : lsp_avg_exit
* Purpose : The memory used for state memory is freed
*
**************************************************************************
*/
//void lsp_avg_exit (lsp_avgState **state)
//{
// if (state == NULL || *state == NULL)
// return;
/* deallocate memory */
// free(*state);
// *state = NULL;
// return;
//}
/*
**************************************************************************
*
* Function : lsp_avg
* Purpose : Calculate the LSP averages
*
**************************************************************************
*/
void lsp_avg (
lsp_avgState *st, /* i/o : State struct Q15 */
Word16 *lsp /* i : state of the state machine Q15 */
)
{
Word32 i;
Word32 L_tmp; /* Q31 */
for (i = 0; i < M; i++) {
// /* mean = 0.84*mean */
// L_tmp = L_deposit_h(st->lsp_meanSave[i]);
// L_tmp -= (EXPCONST * st->lsp_meanSave[i]);
//
// /* Add 0.16 of newest LSPs to mean */
// L_tmp += (EXPCONST * lsp[i]);
// /* Save means */
// st->lsp_meanSave[i] = round16(L_tmp); /* Q15 */
/* mean = 0.84*mean */
L_tmp = -(EXPCONST * st->lsp_meanSave[i]);
/* Add 0.16 of newest LSPs to mean */
L_tmp += (EXPCONST * lsp[i]);
/* Save means */
st->lsp_meanSave[i] = (Word16)( ((L_tmp+0x00004000L)>>15) + st->lsp_meanSave[i]);
}
return;
}
| 27.27673 | 89 | 0.346092 |
6edf2338eafa31eb5303c681bde1a27ab3912a8c | 42,214 | tab | SQL | jet-hypothesis/src/test/f/lrc-02-4.tab | maurotalevi/jet | f24e96b45051e4f15f6a4959fcce1c12e6de4619 | [
"Apache-2.0"
] | 1 | 2017-11-06T23:10:47.000Z | 2017-11-06T23:10:47.000Z | jet-hypothesis/src/test/f/lrc-02-4.tab | codehaus/jet | 42423f56b955129258cf175153fbd7430e1df167 | [
"Apache-2.0"
] | null | null | null | jet-hypothesis/src/test/f/lrc-02-4.tab | codehaus/jet | 42423f56b955129258cf175153fbd7430e1df167 | [
"Apache-2.0"
] | null | null | null | Copyright (C) 1998 James G. MacKinnon, Alfred A. Haug, and Leo Michelis.
lm0-02-4 3 1
3.3474 0.021724
3.6605 0.017614
4.1236 0.012234
4.5152 0.009656
4.9651 0.007820
5.2584 0.007137
5.4765 0.006376
5.6553 0.006109
5.8124 0.005620
5.9494 0.005347
6.0705 0.005282
6.1797 0.005072
6.2804 0.004984
6.6996 0.004662
7.0210 0.004358
7.2841 0.004084
7.5174 0.004010
7.7231 0.003918
7.9130 0.003814
8.0850 0.003734
8.2440 0.003576
8.3902 0.003501
8.5300 0.003449
8.6617 0.003358
8.7865 0.003374
8.9068 0.003289
9.0222 0.003213
9.1339 0.003201
9.2402 0.003203
9.3445 0.003216
9.4441 0.003149
9.5418 0.003123
9.6377 0.003104
9.7305 0.003024
9.8205 0.002985
9.9090 0.003001
9.9964 0.002965
10.0828 0.002973
10.1665 0.002968
10.2488 0.002940
10.3297 0.002952
10.4096 0.002961
10.4868 0.002910
10.5632 0.002883
10.6389 0.002877
10.7137 0.002853
10.7873 0.002821
10.8602 0.002860
10.9321 0.002853
11.0037 0.002856
11.0751 0.002846
11.1452 0.002868
11.2135 0.002887
11.2822 0.002903
11.3499 0.002949
11.4160 0.002976
11.4825 0.002979
11.5477 0.003016
11.6132 0.003051
11.6785 0.003021
11.7428 0.003024
11.8065 0.003054
11.8701 0.003097
11.9332 0.003058
11.9959 0.003063
12.0587 0.003056
12.1213 0.003079
12.1820 0.003082
12.2450 0.003057
12.3067 0.003073
12.3671 0.003067
12.4280 0.003056
12.4881 0.003052
12.5489 0.003076
12.6099 0.003062
12.6705 0.003067
12.7310 0.003040
12.7910 0.003035
12.8508 0.003084
12.9108 0.003127
12.9710 0.003143
13.0305 0.003116
13.0903 0.003091
13.1490 0.003098
13.2081 0.003124
13.2676 0.003122
13.3265 0.003137
13.3854 0.003147
13.4444 0.003147
13.5032 0.003177
13.5626 0.003206
13.6221 0.003223
13.6808 0.003220
13.7398 0.003232
13.7984 0.003231
13.8581 0.003248
13.9169 0.003276
13.9753 0.003320
14.0346 0.003321
14.0949 0.003366
14.1539 0.003405
14.2141 0.003412
14.2733 0.003389
14.3334 0.003402
14.3928 0.003401
14.4529 0.003400
14.5130 0.003442
14.5728 0.003428
14.6340 0.003437
14.6950 0.003414
14.7556 0.003446
14.8166 0.003472
14.8773 0.003498
14.9385 0.003516
15.0004 0.003559
15.0619 0.003520
15.1238 0.003521
15.1860 0.003527
15.2497 0.003548
15.3125 0.003549
15.3753 0.003508
15.4392 0.003520
15.5030 0.003544
15.5666 0.003565
15.6313 0.003530
15.6954 0.003510
15.7608 0.003498
15.8261 0.003464
15.8921 0.003489
15.9577 0.003451
16.0247 0.003420
16.0912 0.003437
16.1585 0.003476
16.2264 0.003458
16.2954 0.003468
16.3647 0.003518
16.4347 0.003550
16.5049 0.003594
16.5757 0.003627
16.6464 0.003701
16.7181 0.003714
16.7905 0.003710
16.8633 0.003673
16.9377 0.003710
17.0112 0.003740
17.0869 0.003735
17.1623 0.003761
17.2393 0.003774
17.3156 0.003847
17.3933 0.003904
17.4723 0.003957
17.5513 0.004024
17.6327 0.004076
17.7155 0.004091
17.7981 0.004102
17.8821 0.004133
17.9673 0.004223
18.0522 0.004189
18.1396 0.004242
18.2279 0.004320
18.3170 0.004277
18.4072 0.004299
18.5000 0.004379
18.5933 0.004424
18.6884 0.004460
18.7846 0.004445
18.8836 0.004482
18.9833 0.004544
19.0843 0.004576
19.1872 0.004645
19.2934 0.004709
19.4007 0.004723
19.5107 0.004725
19.6215 0.004733
19.7357 0.004802
19.8515 0.004828
19.9718 0.004879
20.0940 0.004909
20.2182 0.004977
20.3468 0.004994
20.4797 0.005006
20.6140 0.005093
20.7531 0.005131
20.8963 0.005145
21.0450 0.005245
21.1963 0.005303
21.3522 0.005486
21.5155 0.005566
21.6846 0.005723
21.8602 0.005855
22.0456 0.006014
22.2378 0.006090
22.4366 0.006269
22.6472 0.006470
22.8697 0.006594
23.1017 0.006664
23.3482 0.006922
23.6108 0.007047
23.8926 0.007236
24.2015 0.007474
24.5297 0.007697
24.8885 0.008148
25.2864 0.008614
25.7365 0.009177
26.2495 0.009852
26.8469 0.010496
27.5600 0.011762
28.4749 0.013034
29.7302 0.015423
30.0562 0.016605
30.4109 0.017521
30.8056 0.018732
31.2760 0.020834
31.8142 0.022420
32.4863 0.024411
33.3168 0.028365
34.4665 0.034517
36.3823 0.047417
38.3505 0.064325
40.8560 0.105045
42.6034 0.137258
lm1-02-4 3 1
4.5386 0.024766
4.8909 0.019475
5.4407 0.014389
5.8981 0.011353
6.4243 0.009356
6.7522 0.008316
7.0048 0.007729
7.2088 0.007263
7.3808 0.006547
7.5338 0.005976
7.6721 0.005760
7.7954 0.005673
7.9092 0.005419
8.3753 0.005152
8.7329 0.004967
9.0280 0.004584
9.2859 0.004337
9.5120 0.004138
9.7197 0.004049
9.9074 0.003966
10.0824 0.003820
10.2489 0.003805
10.4023 0.003644
10.5480 0.003589
10.6859 0.003587
10.8176 0.003621
10.9454 0.003528
11.0667 0.003512
11.1845 0.003442
11.2988 0.003445
11.4085 0.003410
11.5162 0.003419
11.6193 0.003412
11.7189 0.003390
11.8179 0.003436
11.9151 0.003443
12.0099 0.003414
12.1029 0.003417
12.1932 0.003405
12.2826 0.003390
12.3699 0.003377
12.4566 0.003369
12.5416 0.003351
12.6259 0.003365
12.7082 0.003401
12.7896 0.003333
12.8687 0.003355
12.9482 0.003280
13.0267 0.003284
13.1037 0.003292
13.1795 0.003308
13.2555 0.003299
13.3301 0.003302
13.4041 0.003300
13.4771 0.003293
13.5493 0.003267
13.6211 0.003253
13.6938 0.003284
13.7650 0.003288
13.8358 0.003298
13.9051 0.003246
13.9744 0.003225
14.0431 0.003255
14.1116 0.003286
14.1799 0.003264
14.2477 0.003294
14.3155 0.003284
14.3827 0.003248
14.4495 0.003261
14.5158 0.003261
14.5811 0.003261
14.6477 0.003262
14.7138 0.003279
14.7787 0.003264
14.8429 0.003275
14.9080 0.003310
14.9728 0.003320
15.0376 0.003264
15.1023 0.003284
15.1666 0.003289
15.2310 0.003292
15.2955 0.003299
15.3598 0.003289
15.4238 0.003267
15.4866 0.003280
15.5514 0.003287
15.6154 0.003287
15.6788 0.003291
15.7420 0.003270
15.8055 0.003238
15.8683 0.003264
15.9317 0.003266
15.9952 0.003282
16.0582 0.003311
16.1213 0.003358
16.1846 0.003342
16.2480 0.003330
16.3122 0.003324
16.3753 0.003326
16.4389 0.003351
16.5025 0.003362
16.5662 0.003408
16.6304 0.003448
16.6946 0.003449
16.7581 0.003429
16.8227 0.003412
16.8872 0.003435
16.9525 0.003435
17.0165 0.003425
17.0810 0.003476
17.1453 0.003473
17.2101 0.003462
17.2763 0.003491
17.3420 0.003474
17.4079 0.003498
17.4745 0.003505
17.5408 0.003545
17.6083 0.003570
17.6750 0.003557
17.7418 0.003582
17.8089 0.003579
17.8765 0.003590
17.9453 0.003603
18.0139 0.003596
18.0824 0.003634
18.1525 0.003685
18.2222 0.003688
18.2927 0.003711
18.3632 0.003740
18.4343 0.003726
18.5053 0.003724
18.5762 0.003746
18.6475 0.003799
18.7204 0.003803
18.7937 0.003826
18.8670 0.003843
18.9412 0.003882
19.0162 0.003850
19.0913 0.003840
19.1669 0.003889
19.2433 0.003898
19.3197 0.003910
19.3974 0.003930
19.4757 0.003878
19.5546 0.003836
19.6340 0.003846
19.7154 0.003854
19.7969 0.003843
19.8792 0.003872
19.9621 0.003848
20.0448 0.003860
20.1304 0.003964
20.2167 0.003990
20.3033 0.004013
20.3919 0.004051
20.4802 0.004094
20.5711 0.004109
20.6627 0.004112
20.7555 0.004119
20.8494 0.004133
20.9436 0.004164
21.0398 0.004252
21.1375 0.004303
21.2340 0.004360
21.3346 0.004424
21.4362 0.004470
21.5406 0.004534
21.6464 0.004613
21.7529 0.004600
21.8601 0.004666
21.9711 0.004738
22.0845 0.004819
22.1998 0.004804
22.3185 0.004901
22.4400 0.004921
22.5623 0.005008
22.6887 0.005093
22.8171 0.005152
22.9500 0.005243
23.0850 0.005307
23.2245 0.005412
23.3678 0.005490
23.5133 0.005563
23.6648 0.005701
23.8222 0.005728
23.9849 0.005733
24.1488 0.005802
24.3188 0.005813
24.4977 0.005891
24.6845 0.006081
24.8762 0.006139
25.0758 0.006369
25.2857 0.006442
25.5052 0.006561
25.7417 0.006790
25.9876 0.007007
26.2492 0.007290
26.5251 0.007546
26.8239 0.007841
27.1385 0.008027
27.4805 0.008440
27.8536 0.008854
28.2705 0.009024
28.7339 0.009729
29.2723 0.010025
29.8906 0.011123
30.6415 0.011880
31.5834 0.013499
32.8977 0.016785
33.2313 0.017608
33.6168 0.018649
34.0400 0.019822
34.5274 0.021190
35.0902 0.023253
35.7701 0.025620
36.6400 0.029246
37.8917 0.034703
39.8901 0.048993
41.8742 0.067131
44.3507 0.109089
46.2557 0.146942
lm1s-02-4 3 1
5.4809 0.025354
5.8303 0.019336
6.3654 0.015294
6.8490 0.011780
7.3601 0.009851
7.6862 0.008343
7.9367 0.007072
8.1382 0.006502
8.3124 0.006314
8.4642 0.006106
8.5990 0.005952
8.7182 0.005782
8.8311 0.005586
9.2934 0.004943
9.6456 0.004591
9.9415 0.004360
10.1966 0.004128
10.4254 0.004041
10.6303 0.003918
10.8163 0.003844
10.9896 0.003747
11.1537 0.003620
11.3050 0.003586
11.4472 0.003600
11.5857 0.003601
11.7161 0.003619
11.8418 0.003592
11.9617 0.003575
12.0787 0.003570
12.1908 0.003526
12.2994 0.003439
12.4057 0.003349
12.5079 0.003370
12.6081 0.003445
12.7067 0.003404
12.8031 0.003347
12.8980 0.003319
12.9908 0.003308
13.0808 0.003269
13.1694 0.003286
13.2564 0.003295
13.3423 0.003260
13.4259 0.003237
13.5084 0.003226
13.5893 0.003241
13.6707 0.003259
13.7504 0.003244
13.8295 0.003279
13.9071 0.003270
13.9837 0.003232
14.0588 0.003234
14.1343 0.003251
14.2084 0.003285
14.2826 0.003261
14.3549 0.003232
14.4274 0.003225
14.4990 0.003250
14.5698 0.003254
14.6404 0.003235
14.7106 0.003225
14.7798 0.003215
14.8493 0.003265
14.9181 0.003253
14.9865 0.003230
15.0550 0.003189
15.1228 0.003161
15.1894 0.003141
15.2564 0.003164
15.3227 0.003148
15.3891 0.003141
15.4551 0.003162
15.5212 0.003186
15.5872 0.003201
15.6525 0.003247
15.7170 0.003269
15.7808 0.003308
15.8453 0.003313
15.9087 0.003300
15.9732 0.003319
16.0360 0.003331
16.1000 0.003327
16.1641 0.003343
16.2272 0.003331
16.2899 0.003341
16.3526 0.003294
16.4162 0.003297
16.4792 0.003253
16.5421 0.003288
16.6064 0.003280
16.6696 0.003331
16.7315 0.003313
16.7948 0.003328
16.8574 0.003313
16.9205 0.003270
16.9831 0.003282
17.0465 0.003312
17.1092 0.003315
17.1721 0.003312
17.2352 0.003313
17.2991 0.003339
17.3629 0.003320
17.4268 0.003321
17.4898 0.003349
17.5539 0.003377
17.6180 0.003416
17.6818 0.003417
17.7457 0.003424
17.8092 0.003449
17.8738 0.003420
17.9383 0.003396
18.0026 0.003388
18.0677 0.003408
18.1331 0.003402
18.1991 0.003380
18.2651 0.003396
18.3310 0.003393
18.3975 0.003406
18.4639 0.003428
18.5307 0.003417
18.5967 0.003431
18.6640 0.003466
18.7317 0.003482
18.7999 0.003492
18.8682 0.003550
18.9366 0.003542
19.0052 0.003530
19.0743 0.003549
19.1436 0.003572
19.2136 0.003617
19.2843 0.003605
19.3549 0.003609
19.4255 0.003581
19.4980 0.003625
19.5695 0.003659
19.6426 0.003660
19.7155 0.003687
19.7889 0.003658
19.8630 0.003644
19.9378 0.003667
20.0134 0.003690
20.0892 0.003701
20.1668 0.003737
20.2437 0.003786
20.3215 0.003805
20.4006 0.003855
20.4808 0.003842
20.5614 0.003847
20.6436 0.003890
20.7258 0.003920
20.8087 0.003903
20.8938 0.003910
20.9781 0.003932
21.0634 0.003953
21.1490 0.003983
21.2362 0.004015
21.3246 0.004028
21.4147 0.004060
21.5050 0.004127
21.5976 0.004150
21.6910 0.004178
21.7850 0.004170
21.8800 0.004219
21.9771 0.004230
22.0757 0.004327
22.1762 0.004358
22.2765 0.004441
22.3803 0.004491
22.4857 0.004517
22.5933 0.004550
22.7026 0.004568
22.8133 0.004624
22.9256 0.004737
23.0408 0.004819
23.1585 0.004936
23.2788 0.004984
23.4012 0.004974
23.5292 0.005043
23.6572 0.005144
23.7887 0.005190
23.9243 0.005258
24.0619 0.005248
24.2040 0.005311
24.3514 0.005327
24.5001 0.005386
24.6586 0.005494
24.8194 0.005633
24.9846 0.005753
25.1561 0.005772
25.3346 0.005854
25.5212 0.005895
25.7136 0.006014
25.9151 0.006137
26.1264 0.006279
26.3461 0.006504
26.5778 0.006852
26.8244 0.007188
27.0827 0.007238
27.3561 0.007573
27.6526 0.007780
27.9723 0.008256
28.3128 0.008377
28.6858 0.008669
29.1018 0.008925
29.5709 0.009434
30.1059 0.010214
30.7236 0.010907
31.4721 0.012130
32.4131 0.013745
33.7234 0.016810
34.0670 0.017862
34.4370 0.018777
34.8632 0.019703
35.3470 0.021031
35.9155 0.023566
36.5993 0.025489
37.4647 0.029207
38.7005 0.034594
40.7091 0.048396
42.7274 0.068070
45.2117 0.107348
47.1077 0.144344
lm2-02-4 2 1
5.9254 0.016427
6.3374 0.013028
6.9415 0.009191
7.4566 0.007843
8.0244 0.005752
8.3881 0.005163
8.6657 0.004679
8.8930 0.004425
9.0878 0.004084
9.2563 0.003926
9.4032 0.003844
9.5437 0.003752
9.6676 0.003629
10.1776 0.003268
10.5701 0.002970
10.8954 0.002844
11.1756 0.002698
11.4246 0.002672
11.6480 0.002533
11.8530 0.002508
12.0422 0.002496
12.2196 0.002449
12.3871 0.002347
12.5447 0.002340
12.6951 0.002262
12.8381 0.002259
12.9739 0.002226
13.1051 0.002181
13.2318 0.002141
13.3556 0.002112
13.4748 0.002052
13.5896 0.002057
13.7019 0.002040
13.8117 0.002055
13.9181 0.002060
14.0224 0.002036
14.1247 0.002050
14.2251 0.002052
14.3225 0.002044
14.4185 0.002052
14.5120 0.002031
14.6043 0.002030
14.6957 0.002036
14.7857 0.002005
14.8736 0.001998
14.9610 0.001985
15.0472 0.002035
15.1324 0.002052
15.2154 0.002055
15.2979 0.002060
15.3800 0.002027
15.4611 0.002030
15.5411 0.002028
15.6205 0.002021
15.6992 0.001992
15.7763 0.002020
15.8527 0.002020
15.9289 0.002018
16.0045 0.002035
16.0794 0.002041
16.1541 0.002058
16.2286 0.002057
16.3024 0.002059
16.3752 0.002040
16.4481 0.002047
16.5204 0.002035
16.5931 0.002033
16.6647 0.002048
16.7362 0.002065
16.8069 0.002029
16.8775 0.002018
16.9476 0.002014
17.0176 0.002034
17.0872 0.002027
17.1560 0.002023
17.2252 0.002022
17.2941 0.002018
17.3630 0.001994
17.4312 0.001983
17.4995 0.001982
17.5680 0.001976
17.6356 0.001979
17.7037 0.001973
17.7713 0.001952
17.8397 0.001942
17.9071 0.001948
17.9747 0.001951
18.0423 0.001972
18.1096 0.001963
18.1771 0.001993
18.2447 0.002004
18.3120 0.002020
18.3798 0.002023
18.4472 0.002042
18.5149 0.002057
18.5825 0.002056
18.6500 0.002058
18.7176 0.002069
18.7853 0.002069
18.8532 0.002076
18.9208 0.002081
18.9885 0.002077
19.0559 0.002110
19.1238 0.002140
19.1922 0.002129
19.2605 0.002107
19.3287 0.002097
19.3970 0.002104
19.4656 0.002112
19.5342 0.002095
19.6032 0.002119
19.6721 0.002111
19.7413 0.002123
19.8109 0.002100
19.8812 0.002105
19.9511 0.002106
20.0217 0.002092
20.0923 0.002085
20.1633 0.002107
20.2342 0.002113
20.3059 0.002129
20.3774 0.002140
20.4495 0.002173
20.5223 0.002173
20.5951 0.002175
20.6679 0.002202
20.7411 0.002233
20.8151 0.002259
20.8901 0.002259
20.9650 0.002238
21.0399 0.002254
21.1152 0.002270
21.1907 0.002232
21.2674 0.002246
21.3443 0.002246
21.4220 0.002252
21.5004 0.002273
21.5790 0.002275
21.6586 0.002274
21.7387 0.002292
21.8194 0.002307
21.9010 0.002306
21.9834 0.002302
22.0658 0.002320
22.1499 0.002352
22.2341 0.002386
22.3199 0.002382
22.4058 0.002380
22.4923 0.002404
22.5799 0.002414
22.6681 0.002406
22.7575 0.002415
22.8475 0.002438
22.9387 0.002467
23.0309 0.002484
23.1236 0.002532
23.2177 0.002567
23.3139 0.002558
23.4109 0.002543
23.5098 0.002552
23.6099 0.002553
23.7112 0.002574
23.8136 0.002630
23.9174 0.002691
24.0236 0.002723
24.1312 0.002746
24.2401 0.002769
24.3515 0.002812
24.4630 0.002864
24.5776 0.002870
24.6941 0.002915
24.8127 0.002909
24.9347 0.002930
25.0596 0.002947
25.1860 0.002954
25.3151 0.002951
25.4474 0.002958
25.5819 0.002988
25.7217 0.003054
25.8635 0.003072
26.0089 0.003123
26.1583 0.003166
26.3123 0.003192
26.4700 0.003234
26.6332 0.003261
26.8017 0.003319
26.9758 0.003374
27.1561 0.003448
27.3427 0.003493
27.5369 0.003562
27.7384 0.003559
27.9489 0.003683
28.1700 0.003744
28.3990 0.003791
28.6417 0.003848
28.8960 0.003942
29.1687 0.003979
29.4589 0.004143
29.7671 0.004217
30.0986 0.004419
30.4572 0.004521
30.8526 0.004719
31.2859 0.004933
31.7757 0.005438
32.3279 0.005795
32.9760 0.006340
33.7546 0.007011
34.7352 0.007932
36.0907 0.009213
36.4362 0.009847
36.8201 0.010752
37.2503 0.011546
37.7464 0.012347
38.3371 0.013476
39.0367 0.014551
39.9355 0.016897
41.1646 0.020867
43.2361 0.029876
45.2597 0.040594
47.8550 0.062199
49.7490 0.085924
lm2s-02-4 2 1
6.9816 0.016681
7.3816 0.013082
7.9616 0.009649
8.4595 0.007273
9.0178 0.005614
9.3774 0.004905
9.6481 0.004652
9.8713 0.004223
10.0555 0.003989
10.2257 0.003812
10.3753 0.003669
10.5099 0.003482
10.6336 0.003349
11.1342 0.002966
11.5207 0.002847
11.8405 0.002797
12.1158 0.002680
12.3605 0.002551
12.5833 0.002545
12.7859 0.002474
12.9731 0.002373
13.1468 0.002373
13.3103 0.002360
13.4649 0.002272
13.6131 0.002214
13.7549 0.002188
13.8895 0.002203
14.0201 0.002151
14.1464 0.002166
14.2677 0.002203
14.3852 0.002197
14.4993 0.002196
14.6106 0.002164
14.7188 0.002169
14.8240 0.002144
14.9273 0.002165
15.0280 0.002193
15.1270 0.002218
15.2235 0.002219
15.3185 0.002206
15.4119 0.002198
15.5041 0.002171
15.5940 0.002130
15.6827 0.002103
15.7701 0.002144
15.8561 0.002102
15.9412 0.002075
16.0252 0.002060
16.1083 0.002042
16.1900 0.002083
16.2710 0.002110
16.3510 0.002084
16.4303 0.002104
16.5097 0.002091
16.5876 0.002084
16.6646 0.002070
16.7416 0.002066
16.8173 0.002062
16.8925 0.002013
16.9672 0.002049
17.0411 0.002061
17.1142 0.002051
17.1871 0.002031
17.2594 0.002042
17.3320 0.002037
17.4038 0.002022
17.4749 0.002002
17.5460 0.001978
17.6162 0.001980
17.6869 0.001983
17.7568 0.001983
17.8268 0.001985
17.8966 0.001966
17.9655 0.001989
18.0344 0.002001
18.1028 0.001994
18.1708 0.002007
18.2389 0.002023
18.3070 0.001983
18.3755 0.001999
18.4436 0.002006
18.5117 0.002010
18.5795 0.002010
18.6469 0.002037
18.7144 0.002032
18.7814 0.002031
18.8485 0.002021
18.9157 0.002006
18.9824 0.002013
19.0495 0.002010
19.1165 0.002025
19.1837 0.002031
19.2507 0.002017
19.3177 0.002015
19.3846 0.002020
19.4516 0.002017
19.5188 0.002013
19.5857 0.002009
19.6527 0.002030
19.7195 0.002052
19.7870 0.002059
19.8545 0.002040
19.9221 0.002046
19.9899 0.002047
20.0579 0.002043
20.1252 0.002046
20.1931 0.002058
20.2610 0.002060
20.3293 0.002067
20.3979 0.002066
20.4665 0.002077
20.5354 0.002092
20.6044 0.002075
20.6733 0.002103
20.7429 0.002121
20.8123 0.002110
20.8824 0.002100
20.9524 0.002097
21.0230 0.002117
21.0936 0.002130
21.1638 0.002117
21.2356 0.002122
21.3076 0.002123
21.3794 0.002141
21.4519 0.002135
21.5246 0.002121
21.5980 0.002168
21.6715 0.002164
21.7453 0.002187
21.8195 0.002197
21.8939 0.002214
21.9692 0.002208
22.0454 0.002236
22.1223 0.002205
22.1998 0.002224
22.2768 0.002232
22.3549 0.002237
22.4333 0.002247
22.5123 0.002257
22.5917 0.002264
22.6716 0.002304
22.7523 0.002289
22.8331 0.002303
22.9160 0.002333
22.9992 0.002338
23.0826 0.002370
23.1668 0.002404
23.2518 0.002426
23.3379 0.002434
23.4249 0.002439
23.5133 0.002484
23.6027 0.002485
23.6927 0.002515
23.7839 0.002549
23.8760 0.002579
23.9691 0.002611
24.0626 0.002642
24.1581 0.002638
24.2549 0.002663
24.3532 0.002662
24.4530 0.002672
24.5533 0.002694
24.6559 0.002734
24.7597 0.002754
24.8650 0.002751
24.9724 0.002785
25.0805 0.002828
25.1915 0.002856
25.3040 0.002901
25.4181 0.002899
25.5352 0.002912
25.6542 0.002906
25.7755 0.002895
25.8998 0.002905
26.0264 0.002905
26.1547 0.002970
26.2867 0.003020
26.4221 0.003080
26.5600 0.003173
26.7018 0.003162
26.8463 0.003193
26.9954 0.003202
27.1480 0.003218
27.3062 0.003262
27.4677 0.003292
27.6369 0.003324
27.8104 0.003303
27.9902 0.003410
28.1764 0.003530
28.3693 0.003484
28.5703 0.003573
28.7793 0.003671
28.9999 0.003730
29.2292 0.003753
29.4718 0.003793
29.7269 0.003964
29.9963 0.004097
30.2823 0.004232
30.5912 0.004311
30.9214 0.004418
31.2785 0.004544
31.6698 0.004796
32.1044 0.004974
32.5918 0.005478
33.1476 0.005877
33.7953 0.006294
34.5699 0.006964
35.5529 0.007795
36.9071 0.009404
37.2496 0.009846
37.6321 0.010348
38.0665 0.011216
38.5598 0.011907
39.1492 0.013062
39.8618 0.014904
40.7527 0.017282
41.9773 0.020831
44.0310 0.030099
46.0842 0.041910
48.6457 0.060542
50.5166 0.084139
tr0-02-4 2 1
4.9503 0.018376
5.3931 0.015386
6.0727 0.011660
6.6504 0.008800
7.3317 0.007095
7.7632 0.006465
8.0944 0.006011
8.3664 0.005545
8.5953 0.005313
8.7967 0.005123
8.9773 0.004872
9.1400 0.004699
9.2894 0.004542
9.9058 0.004079
10.3814 0.003830
10.7771 0.003590
11.1182 0.003300
11.4208 0.003174
11.6957 0.003181
11.9450 0.003086
12.1766 0.002993
12.3942 0.002905
12.5987 0.002879
12.7925 0.002841
12.9754 0.002804
13.1514 0.002740
13.3203 0.002721
13.4802 0.002687
13.6356 0.002670
13.7866 0.002669
13.9323 0.002611
14.0734 0.002603
14.2104 0.002551
14.3436 0.002552
14.4752 0.002521
14.6039 0.002510
14.7292 0.002476
14.8516 0.002484
14.9715 0.002475
15.0875 0.002443
15.2022 0.002402
15.3150 0.002367
15.4259 0.002332
15.5361 0.002337
15.6441 0.002406
15.7510 0.002384
15.8560 0.002380
15.9597 0.002331
16.0626 0.002328
16.1635 0.002352
16.2636 0.002397
16.3618 0.002445
16.4603 0.002414
16.5574 0.002408
16.6534 0.002431
16.7483 0.002480
16.8417 0.002467
16.9347 0.002503
17.0276 0.002530
17.1194 0.002524
17.2106 0.002493
17.3011 0.002500
17.3902 0.002498
17.4794 0.002521
17.5682 0.002500
17.6558 0.002513
17.7433 0.002529
17.8305 0.002541
17.9166 0.002555
18.0026 0.002546
18.0884 0.002539
18.1734 0.002545
18.2583 0.002541
18.3428 0.002538
18.4267 0.002535
18.5104 0.002527
18.5938 0.002539
18.6776 0.002529
18.7605 0.002531
18.8430 0.002521
18.9253 0.002504
19.0083 0.002516
19.0907 0.002549
19.1728 0.002542
19.2546 0.002545
19.3364 0.002541
19.4187 0.002544
19.4999 0.002498
19.5812 0.002514
19.6630 0.002551
19.7445 0.002558
19.8259 0.002571
19.9068 0.002575
19.9881 0.002565
20.0692 0.002563
20.1502 0.002532
20.2314 0.002574
20.3125 0.002594
20.3932 0.002581
20.4743 0.002602
20.5557 0.002621
20.6368 0.002610
20.7188 0.002593
20.8004 0.002609
20.8816 0.002620
20.9630 0.002630
21.0454 0.002622
21.1278 0.002623
21.2103 0.002622
21.2931 0.002613
21.3761 0.002635
21.4590 0.002620
21.5425 0.002620
21.6258 0.002624
21.7096 0.002616
21.7938 0.002614
21.8783 0.002606
21.9622 0.002602
22.0467 0.002612
22.1319 0.002624
22.2175 0.002604
22.3033 0.002620
22.3890 0.002616
22.4752 0.002612
22.5620 0.002645
22.6494 0.002677
22.7371 0.002687
22.8253 0.002727
22.9136 0.002738
23.0023 0.002749
23.0919 0.002770
23.1816 0.002776
23.2718 0.002812
23.3628 0.002827
23.4538 0.002823
23.5463 0.002812
23.6394 0.002846
23.7330 0.002852
23.8261 0.002858
23.9213 0.002889
24.0171 0.002905
24.1130 0.002885
24.2105 0.002891
24.3075 0.002883
24.4068 0.002909
24.5070 0.002922
24.6066 0.002959
24.7074 0.002973
24.8085 0.003014
24.9116 0.003000
25.0153 0.003004
25.1205 0.002992
25.2264 0.002983
25.3341 0.002973
25.4431 0.002981
25.5536 0.003017
25.6644 0.002980
25.7772 0.003061
25.8914 0.003104
26.0070 0.003116
26.1240 0.003081
26.2418 0.003101
26.3622 0.003124
26.4844 0.003137
26.6072 0.003167
26.7334 0.003193
26.8619 0.003237
26.9913 0.003288
27.1233 0.003306
27.2581 0.003338
27.3935 0.003401
27.5324 0.003479
27.6747 0.003488
27.8191 0.003511
27.9656 0.003541
28.1166 0.003615
28.2716 0.003673
28.4295 0.003663
28.5903 0.003667
28.7545 0.003706
28.9215 0.003737
29.0953 0.003777
29.2733 0.003853
29.4549 0.003890
29.6430 0.003904
29.8372 0.004009
30.0368 0.004081
30.2437 0.004228
30.4584 0.004319
30.6817 0.004402
30.9139 0.004467
31.1558 0.004522
31.4094 0.004631
31.6739 0.004775
31.9518 0.004880
32.2446 0.004953
32.5558 0.005081
32.8884 0.005304
33.2414 0.005494
33.6225 0.005770
34.0353 0.006003
34.4825 0.006292
34.9777 0.006602
35.5286 0.006712
36.1585 0.007101
36.8866 0.007825
37.7655 0.008674
38.8637 0.009729
40.3841 0.011651
40.7678 0.011929
41.1946 0.012596
41.6756 0.013329
42.2276 0.014382
42.8692 0.015136
43.6581 0.016964
44.6613 0.019731
46.0383 0.023383
48.3511 0.031406
50.5523 0.041743
53.4616 0.064017
55.6112 0.089952
tr1-02-4 3 1
6.7219 0.039986
7.3023 0.031907
8.1176 0.023708
8.7985 0.018478
9.5923 0.015003
10.1291 0.012709
10.5156 0.011642
10.8314 0.010977
11.0971 0.010143
11.3403 0.009473
11.5505 0.009109
11.7381 0.008964
11.9148 0.008680
12.6194 0.007515
13.1628 0.006815
13.6107 0.006469
13.9983 0.006158
14.3471 0.005930
14.6605 0.005635
14.9462 0.005469
15.2078 0.005444
15.4517 0.005259
15.6802 0.005314
15.8971 0.005264
16.1042 0.005248
16.3023 0.005062
16.4918 0.005023
16.6727 0.004955
16.8472 0.004966
17.0154 0.004927
17.1790 0.004897
17.3367 0.004894
17.4881 0.004867
17.6378 0.004847
17.7822 0.004800
17.9258 0.004807
18.0650 0.004833
18.2004 0.004794
18.3344 0.004750
18.4643 0.004743
18.5930 0.004666
18.7169 0.004611
18.8405 0.004539
18.9632 0.004543
19.0846 0.004496
19.2038 0.004429
19.3201 0.004416
19.4367 0.004472
19.5492 0.004432
19.6621 0.004403
19.7722 0.004385
19.8816 0.004299
19.9894 0.004316
20.0957 0.004297
20.2020 0.004347
20.3070 0.004325
20.4107 0.004287
20.5130 0.004312
20.6147 0.004304
20.7143 0.004274
20.8155 0.004284
20.9161 0.004336
21.0146 0.004262
21.1117 0.004312
21.2082 0.004354
21.3036 0.004316
21.3996 0.004325
21.4944 0.004368
21.5904 0.004278
21.6845 0.004321
21.7790 0.004408
21.8722 0.004512
21.9650 0.004499
22.0585 0.004488
22.1518 0.004517
22.2439 0.004474
22.3351 0.004457
22.4254 0.004471
22.5174 0.004472
22.6079 0.004446
22.6990 0.004443
22.7889 0.004447
22.8788 0.004471
22.9678 0.004471
23.0572 0.004467
23.1457 0.004535
23.2353 0.004572
23.3252 0.004613
23.4130 0.004602
23.5020 0.004612
23.5919 0.004623
23.6810 0.004677
23.7698 0.004663
23.8583 0.004678
23.9465 0.004719
24.0361 0.004679
24.1247 0.004678
24.2136 0.004607
24.3008 0.004588
24.3892 0.004588
24.4787 0.004620
24.5668 0.004653
24.6556 0.004672
24.7447 0.004671
24.8346 0.004665
24.9246 0.004665
25.0138 0.004697
25.1030 0.004637
25.1937 0.004703
25.2837 0.004792
25.3739 0.004792
25.4627 0.004869
25.5523 0.004880
25.6432 0.004858
25.7344 0.004897
25.8259 0.004924
25.9178 0.004926
26.0103 0.004966
26.1031 0.004973
26.1953 0.004960
26.2876 0.004959
26.3808 0.004976
26.4753 0.005013
26.5682 0.005085
26.6629 0.005112
26.7573 0.005187
26.8530 0.005195
26.9478 0.005185
27.0435 0.005227
27.1400 0.005179
27.2368 0.005204
27.3345 0.005217
27.4317 0.005200
27.5297 0.005200
27.6294 0.005338
27.7298 0.005326
27.8309 0.005358
27.9329 0.005316
28.0344 0.005316
28.1365 0.005397
28.2392 0.005369
28.3424 0.005413
28.4490 0.005408
28.5549 0.005427
28.6608 0.005477
28.7682 0.005476
28.8761 0.005512
28.9869 0.005474
29.0959 0.005478
29.2072 0.005500
29.3191 0.005553
29.4323 0.005583
29.5450 0.005666
29.6611 0.005700
29.7782 0.005713
29.8948 0.005723
30.0160 0.005748
30.1375 0.005842
30.2595 0.005867
30.3829 0.005854
30.5087 0.005832
30.6360 0.005879
30.7659 0.005938
30.8967 0.005995
31.0299 0.006025
31.1670 0.006006
31.3030 0.006036
31.4397 0.006113
31.5821 0.006174
31.7259 0.006219
31.8724 0.006261
32.0229 0.006273
32.1754 0.006304
32.3302 0.006331
32.4892 0.006401
32.6507 0.006389
32.8158 0.006522
32.9845 0.006539
33.1544 0.006614
33.3279 0.006611
33.5081 0.006689
33.6915 0.006894
33.8839 0.006995
34.0779 0.007140
34.2781 0.007324
34.4885 0.007370
34.7042 0.007429
34.9271 0.007505
35.1569 0.007735
35.3948 0.007781
35.6443 0.007863
35.9031 0.007992
36.1727 0.008141
36.4536 0.008398
36.7515 0.008728
37.0624 0.008893
37.3925 0.009013
37.7447 0.009390
38.1183 0.009555
38.5166 0.009768
38.9532 0.010300
39.4294 0.011052
39.9499 0.011424
40.5336 0.011961
41.1935 0.012819
41.9721 0.013300
42.9098 0.014461
44.0840 0.017479
45.6945 0.020326
46.1145 0.021972
46.5731 0.023642
47.0677 0.024957
47.6420 0.026703
48.3411 0.028715
49.1620 0.031900
50.2327 0.035284
51.6882 0.043051
54.0538 0.060099
56.4510 0.084018
59.7124 0.121425
61.8283 0.179160
tr1s-02-4 2 1
9.0245 0.023672
9.5775 0.018570
10.3946 0.013011
11.1047 0.010391
11.8800 0.008683
12.3908 0.007348
12.7746 0.006696
13.0840 0.006041
13.3515 0.005481
13.5820 0.005428
13.7912 0.005236
13.9766 0.005008
14.1472 0.004885
14.8451 0.004367
15.3807 0.003817
15.8209 0.003576
16.2011 0.003413
16.5389 0.003311
16.8422 0.003255
17.1212 0.003221
17.3769 0.003076
17.6168 0.003121
17.8425 0.003018
18.0542 0.003016
18.2562 0.003032
18.4486 0.003019
18.6322 0.003008
18.8107 0.002892
18.9804 0.002886
19.1446 0.002841
19.3042 0.002801
19.4597 0.002742
19.6109 0.002746
19.7576 0.002649
19.8997 0.002587
20.0386 0.002597
20.1756 0.002550
20.3098 0.002570
20.4406 0.002563
20.5694 0.002569
20.6943 0.002540
20.8183 0.002561
20.9392 0.002496
21.0583 0.002487
21.1757 0.002486
21.2910 0.002438
21.4046 0.002464
21.5172 0.002468
21.6276 0.002475
21.7374 0.002477
21.8456 0.002509
21.9526 0.002482
22.0591 0.002488
22.1641 0.002508
22.2682 0.002522
22.3711 0.002502
22.4733 0.002529
22.5747 0.002521
22.6756 0.002511
22.7748 0.002500
22.8736 0.002511
22.9708 0.002523
23.0674 0.002518
23.1642 0.002529
23.2602 0.002493
23.3558 0.002461
23.4499 0.002478
23.5440 0.002477
23.6380 0.002540
23.7314 0.002535
23.8240 0.002567
23.9163 0.002547
24.0086 0.002596
24.1001 0.002611
24.1916 0.002621
24.2829 0.002601
24.3736 0.002603
24.4640 0.002625
24.5536 0.002621
24.6431 0.002643
24.7329 0.002667
24.8219 0.002645
24.9111 0.002634
24.9987 0.002589
25.0871 0.002578
25.1752 0.002587
25.2638 0.002632
25.3511 0.002632
25.4392 0.002620
25.5260 0.002655
25.6135 0.002647
25.7009 0.002659
25.7880 0.002662
25.8753 0.002673
25.9625 0.002673
26.0505 0.002653
26.1379 0.002674
26.2251 0.002692
26.3126 0.002727
26.4006 0.002736
26.4871 0.002732
26.5740 0.002741
26.6613 0.002773
26.7484 0.002781
26.8366 0.002754
26.9248 0.002767
27.0131 0.002793
27.1010 0.002777
27.1887 0.002774
27.2775 0.002791
27.3661 0.002802
27.4550 0.002770
27.5437 0.002777
27.6332 0.002802
27.7232 0.002848
27.8135 0.002872
27.9034 0.002897
27.9942 0.002905
28.0851 0.002915
28.1769 0.002925
28.2687 0.002935
28.3615 0.002957
28.4533 0.002980
28.5456 0.002998
28.6385 0.002998
28.7318 0.002994
28.8251 0.002994
28.9196 0.003021
29.0142 0.003029
29.1101 0.003030
29.2061 0.003026
29.3021 0.003067
29.3994 0.003069
29.4971 0.003073
29.5953 0.003093
29.6935 0.003077
29.7923 0.003089
29.8925 0.003106
29.9936 0.003134
30.0952 0.003141
30.1970 0.003169
30.3002 0.003199
30.4043 0.003202
30.5085 0.003185
30.6129 0.003210
30.7189 0.003227
30.8266 0.003212
30.9352 0.003217
31.0442 0.003219
31.1538 0.003219
31.2648 0.003226
31.3769 0.003273
31.4900 0.003254
31.6047 0.003212
31.7212 0.003246
31.8388 0.003257
31.9573 0.003287
32.0775 0.003316
32.1986 0.003319
32.3219 0.003346
32.4468 0.003378
32.5731 0.003355
32.7016 0.003356
32.8321 0.003324
32.9643 0.003355
33.0981 0.003394
33.2340 0.003421
33.3725 0.003397
33.5115 0.003457
33.6542 0.003507
33.8004 0.003514
33.9496 0.003534
34.1010 0.003568
34.2544 0.003589
34.4126 0.003612
34.5726 0.003611
34.7377 0.003693
34.9044 0.003800
35.0757 0.003805
35.2506 0.003828
35.4300 0.003907
35.6146 0.003901
35.8035 0.003953
35.9993 0.004042
36.1997 0.004109
36.4065 0.004153
36.6193 0.004270
36.8398 0.004378
37.0679 0.004405
37.3045 0.004433
37.5519 0.004484
37.8083 0.004601
38.0784 0.004734
38.3586 0.004924
38.6546 0.005051
38.9644 0.005241
39.2921 0.005377
39.6407 0.005452
40.0137 0.005599
40.4134 0.005794
40.8472 0.006045
41.3208 0.006222
41.8419 0.006517
42.4295 0.007001
43.0890 0.007187
43.8590 0.007735
44.7954 0.008753
45.9602 0.009727
47.5530 0.012053
47.9597 0.012565
48.4113 0.013044
48.9192 0.014219
49.5027 0.015279
50.1932 0.016110
51.0093 0.017501
52.0586 0.019844
53.4869 0.024263
55.8537 0.034568
58.2055 0.050211
61.1966 0.074157
63.4144 0.105009
tr2-02-4 2 1
9.0099 0.028965
9.6775 0.022058
10.6392 0.016352
11.4611 0.012073
12.3525 0.009547
12.9409 0.008436
13.3785 0.007573
13.7429 0.006635
14.0467 0.006314
14.3092 0.006153
14.5463 0.005911
14.7634 0.005660
14.9608 0.005602
15.7580 0.004982
16.3656 0.004510
16.8681 0.004381
17.3022 0.004114
17.6860 0.003958
18.0312 0.003869
18.3463 0.003844
18.6356 0.003708
18.9074 0.003623
19.1589 0.003589
19.3992 0.003518
19.6255 0.003474
19.8419 0.003357
20.0479 0.003219
20.2453 0.003150
20.4368 0.003084
20.6214 0.003068
20.8007 0.003076
20.9732 0.003028
21.1404 0.003013
21.3035 0.002951
21.4632 0.002929
21.6196 0.002946
21.7710 0.002917
21.9180 0.002928
22.0632 0.002895
22.2056 0.002906
22.3450 0.002854
22.4815 0.002871
22.6165 0.002871
22.7483 0.002864
22.8779 0.002824
23.0057 0.002829
23.1321 0.002846
23.2563 0.002854
23.3780 0.002827
23.4985 0.002865
23.6190 0.002845
23.7367 0.002877
23.8537 0.002905
23.9686 0.002891
24.0831 0.002872
24.1963 0.002858
24.3082 0.002849
24.4197 0.002841
24.5303 0.002857
24.6388 0.002823
24.7476 0.002815
24.8560 0.002797
24.9628 0.002753
25.0689 0.002774
25.1742 0.002778
25.2791 0.002737
25.3833 0.002731
25.4873 0.002733
25.5904 0.002744
25.6922 0.002731
25.7935 0.002740
25.8944 0.002752
25.9945 0.002753
26.0938 0.002776
26.1937 0.002775
26.2928 0.002813
26.3918 0.002836
26.4903 0.002830
26.5884 0.002837
26.6861 0.002845
26.7828 0.002834
26.8803 0.002842
26.9769 0.002848
27.0735 0.002834
27.1699 0.002835
27.2663 0.002855
27.3631 0.002857
27.4592 0.002869
27.5544 0.002828
27.6496 0.002831
27.7450 0.002816
27.8409 0.002823
27.9353 0.002832
28.0303 0.002845
28.1251 0.002868
28.2205 0.002886
28.3153 0.002854
28.4098 0.002838
28.5053 0.002801
28.6011 0.002814
28.6954 0.002837
28.7901 0.002832
28.8855 0.002804
28.9808 0.002798
29.0762 0.002769
29.1720 0.002759
29.2680 0.002792
29.3635 0.002815
29.4596 0.002803
29.5556 0.002821
29.6522 0.002838
29.7490 0.002849
29.8454 0.002887
29.9422 0.002881
30.0391 0.002878
30.1369 0.002871
30.2349 0.002880
30.3333 0.002895
30.4316 0.002878
30.5308 0.002909
30.6300 0.002925
30.7295 0.002932
30.8284 0.002941
30.9284 0.002942
31.0283 0.002956
31.1294 0.002965
31.2310 0.002965
31.3325 0.002985
31.4350 0.002979
31.5377 0.002993
31.6412 0.003033
31.7450 0.003024
31.8500 0.003107
31.9556 0.003105
32.0608 0.003135
32.1676 0.003163
32.2745 0.003188
32.3822 0.003189
32.4899 0.003193
32.5989 0.003218
32.7079 0.003238
32.8193 0.003280
32.9309 0.003266
33.0426 0.003278
33.1557 0.003298
33.2699 0.003332
33.3849 0.003339
33.5018 0.003352
33.6200 0.003373
33.7376 0.003348
33.8569 0.003355
33.9781 0.003362
34.0995 0.003361
34.2227 0.003447
34.3467 0.003469
34.4729 0.003517
34.6012 0.003582
34.7301 0.003589
34.8605 0.003604
34.9924 0.003567
35.1256 0.003589
35.2604 0.003606
35.3988 0.003615
35.5384 0.003649
35.6797 0.003661
35.8232 0.003697
35.9685 0.003699
36.1171 0.003738
36.2672 0.003797
36.4200 0.003800
36.5737 0.003842
36.7313 0.003828
36.8920 0.003856
37.0565 0.003902
37.2232 0.003985
37.3950 0.004047
37.5704 0.004090
37.7501 0.004144
37.9316 0.004203
38.1186 0.004185
38.3087 0.004168
38.5060 0.004222
38.7098 0.004225
38.9173 0.004318
39.1287 0.004342
39.3479 0.004389
39.5747 0.004468
39.8084 0.004524
40.0496 0.004569
40.3000 0.004637
40.5633 0.004800
40.8357 0.004848
41.1210 0.004868
41.4182 0.004940
41.7335 0.004925
42.0636 0.005092
42.4131 0.005172
42.7801 0.005317
43.1755 0.005616
43.5987 0.005808
44.0565 0.006085
44.5581 0.006348
45.1089 0.006767
45.7268 0.007057
46.4251 0.007524
47.2358 0.007855
48.2138 0.008758
49.4400 0.009763
51.1240 0.012453
51.5558 0.013219
52.0242 0.014094
52.5605 0.014723
53.1656 0.016059
53.8741 0.017930
54.7268 0.019682
55.7987 0.022165
57.3266 0.026213
59.8321 0.036095
62.2460 0.049228
65.3085 0.068998
67.6163 0.100439
tr2s-02-4 2 1
11.6146 0.027011
12.2615 0.020813
13.1978 0.015760
13.9668 0.011984
14.8432 0.008877
15.4027 0.007563
15.8238 0.006909
16.1706 0.006605
16.4593 0.006078
16.7128 0.005769
16.9415 0.005661
17.1469 0.005541
17.3331 0.005373
18.1019 0.004816
18.6911 0.004377
19.1731 0.004359
19.5878 0.004124
19.9575 0.003921
20.2900 0.003784
20.5911 0.003620
20.8718 0.003451
21.1324 0.003421
21.3756 0.003355
21.6082 0.003349
21.8287 0.003242
22.0377 0.003184
22.2391 0.003171
22.4310 0.003095
22.6169 0.003007
22.7957 0.003003
22.9683 0.002970
23.1377 0.002934
23.3003 0.002966
23.4581 0.002961
23.6130 0.002937
23.7626 0.002938
23.9087 0.002937
24.0523 0.002936
24.1937 0.002929
24.3315 0.002910
24.4666 0.002859
24.5995 0.002873
24.7288 0.002855
24.8580 0.002817
24.9844 0.002785
25.1102 0.002798
25.2336 0.002817
25.3544 0.002803
25.4740 0.002828
25.5920 0.002848
25.7096 0.002893
25.8248 0.002837
25.9389 0.002808
26.0515 0.002798
26.1630 0.002810
26.2738 0.002815
26.3837 0.002753
26.4928 0.002747
26.6003 0.002751
26.7074 0.002716
26.8135 0.002672
26.9183 0.002719
27.0231 0.002722
27.1271 0.002741
27.2295 0.002765
27.3322 0.002734
27.4339 0.002736
27.5344 0.002760
27.6348 0.002744
27.7345 0.002754
27.8337 0.002803
27.9325 0.002822
28.0318 0.002810
28.1298 0.002815
28.2274 0.002804
28.3247 0.002833
28.4218 0.002854
28.5191 0.002823
28.6153 0.002809
28.7112 0.002798
28.8070 0.002829
28.9025 0.002821
28.9985 0.002811
29.0939 0.002794
29.1890 0.002793
29.2837 0.002810
29.3780 0.002819
29.4718 0.002811
29.5654 0.002784
29.6594 0.002791
29.7530 0.002773
29.8464 0.002824
29.9402 0.002822
30.0333 0.002825
30.1273 0.002839
30.2211 0.002839
30.3146 0.002837
30.4081 0.002871
30.5016 0.002855
30.5949 0.002839
30.6886 0.002831
30.7823 0.002835
30.8762 0.002843
30.9697 0.002817
31.0635 0.002798
31.1576 0.002815
31.2520 0.002804
31.3468 0.002799
31.4419 0.002850
31.5366 0.002853
31.6317 0.002866
31.7271 0.002880
31.8219 0.002900
31.9177 0.002891
32.0133 0.002908
32.1090 0.002938
32.2052 0.002915
32.3017 0.002941
32.3984 0.002954
32.4954 0.002968
32.5921 0.003017
32.6905 0.003019
32.7883 0.003012
32.8866 0.003022
32.9860 0.003022
33.0851 0.003038
33.1853 0.003081
33.2857 0.003064
33.3869 0.003051
33.4879 0.003032
33.5906 0.003080
33.6926 0.003089
33.7955 0.003116
33.8992 0.003134
34.0032 0.003148
34.1081 0.003137
34.2128 0.003174
34.3188 0.003216
34.4263 0.003253
34.5342 0.003276
34.6428 0.003283
34.7518 0.003330
34.8623 0.003346
34.9736 0.003344
35.0858 0.003353
35.1986 0.003320
35.3123 0.003321
35.4282 0.003360
35.5443 0.003312
35.6617 0.003314
35.7805 0.003356
35.9001 0.003363
36.0211 0.003340
36.1434 0.003409
36.2665 0.003385
36.3917 0.003409
36.5179 0.003429
36.6450 0.003437
36.7733 0.003457
36.9046 0.003455
37.0369 0.003524
37.1713 0.003546
37.3070 0.003568
37.4443 0.003630
37.5843 0.003639
37.7265 0.003665
37.8713 0.003703
38.0185 0.003721
38.1671 0.003726
38.3189 0.003782
38.4731 0.003793
38.6299 0.003849
38.7885 0.003897
38.9520 0.003958
39.1184 0.003999
39.2885 0.003953
39.4613 0.004004
39.6380 0.004073
39.8194 0.004086
40.0035 0.004111
40.1933 0.004158
40.3868 0.004236
40.5862 0.004307
40.7912 0.004376
41.0042 0.004445
41.2218 0.004508
41.4460 0.004497
41.6790 0.004474
41.9199 0.004561
42.1703 0.004604
42.4300 0.004681
42.7003 0.004714
42.9828 0.004756
43.2776 0.004780
43.5895 0.004929
43.9167 0.004991
44.2645 0.005238
44.6331 0.005488
45.0267 0.005638
45.4488 0.005776
45.9067 0.006135
46.4031 0.006254
46.9504 0.006696
47.5625 0.007251
48.2576 0.007795
49.0675 0.008108
50.0385 0.008610
51.2591 0.010013
52.9405 0.012358
53.3692 0.012814
53.8376 0.013808
54.3653 0.014761
54.9724 0.016115
55.6819 0.017643
56.5368 0.020088
57.6048 0.022266
59.1257 0.025405
61.6248 0.034537
64.0621 0.046998
67.0638 0.071491
69.3652 0.101806
| 18.9982 | 73 | 0.681077 |
fbb378382c2719d1710bc0873713d2d8b8552bc4 | 3,639 | h | C | include/multiverso/table/matrix.h | yesme/Multiverso | e45369e1d07277f656b0900beb2709d86679fa53 | [
"MIT"
] | 445 | 2015-11-10T04:00:17.000Z | 2016-10-21T01:10:27.000Z | include/multiverso/table/matrix.h | yesme/Multiverso | e45369e1d07277f656b0900beb2709d86679fa53 | [
"MIT"
] | 57 | 2015-11-10T14:54:29.000Z | 2016-08-11T05:48:13.000Z | include/multiverso/table/matrix.h | yesme/Multiverso | e45369e1d07277f656b0900beb2709d86679fa53 | [
"MIT"
] | 156 | 2015-11-10T05:21:49.000Z | 2016-10-19T15:25:38.000Z | #ifndef MULTIVERSO_MATRIX_H_
#define MULTIVERSO_MATRIX_H_
#include "multiverso/multiverso.h"
#include "multiverso/table_interface.h"
#include <vector>
namespace multiverso {
template <typename T>
struct MatrixOption;
template <typename T>
class MatrixWorker : public WorkerTable {
public:
explicit MatrixWorker(const MatrixOption<T>& option);
MatrixWorker(integer_t num_row, integer_t num_col, bool is_sparse = false);
~MatrixWorker();
// get whole table, data is user-allocated memory
void Get(T* data, size_t size,
const GetOption* option = nullptr);
// data is user-allocated memory
void Get(integer_t row_id, T* data, size_t size,
const GetOption* option = nullptr);
void Get(const std::vector<integer_t>& row_ids,
const std::vector<T*>& data_vec, size_t size,
const GetOption* option = nullptr);
// Get specific rows.
void Get(T* data, size_t size, integer_t* row_ids,
integer_t row_ids_size,
const GetOption* option = nullptr);
// Add whole table
void Add(T* data, size_t size,
const AddOption* option = nullptr);
void Add(integer_t row_id, T* data, size_t size,
const AddOption* option = nullptr);
void Add(const std::vector<integer_t>& row_ids,
const std::vector<T*>& data_vec, size_t size,
const AddOption* option = nullptr);
// Add specific rows.
void Add(T* data, size_t size, integer_t* row_ids, integer_t row_ids_size,
const AddOption* option = nullptr);
int Partition(const std::vector<Blob>& kv,
MsgType partition_type,
std::unordered_map<int, std::vector<Blob>>* out) override;
void ProcessReplyGet(std::vector<Blob>& reply_data) override;
protected:
T** row_index_;
int get_reply_count_; // number of unprocessed get reply
integer_t num_row_;
integer_t num_col_;
integer_t row_size_; // equals to sizeof(T) * num_col_
int num_server_; // the number of running servers
std::vector<integer_t> server_offsets_; // offset for the row in each servers
bool is_sparse_;
};
template <typename T>
class Updater;
template <typename T>
class MatrixServer : public ServerTable {
public:
explicit MatrixServer(const MatrixOption<T>& option);
MatrixServer(integer_t num_row, integer_t num_col, bool is_sparse = false,
bool is_pipeline = false);
void ProcessAdd(const std::vector<Blob>& data) override;
void ProcessGet(const std::vector<Blob>& data,
std::vector<Blob>* result) override;
void Store(Stream* s) override;
void Load(Stream* s) override;
protected:
void UpdateAddState(int worker_id, Blob keys);
void UpdateGetState(int worker_id, integer_t* keys, size_t key_size,
std::vector<integer_t>* out_rows);
inline integer_t GetLogicalRow(integer_t physical_row) {
return row_offset_ + physical_row;
}
inline integer_t GetPhysicalRow(integer_t logical_row) {
return logical_row - row_offset_;
}
int server_id_;
integer_t my_num_row_;
integer_t num_col_;
integer_t row_offset_;
Updater<T>* updater_;
std::vector<T> storage_;
// following attibutes are used by sparse update
bool is_sparse_;
bool** up_to_date_;
int workers_nums_;
};
template <typename T>
struct MatrixOption {
integer_t num_row;
integer_t num_col;
bool is_sparse;
bool is_pipeline;
DEFINE_TABLE_TYPE(T, MatrixWorker, MatrixServer);
};
}
#endif // MULTIVERSO_MATRIX_H_
| 28.429688 | 88 | 0.674636 |
da93f4838d06aa176a414fb8e7b2206dbba8803f | 1,614 | dart | Dart | lib/bloc/feature/daily_update_bloc.dart | Vellutia/covid19_monitor | 29edffd19e05f65a620156f0f071f3950b19efa1 | [
"Apache-2.0"
] | 7 | 2020-03-27T22:42:02.000Z | 2021-02-21T16:34:59.000Z | lib/bloc/feature/daily_update_bloc.dart | Vellutia/covid19_monitor | 29edffd19e05f65a620156f0f071f3950b19efa1 | [
"Apache-2.0"
] | null | null | null | lib/bloc/feature/daily_update_bloc.dart | Vellutia/covid19_monitor | 29edffd19e05f65a620156f0f071f3950b19efa1 | [
"Apache-2.0"
] | 3 | 2020-04-14T16:40:14.000Z | 2020-11-16T05:51:39.000Z | import 'dart:async';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
import '../../model/daily_update_model.dart';
import '../../repository/daily_update_repository.dart';
part 'daily_update_event.dart';
part 'daily_update_state.dart';
class DailyUpdateBloc extends HydratedBloc<DailyUpdateEvent, DailyUpdateState> {
final DailyUpdateRepository dailyUpdateRepository;
DailyUpdateBloc({
@required this.dailyUpdateRepository,
});
@override
DailyUpdateState get initialState =>
super.initialState ?? DailyUpdateInitial();
@override
Stream<DailyUpdateState> mapEventToState(
DailyUpdateEvent event,
) async* {
if (event is RefreshDailyUpdate) {
yield DailyUpdateLoaded(
event.dailyUpdate,
);
} else {
final dailyUpdate = await dailyUpdateRepository.fetchDailyUpdate();
yield DailyUpdateLoaded(
dailyUpdate,
);
}
}
@override
DailyUpdateState fromJson(Map<String, dynamic> json) {
final dailyUpdates = List<DailyUpdate>.from(
json["dailyUpdates"].map((x) => DailyUpdate.fromJson(x)));
try {
return DailyUpdateLoaded(
dailyUpdates,
);
} catch (_) {
return null;
}
}
@override
Map<String, dynamic> toJson(DailyUpdateState state) {
final dailyUpdates = List<dynamic>.from(
(state as DailyUpdateLoaded).dailyUpdates.map((x) => x.toJson()),
);
try {
return {
'dailyUpdates': dailyUpdates,
};
} catch (_) {
return null;
}
}
}
| 24.089552 | 80 | 0.673482 |