blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
772aee880c7cb8521c48531c42d1452895a5bb01
|
fb3b6e3000bb179374872d36cffdaaff96993623
|
/src/libnfc-nci/nfa/include/nfa_mem_co.h
|
4dfcacbf55b86d7af3f176e4ceed2eff40d185ed
|
[
"Apache-2.0"
] |
permissive
|
NXPNFCLinux/linux_libnfc-nci
|
3a12d862b9ffaca1a1ebdb529bd01524811596a5
|
449538e5e106666e5263afeaddacc5836fc23d3f
|
refs/heads/master
| 2023-07-07T12:19:52.297795
| 2023-05-22T12:59:33
| 2023-05-22T12:59:33
| 35,533,236
| 141
| 105
|
Apache-2.0
| 2022-07-21T07:09:51
| 2015-05-13T06:56:44
|
C
|
UTF-8
|
C
| false
| false
| 2,366
|
h
|
nfa_mem_co.h
|
/******************************************************************************
*
* Copyright (C) 2010-2014 Broadcom Corporation
*
* 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.
*
******************************************************************************/
/******************************************************************************
*
* Callout functions for memory allocation/deallocatoin
*
******************************************************************************/
#ifndef NFA_MEM_CO_H
#define NFA_MEM_CO_H
#include "nfc_target.h"
/*****************************************************************************
** Constants and data types
*****************************************************************************/
/*****************************************************************************
** External Function Declarations
*****************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
/*******************************************************************************
**
** Function nfa_mem_co_alloc
**
** Description allocate a buffer from platform's memory pool
**
** Returns:
** pointer to buffer if successful
** NULL otherwise
**
*******************************************************************************/
NFC_API extern void *nfa_mem_co_alloc (UINT32 num_bytes);
/*******************************************************************************
**
** Function nfa_mem_co_free
**
** Description free buffer previously allocated using nfa_mem_co_alloc
**
** Returns:
** Nothing
**
*******************************************************************************/
NFC_API extern void nfa_mem_co_free (void *p_buf);
#ifdef __cplusplus
}
#endif
#endif /* NFA_MEM_CO_H */
|
b267ac90f686faf4e1e01f8377962547843918e0
|
07327b5e8b2831b12352bf7c6426bfda60129da7
|
/Include/10.0.14393.0/um/WinFax.h
|
94d0927a8a465b2c332a82bc3388aa44d9dd403d
|
[] |
no_license
|
tpn/winsdk-10
|
ca279df0fce03f92036e90fb04196d6282a264b7
|
9b69fd26ac0c7d0b83d378dba01080e93349c2ed
|
refs/heads/master
| 2021-01-10T01:56:18.586459
| 2018-02-19T21:26:31
| 2018-02-19T21:29:50
| 44,352,845
| 218
| 432
| null | null | null | null |
UTF-8
|
C
| false
| false
| 65,135
|
h
|
WinFax.h
|
/*++
Copyright (c) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
Abstract:
This module contains the WIN32 FAX APIs.
--*/
#ifndef _FAXAPI_
#define _FAXAPI_
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#ifndef MIDL_PASS
#include <tapi.h>
#endif
#if !defined(_WINFAX_)
#define WINFAXAPI DECLSPEC_IMPORT
#else
#define WINFAXAPI
#endif
#ifdef __cplusplus
extern "C" {
#endif
//
// FAX ERROR CODES
//
#define FAX_ERR_START 7001L // First fax specific error code
#define FAX_ERR_SRV_OUTOFMEMORY 7001L
#define FAX_ERR_GROUP_NOT_FOUND 7002L
#define FAX_ERR_BAD_GROUP_CONFIGURATION 7003L
#define FAX_ERR_GROUP_IN_USE 7004L
#define FAX_ERR_RULE_NOT_FOUND 7005L
#define FAX_ERR_NOT_NTFS 7006L
#define FAX_ERR_DIRECTORY_IN_USE 7007L
#define FAX_ERR_FILE_ACCESS_DENIED 7008L
#define FAX_ERR_MESSAGE_NOT_FOUND 7009L
#define FAX_ERR_DEVICE_NUM_LIMIT_EXCEEDED 7010L
#define FAX_ERR_NOT_SUPPORTED_ON_THIS_SKU 7011L
#define FAX_ERR_VERSION_MISMATCH 7012L // Fax client/server versions mismtach
#define FAX_ERR_RECIPIENTS_LIMIT 7013L // Recipients limit in a single broadcast
#define FAX_ERR_END 7013L // Last fax specific error code
//
// MessageId: FAX_E_SRV_OUTOFMEMORY
//
// MessageText:
//
// The fax server failed to allocate memory.
//
#define FAX_E_SRV_OUTOFMEMORY MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_SRV_OUTOFMEMORY)
//
// MessageId: FAX_E_GROUP_NOT_FOUND
//
// MessageText:
//
// The fax server failed to locate an outbound routing group by name.
//
#define FAX_E_GROUP_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_GROUP_NOT_FOUND)
//
// MessageId: FAX_E_BAD_GROUP_CONFIGURATION
//
// MessageText:
//
// The fax server encountered an outbound routing group with bad configuration.
//
#define FAX_E_BAD_GROUP_CONFIGURATION MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_BAD_GROUP_CONFIGURATION)
//
// MessageId: FAX_E_GROUP_IN_USE
//
// MessageText:
//
// The fax server cannot remove an outbound routing group because it is in use by one or more outbound routing rules.
//
#define FAX_E_GROUP_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_GROUP_IN_USE)
//
// MessageId: FAX_E_RULE_NOT_FOUND
//
// MessageText:
//
// The fax server failed to locate an outbound routing rule by country/region code and area code.
//
#define FAX_E_RULE_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_RULE_NOT_FOUND)
//
// MessageId: FAX_E_NOT_NTFS
//
// MessageText:
//
// The fax server cannot set an archive folder to a non-NTFS partition.
//
#define FAX_E_NOT_NTFS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_NOT_NTFS)
//
// MessageId: FAX_E_DIRECTORY_IN_USE
//
// MessageText:
//
// The fax server cannot use the same folder for both the inbox and the sent-items archives.
//
#define FAX_E_DIRECTORY_IN_USE MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_DIRECTORY_IN_USE)
//
// MessageId: FAX_E_FILE_ACCESS_DENIED
//
// MessageText:
//
// The fax server cannot access the specified file or folder.
//
#define FAX_E_FILE_ACCESS_DENIED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_FILE_ACCESS_DENIED)
//
// MessageId: FAX_E_MESSAGE_NOT_FOUND
//
// MessageText:
//
// The fax server cannot find the job or message by its ID.
//
#define FAX_E_MESSAGE_NOT_FOUND MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_MESSAGE_NOT_FOUND)
//
// MessageId: FAX_E_DEVICE_NUM_LIMIT_EXCEEDED
//
// MessageText:
//
// The fax server cannot complete the operation because the number of active fax devices allowed for this version of Windows was exceeded.
//
#define FAX_E_DEVICE_NUM_LIMIT_EXCEEDED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_DEVICE_NUM_LIMIT_EXCEEDED)
//
// MessageId: FAX_E_NOT_SUPPORTED_ON_THIS_SKU
//
// MessageText:
//
// The fax server cannot complete the operation because it is not supported for this version of Windows.
//
#define FAX_E_NOT_SUPPORTED_ON_THIS_SKU MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_NOT_SUPPORTED_ON_THIS_SKU)
//
// MessageId: FAX_E_VERSION_MISMATCH
//
// MessageText:
//
// The fax server API version does not support the requested operation.
//
#define FAX_E_VERSION_MISMATCH MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_VERSION_MISMATCH)
//
// MessageId: FAX_E_RECIPIENT_LIMIT
//
// MessageText:
//
// The limit on the number of recipients for a single fax broadcast was reached.
//
#define FAX_E_RECIPIENTS_LIMIT MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, FAX_ERR_RECIPIENTS_LIMIT)
typedef enum
{
FAXLOG_LEVEL_NONE = 0,
FAXLOG_LEVEL_MIN,
FAXLOG_LEVEL_MED,
FAXLOG_LEVEL_MAX
} FAX_ENUM_LOG_LEVELS;
typedef enum
{
FAXLOG_CATEGORY_INIT = 1, // Initialization / shutdown
FAXLOG_CATEGORY_OUTBOUND, // Outbound messages
FAXLOG_CATEGORY_INBOUND, // Inbound messages
FAXLOG_CATEGORY_UNKNOWN // Unknown category (all others)
} FAX_ENUM_LOG_CATEGORIES;
typedef struct _FAX_LOG_CATEGORYA
{
LPCSTR Name; // logging category name
DWORD Category; // logging category number
DWORD Level; // logging level for the category
} FAX_LOG_CATEGORYA, *PFAX_LOG_CATEGORYA;
typedef struct _FAX_LOG_CATEGORYW
{
LPCWSTR Name; // logging category name
DWORD Category; // logging category number
DWORD Level; // logging level for the category
} FAX_LOG_CATEGORYW, *PFAX_LOG_CATEGORYW;
#ifdef UNICODE
typedef FAX_LOG_CATEGORYW FAX_LOG_CATEGORY;
typedef PFAX_LOG_CATEGORYW PFAX_LOG_CATEGORY;
#else
typedef FAX_LOG_CATEGORYA FAX_LOG_CATEGORY;
typedef PFAX_LOG_CATEGORYA PFAX_LOG_CATEGORY;
#endif // UNICODE
typedef struct _FAX_TIME
{
WORD Hour;
WORD Minute;
} FAX_TIME, *PFAX_TIME;
typedef struct _FAX_CONFIGURATIONA
{
DWORD SizeOfStruct; // size of this structure
DWORD Retries; // number of retries for fax send
DWORD RetryDelay; // number of minutes between retries
DWORD DirtyDays; // number of days to keep an unsent job in the queue
BOOL Branding; // fsp should brand outgoing faxes
BOOL UseDeviceTsid; // server uses device tsid only
BOOL ServerCp; // clients must use cover pages on the server
BOOL PauseServerQueue; // is the server queue paused?
FAX_TIME StartCheapTime; // start of discount rate period
FAX_TIME StopCheapTime; // end of discount rate period
BOOL ArchiveOutgoingFaxes; // whether outgoing faxes should be archived
LPCSTR ArchiveDirectory; // archive directory for outgoing faxes
LPCSTR Reserved; // Reserved; must be NULL
} FAX_CONFIGURATIONA, *PFAX_CONFIGURATIONA;
typedef struct _FAX_CONFIGURATIONW
{
DWORD SizeOfStruct; // size of this structure
DWORD Retries; // number of retries for fax send
DWORD RetryDelay; // number of minutes between retries
DWORD DirtyDays; // number of days to keep an unsent job in the queue
BOOL Branding; // fsp should brand outgoing faxes
BOOL UseDeviceTsid; // server uses device tsid only
BOOL ServerCp; // clients must use cover pages on the server
BOOL PauseServerQueue; // is the server queue paused?
FAX_TIME StartCheapTime; // start of discount rate period
FAX_TIME StopCheapTime; // end of discount rate period
BOOL ArchiveOutgoingFaxes; // whether outgoing faxes should be archived
LPCWSTR ArchiveDirectory; // archive directory for outgoing faxes
LPCWSTR Reserved; // Reserved; must be NULL
} FAX_CONFIGURATIONW, *PFAX_CONFIGURATIONW;
#ifdef UNICODE
typedef FAX_CONFIGURATIONW FAX_CONFIGURATION;
typedef PFAX_CONFIGURATIONW PFAX_CONFIGURATION;
#else
typedef FAX_CONFIGURATIONA FAX_CONFIGURATION;
typedef PFAX_CONFIGURATIONA PFAX_CONFIGURATION;
#endif // UNICODE
//
// FaxSetJob() command codes
//
typedef enum
{
JC_UNKNOWN = 0,
JC_DELETE,
JC_PAUSE,
JC_RESUME
} FAX_ENUM_JOB_COMMANDS;
#define JC_RESTART JC_RESUME
//
// job type defines
//
#define JT_UNKNOWN 0
#define JT_SEND 1
#define JT_RECEIVE 2
#define JT_ROUTING 3
#define JT_FAIL_RECEIVE 4
//
// job status defines
//
#define JS_PENDING 0x00000000
#define JS_INPROGRESS 0x00000001
#define JS_DELETING 0x00000002
#define JS_FAILED 0x00000004
#define JS_PAUSED 0x00000008
#define JS_NOLINE 0x00000010
#define JS_RETRYING 0x00000020
#define JS_RETRIES_EXCEEDED 0x00000040
typedef struct _FAX_DEVICE_STATUSA
{
DWORD SizeOfStruct; // size of this structure
LPCSTR CallerId; // caller id string
LPCSTR Csid; // station identifier
DWORD CurrentPage; // current page
DWORD DeviceId; // permanent line id
LPCSTR DeviceName; // device name
LPCSTR DocumentName; // document name
DWORD JobType; // send or receive?
LPCSTR PhoneNumber; // sending phone number
LPCSTR RoutingString; // routing information
LPCSTR SenderName; // sender name
LPCSTR RecipientName; // recipient name
DWORD Size; // size in bytes of the document
FILETIME StartTime; // starting time of the fax send/receive
DWORD Status; // current status of the device, see FPS_??? masks
LPCSTR StatusString; // status string if the Status field is zero. this may be NULL.
FILETIME SubmittedTime; // time the document was submitted
DWORD TotalPages; // total number of pages in this job
LPCSTR Tsid; // transmitting station identifier
LPCSTR UserName; // user that submitted the active job
} FAX_DEVICE_STATUSA, *PFAX_DEVICE_STATUSA;
typedef struct _FAX_DEVICE_STATUSW
{
DWORD SizeOfStruct; // size of this structure
LPCWSTR CallerId; // caller id string
LPCWSTR Csid; // station identifier
DWORD CurrentPage; // current page
DWORD DeviceId; // permanent line id
LPCWSTR DeviceName; // device name
LPCWSTR DocumentName; // document name
DWORD JobType; // send or receive?
LPCWSTR PhoneNumber; // sending phone number
LPCWSTR RoutingString; // routing information
LPCWSTR SenderName; // sender name
LPCWSTR RecipientName; // recipient name
DWORD Size; // size in bytes of the document
FILETIME StartTime; // starting time of the fax send/receive
DWORD Status; // current status of the device, see FPS_??? masks
LPCWSTR StatusString; // status string if the Status field is zero. this may be NULL.
FILETIME SubmittedTime; // time the document was submitted
DWORD TotalPages; // total number of pages in this job
LPCWSTR Tsid; // transmitting station identifier
LPCWSTR UserName; // user that submitted the active job
} FAX_DEVICE_STATUSW, *PFAX_DEVICE_STATUSW;
#ifdef UNICODE
typedef FAX_DEVICE_STATUSW FAX_DEVICE_STATUS;
typedef PFAX_DEVICE_STATUSW PFAX_DEVICE_STATUS;
#else
typedef FAX_DEVICE_STATUSA FAX_DEVICE_STATUS;
typedef PFAX_DEVICE_STATUSA PFAX_DEVICE_STATUS;
#endif // UNICODE
typedef struct _FAX_JOB_ENTRYA
{
DWORD SizeOfStruct; // size of this structure
DWORD JobId; // fax job id
LPCSTR UserName; // user who submitted the job
DWORD JobType; // job type, see JT defines
DWORD QueueStatus; // job queue status, see JS defines
DWORD Status; // current status of the device, see FPS_??? masks
DWORD Size; // size in bytes of the document
DWORD PageCount; // total page count
LPCSTR RecipientNumber; // recipient fax number
LPCSTR RecipientName; // recipient name
LPCSTR Tsid; // transmitter's id
LPCSTR SenderName; // sender name
LPCSTR SenderCompany; // sender company
LPCSTR SenderDept; // sender department
LPCSTR BillingCode; // billing code
DWORD ScheduleAction; // when to schedule the fax, see JSA defines
SYSTEMTIME ScheduleTime; // time to send the fax when JSA_SPECIFIC_TIME is used (must be local time)
DWORD DeliveryReportType; // delivery report type, see DRT defines
LPCSTR DeliveryReportAddress; // email address for delivery report (ndr or dr) thru MAPI / SMTP
LPCSTR DocumentName; // document name
} FAX_JOB_ENTRYA, *PFAX_JOB_ENTRYA;
typedef struct _FAX_JOB_ENTRYW
{
DWORD SizeOfStruct; // size of this structure
DWORD JobId; // fax job id
LPCWSTR UserName; // user who submitted the job
DWORD JobType; // job type, see JT defines
DWORD QueueStatus; // job queue status, see JS defines
DWORD Status; // current status of the device, see FPS_??? masks
DWORD Size; // size in bytes of the document
DWORD PageCount; // total page count
LPCWSTR RecipientNumber; // recipient fax number
LPCWSTR RecipientName; // recipient name
LPCWSTR Tsid; // transmitter's id
LPCWSTR SenderName; // sender name
LPCWSTR SenderCompany; // sender company
LPCWSTR SenderDept; // sender department
LPCWSTR BillingCode; // billing code
DWORD ScheduleAction; // when to schedule the fax, see JSA defines
SYSTEMTIME ScheduleTime; // time to send the fax when JSA_SPECIFIC_TIME is used (must be local time)
DWORD DeliveryReportType; // delivery report type, see DRT defines
LPCWSTR DeliveryReportAddress; // email address for delivery report (ndr or dr) thru MAPI / SMTP
LPCWSTR DocumentName; // document name
} FAX_JOB_ENTRYW, *PFAX_JOB_ENTRYW;
#ifdef UNICODE
typedef FAX_JOB_ENTRYW FAX_JOB_ENTRY;
typedef PFAX_JOB_ENTRYW PFAX_JOB_ENTRY;
#else
typedef FAX_JOB_ENTRYA FAX_JOB_ENTRY;
typedef PFAX_JOB_ENTRYA PFAX_JOB_ENTRY;
#endif // UNICODE
//
// fax port state masks
//
// if you change these defines the be sure to
// change the resources in the fax service.
//
#define FPS_DIALING 0x20000001
#define FPS_SENDING 0x20000002
#define FPS_RECEIVING 0x20000004
#define FPS_COMPLETED 0x20000008
#define FPS_HANDLED 0x20000010
#define FPS_UNAVAILABLE 0x20000020
#define FPS_BUSY 0x20000040
#define FPS_NO_ANSWER 0x20000080
#define FPS_BAD_ADDRESS 0x20000100
#define FPS_NO_DIAL_TONE 0x20000200
#define FPS_DISCONNECTED 0x20000400
#define FPS_FATAL_ERROR 0x20000800
#define FPS_NOT_FAX_CALL 0x20001000
#define FPS_CALL_DELAYED 0x20002000
#define FPS_CALL_BLACKLISTED 0x20004000
#define FPS_INITIALIZING 0x20008000
#define FPS_OFFLINE 0x20010000
#define FPS_RINGING 0x20020000
#define FPS_AVAILABLE 0x20100000
#define FPS_ABORTING 0x20200000
#define FPS_ROUTING 0x20400000
#define FPS_ANSWERED 0x20800000
//
// fax port capability mask
//
#define FPF_RECEIVE 0x00000001 // Automatically receive faxes
#define FPF_SEND 0x00000002
#define FPF_VIRTUAL 0x00000004
typedef struct _FAX_PORT_INFOA
{
DWORD SizeOfStruct; // size of this structure
DWORD DeviceId; // Device ID
DWORD State; // State of the device
DWORD Flags; // Device specific flags
DWORD Rings; // Number of rings before answer
DWORD Priority; // Device priority
LPCSTR DeviceName; // Device name
LPCSTR Tsid; // Device Tsid
LPCSTR Csid; // Device Csid
} FAX_PORT_INFOA, *PFAX_PORT_INFOA;
typedef struct _FAX_PORT_INFOW
{
DWORD SizeOfStruct; // size of this structure
DWORD DeviceId; // Device ID
DWORD State; // State of the device
DWORD Flags; // Device specific flags
DWORD Rings; // Number of rings before answer
DWORD Priority; // Device priority
LPCWSTR DeviceName; // Device name
LPCWSTR Tsid; // Device Tsid
LPCWSTR Csid; // Device Csid
} FAX_PORT_INFOW, *PFAX_PORT_INFOW;
#ifdef UNICODE
typedef FAX_PORT_INFOW FAX_PORT_INFO;
typedef PFAX_PORT_INFOW PFAX_PORT_INFO;
#else
typedef FAX_PORT_INFOA FAX_PORT_INFO;
typedef PFAX_PORT_INFOA PFAX_PORT_INFO;
#endif // UNICODE
typedef struct _FAX_ROUTING_METHODA
{
DWORD SizeOfStruct; // size of this structure
DWORD DeviceId; // device identifier
BOOL Enabled; // is this method enabled for this device?
LPCSTR DeviceName; // device name
LPCSTR Guid; // guid that identifies this routing method
LPCSTR FriendlyName; // friendly name for this method
LPCSTR FunctionName; // exported function name that identifies this method
LPCSTR ExtensionImageName; // module (dll) name that implements this method
LPCSTR ExtensionFriendlyName; // displayable string that identifies the extension
} FAX_ROUTING_METHODA, *PFAX_ROUTING_METHODA;
typedef struct _FAX_ROUTING_METHODW
{
DWORD SizeOfStruct; // size of this structure
DWORD DeviceId; // device identifier
BOOL Enabled; // is this method enabled for this device?
LPCWSTR DeviceName; // device name
LPCWSTR Guid; // guid that identifies this routing method
LPCWSTR FriendlyName; // friendly name for this method
LPCWSTR FunctionName; // exported function name that identifies this method
LPCWSTR ExtensionImageName; // module (dll) name that implements this method
LPCWSTR ExtensionFriendlyName; // displayable string that identifies the extension
} FAX_ROUTING_METHODW, *PFAX_ROUTING_METHODW;
#ifdef UNICODE
typedef FAX_ROUTING_METHODW FAX_ROUTING_METHOD;
typedef PFAX_ROUTING_METHODW PFAX_ROUTING_METHOD;
#else
typedef FAX_ROUTING_METHODA FAX_ROUTING_METHOD;
typedef PFAX_ROUTING_METHODA PFAX_ROUTING_METHOD;
#endif // UNICODE
typedef struct _FAX_GLOBAL_ROUTING_INFOA
{
DWORD SizeOfStruct; // size of this structure
DWORD Priority; // priority of this device
LPCSTR Guid; // guid that identifies this routing method
LPCSTR FriendlyName; // friendly name for this method
LPCSTR FunctionName; // exported function name that identifies this method
LPCSTR ExtensionImageName; // module (dll) name that implements this method
LPCSTR ExtensionFriendlyName; // displayable string that identifies the extension
} FAX_GLOBAL_ROUTING_INFOA, *PFAX_GLOBAL_ROUTING_INFOA;
typedef struct _FAX_GLOBAL_ROUTING_INFOW
{
DWORD SizeOfStruct; // size of this structure
DWORD Priority; // priority of this device
LPCWSTR Guid; // guid that identifies this routing method
LPCWSTR FriendlyName; // friendly name for this method
LPCWSTR FunctionName; // exported function name that identifies this method
LPCWSTR ExtensionImageName; // module (dll) name that implements this method
LPCWSTR ExtensionFriendlyName; // displayable string that identifies the extension
} FAX_GLOBAL_ROUTING_INFOW, *PFAX_GLOBAL_ROUTING_INFOW;
#ifdef UNICODE
typedef FAX_GLOBAL_ROUTING_INFOW FAX_GLOBAL_ROUTING_INFO;
typedef PFAX_GLOBAL_ROUTING_INFOW PFAX_GLOBAL_ROUTING_INFO;
#else
typedef FAX_GLOBAL_ROUTING_INFOA FAX_GLOBAL_ROUTING_INFO;
typedef PFAX_GLOBAL_ROUTING_INFOA PFAX_GLOBAL_ROUTING_INFO;
#endif // UNICODE
typedef struct _FAX_COVERPAGE_INFOA
{
DWORD SizeOfStruct; // Size of this structure
//
// general
//
LPCSTR CoverPageName; // coverpage document name
BOOL UseServerCoverPage; // coverpage exists on the fax server
//
// Recipient information
//
LPCSTR RecName; //
LPCSTR RecFaxNumber; //
LPCSTR RecCompany; //
LPCSTR RecStreetAddress; //
LPCSTR RecCity; //
LPCSTR RecState; //
LPCSTR RecZip; //
LPCSTR RecCountry; //
LPCSTR RecTitle; //
LPCSTR RecDepartment; //
LPCSTR RecOfficeLocation; //
LPCSTR RecHomePhone; //
LPCSTR RecOfficePhone; //
//
// Sender information
//
LPCSTR SdrName; //
LPCSTR SdrFaxNumber; //
LPCSTR SdrCompany; //
LPCSTR SdrAddress; //
LPCSTR SdrTitle; //
LPCSTR SdrDepartment; //
LPCSTR SdrOfficeLocation; //
LPCSTR SdrHomePhone; //
LPCSTR SdrOfficePhone; //
//
// Misc information
//
LPCSTR Note; //
LPCSTR Subject; //
SYSTEMTIME TimeSent; // Time the fax was sent
DWORD PageCount; // Number of pages
} FAX_COVERPAGE_INFOA, *PFAX_COVERPAGE_INFOA;
typedef struct _FAX_COVERPAGE_INFOW
{
DWORD SizeOfStruct; // Size of this structure
//
// general
//
LPCWSTR CoverPageName; // coverpage document name
BOOL UseServerCoverPage; // coverpage exists on the fax server
//
// Recipient information
//
LPCWSTR RecName; //
LPCWSTR RecFaxNumber; //
LPCWSTR RecCompany; //
LPCWSTR RecStreetAddress; //
LPCWSTR RecCity; //
LPCWSTR RecState; //
LPCWSTR RecZip; //
LPCWSTR RecCountry; //
LPCWSTR RecTitle; //
LPCWSTR RecDepartment; //
LPCWSTR RecOfficeLocation; //
LPCWSTR RecHomePhone; //
LPCWSTR RecOfficePhone; //
//
// Sender information
//
LPCWSTR SdrName; //
LPCWSTR SdrFaxNumber; //
LPCWSTR SdrCompany; //
LPCWSTR SdrAddress; //
LPCWSTR SdrTitle; //
LPCWSTR SdrDepartment; //
LPCWSTR SdrOfficeLocation; //
LPCWSTR SdrHomePhone; //
LPCWSTR SdrOfficePhone; //
//
// Misc information
//
LPCWSTR Note; //
LPCWSTR Subject; //
SYSTEMTIME TimeSent; // Time the fax was sent
DWORD PageCount; // Number of pages
} FAX_COVERPAGE_INFOW, *PFAX_COVERPAGE_INFOW;
#ifdef UNICODE
typedef FAX_COVERPAGE_INFOW FAX_COVERPAGE_INFO;
typedef PFAX_COVERPAGE_INFOW PFAX_COVERPAGE_INFO;
#else
typedef FAX_COVERPAGE_INFOA FAX_COVERPAGE_INFO;
typedef PFAX_COVERPAGE_INFOA PFAX_COVERPAGE_INFO;
#endif // UNICODE
typedef enum
{
JSA_NOW = 0, // Send now
JSA_SPECIFIC_TIME, // Send at specific time
JSA_DISCOUNT_PERIOD // Send at server configured discount period
} FAX_ENUM_JOB_SEND_ATTRIBUTES;
#ifndef _FAXAPIP_
typedef enum
{
DRT_NONE = 0x0000, // Do not send receipt
DRT_EMAIL = 0x0001, // Send receipt by email
DRT_INBOX = 0x0002 // send receipt to local inbox
} FAX_ENUM_DELIVERY_REPORT_TYPES;
#endif // _FAXAPIP_
typedef struct _FAX_JOB_PARAMA
{
DWORD SizeOfStruct; // size of this structure
LPCSTR RecipientNumber; // recipient fax number
LPCSTR RecipientName; // recipient name
LPCSTR Tsid; // transmitter's id
LPCSTR SenderName; // sender name
LPCSTR SenderCompany; // sender company
LPCSTR SenderDept; // sender department
LPCSTR BillingCode; // billing code
DWORD ScheduleAction; // when to schedule the fax, see JSA defines
SYSTEMTIME ScheduleTime; // time to send the fax when JSA_SPECIFIC_TIME is used (must be local time)
DWORD DeliveryReportType; // delivery report type, see DRT defines
LPCSTR DeliveryReportAddress; // email address for delivery report (ndr or dr) thru MAPI / SMTP
LPCSTR DocumentName; // document name (optional)
HCALL CallHandle; // optional call handle
DWORD_PTR Reserved[3]; // reserved for ms use only
} FAX_JOB_PARAMA, *PFAX_JOB_PARAMA;
typedef struct _FAX_JOB_PARAMW
{
DWORD SizeOfStruct; // size of this structure
LPCWSTR RecipientNumber; // recipient fax number
LPCWSTR RecipientName; // recipient name
LPCWSTR Tsid; // transmitter's id
LPCWSTR SenderName; // sender name
LPCWSTR SenderCompany; // sender company
LPCWSTR SenderDept; // sender department
LPCWSTR BillingCode; // billing code
DWORD ScheduleAction; // when to schedule the fax, see JSA defines
SYSTEMTIME ScheduleTime; // time to send the fax when JSA_SPECIFIC_TIME is used (must be local time)
DWORD DeliveryReportType; // delivery report type, see DRT defines
LPCWSTR DeliveryReportAddress; // email address for delivery report (ndr or dr) thru MAPI / SMTP
LPCWSTR DocumentName; // document name (optional)
HCALL CallHandle; // optional call handle
DWORD_PTR Reserved[3]; // reserved for ms use only
} FAX_JOB_PARAMW, *PFAX_JOB_PARAMW;
#ifdef UNICODE
typedef FAX_JOB_PARAMW FAX_JOB_PARAM;
typedef PFAX_JOB_PARAMW PFAX_JOB_PARAM;
#else
typedef FAX_JOB_PARAMA FAX_JOB_PARAM;
typedef PFAX_JOB_PARAMA PFAX_JOB_PARAM;
#endif // UNICODE
//
// Event Ids
//
// FEI_NEVENTS is the number of events
//
#define FEI_DIALING 0x00000001
#define FEI_SENDING 0x00000002
#define FEI_RECEIVING 0x00000003
#define FEI_COMPLETED 0x00000004
#define FEI_BUSY 0x00000005
#define FEI_NO_ANSWER 0x00000006
#define FEI_BAD_ADDRESS 0x00000007
#define FEI_NO_DIAL_TONE 0x00000008
#define FEI_DISCONNECTED 0x00000009
#define FEI_FATAL_ERROR 0x0000000a
#define FEI_NOT_FAX_CALL 0x0000000b
#define FEI_CALL_DELAYED 0x0000000c
#define FEI_CALL_BLACKLISTED 0x0000000d
#define FEI_RINGING 0x0000000e
#define FEI_ABORTING 0x0000000f
#define FEI_ROUTING 0x00000010
#define FEI_MODEM_POWERED_ON 0x00000011
#define FEI_MODEM_POWERED_OFF 0x00000012
#define FEI_IDLE 0x00000013
#define FEI_FAXSVC_ENDED 0x00000014
#define FEI_ANSWERED 0x00000015
#define FEI_JOB_QUEUED 0x00000016
#define FEI_DELETED 0x00000017
#define FEI_INITIALIZING 0x00000018
#define FEI_LINE_UNAVAILABLE 0x00000019
#define FEI_HANDLED 0x0000001a
#define FEI_FAXSVC_STARTED 0x0000001b
#define FEI_NEVENTS FEI_FAXSVC_STARTED
typedef struct _FAX_EVENTA
{
DWORD SizeOfStruct; // Size of this structure
FILETIME TimeStamp; // Timestamp for when the event was generated
DWORD DeviceId; // Permanent line id
DWORD EventId; // Current event id
DWORD JobId; // Fax Job Id, 0xffffffff indicates inactive job
} FAX_EVENTA, *PFAX_EVENTA;
typedef struct _FAX_EVENTW
{
DWORD SizeOfStruct; // Size of this structure
FILETIME TimeStamp; // Timestamp for when the event was generated
DWORD DeviceId; // Permanent line id
DWORD EventId; // Current event id
DWORD JobId; // Fax Job Id, 0xffffffff indicates inactive job
} FAX_EVENTW, *PFAX_EVENTW;
#ifdef UNICODE
typedef FAX_EVENTW FAX_EVENT;
typedef PFAX_EVENTW PFAX_EVENT;
#else
typedef FAX_EVENTA FAX_EVENT;
typedef PFAX_EVENTA PFAX_EVENT;
#endif // UNICODE
typedef struct _FAX_PRINT_INFOA
{
DWORD SizeOfStruct; // Size of this structure
LPCSTR DocName; // Document name that appears in the spooler
LPCSTR RecipientName; // Recipient name
LPCSTR RecipientNumber; // Recipient fax number (non-canonical number)
LPCSTR SenderName; // Sender name
LPCSTR SenderCompany; // Sender company (optional)
LPCSTR SenderDept; // Sender department
LPCSTR SenderBillingCode; // Billing code
LPCSTR Reserved; // Reserved; must be NULL
LPCSTR DrEmailAddress; // E.Mail address for delivery report
LPCSTR OutputFileName; // for print to file, resulting file name
} FAX_PRINT_INFOA, *PFAX_PRINT_INFOA;
typedef struct _FAX_PRINT_INFOW
{
DWORD SizeOfStruct; // Size of this structure
LPCWSTR DocName; // Document name that appears in the spooler
LPCWSTR RecipientName; // Recipient name
LPCWSTR RecipientNumber; // Recipient fax number (non-canonical number)
LPCWSTR SenderName; // Sender name
LPCWSTR SenderCompany; // Sender company (optional)
LPCWSTR SenderDept; // Sender department
LPCWSTR SenderBillingCode; // Billing code
LPCWSTR Reserved; // Reserved; must be NULL
LPCWSTR DrEmailAddress; // E.Mail address for delivery report
LPCWSTR OutputFileName; // for print to file, resulting file name
} FAX_PRINT_INFOW, *PFAX_PRINT_INFOW;
#ifdef UNICODE
typedef FAX_PRINT_INFOW FAX_PRINT_INFO;
typedef PFAX_PRINT_INFOW PFAX_PRINT_INFO;
#else
typedef FAX_PRINT_INFOA FAX_PRINT_INFO;
typedef PFAX_PRINT_INFOA PFAX_PRINT_INFO;
#endif // UNICODE
typedef struct _FAX_CONTEXT_INFOA
{
DWORD SizeOfStruct; // Size of this structure
HDC hDC; // Device Context
CHAR ServerName[MAX_COMPUTERNAME_LENGTH+1]; // Server name
} FAX_CONTEXT_INFOA, *PFAX_CONTEXT_INFOA;
typedef struct _FAX_CONTEXT_INFOW
{
DWORD SizeOfStruct; // Size of this structure
HDC hDC; // Device Context
WCHAR ServerName[MAX_COMPUTERNAME_LENGTH+1]; // Server name
} FAX_CONTEXT_INFOW, *PFAX_CONTEXT_INFOW;
#ifdef UNICODE
typedef FAX_CONTEXT_INFOW FAX_CONTEXT_INFO;
typedef PFAX_CONTEXT_INFOW PFAX_CONTEXT_INFO;
#else
typedef FAX_CONTEXT_INFOA FAX_CONTEXT_INFO;
typedef PFAX_CONTEXT_INFOA PFAX_CONTEXT_INFO;
#endif // UNICODE
//
// prototypes
//
WINFAXAPI
BOOL
WINAPI
FaxConnectFaxServerA(
IN LPCSTR MachineName OPTIONAL,
OUT LPHANDLE FaxHandle
);
WINFAXAPI
BOOL
WINAPI
FaxConnectFaxServerW(
IN LPCWSTR MachineName OPTIONAL,
OUT LPHANDLE FaxHandle
);
#ifdef UNICODE
#define FaxConnectFaxServer FaxConnectFaxServerW
#else
#define FaxConnectFaxServer FaxConnectFaxServerA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXCONNECTFAXSERVERA)(
IN LPCSTR MachineName OPTIONAL,
OUT LPHANDLE FaxHandle
);
typedef BOOL
(WINAPI *PFAXCONNECTFAXSERVERW)(
IN LPCWSTR MachineName OPTIONAL,
OUT LPHANDLE FaxHandle
);
#ifdef UNICODE
#define PFAXCONNECTFAXSERVER PFAXCONNECTFAXSERVERW
#else
#define PFAXCONNECTFAXSERVER PFAXCONNECTFAXSERVERA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxClose(
IN HANDLE FaxHandle
);
typedef BOOL
(WINAPI *PFAXCLOSE)(
IN HANDLE FaxHandle
);
typedef enum
{
PORT_OPEN_QUERY = 1,
PORT_OPEN_MODIFY
} FAX_ENUM_PORT_OPEN_TYPE;
WINFAXAPI
BOOL
WINAPI
FaxOpenPort(
IN HANDLE FaxHandle,
IN DWORD DeviceId,
IN DWORD Flags,
OUT LPHANDLE FaxPortHandle
);
typedef BOOL
(WINAPI *PFAXOPENPORT)(
IN HANDLE FaxHandle,
IN DWORD DeviceId,
IN DWORD Flags,
OUT LPHANDLE FaxPortHandle
);
WINFAXAPI
BOOL
WINAPI
FaxCompleteJobParamsA(
IN OUT PFAX_JOB_PARAMA *JobParams,
IN OUT PFAX_COVERPAGE_INFOA *CoverpageInfo
);
WINFAXAPI
BOOL
WINAPI
FaxCompleteJobParamsW(
IN OUT PFAX_JOB_PARAMW *JobParams,
IN OUT PFAX_COVERPAGE_INFOW *CoverpageInfo
);
#ifdef UNICODE
#define FaxCompleteJobParams FaxCompleteJobParamsW
#else
#define FaxCompleteJobParams FaxCompleteJobParamsA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXCOMPLETEJOBPARAMSA)(
IN OUT PFAX_JOB_PARAMA *JobParams,
IN OUT PFAX_COVERPAGE_INFOA *CoverpageInfo
);
typedef BOOL
(WINAPI *PFAXCOMPLETEJOBPARAMSW)(
IN OUT PFAX_JOB_PARAMW *JobParams,
IN OUT PFAX_COVERPAGE_INFOW *CoverpageInfo
);
#ifdef UNICODE
#define PFAXCOMPLETEJOBPARAMS PFAXCOMPLETEJOBPARAMSW
#else
#define PFAXCOMPLETEJOBPARAMS PFAXCOMPLETEJOBPARAMSA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSendDocumentA(
IN HANDLE FaxHandle,
IN LPCSTR FileName,
IN PFAX_JOB_PARAMA JobParams,
IN const FAX_COVERPAGE_INFOA *CoverpageInfo, OPTIONAL
OUT LPDWORD FaxJobId OPTIONAL
);
WINFAXAPI
BOOL
WINAPI
FaxSendDocumentW(
IN HANDLE FaxHandle,
IN LPCWSTR FileName,
IN PFAX_JOB_PARAMW JobParams,
IN const FAX_COVERPAGE_INFOW *CoverpageInfo, OPTIONAL
OUT LPDWORD FaxJobId OPTIONAL
);
#ifdef UNICODE
#define FaxSendDocument FaxSendDocumentW
#else
#define FaxSendDocument FaxSendDocumentA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSENDDOCUMENTA)(
IN HANDLE FaxHandle,
IN LPCSTR FileName,
IN PFAX_JOB_PARAMA JobParams,
IN const FAX_COVERPAGE_INFOA *CoverpageInfo, OPTIONAL
OUT LPDWORD FaxJobId OPTIONAL
);
typedef BOOL
(WINAPI *PFAXSENDDOCUMENTW)(
IN HANDLE FaxHandle,
IN LPCWSTR FileName,
IN PFAX_JOB_PARAMW JobParams,
IN const FAX_COVERPAGE_INFOW *CoverpageInfo, OPTIONAL
OUT LPDWORD FaxJobId OPTIONAL
);
#ifdef UNICODE
#define PFAXSENDDOCUMENT PFAXSENDDOCUMENTW
#else
#define PFAXSENDDOCUMENT PFAXSENDDOCUMENTA
#endif // !UNICODE
typedef BOOL
(CALLBACK *PFAX_RECIPIENT_CALLBACKA)(
IN HANDLE FaxHandle,
IN DWORD RecipientNumber,
IN LPVOID Context,
IN OUT PFAX_JOB_PARAMA JobParams,
IN OUT PFAX_COVERPAGE_INFOA CoverpageInfo OPTIONAL
);
typedef BOOL
(CALLBACK *PFAX_RECIPIENT_CALLBACKW)(
IN HANDLE FaxHandle,
IN DWORD RecipientNumber,
IN LPVOID Context,
IN OUT PFAX_JOB_PARAMW JobParams,
IN OUT PFAX_COVERPAGE_INFOW CoverpageInfo OPTIONAL
);
#ifdef UNICODE
#define PFAX_RECIPIENT_CALLBACK PFAX_RECIPIENT_CALLBACKW
#else
#define PFAX_RECIPIENT_CALLBACK PFAX_RECIPIENT_CALLBACKA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSendDocumentForBroadcastA(
IN HANDLE FaxHandle,
IN LPCSTR FileName,
OUT LPDWORD FaxJobId,
IN PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback,
IN LPVOID Context
);
WINFAXAPI
BOOL
WINAPI
FaxSendDocumentForBroadcastW(
IN HANDLE FaxHandle,
IN LPCWSTR FileName,
OUT LPDWORD FaxJobId,
IN PFAX_RECIPIENT_CALLBACKW FaxRecipientCallback,
IN LPVOID Context
);
#ifdef UNICODE
#define FaxSendDocumentForBroadcast FaxSendDocumentForBroadcastW
#else
#define FaxSendDocumentForBroadcast FaxSendDocumentForBroadcastA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSENDDOCUMENTFORBROADCASTA)(
IN HANDLE FaxHandle,
IN LPCSTR FileName,
OUT LPDWORD FaxJobId,
IN PFAX_RECIPIENT_CALLBACKA FaxRecipientCallback,
IN LPVOID Context
);
typedef BOOL
(WINAPI *PFAXSENDDOCUMENTFORBROADCASTW)(
IN HANDLE FaxHandle,
IN LPCWSTR FileName,
OUT LPDWORD FaxJobId,
IN PFAX_RECIPIENT_CALLBACKW FaxRecipientCallback,
IN LPVOID Context
);
#ifdef UNICODE
#define PFAXSENDDOCUMENTFORBROADCAST PFAXSENDDOCUMENTFORBROADCASTW
#else
#define PFAXSENDDOCUMENTFORBROADCAST PFAXSENDDOCUMENTFORBROADCASTA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxEnumJobsA(
IN HANDLE FaxHandle,
OUT PFAX_JOB_ENTRYA *JobEntry,
OUT LPDWORD JobsReturned
);
WINFAXAPI
BOOL
WINAPI
FaxEnumJobsW(
IN HANDLE FaxHandle,
OUT PFAX_JOB_ENTRYW *JobEntry,
OUT LPDWORD JobsReturned
);
#ifdef UNICODE
#define FaxEnumJobs FaxEnumJobsW
#else
#define FaxEnumJobs FaxEnumJobsA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXENUMJOBSA)(
IN HANDLE FaxHandle,
OUT PFAX_JOB_ENTRYA *JobEntry,
OUT LPDWORD JobsReturned
);
typedef BOOL
(WINAPI *PFAXENUMJOBSW)(
IN HANDLE FaxHandle,
OUT PFAX_JOB_ENTRYW *JobEntry,
OUT LPDWORD JobsReturned
);
#ifdef UNICODE
#define PFAXENUMJOBS PFAXENUMJOBSW
#else
#define PFAXENUMJOBS PFAXENUMJOBSA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxGetJobA(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT PFAX_JOB_ENTRYA *JobEntry
);
WINFAXAPI
BOOL
WINAPI
FaxGetJobW(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT PFAX_JOB_ENTRYW *JobEntry
);
#ifdef UNICODE
#define FaxGetJob FaxGetJobW
#else
#define FaxGetJob FaxGetJobA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETJOBA)(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT PFAX_JOB_ENTRYA *JobEntry
);
typedef BOOL
(WINAPI *PFAXGETJOBW)(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT PFAX_JOB_ENTRYW *JobEntry
);
#ifdef UNICODE
#define PFAXGETJOB PFAXGETJOBW
#else
#define PFAXGETJOB PFAXGETJOBA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetJobA(
IN HANDLE FaxHandle,
IN DWORD JobId,
IN DWORD Command,
IN const FAX_JOB_ENTRYA *JobEntry
);
WINFAXAPI
BOOL
WINAPI
FaxSetJobW(
IN HANDLE FaxHandle,
IN DWORD JobId,
IN DWORD Command,
IN const FAX_JOB_ENTRYW *JobEntry
);
#ifdef UNICODE
#define FaxSetJob FaxSetJobW
#else
#define FaxSetJob FaxSetJobA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETJOBA)(
IN HANDLE FaxHandle,
IN DWORD JobId,
IN DWORD Command,
IN const FAX_JOB_ENTRYA *JobEntry
);
typedef BOOL
(WINAPI *PFAXSETJOBW)(
IN HANDLE FaxHandle,
IN DWORD JobId,
IN DWORD Command,
IN const FAX_JOB_ENTRYW *JobEntry
);
#ifdef UNICODE
#define PFAXSETJOB PFAXSETJOBW
#else
#define PFAXSETJOB PFAXSETJOBA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxGetPageData(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT LPBYTE *Buffer,
OUT LPDWORD BufferSize,
OUT LPDWORD ImageWidth,
OUT LPDWORD ImageHeight
);
typedef BOOL
(WINAPI *PFAXGETPAGEDATA)(
IN HANDLE FaxHandle,
IN DWORD JobId,
OUT LPBYTE *Buffer,
OUT LPDWORD BufferSize,
OUT LPDWORD ImageWidth,
OUT LPDWORD ImageHeight
);
WINFAXAPI
BOOL
WINAPI
FaxGetDeviceStatusA(
IN HANDLE FaxPortHandle,
OUT PFAX_DEVICE_STATUSA *DeviceStatus
);
WINFAXAPI
BOOL
WINAPI
FaxGetDeviceStatusW(
IN HANDLE FaxPortHandle,
OUT PFAX_DEVICE_STATUSW *DeviceStatus
);
#ifdef UNICODE
#define FaxGetDeviceStatus FaxGetDeviceStatusW
#else
#define FaxGetDeviceStatus FaxGetDeviceStatusA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETDEVICESTATUSA)(
IN HANDLE FaxPortHandle,
OUT PFAX_DEVICE_STATUSA *DeviceStatus
);
typedef BOOL
(WINAPI *PFAXGETDEVICESTATUSW)(
IN HANDLE FaxPortHandle,
OUT PFAX_DEVICE_STATUSW *DeviceStatus
);
#ifdef UNICODE
#define PFAXGETDEVICESTATUS PFAXGETDEVICESTATUSW
#else
#define PFAXGETDEVICESTATUS PFAXGETDEVICESTATUSA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxAbort(
IN HANDLE FaxHandle,
IN DWORD JobId
);
typedef BOOL
(WINAPI *PFAXABORT)(
IN HANDLE FaxHandle,
IN DWORD JobId
);
WINFAXAPI
BOOL
WINAPI
FaxGetConfigurationA(
IN HANDLE FaxHandle,
OUT PFAX_CONFIGURATIONA *FaxConfig
);
WINFAXAPI
BOOL
WINAPI
FaxGetConfigurationW(
IN HANDLE FaxHandle,
OUT PFAX_CONFIGURATIONW *FaxConfig
);
#ifdef UNICODE
#define FaxGetConfiguration FaxGetConfigurationW
#else
#define FaxGetConfiguration FaxGetConfigurationA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETCONFIGURATIONA)(
IN HANDLE FaxHandle,
OUT PFAX_CONFIGURATIONA *FaxConfig
);
typedef BOOL
(WINAPI *PFAXGETCONFIGURATIONW)(
IN HANDLE FaxHandle,
OUT PFAX_CONFIGURATIONW *FaxConfig
);
#ifdef UNICODE
#define PFAXGETCONFIGURATION PFAXGETCONFIGURATIONW
#else
#define PFAXGETCONFIGURATION PFAXGETCONFIGURATIONA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetConfigurationA(
IN HANDLE FaxHandle,
IN const FAX_CONFIGURATIONA *FaxConfig
);
WINFAXAPI
BOOL
WINAPI
FaxSetConfigurationW(
IN HANDLE FaxHandle,
IN const FAX_CONFIGURATIONW *FaxConfig
);
#ifdef UNICODE
#define FaxSetConfiguration FaxSetConfigurationW
#else
#define FaxSetConfiguration FaxSetConfigurationA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETCONFIGURATIONA)(
IN HANDLE FaxHandle,
IN const FAX_CONFIGURATIONA *FaxConfig
);
typedef BOOL
(WINAPI *PFAXSETCONFIGURATIONW)(
IN HANDLE FaxHandle,
IN const FAX_CONFIGURATIONW *FaxConfig
);
#ifdef UNICODE
#define PFAXSETCONFIGURATION PFAXSETCONFIGURATIONW
#else
#define PFAXSETCONFIGURATION PFAXSETCONFIGURATIONA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxGetLoggingCategoriesA(
IN HANDLE FaxHandle,
OUT PFAX_LOG_CATEGORYA *Categories,
OUT LPDWORD NumberCategories
);
WINFAXAPI
BOOL
WINAPI
FaxGetLoggingCategoriesW(
IN HANDLE FaxHandle,
OUT PFAX_LOG_CATEGORYW *Categories,
OUT LPDWORD NumberCategories
);
#ifdef UNICODE
#define FaxGetLoggingCategories FaxGetLoggingCategoriesW
#else
#define FaxGetLoggingCategories FaxGetLoggingCategoriesA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETLOGGINGCATEGORIESA)(
IN HANDLE FaxHandle,
OUT PFAX_LOG_CATEGORYA *Categories,
OUT LPDWORD NumberCategories
);
typedef BOOL
(WINAPI *PFAXGETLOGGINGCATEGORIESW)(
IN HANDLE FaxHandle,
OUT PFAX_LOG_CATEGORYW *Categories,
OUT LPDWORD NumberCategories
);
#ifdef UNICODE
#define PFAXGETLOGGINGCATEGORIES PFAXGETLOGGINGCATEGORIESW
#else
#define PFAXGETLOGGINGCATEGORIES PFAXGETLOGGINGCATEGORIESA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetLoggingCategoriesA(
IN HANDLE FaxHandle,
IN const FAX_LOG_CATEGORYA *Categories,
IN DWORD NumberCategories
);
WINFAXAPI
BOOL
WINAPI
FaxSetLoggingCategoriesW(
IN HANDLE FaxHandle,
IN const FAX_LOG_CATEGORYW *Categories,
IN DWORD NumberCategories
);
#ifdef UNICODE
#define FaxSetLoggingCategories FaxSetLoggingCategoriesW
#else
#define FaxSetLoggingCategories FaxSetLoggingCategoriesA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETLOGGINGCATEGORIESA)(
IN HANDLE FaxHandle,
IN const FAX_LOG_CATEGORYA *Categories,
IN DWORD NumberCategories
);
typedef BOOL
(WINAPI *PFAXSETLOGGINGCATEGORIESW)(
IN HANDLE FaxHandle,
IN const FAX_LOG_CATEGORYW *Categories,
IN DWORD NumberCategories
);
#ifdef UNICODE
#define PFAXSETLOGGINGCATEGORIES PFAXSETLOGGINGCATEGORIESW
#else
#define PFAXSETLOGGINGCATEGORIES PFAXSETLOGGINGCATEGORIESA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxEnumPortsA(
IN HANDLE FaxHandle,
OUT PFAX_PORT_INFOA *PortInfo,
OUT LPDWORD PortsReturned
);
WINFAXAPI
BOOL
WINAPI
FaxEnumPortsW(
IN HANDLE FaxHandle,
OUT PFAX_PORT_INFOW *PortInfo,
OUT LPDWORD PortsReturned
);
#ifdef UNICODE
#define FaxEnumPorts FaxEnumPortsW
#else
#define FaxEnumPorts FaxEnumPortsA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXENUMPORTSA)(
IN HANDLE FaxHandle,
OUT PFAX_PORT_INFOA *PortInfo,
OUT LPDWORD PortsReturned
);
typedef BOOL
(WINAPI *PFAXENUMPORTSW)(
IN HANDLE FaxHandle,
OUT PFAX_PORT_INFOW *PortInfo,
OUT LPDWORD PortsReturned
);
#ifdef UNICODE
#define PFAXENUMPORTS PFAXENUMPORTSW
#else
#define PFAXENUMPORTS PFAXENUMPORTSA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxGetPortA(
IN HANDLE FaxPortHandle,
OUT PFAX_PORT_INFOA *PortInfo
);
WINFAXAPI
BOOL
WINAPI
FaxGetPortW(
IN HANDLE FaxPortHandle,
OUT PFAX_PORT_INFOW *PortInfo
);
#ifdef UNICODE
#define FaxGetPort FaxGetPortW
#else
#define FaxGetPort FaxGetPortA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETPORTA)(
IN HANDLE FaxPortHandle,
OUT PFAX_PORT_INFOA *PortInfo
);
typedef BOOL
(WINAPI *PFAXGETPORTW)(
IN HANDLE FaxPortHandle,
OUT PFAX_PORT_INFOW *PortInfo
);
#ifdef UNICODE
#define PFAXGETPORT PFAXGETPORTW
#else
#define PFAXGETPORT PFAXGETPORTA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetPortA(
IN HANDLE FaxPortHandle,
IN const FAX_PORT_INFOA *PortInfo
);
WINFAXAPI
BOOL
WINAPI
FaxSetPortW(
IN HANDLE FaxPortHandle,
IN const FAX_PORT_INFOW *PortInfo
);
#ifdef UNICODE
#define FaxSetPort FaxSetPortW
#else
#define FaxSetPort FaxSetPortA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETPORTA)(
IN HANDLE FaxPortHandle,
IN const FAX_PORT_INFOA *PortInfo
);
typedef BOOL
(WINAPI *PFAXSETPORTW)(
IN HANDLE FaxPortHandle,
IN const FAX_PORT_INFOW *PortInfo
);
#ifdef UNICODE
#define PFAXSETPORT PFAXSETPORTW
#else
#define PFAXSETPORT PFAXSETPORTA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxEnumRoutingMethodsA(
IN HANDLE FaxPortHandle,
OUT PFAX_ROUTING_METHODA *RoutingMethod,
OUT LPDWORD MethodsReturned
);
WINFAXAPI
BOOL
WINAPI
FaxEnumRoutingMethodsW(
IN HANDLE FaxPortHandle,
OUT PFAX_ROUTING_METHODW *RoutingMethod,
OUT LPDWORD MethodsReturned
);
#ifdef UNICODE
#define FaxEnumRoutingMethods FaxEnumRoutingMethodsW
#else
#define FaxEnumRoutingMethods FaxEnumRoutingMethodsA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXENUMROUTINGMETHODSA)(
IN HANDLE FaxPortHandle,
OUT PFAX_ROUTING_METHODA *RoutingMethod,
OUT LPDWORD MethodsReturned
);
typedef BOOL
(WINAPI *PFAXENUMROUTINGMETHODSW)(
IN HANDLE FaxPortHandle,
OUT PFAX_ROUTING_METHODW *RoutingMethod,
OUT LPDWORD MethodsReturned
);
#ifdef UNICODE
#define PFAXENUMROUTINGMETHODS PFAXENUMROUTINGMETHODSW
#else
#define PFAXENUMROUTINGMETHODS PFAXENUMROUTINGMETHODSA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxEnableRoutingMethodA(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
IN BOOL Enabled
);
WINFAXAPI
BOOL
WINAPI
FaxEnableRoutingMethodW(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
IN BOOL Enabled
);
#ifdef UNICODE
#define FaxEnableRoutingMethod FaxEnableRoutingMethodW
#else
#define FaxEnableRoutingMethod FaxEnableRoutingMethodA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXENABLEROUTINGMETHODA)(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
IN BOOL Enabled
);
typedef BOOL
(WINAPI *PFAXENABLEROUTINGMETHODW)(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
IN BOOL Enabled
);
#ifdef UNICODE
#define PFAXENABLEROUTINGMETHOD PFAXENABLEROUTINGMETHODW
#else
#define PFAXENABLEROUTINGMETHOD PFAXENABLEROUTINGMETHODA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxEnumGlobalRoutingInfoA(
IN HANDLE FaxHandle,
OUT PFAX_GLOBAL_ROUTING_INFOA *RoutingInfo,
OUT LPDWORD MethodsReturned
);
WINFAXAPI
BOOL
WINAPI
FaxEnumGlobalRoutingInfoW(
IN HANDLE FaxHandle,
OUT PFAX_GLOBAL_ROUTING_INFOW *RoutingInfo,
OUT LPDWORD MethodsReturned
);
#ifdef UNICODE
#define FaxEnumGlobalRoutingInfo FaxEnumGlobalRoutingInfoW
#else
#define FaxEnumGlobalRoutingInfo FaxEnumGlobalRoutingInfoA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXENUMGLOBALROUTINGINFOA)(
IN HANDLE FaxHandle,
OUT PFAX_GLOBAL_ROUTING_INFOA *RoutingInfo,
OUT LPDWORD MethodsReturned
);
typedef BOOL
(WINAPI *PFAXENUMGLOBALROUTINGINFOW)(
IN HANDLE FaxHandle,
OUT PFAX_GLOBAL_ROUTING_INFOW *RoutingInfo,
OUT LPDWORD MethodsReturned
);
#ifdef UNICODE
#define PFAXENUMGLOBALROUTINGINFO PFAXENUMGLOBALROUTINGINFOW
#else
#define PFAXENUMGLOBALROUTINGINFO PFAXENUMGLOBALROUTINGINFOA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetGlobalRoutingInfoA(
IN HANDLE FaxHandle,
IN const FAX_GLOBAL_ROUTING_INFOA *RoutingInfo
);
WINFAXAPI
BOOL
WINAPI
FaxSetGlobalRoutingInfoW(
IN HANDLE FaxHandle,
IN const FAX_GLOBAL_ROUTING_INFOW *RoutingInfo
);
#ifdef UNICODE
#define FaxSetGlobalRoutingInfo FaxSetGlobalRoutingInfoW
#else
#define FaxSetGlobalRoutingInfo FaxSetGlobalRoutingInfoA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETGLOBALROUTINGINFOA)(
IN HANDLE FaxPortHandle,
IN const FAX_GLOBAL_ROUTING_INFOA *RoutingInfo
);
typedef BOOL
(WINAPI *PFAXSETGLOBALROUTINGINFOW)(
IN HANDLE FaxPortHandle,
IN const FAX_GLOBAL_ROUTING_INFOW *RoutingInfo
);
#ifdef UNICODE
#define PFAXSETGLOBALROUTINGINFO PFAXSETGLOBALROUTINGINFOW
#else
#define PFAXSETGLOBALROUTINGINFO PFAXSETGLOBALROUTINGINFOA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxGetRoutingInfoA(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
OUT LPBYTE *RoutingInfoBuffer,
OUT LPDWORD RoutingInfoBufferSize
);
WINFAXAPI
BOOL
WINAPI
FaxGetRoutingInfoW(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
OUT LPBYTE *RoutingInfoBuffer,
OUT LPDWORD RoutingInfoBufferSize
);
#ifdef UNICODE
#define FaxGetRoutingInfo FaxGetRoutingInfoW
#else
#define FaxGetRoutingInfo FaxGetRoutingInfoA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXGETROUTINGINFOA)(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
OUT LPBYTE *RoutingInfoBuffer,
OUT LPDWORD RoutingInfoBufferSize
);
typedef BOOL
(WINAPI *PFAXGETROUTINGINFOW)(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
OUT LPBYTE *RoutingInfoBuffer,
OUT LPDWORD RoutingInfoBufferSize
);
#ifdef UNICODE
#define PFAXGETROUTINGINFO PFAXGETROUTINGINFOW
#else
#define PFAXGETROUTINGINFO PFAXGETROUTINGINFOA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxSetRoutingInfoA(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
IN const BYTE *RoutingInfoBuffer,
IN DWORD RoutingInfoBufferSize
);
WINFAXAPI
BOOL
WINAPI
FaxSetRoutingInfoW(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
IN const BYTE *RoutingInfoBuffer,
IN DWORD RoutingInfoBufferSize
);
#ifdef UNICODE
#define FaxSetRoutingInfo FaxSetRoutingInfoW
#else
#define FaxSetRoutingInfo FaxSetRoutingInfoA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSETROUTINGINFOA)(
IN HANDLE FaxPortHandle,
IN LPCSTR RoutingGuid,
IN const BYTE *RoutingInfoBuffer,
IN DWORD RoutingInfoBufferSize
);
typedef BOOL
(WINAPI *PFAXSETROUTINGINFOW)(
IN HANDLE FaxPortHandle,
IN LPCWSTR RoutingGuid,
IN const BYTE *RoutingInfoBuffer,
IN DWORD RoutingInfoBufferSize
);
#ifdef UNICODE
#define PFAXSETROUTINGINFO PFAXSETROUTINGINFOW
#else
#define PFAXSETROUTINGINFO PFAXSETROUTINGINFOA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxInitializeEventQueue(
IN HANDLE FaxHandle,
IN HANDLE CompletionPort,
IN ULONG_PTR CompletionKey,
IN HWND hWnd,
IN UINT MessageStart
);
typedef BOOL
(WINAPI *PFAXINITIALIZEEVENTQUEUE)(
IN HANDLE FaxHandle,
IN HANDLE CompletionPort,
IN ULONG_PTR CompletionKey,
IN HWND hWnd,
IN UINT MessageStart
);
WINFAXAPI
VOID
WINAPI
FaxFreeBuffer(
LPVOID Buffer
);
typedef VOID
(WINAPI *PFAXFREEBUFFER)(
LPVOID Buffer
);
WINFAXAPI
BOOL
WINAPI
FaxStartPrintJobA(
IN LPCSTR PrinterName,
IN const FAX_PRINT_INFOA *PrintInfo,
OUT LPDWORD FaxJobId,
OUT PFAX_CONTEXT_INFOA FaxContextInfo
);
WINFAXAPI
BOOL
WINAPI
FaxStartPrintJobW(
IN LPCWSTR PrinterName,
IN const FAX_PRINT_INFOW *PrintInfo,
OUT LPDWORD FaxJobId,
OUT PFAX_CONTEXT_INFOW FaxContextInfo
);
#ifdef UNICODE
#define FaxStartPrintJob FaxStartPrintJobW
#else
#define FaxStartPrintJob FaxStartPrintJobA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXSTARTPRINTJOBA)(
IN LPCSTR PrinterName,
IN const FAX_PRINT_INFOA *PrintInfo,
OUT LPDWORD FaxJobId,
OUT PFAX_CONTEXT_INFOA FaxContextInfo
);
typedef BOOL
(WINAPI *PFAXSTARTPRINTJOBW)(
IN LPCWSTR PrinterName,
IN const FAX_PRINT_INFOW *PrintInfo,
OUT LPDWORD FaxJobId,
OUT PFAX_CONTEXT_INFOW FaxContextInfo
);
#ifdef UNICODE
#define PFAXSTARTPRINTJOB PFAXSTARTPRINTJOBW
#else
#define PFAXSTARTPRINTJOB PFAXSTARTPRINTJOBA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxPrintCoverPageA(
IN const FAX_CONTEXT_INFOA *FaxContextInfo,
IN const FAX_COVERPAGE_INFOA *CoverPageInfo
);
WINFAXAPI
BOOL
WINAPI
FaxPrintCoverPageW(
IN const FAX_CONTEXT_INFOW *FaxContextInfo,
IN const FAX_COVERPAGE_INFOW *CoverPageInfo
);
#ifdef UNICODE
#define FaxPrintCoverPage FaxPrintCoverPageW
#else
#define FaxPrintCoverPage FaxPrintCoverPageA
#endif // !UNICODE
typedef BOOL
(WINAPI *PFAXPRINTCOVERPAGEA)(
IN const FAX_CONTEXT_INFOA *FaxContextInfo,
IN const FAX_COVERPAGE_INFOA *CoverPageInfo
);
typedef BOOL
(WINAPI *PFAXPRINTCOVERPAGEW)(
IN const FAX_CONTEXT_INFOW *FaxContextInfo,
IN const FAX_COVERPAGE_INFOW *CoverPageInfo
);
#ifdef UNICODE
#define PFAXPRINTCOVERPAGE PFAXPRINTCOVERPAGEW
#else
#define PFAXPRINTCOVERPAGE PFAXPRINTCOVERPAGEA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxRegisterServiceProviderW(
IN LPCWSTR DeviceProvider,
IN LPCWSTR FriendlyName,
IN LPCWSTR ImageName,
IN LPCWSTR TspName
);
#define FaxRegisterServiceProvider FaxRegisterServiceProviderW
typedef BOOL
(WINAPI *PFAXREGISTERSERVICEPROVIDERW)(
IN LPCWSTR DeviceProvider,
IN LPCWSTR FriendlyName,
IN LPCWSTR ImageName,
IN LPCWSTR TspName
);
#define PFAXREGISTERSERVICEPROVIDER PFAXREGISTERSERVICEPROVIDERW
WINFAXAPI
BOOL
WINAPI
FaxUnregisterServiceProviderW(
IN LPCWSTR DeviceProvider
);
#define FaxUnregisterServiceProvider FaxUnregisterServiceProviderW
typedef BOOL
(WINAPI *PFAXUNREGISTERSERVICEPROVIDERW)(
IN LPCWSTR DeviceProvider
);
#define PFAXUNREGISTERSERVICEPROVIDER PFAXUNREGISTERSERVICEPROVIDERW
typedef BOOL
(CALLBACK *PFAX_ROUTING_INSTALLATION_CALLBACKW)(
IN HANDLE FaxHandle,
IN LPVOID Context,
IN OUT LPWSTR MethodName,
IN OUT LPWSTR FriendlyName,
IN OUT LPWSTR FunctionName,
IN OUT LPWSTR Guid
);
#define PFAX_ROUTING_INSTALLATION_CALLBACK PFAX_ROUTING_INSTALLATION_CALLBACKW
WINFAXAPI
BOOL
WINAPI
FaxRegisterRoutingExtensionW(
IN HANDLE FaxHandle,
IN LPCWSTR ExtensionName,
IN LPCWSTR FriendlyName,
IN LPCWSTR ImageName,
IN PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack,
IN LPVOID Context
);
#define FaxRegisterRoutingExtension FaxRegisterRoutingExtensionW
typedef BOOL
(WINAPI *PFAXREGISTERROUTINGEXTENSIONW)(
IN HANDLE FaxHandle,
IN LPCWSTR ExtensionName,
IN LPCWSTR FriendlyName,
IN LPCWSTR ImageName,
IN PFAX_ROUTING_INSTALLATION_CALLBACKW CallBack,
IN LPVOID Context
);
#define PFAXREGISTERROUTINGEXTENSION PFAXREGISTERROUTINGEXTENSIONW
WINFAXAPI
BOOL
WINAPI
FaxUnregisterRoutingExtensionA(
IN HANDLE hFaxHandle,
IN LPCSTR lpctstrExtensionName
);
WINFAXAPI
BOOL
WINAPI
FaxUnregisterRoutingExtensionW(
IN HANDLE hFaxHandle,
IN LPCWSTR lpctstrExtensionName
);
#ifdef UNICODE
#define FaxUnregisterRoutingExtension FaxUnregisterRoutingExtensionW
#else
#define FaxUnregisterRoutingExtension FaxUnregisterRoutingExtensionA
#endif // !UNICODE
WINFAXAPI
BOOL
WINAPI
FaxAccessCheck(
IN HANDLE FaxHandle,
IN DWORD AccessMask
);
typedef BOOL
(WINAPI *PFAXACCESSCHECK)(
IN HANDLE FaxHandle,
IN DWORD AccessMask
);
//
// Fax Specific Access Rights
//
#define FAX_JOB_SUBMIT (0x0001)
#define FAX_JOB_QUERY (0x0002)
#define FAX_CONFIG_QUERY (0x0004)
#define FAX_CONFIG_SET (0x0008)
#define FAX_PORT_QUERY (0x0010)
#define FAX_PORT_SET (0x0020)
#define FAX_JOB_MANAGE (0x0040)
#define FAX_READ (STANDARD_RIGHTS_READ |\
FAX_JOB_QUERY |\
FAX_CONFIG_QUERY |\
FAX_PORT_QUERY)
#define FAX_WRITE (STANDARD_RIGHTS_WRITE |\
FAX_JOB_SUBMIT )
#define FAX_ALL_ACCESS (STANDARD_RIGHTS_ALL |\
FAX_JOB_SUBMIT |\
FAX_JOB_QUERY |\
FAX_CONFIG_QUERY |\
FAX_CONFIG_SET |\
FAX_PORT_QUERY |\
FAX_PORT_SET |\
FAX_JOB_MANAGE)
#ifdef __cplusplus
}
#endif
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#endif
|
9b86c9d170c78c63e0750b26873e95503392b667
|
1577e1cf4e89584a125cffb855ca50a9654c6d55
|
/Security/header_symlinks/macOS/Security/oidscert.h
|
7af27c7b2f383cf2340311be829aeee8814dd2c2
|
[] |
no_license
|
apple-open-source/macos
|
a4188b5c2ef113d90281d03cd1b14e5ee52ebffb
|
2d2b15f13487673de33297e49f00ef94af743a9a
|
refs/heads/master
| 2023-08-01T11:03:26.870408
| 2023-03-27T00:00:00
| 2023-03-27T00:00:00
| 180,595,052
| 124
| 24
| null | 2022-12-27T14:54:09
| 2019-04-10T14:06:23
| null |
UTF-8
|
C
| false
| false
| 44
|
h
|
oidscert.h
|
../../../OSX/libsecurity_cssm/lib/oidscert.h
|
495237d8ffd3fbb80e466ecdc6594c79c1ee7e60
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/sys/dev/kstat.c
|
073f61a2c34c4f9e6254b2817c54dd4ed9d8265c
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 14,620
|
c
|
kstat.c
|
/* $OpenBSD: kstat.c,v 1.2 2022/01/31 05:09:17 dlg Exp $ */
/*
* Copyright (c) 2020 David Gwynne <dlg@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <sys/malloc.h>
#include <sys/pool.h>
#include <sys/time.h>
/* for kstat_set_cpu */
#include <sys/proc.h>
#include <sys/sched.h>
#include <sys/kstat.h>
RBT_HEAD(kstat_id_tree, kstat);
static inline int
kstat_id_cmp(const struct kstat *a, const struct kstat *b)
{
if (a->ks_id > b->ks_id)
return (1);
if (a->ks_id < b->ks_id)
return (-1);
return (0);
}
RBT_PROTOTYPE(kstat_id_tree, kstat, ks_id_entry, kstat_id_cmp);
RBT_HEAD(kstat_pv_tree, kstat);
static inline int
kstat_pv_cmp(const struct kstat *a, const struct kstat *b)
{
int rv;
rv = strcmp(a->ks_provider, b->ks_provider);
if (rv != 0)
return (rv);
if (a->ks_instance > b->ks_instance)
return (1);
if (a->ks_instance < b->ks_instance)
return (-1);
rv = strcmp(a->ks_name, b->ks_name);
if (rv != 0)
return (rv);
if (a->ks_unit > b->ks_unit)
return (1);
if (a->ks_unit < b->ks_unit)
return (-1);
return (0);
}
RBT_PROTOTYPE(kstat_pv_tree, kstat, ks_pv_entry, kstat_pv_cmp);
RBT_HEAD(kstat_nm_tree, kstat);
static inline int
kstat_nm_cmp(const struct kstat *a, const struct kstat *b)
{
int rv;
rv = strcmp(a->ks_name, b->ks_name);
if (rv != 0)
return (rv);
if (a->ks_unit > b->ks_unit)
return (1);
if (a->ks_unit < b->ks_unit)
return (-1);
rv = strcmp(a->ks_provider, b->ks_provider);
if (rv != 0)
return (rv);
if (a->ks_instance > b->ks_instance)
return (1);
if (a->ks_instance < b->ks_instance)
return (-1);
return (0);
}
RBT_PROTOTYPE(kstat_nm_tree, kstat, ks_nm_entry, kstat_nm_cmp);
struct kstat_lock_ops {
void (*enter)(void *);
void (*leave)(void *);
};
#define kstat_enter(_ks) (_ks)->ks_lock_ops->enter((_ks)->ks_lock)
#define kstat_leave(_ks) (_ks)->ks_lock_ops->leave((_ks)->ks_lock)
const struct kstat_lock_ops kstat_rlock_ops = {
(void (*)(void *))rw_enter_read,
(void (*)(void *))rw_exit_read,
};
const struct kstat_lock_ops kstat_wlock_ops = {
(void (*)(void *))rw_enter_write,
(void (*)(void *))rw_exit_write,
};
const struct kstat_lock_ops kstat_mutex_ops = {
(void (*)(void *))mtx_enter,
(void (*)(void *))mtx_leave,
};
void kstat_cpu_enter(void *);
void kstat_cpu_leave(void *);
const struct kstat_lock_ops kstat_cpu_ops = {
kstat_cpu_enter,
kstat_cpu_leave,
};
struct rwlock kstat_lock = RWLOCK_INITIALIZER("kstat");
/*
* The global state is versioned so changes to the set of kstats
* can be detected. This is an int so it can be read atomically on
* any arch, which is a ridiculous optimisation, really.
*/
unsigned int kstat_version = 0;
/*
* kstat structures have a unique identifier so they can be found
* quickly. Identifiers are 64bit in the hope that it won't wrap
* during the runtime of a system. The identifiers start at 1 so that
* 0 can be used as the first value for userland to iterate with.
*/
uint64_t kstat_next_id = 1;
struct kstat_id_tree kstat_id_tree = RBT_INITIALIZER();
struct kstat_pv_tree kstat_pv_tree = RBT_INITIALIZER();
struct kstat_nm_tree kstat_nm_tree = RBT_INITIALIZER();
struct pool kstat_pool;
struct rwlock kstat_default_lock = RWLOCK_INITIALIZER("kstatlk");
int kstat_read(struct kstat *);
int kstat_copy(struct kstat *, void *);
int
kstatattach(int num)
{
/* XXX install system stats here */
return (0);
}
int
kstatopen(dev_t dev, int flag, int mode, struct proc *p)
{
return (0);
}
int
kstatclose(dev_t dev, int flag, int mode, struct proc *p)
{
return (0);
}
int
kstatioc_enter(struct kstat_req *ksreq)
{
int error;
error = rw_enter(&kstat_lock, RW_READ | RW_INTR);
if (error != 0)
return (error);
if (!ISSET(ksreq->ks_rflags, KSTATIOC_F_IGNVER) &&
ksreq->ks_version != kstat_version) {
error = EINVAL;
goto error;
}
return (0);
error:
rw_exit(&kstat_lock);
return (error);
}
int
kstatioc_leave(struct kstat_req *ksreq, struct kstat *ks)
{
void *buf = NULL;
size_t klen = 0, ulen = 0;
struct timespec updated;
int error = 0;
if (ks == NULL) {
error = ENOENT;
goto error;
}
switch (ks->ks_state) {
case KSTAT_S_CREATED:
ksreq->ks_updated = ks->ks_created;
ksreq->ks_interval.tv_sec = 0;
ksreq->ks_interval.tv_nsec = 0;
ksreq->ks_datalen = 0;
ksreq->ks_dataver = 0;
break;
case KSTAT_S_INSTALLED:
ksreq->ks_dataver = ks->ks_dataver;
ksreq->ks_interval = ks->ks_interval;
if (ksreq->ks_data == NULL) {
/* userland doesn't want actual data, so shortcut */
kstat_enter(ks);
ksreq->ks_datalen = ks->ks_datalen;
ksreq->ks_updated = ks->ks_updated;
kstat_leave(ks);
break;
}
klen = ks->ks_datalen; /* KSTAT_F_REALLOC */
buf = malloc(klen, M_TEMP, M_WAITOK|M_CANFAIL);
if (buf == NULL) {
error = ENOMEM;
goto error;
}
kstat_enter(ks);
error = (*ks->ks_read)(ks);
if (error == 0) {
updated = ks->ks_updated;
/* KSTAT_F_REALLOC */
KASSERTMSG(ks->ks_datalen == klen,
"kstat doesnt support resized data yet");
error = (*ks->ks_copy)(ks, buf);
}
kstat_leave(ks);
if (error != 0)
goto error;
ulen = ksreq->ks_datalen;
ksreq->ks_datalen = klen; /* KSTAT_F_REALLOC */
ksreq->ks_updated = updated;
break;
default:
panic("ks %p unexpected state %u", ks, ks->ks_state);
}
ksreq->ks_version = kstat_version;
ksreq->ks_id = ks->ks_id;
if (strlcpy(ksreq->ks_provider, ks->ks_provider,
sizeof(ksreq->ks_provider)) >= sizeof(ksreq->ks_provider))
panic("kstat %p provider string has grown", ks);
ksreq->ks_instance = ks->ks_instance;
if (strlcpy(ksreq->ks_name, ks->ks_name,
sizeof(ksreq->ks_name)) >= sizeof(ksreq->ks_name))
panic("kstat %p name string has grown", ks);
ksreq->ks_unit = ks->ks_unit;
ksreq->ks_created = ks->ks_created;
ksreq->ks_type = ks->ks_type;
ksreq->ks_state = ks->ks_state;
error:
rw_exit(&kstat_lock);
if (buf != NULL) {
if (error == 0)
error = copyout(buf, ksreq->ks_data, min(klen, ulen));
free(buf, M_TEMP, klen);
}
return (error);
}
int
kstatioc_find_id(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_id = ksreq->ks_id;
ks = RBT_FIND(kstat_id_tree, &kstat_id_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioc_nfind_id(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_id = ksreq->ks_id;
ks = RBT_NFIND(kstat_id_tree, &kstat_id_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioc_find_pv(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_provider = ksreq->ks_provider;
key.ks_instance = ksreq->ks_instance;
key.ks_name = ksreq->ks_name;
key.ks_unit = ksreq->ks_unit;
ks = RBT_FIND(kstat_pv_tree, &kstat_pv_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioc_nfind_pv(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_provider = ksreq->ks_provider;
key.ks_instance = ksreq->ks_instance;
key.ks_name = ksreq->ks_name;
key.ks_unit = ksreq->ks_unit;
ks = RBT_NFIND(kstat_pv_tree, &kstat_pv_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioc_find_nm(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_name = ksreq->ks_name;
key.ks_unit = ksreq->ks_unit;
key.ks_provider = ksreq->ks_provider;
key.ks_instance = ksreq->ks_instance;
ks = RBT_FIND(kstat_nm_tree, &kstat_nm_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioc_nfind_nm(struct kstat_req *ksreq)
{
struct kstat *ks, key;
int error;
error = kstatioc_enter(ksreq);
if (error != 0)
return (error);
key.ks_name = ksreq->ks_name;
key.ks_unit = ksreq->ks_unit;
key.ks_provider = ksreq->ks_provider;
key.ks_instance = ksreq->ks_instance;
ks = RBT_NFIND(kstat_nm_tree, &kstat_nm_tree, &key);
return (kstatioc_leave(ksreq, ks));
}
int
kstatioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
struct kstat_req *ksreq = (struct kstat_req *)data;
int error = 0;
KERNEL_UNLOCK();
switch (cmd) {
case KSTATIOC_VERSION:
*(unsigned int *)data = kstat_version;
break;
case KSTATIOC_FIND_ID:
error = kstatioc_find_id(ksreq);
break;
case KSTATIOC_NFIND_ID:
error = kstatioc_nfind_id(ksreq);
break;
case KSTATIOC_FIND_PROVIDER:
error = kstatioc_find_pv(ksreq);
break;
case KSTATIOC_NFIND_PROVIDER:
error = kstatioc_nfind_pv(ksreq);
break;
case KSTATIOC_FIND_NAME:
error = kstatioc_find_nm(ksreq);
break;
case KSTATIOC_NFIND_NAME:
error = kstatioc_nfind_nm(ksreq);
break;
default:
error = ENOTTY;
break;
}
KERNEL_LOCK();
return (error);
}
void
kstat_init(void)
{
static int initialized = 0;
if (initialized)
return;
pool_init(&kstat_pool, sizeof(struct kstat), 0, IPL_NONE,
PR_WAITOK | PR_RWLOCK, "kstatmem", NULL);
initialized = 1;
}
int
kstat_strcheck(const char *str)
{
size_t i, l;
l = strlen(str);
if (l == 0 || l >= KSTAT_STRLEN)
return (-1);
for (i = 0; i < l; i++) {
int ch = str[i];
if (ch >= 'a' && ch <= 'z')
continue;
if (ch >= 'A' && ch <= 'Z')
continue;
if (ch >= '0' && ch <= '9')
continue;
switch (ch) {
case '-':
case '_':
case '.':
break;
default:
return (-1);
}
}
return (0);
}
struct kstat *
kstat_create(const char *provider, unsigned int instance,
const char *name, unsigned int unit,
unsigned int type, unsigned int flags)
{
struct kstat *ks, *oks;
if (kstat_strcheck(provider) == -1)
panic("invalid provider string");
if (kstat_strcheck(name) == -1)
panic("invalid name string");
kstat_init();
ks = pool_get(&kstat_pool, PR_WAITOK|PR_ZERO);
ks->ks_provider = provider;
ks->ks_instance = instance;
ks->ks_name = name;
ks->ks_unit = unit;
ks->ks_flags = flags;
ks->ks_type = type;
ks->ks_state = KSTAT_S_CREATED;
getnanouptime(&ks->ks_created);
ks->ks_updated = ks->ks_created;
ks->ks_lock = &kstat_default_lock;
ks->ks_lock_ops = &kstat_wlock_ops;
ks->ks_read = kstat_read;
ks->ks_copy = kstat_copy;
rw_enter_write(&kstat_lock);
ks->ks_id = kstat_next_id;
oks = RBT_INSERT(kstat_pv_tree, &kstat_pv_tree, ks);
if (oks == NULL) {
/* commit */
kstat_next_id++;
kstat_version++;
oks = RBT_INSERT(kstat_nm_tree, &kstat_nm_tree, ks);
if (oks != NULL)
panic("kstat name collision! (%llu)", ks->ks_id);
oks = RBT_INSERT(kstat_id_tree, &kstat_id_tree, ks);
if (oks != NULL)
panic("kstat id collision! (%llu)", ks->ks_id);
}
rw_exit_write(&kstat_lock);
if (oks != NULL) {
pool_put(&kstat_pool, ks);
return (NULL);
}
return (ks);
}
void
kstat_set_rlock(struct kstat *ks, struct rwlock *rwl)
{
KASSERT(ks->ks_state == KSTAT_S_CREATED);
ks->ks_lock = rwl;
ks->ks_lock_ops = &kstat_rlock_ops;
}
void
kstat_set_wlock(struct kstat *ks, struct rwlock *rwl)
{
KASSERT(ks->ks_state == KSTAT_S_CREATED);
ks->ks_lock = rwl;
ks->ks_lock_ops = &kstat_wlock_ops;
}
void
kstat_set_mutex(struct kstat *ks, struct mutex *mtx)
{
KASSERT(ks->ks_state == KSTAT_S_CREATED);
ks->ks_lock = mtx;
ks->ks_lock_ops = &kstat_mutex_ops;
}
void
kstat_cpu_enter(void *p)
{
struct cpu_info *ci = p;
sched_peg_curproc(ci);
}
void
kstat_cpu_leave(void *p)
{
atomic_clearbits_int(&curproc->p_flag, P_CPUPEG);
}
void
kstat_set_cpu(struct kstat *ks, struct cpu_info *ci)
{
KASSERT(ks->ks_state == KSTAT_S_CREATED);
ks->ks_lock = ci;
ks->ks_lock_ops = &kstat_cpu_ops;
}
int
kstat_read_nop(struct kstat *ks)
{
return (0);
}
void
kstat_install(struct kstat *ks)
{
if (!ISSET(ks->ks_flags, KSTAT_F_REALLOC)) {
KASSERTMSG(ks->ks_copy != NULL || ks->ks_data != NULL,
"kstat %p %s:%u:%s:%u must provide ks_copy or ks_data", ks,
ks->ks_provider, ks->ks_instance, ks->ks_name, ks->ks_unit);
KASSERT(ks->ks_datalen > 0);
}
rw_enter_write(&kstat_lock);
ks->ks_state = KSTAT_S_INSTALLED;
rw_exit_write(&kstat_lock);
}
void
kstat_remove(struct kstat *ks)
{
rw_enter_write(&kstat_lock);
KASSERTMSG(ks->ks_state == KSTAT_S_INSTALLED,
"kstat %p %s:%u:%s:%u is not installed", ks,
ks->ks_provider, ks->ks_instance, ks->ks_name, ks->ks_unit);
ks->ks_state = KSTAT_S_CREATED;
rw_exit_write(&kstat_lock);
}
void
kstat_destroy(struct kstat *ks)
{
rw_enter_write(&kstat_lock);
RBT_REMOVE(kstat_id_tree, &kstat_id_tree, ks);
RBT_REMOVE(kstat_pv_tree, &kstat_pv_tree, ks);
RBT_REMOVE(kstat_nm_tree, &kstat_nm_tree, ks);
kstat_version++;
rw_exit_write(&kstat_lock);
pool_put(&kstat_pool, ks);
}
int
kstat_read(struct kstat *ks)
{
getnanouptime(&ks->ks_updated);
return (0);
}
int
kstat_copy(struct kstat *ks, void *buf)
{
memcpy(buf, ks->ks_data, ks->ks_datalen);
return (0);
}
RBT_GENERATE(kstat_id_tree, kstat, ks_id_entry, kstat_id_cmp);
RBT_GENERATE(kstat_pv_tree, kstat, ks_pv_entry, kstat_pv_cmp);
RBT_GENERATE(kstat_nm_tree, kstat, ks_nm_entry, kstat_nm_cmp);
void
kstat_kv_init(struct kstat_kv *kv, const char *name, enum kstat_kv_type type)
{
memset(kv, 0, sizeof(*kv));
strlcpy(kv->kv_key, name, sizeof(kv->kv_key)); /* XXX truncated? */
kv->kv_type = type;
kv->kv_unit = KSTAT_KV_U_NONE;
}
void
kstat_kv_unit_init(struct kstat_kv *kv, const char *name,
enum kstat_kv_type type, enum kstat_kv_unit unit)
{
switch (type) {
case KSTAT_KV_T_COUNTER64:
case KSTAT_KV_T_COUNTER32:
case KSTAT_KV_T_UINT64:
case KSTAT_KV_T_INT64:
case KSTAT_KV_T_UINT32:
case KSTAT_KV_T_INT32:
break;
default:
panic("kv unit init %s: unit for non-integer type", name);
}
memset(kv, 0, sizeof(*kv));
strlcpy(kv->kv_key, name, sizeof(kv->kv_key)); /* XXX truncated? */
kv->kv_type = type;
kv->kv_unit = unit;
}
|
cafd8dfc8b42bb86f3413e7ab0caa866c990c480
|
89ac799bd004042f913c9205abd22feaf847f5be
|
/src/Menu/menu_radio_codec_helper_8004158C/menu_radio_codec_helper_helper9_80047FF4.c
|
ba4b7c8d04ecd272c24b275e545a79deac377ee8
|
[] |
no_license
|
FoxdieTeam/mgs_reversing
|
de0b501e9a6318bf817e0d0f03af34c836a2f0b6
|
d057e3eb8bebeb645ca23db6ce690577268f59d5
|
refs/heads/master
| 2023-07-21T02:31:57.827478
| 2023-07-17T10:50:39
| 2023-07-17T10:50:39
| 223,033,157
| 270
| 35
| null | 2023-09-14T21:49:31
| 2019-11-20T21:44:13
|
C
|
UTF-8
|
C
| false
| false
| 202
|
c
|
menu_radio_codec_helper_helper9_80047FF4.c
|
#include "libfs/libfs.h"
int menu_radio_codec_helper_helper9_80047FF4()
{
int iVar1;
iVar1 = FS_LoadFileSync_80021F48();
if (iVar1 >= 1)
{
return iVar1;
}
return 0;
}
|
77c22106fb101b1016f81845b43e59d7c1b06278
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/PerformancePkg/Dp_App/Literals.h
|
b11fad468139e7d539e79294d593ea893acbec00
|
[
"MIT",
"BSD-2-Clause",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 951
|
h
|
Literals.h
|
/** @file
Declarations of ASCII string literals used by DP.
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _LITERALS_H_
#define _LITERALS_H_
// ASCII String literals which probably don't need translation
extern CHAR8 const ALit_TimerLibError[];
extern CHAR8 const ALit_SEC[];
extern CHAR8 const ALit_DXE[];
extern CHAR8 const ALit_SHELL[];
extern CHAR8 const ALit_PEI[];
extern CHAR8 const ALit_BDS[];
extern CHAR8 const ALit_BdsTO[];
extern CHAR8 const ALit_PEIM[];
#endif // _LITERALS_H_
|
f758befc9bebfebd8e768afe509e47d1657ee244
|
010279e2ba272d09e9d2c4e903722e5faba2cf7a
|
/contrib/python/Pillow/py3/libImaging/Jpeg2K.h
|
e8d92f7b6bc166c19e240a643a0d5430c55f9916
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND"
] |
permissive
|
catboost/catboost
|
854c1a1f439a96f1ae6b48e16644be20aa04dba2
|
f5042e35b945aded77b23470ead62d7eacefde92
|
refs/heads/master
| 2023-09-01T12:14:14.174108
| 2023-09-01T10:01:01
| 2023-09-01T10:22:12
| 97,556,265
| 8,012
| 1,425
|
Apache-2.0
| 2023-09-11T03:32:32
| 2017-07-18T05:29:04
|
Python
|
UTF-8
|
C
| false
| false
| 2,563
|
h
|
Jpeg2K.h
|
/*
* The Python Imaging Library
* $Id$
*
* declarations for the OpenJPEG codec interface.
*
* Copyright (c) 2014 by Coriolis Systems Limited
* Copyright (c) 2014 by Alastair Houghton
*/
#include <openjpeg.h>
/* 1MB for now */
#define BUFFER_SIZE OPJ_J2K_STREAM_CHUNK_SIZE
/* -------------------------------------------------------------------- */
/* Decoder */
/* -------------------------------------------------------------------- */
typedef struct {
/* CONFIGURATION */
/* File descriptor, if available; otherwise, -1 */
int fd;
/* File pointer, when opened */
FILE *pfile;
/* Length of data, if available; otherwise, -1 */
off_t length;
/* Specify the desired format */
OPJ_CODEC_FORMAT format;
/* Set to divide image resolution by 2**reduce. */
int reduce;
/* Set to limit the number of quality layers to decode (0 = all layers) */
int layers;
/* PRIVATE CONTEXT (set by decoder) */
const char *error_msg;
} JPEG2KDECODESTATE;
/* -------------------------------------------------------------------- */
/* Encoder */
/* -------------------------------------------------------------------- */
typedef struct {
/* CONFIGURATION */
/* File descriptor, if available; otherwise, -1 */
int fd;
/* File pointer, when opened */
FILE *pfile;
/* Specify the desired format */
OPJ_CODEC_FORMAT format;
/* Image offset */
int offset_x, offset_y;
/* Tile information */
int tile_offset_x, tile_offset_y;
int tile_size_x, tile_size_y;
/* Quality layers (a sequence of numbers giving *either* rates or dB) */
int quality_is_in_db;
PyObject *quality_layers;
/* Number of resolutions (DWT decompositions + 1 */
int num_resolutions;
/* Code block size */
int cblk_width, cblk_height;
/* Precinct size */
int precinct_width, precinct_height;
/* Compression style */
int irreversible;
/* Set multiple component transformation */
char mct;
/* Signed */
int sgnd;
/* Progression order (LRCP/RLCP/RPCL/PCRL/CPRL) */
OPJ_PROG_ORDER progression;
/* Cinema mode */
OPJ_CINEMA_MODE cinema_mode;
/* PRIVATE CONTEXT (set by decoder) */
const char *error_msg;
/* Custom comment */
char *comment;
/* Include PLT marker segment */
int plt;
} JPEG2KENCODESTATE;
/*
* Local Variables:
* c-basic-offset: 4
* End:
*
*/
|
a560e8e6ead70700aed58fcbcea06672087e92cf
|
76f9898ff7a555f4a729d725056a317af818375d
|
/assets/objects/object_d_hsblock/object_d_hsblock.c
|
6fe5fd1fba8586ed4ae4070bffbef12211b7e7a4
|
[] |
no_license
|
z64proto/sw97
|
0b65837ab2f2a4073faca5670761d7fe0e74d29d
|
f571505ade2cefd4a5b5d19da06d33e7c6b02c60
|
refs/heads/master
| 2023-08-01T02:47:42.895871
| 2022-05-15T20:29:08
| 2022-05-15T20:29:08
| 430,216,978
| 208
| 29
| null | 2021-11-22T12:23:50
| 2021-11-20T21:52:59
|
C
|
UTF-8
|
C
| false
| false
| 9,839
|
c
|
object_d_hsblock.c
|
#include "ultra64.h"
#include "z64.h"
#include "macros.h"
#include "objects/gameplay_keep/gameplay_keep.h"
// static Vtx object_d_hsblockVtx_000000[16];
// static Vtx object_d_hsblockVtx_000100[17];
// static Vtx object_d_hsblockVtx_000330[4];
// static Vtx object_d_hsblockVtx_000370[16];
// static Vtx object_d_hsblockVtx_000000[16] = {
// VTX(-200, 0, 200, 1024, 2048, 51, 51, 51, 255),
// VTX(-200, 600, 200, 1024, 0, 140, 140, 140, 255),
// VTX(-200, 600, -200, 0, 0, 204, 204, 204, 255),
// VTX(-200, 0, -200, 0, 2048, 89, 89, 89, 255),
// VTX(200, 0, 200, 0, 2048, 51, 51, 51, 255),
// VTX(200, 600, 200, 0, 0, 114, 114, 114, 255),
// VTX(-200, 600, 200, 1024, 0, 204, 204, 204, 255),
// VTX(-200, 0, 200, 1024, 2048, 153, 153, 153, 255),
// VTX(200, 0, -200, 1024, 2048, 51, 51, 51, 255),
// VTX(200, 600, -200, 1024, 0, 140, 140, 140, 255),
// VTX(200, 600, 200, 0, 0, 204, 204, 204, 255),
// VTX(200, 0, 200, 0, 2048, 153, 153, 153, 255),
// VTX(-200, 0, -200, 1024, 2048, 51, 51, 51, 255),
// VTX(-200, 600, -200, 1024, 0, 114, 114, 114, 255),
// VTX(200, 600, -200, 0, 0, 204, 204, 204, 255),
// VTX(200, 0, -200, 0, 2048, 153, 153, 153, 255),
// };
// static Vtx object_d_hsblockVtx_000100[17] = {
// VTX(-200, 1000, -200, -192, -192, 255, 255, 255, 255),
// VTX(-200, 1000, 200, -192, 202, 255, 255, 255, 255),
// VTX(200, 1000, 200, 202, 202, 255, 255, 255, 255),
// VTX(200, 1000, -200, 202, -192, 255, 255, 255, 255),
// VTX(-200, 600, 200, 1024, 1024, 140, 140, 140, 255),
// VTX(-200, 1000, 200, 1024, 0, 255, 255, 255, 255),
// VTX(-200, 1000, -200, 0, 0, 255, 255, 255, 255),
// VTX(-200, 600, -200, 0, 1024, 204, 204, 204, 255),
// VTX(200, 600, 200, 0, 1024, 114, 114, 114, 255),
// VTX(200, 1000, 200, 0, 0, 255, 255, 255, 255),
// VTX(-200, 600, 200, 1024, 1024, 204, 204, 204, 255),
// VTX(200, 600, -200, 1024, 1024, 140, 140, 140, 255),
// VTX(200, 1000, -200, 1024, 0, 255, 255, 255, 255),
// VTX(200, 600, 200, 0, 1024, 204, 204, 204, 255),
// VTX(-200, 600, -200, 0, 1024, 114, 114, 114, 255),
// VTX(-200, 1000, -200, 0, 0, 255, 255, 255, 255),
// VTX(200, 600, -200, 1024, 1024, 204, 204, 204, 255),
// };
// Gfx gHsBlockDL_000210[] = {
// gsDPPipeSync(),
// gsDPSetTextureLUT(G_TT_NONE),
// gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
// gsDPLoadTextureBlock(hsblock_pillar_base, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP,
// G_TX_NOMIRROR | G_TX_CLAMP, 5, 6, G_TX_NOLOD, G_TX_NOLOD),
// gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, 1, COMBINED, 0, ENVIRONMENT, 0, 0, 0, 0, COMBINED),
// gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2),
// gsSPClearGeometryMode(G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR),
// gsSPSetGeometryMode(G_CULL_BACK | G_FOG),
// gsDPSetPrimColor(0, 0, 255, 255, 255, 255),
// gsSPVertex(&object_d_hsblockVtx_000000[0], 16, 0),
// gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
// gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
// gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0),
// gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0),
// gsDPPipeSync(),
// gsDPLoadTextureBlock(gUnusedStoneHookshotTargetTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR
// | G_TX_WRAP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
// gsSPVertex(&object_d_hsblockVtx_000100[0], 17, 0),
// gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
// gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
// gsSP2Triangles(8, 9, 5, 0, 8, 5, 10, 0),
// gsSP2Triangles(11, 12, 9, 0, 11, 9, 13, 0),
// gsSP2Triangles(14, 15, 12, 0, 14, 12, 16, 0),
// gsSPEndDisplayList(),
// };
// static u8 unaccounted_000328[8] = {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// };
// static Vtx object_d_hsblockVtx_000330[4] = {
// VTX(200, -200, 80, 1024, 1024, 255, 255, 255, 255),
// VTX(200, 200, 80, 1024, 0, 255, 255, 255, 255),
// VTX(-200, 200, 80, 0, 0, 255, 255, 255, 255),
// VTX(-200, -200, 80, 0, 1024, 255, 255, 255, 255),
// };
// static Vtx object_d_hsblockVtx_000370[16] = {
// VTX(-200, 200, 80, 0, 1024, 255, 255, 255, 255),
// VTX(200, 200, 80, 1024, 1024, 255, 255, 255, 255),
// VTX(200, 200, 0, 1024, 1824, 255, 255, 255, 255),
// VTX(-200, 200, 0, 0, 1024, 255, 255, 255, 255),
// VTX(-200, -200, 80, 0, 1024, 153, 153, 153, 255),
// VTX(-200, 200, 80, 0, 0, 216, 216, 216, 255),
// VTX(-200, 200, 0, 176, 0, 178, 178, 178, 255),
// VTX(-200, -200, 0, 176, 1024, 114, 114, 114, 255),
// VTX(-200, -200, 0, 0, 1773, 51, 51, 51, 255),
// VTX(200, -200, 0, 1024, 1773, 51, 51, 51, 255),
// VTX(200, -200, 80, 1024, 1024, 89, 89, 89, 255),
// VTX(-200, -200, 80, 0, 1024, 89, 89, 89, 255),
// VTX(200, -200, 0, 1830, 1024, 114, 114, 114, 255),
// VTX(200, 200, 0, 1830, 0, 178, 178, 178, 255),
// VTX(200, 200, 80, 1024, 0, 216, 216, 216, 255),
// VTX(200, -200, 80, 1024, 1024, 153, 153, 153, 255),
// };
// Gfx gHsBlockDL_000470[] = {
// gsDPPipeSync(),
// gsDPSetTextureLUT(G_TT_NONE),
// gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
// gsDPLoadTextureBlock(gUnusedStoneHookshotTargetTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR
// | G_TX_WRAP, 6, 6, G_TX_NOLOD, G_TX_NOLOD),
// gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, 0, 0, 0, 1, COMBINED, 0, ENVIRONMENT, 0, 0, 0, 0, COMBINED),
// gsDPSetRenderMode(G_RM_FOG_SHADE_A, G_RM_AA_ZB_TEX_EDGE2),
// gsSPClearGeometryMode(G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR),
// gsSPSetGeometryMode(G_CULL_BACK | G_FOG),
// gsDPSetPrimColor(0, 0, 255, 255, 255, 255),
// gsSPVertex(&object_d_hsblockVtx_000330[0], 4, 0),
// gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
// gsSPVertex(&object_d_hsblockVtx_000370[0], 16, 0),
// gsSP2Triangles(0, 1, 2, 0, 0, 2, 3, 0),
// gsSP2Triangles(4, 5, 6, 0, 4, 6, 7, 0),
// gsSP2Triangles(8, 9, 10, 0, 8, 10, 11, 0),
// gsSP2Triangles(12, 13, 14, 0, 12, 14, 15, 0),
// gsSPEndDisplayList(),
// };
// static u8 unaccounted_000528[8] = {
// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// };
// CamData gHsBlockCol_000578_camDataList_00000530[1] = {
// { 0x0000, 0, 0x00000000 },
// };
// SurfaceType gHsBlockCol_000578_surfaceType_00000538[] = {
// { 0x00000000, 0x000207C0 },
// };
// CollisionPoly gHsBlockCol_000578_polygons_00000540[] = {
// { 0x0000, 0x2000, 0x0001, 0x0002, 0x0000, 0x0000, 0x7FFF, 0xFFB0 },
// { 0x0000, 0x2000, 0x0002, 0x0003, 0x0000, 0x0000, 0x7FFF, 0xFFB0 },
// };
// Vec3s gHsBlockCol_000578_vtx_00000560[] = {
// { 200, -200, 80 },
// { 200, 200, 80 },
// { -200, 200, 80 },
// { -200, -200, 80 },
// };
// CollisionHeader gHsBlockCol_000578 = {
// { -200, -200, 0 },
// { 200, 200, 80 },
// 4,
// gHsBlockCol_000578_vtx_00000560,
// 2,
// gHsBlockCol_000578_polygons_00000540,
// gHsBlockCol_000578_surfaceType_00000538,
// gHsBlockCol_000578_camDataList_00000530,
// 0,
// NULL
// };
// static u32 pad5A4 = 0;
// static u32 pad5A8 = 0;
// static u32 pad5AC = 0;
// CamData gHsBlockCol_000730_camDataList_000005B0[1] = {
// { 0x0000, 0, 0x00000000 },
// };
// SurfaceType gHsBlockCol_000730_surfaceType_000005B8[] = {
// { 0x00000000, 0x000007C2 },
// { 0x00000000, 0x000207C2 },
// };
// CollisionPoly gHsBlockCol_000730_polygons_000005C8[] = {
// { 0x0000, 0x0000, 0x0001, 0x0002, 0x8001, 0x0000, 0x0000, 0xFF38 },
// { 0x0000, 0x0000, 0x0002, 0x0003, 0x8001, 0x0000, 0x0000, 0xFF38 },
// { 0x0000, 0x0004, 0x0005, 0x0001, 0x0000, 0x0000, 0x7FFF, 0xFF38 },
// { 0x0000, 0x0004, 0x0001, 0x0000, 0x0000, 0x0000, 0x7FFF, 0xFF38 },
// { 0x0000, 0x0006, 0x0007, 0x0005, 0x7FFF, 0x0000, 0x0000, 0xFF38 },
// { 0x0000, 0x0006, 0x0005, 0x0004, 0x7FFF, 0x0000, 0x0000, 0xFF38 },
// { 0x0000, 0x0003, 0x0002, 0x0007, 0x0000, 0x0000, 0x8001, 0xFF38 },
// { 0x0000, 0x0003, 0x0007, 0x0006, 0x0000, 0x0000, 0x8001, 0xFF38 },
// { 0x0000, 0x0008, 0x0009, 0x000A, 0x0000, 0x7FFF, 0x0000, 0xFC18 },
// { 0x0000, 0x0008, 0x000A, 0x000B, 0x0000, 0x7FFF, 0x0000, 0xFC18 },
// { 0x0001, 0x0001, 0x0009, 0x0008, 0x8001, 0x0000, 0x0000, 0xFF38 },
// { 0x0001, 0x0001, 0x0008, 0x0002, 0x8001, 0x0000, 0x0000, 0xFF38 },
// { 0x0001, 0x0005, 0x000A, 0x0009, 0x0000, 0x0000, 0x7FFF, 0xFF38 },
// { 0x0001, 0x0005, 0x0009, 0x0001, 0x0000, 0x0000, 0x7FFF, 0xFF38 },
// { 0x0001, 0x0007, 0x000B, 0x000A, 0x7FFF, 0x0000, 0x0000, 0xFF38 },
// { 0x0001, 0x0007, 0x000A, 0x0005, 0x7FFF, 0x0000, 0x0000, 0xFF38 },
// { 0x0001, 0x0002, 0x0008, 0x000B, 0x0000, 0x0000, 0x8001, 0xFF38 },
// { 0x0001, 0x0002, 0x000B, 0x0007, 0x0000, 0x0000, 0x8001, 0xFF38 },
// };
// Vec3s gHsBlockCol_000730_vtx_000006E8[] = {
// { -200, 0, 200 },
// { -200, 600, 200 },
// { -200, 600, -200 },
// { -200, 0, -200 },
// { 200, 0, 200 },
// { 200, 600, 200 },
// { 200, 0, -200 },
// { 200, 600, -200 },
// { -200, 1000, -200 },
// { -200, 1000, 200 },
// { 200, 1000, 200 },
// { 200, 1000, -200 },
// };
// CollisionHeader gHsBlockCol_000730 = {
// { -200, 0, -200 },
// { 200, 1000, 200 },
// 12,
// gHsBlockCol_000730_vtx_000006E8,
// 18,
// gHsBlockCol_000730_polygons_000005C8,
// gHsBlockCol_000730_surfaceType_000005B8,
// gHsBlockCol_000730_camDataList_000005B0,
// 0,
// NULL
// };
// static u32 pad75C = 0;
// u64 hsblock_pillar_base[] = {
// #include "assets/objects/object_d_hsblock/hsblock_pillar_base.rgb5a1.inc.c"
// };
|
ed516c8048aa776b315aadffeefaa89a9e5a42be
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/third_party/sqlite3/fts3_hash.c
|
e226b83a2a870613650aa87df04c4a7ef5e56198
|
[
"MIT",
"LicenseRef-scancode-public-domain",
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 11,646
|
c
|
fts3_hash.c
|
/*
** 2001 September 22
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables used in SQLite.
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/
/*
** The code in this file is only compiled if:
**
** * The FTS3 module is being built as an extension
** (in which case SQLITE_CORE is not defined), or
**
** * The FTS3 module is being built into the core of
** SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/
#include "third_party/sqlite3/fts3Int.h"
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#include "libc/assert.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/sqlite3/fts3_hash.h"
/*
** Malloc and Free functions
*/
static void *fts3HashMalloc(sqlite3_int64 n){
void *p = sqlite3_malloc64(n);
if( p ){
memset(p, 0, n);
}
return p;
}
static void fts3HashFree(void *p){
sqlite3_free(p);
}
/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
** "pNew" is a pointer to the hash table that is to be initialized.
** keyClass is one of the constants
** FTS3_HASH_BINARY or FTS3_HASH_STRING. The value of keyClass
** determines what kind of key the hash table will use. "copyKey" is
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.
*/
void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){
assert( pNew!=0 );
assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );
pNew->keyClass = keyClass;
pNew->copyKey = copyKey;
pNew->first = 0;
pNew->count = 0;
pNew->htsize = 0;
pNew->ht = 0;
}
/* Remove all entries from a hash table. Reclaim all memory.
** Call this routine to delete a hash table or to reset a hash table
** to the empty state.
*/
void sqlite3Fts3HashClear(Fts3Hash *pH){
Fts3HashElem *elem; /* For looping over all elements of the table */
assert( pH!=0 );
elem = pH->first;
pH->first = 0;
fts3HashFree(pH->ht);
pH->ht = 0;
pH->htsize = 0;
while( elem ){
Fts3HashElem *next_elem = elem->next;
if( pH->copyKey && elem->pKey ){
fts3HashFree(elem->pKey);
}
fts3HashFree(elem);
elem = next_elem;
}
pH->count = 0;
}
/*
** Hash and comparison functions when the mode is FTS3_HASH_STRING
*/
static int fts3StrHash(const void *pKey, int nKey){
const char *z = (const char *)pKey;
unsigned h = 0;
if( nKey<=0 ) nKey = (int) strlen(z);
while( nKey > 0 ){
h = (h<<3) ^ h ^ *z++;
nKey--;
}
return (int)(h & 0x7fffffff);
}
static int fts3StrCompare(const void *pKey1, int n1, const void *pKey2, int n2){
if( n1!=n2 ) return 1;
return strncmp((const char*)pKey1,(const char*)pKey2,n1);
}
/*
** Hash and comparison functions when the mode is FTS3_HASH_BINARY
*/
static int fts3BinHash(const void *pKey, int nKey){
int h = 0;
const char *z = (const char *)pKey;
while( nKey-- > 0 ){
h = (h<<3) ^ h ^ *(z++);
}
return h & 0x7fffffff;
}
static int fts3BinCompare(const void *pKey1, int n1, const void *pKey2, int n2){
if( n1!=n2 ) return 1;
return memcmp(pKey1,pKey2,n1);
}
/*
** Return a pointer to the appropriate hash function given the key class.
**
** The C syntax in this function definition may be unfamilar to some
** programmers, so we provide the following additional explanation:
**
** The name of the function is "ftsHashFunction". The function takes a
** single parameter "keyClass". The return value of ftsHashFunction()
** is a pointer to another function. Specifically, the return value
** of ftsHashFunction() is a pointer to a function that takes two parameters
** with types "const void*" and "int" and returns an "int".
*/
static int (*ftsHashFunction(int keyClass))(const void*,int){
if( keyClass==FTS3_HASH_STRING ){
return &fts3StrHash;
}else{
assert( keyClass==FTS3_HASH_BINARY );
return &fts3BinHash;
}
}
/*
** Return a pointer to the appropriate hash function given the key class.
**
** For help in interpreted the obscure C code in the function definition,
** see the header comment on the previous function.
*/
static int (*ftsCompareFunction(int keyClass))(const void*,int,const void*,int){
if( keyClass==FTS3_HASH_STRING ){
return &fts3StrCompare;
}else{
assert( keyClass==FTS3_HASH_BINARY );
return &fts3BinCompare;
}
}
/* Link an element into the hash table
*/
static void fts3HashInsertElement(
Fts3Hash *pH, /* The complete hash table */
struct _fts3ht *pEntry, /* The entry into which pNew is inserted */
Fts3HashElem *pNew /* The element to be inserted */
){
Fts3HashElem *pHead; /* First element already in pEntry */
pHead = pEntry->chain;
if( pHead ){
pNew->next = pHead;
pNew->prev = pHead->prev;
if( pHead->prev ){ pHead->prev->next = pNew; }
else { pH->first = pNew; }
pHead->prev = pNew;
}else{
pNew->next = pH->first;
if( pH->first ){ pH->first->prev = pNew; }
pNew->prev = 0;
pH->first = pNew;
}
pEntry->count++;
pEntry->chain = pNew;
}
/* Resize the hash table so that it cantains "new_size" buckets.
** "new_size" must be a power of 2. The hash table might fail
** to resize if sqliteMalloc() fails.
**
** Return non-zero if a memory allocation error occurs.
*/
static int fts3Rehash(Fts3Hash *pH, int new_size){
struct _fts3ht *new_ht; /* The new hash table */
Fts3HashElem *elem, *next_elem; /* For looping over existing elements */
int (*xHash)(const void*,int); /* The hash function */
assert( (new_size & (new_size-1))==0 );
new_ht = (struct _fts3ht *)fts3HashMalloc( new_size*sizeof(struct _fts3ht) );
if( new_ht==0 ) return 1;
fts3HashFree(pH->ht);
pH->ht = new_ht;
pH->htsize = new_size;
xHash = ftsHashFunction(pH->keyClass);
for(elem=pH->first, pH->first=0; elem; elem = next_elem){
int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
next_elem = elem->next;
fts3HashInsertElement(pH, &new_ht[h], elem);
}
return 0;
}
/* This function (for internal use only) locates an element in an
** hash table that matches the given key. The hash for this key has
** already been computed and is passed as the 4th parameter.
*/
static Fts3HashElem *fts3FindElementByHash(
const Fts3Hash *pH, /* The pH to be searched */
const void *pKey, /* The key we are searching for */
int nKey,
int h /* The hash for this key. */
){
Fts3HashElem *elem; /* Used to loop thru the element list */
int count; /* Number of elements left to test */
int (*xCompare)(const void*,int,const void*,int); /* comparison function */
if( pH->ht ){
struct _fts3ht *pEntry = &pH->ht[h];
elem = pEntry->chain;
count = pEntry->count;
xCompare = ftsCompareFunction(pH->keyClass);
while( count-- && elem ){
if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){
return elem;
}
elem = elem->next;
}
}
return 0;
}
/* Remove a single entry from the hash table given a pointer to that
** element and a hash on the element's key.
*/
static void fts3RemoveElementByHash(
Fts3Hash *pH, /* The pH containing "elem" */
Fts3HashElem* elem, /* The element to be removed from the pH */
int h /* Hash value for the element */
){
struct _fts3ht *pEntry;
if( elem->prev ){
elem->prev->next = elem->next;
}else{
pH->first = elem->next;
}
if( elem->next ){
elem->next->prev = elem->prev;
}
pEntry = &pH->ht[h];
if( pEntry->chain==elem ){
pEntry->chain = elem->next;
}
pEntry->count--;
if( pEntry->count<=0 ){
pEntry->chain = 0;
}
if( pH->copyKey && elem->pKey ){
fts3HashFree(elem->pKey);
}
fts3HashFree( elem );
pH->count--;
if( pH->count<=0 ){
assert( pH->first==0 );
assert( pH->count==0 );
fts3HashClear(pH);
}
}
Fts3HashElem *sqlite3Fts3HashFindElem(
const Fts3Hash *pH,
const void *pKey,
int nKey
){
int h; /* A hash on key */
int (*xHash)(const void*,int); /* The hash function */
if( pH==0 || pH->ht==0 ) return 0;
xHash = ftsHashFunction(pH->keyClass);
assert( xHash!=0 );
h = (*xHash)(pKey,nKey);
assert( (pH->htsize & (pH->htsize-1))==0 );
return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
}
/*
** Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey. Return the data for this element if it is
** found, or NULL if there is no match.
*/
void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){
Fts3HashElem *pElem; /* The element that matches key (if any) */
pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);
return pElem ? pElem->data : 0;
}
/* Insert an element into the hash table pH. The key is pKey,nKey
** and the data is "data".
**
** If no element exists with a matching key, then a new
** element is created. A copy of the key is made if the copyKey
** flag is set. NULL is returned.
**
** If another element already exists with the same key, then the
** new data replaces the old data and the old data is returned.
** The key is not copied in this instance. If a malloc fails, then
** the new data is returned and the hash table is unchanged.
**
** If the "data" parameter to this function is NULL, then the
** element corresponding to "key" is removed from the hash table.
*/
void *sqlite3Fts3HashInsert(
Fts3Hash *pH, /* The hash table to insert into */
const void *pKey, /* The key */
int nKey, /* Number of bytes in the key */
void *data /* The data */
){
int hraw; /* Raw hash value of the key */
int h; /* the hash of the key modulo hash table size */
Fts3HashElem *elem; /* Used to loop thru the element list */
Fts3HashElem *new_elem; /* New element added to the pH */
int (*xHash)(const void*,int); /* The hash function */
assert( pH!=0 );
xHash = ftsHashFunction(pH->keyClass);
assert( xHash!=0 );
hraw = (*xHash)(pKey, nKey);
assert( (pH->htsize & (pH->htsize-1))==0 );
h = hraw & (pH->htsize-1);
elem = fts3FindElementByHash(pH,pKey,nKey,h);
if( elem ){
void *old_data = elem->data;
if( data==0 ){
fts3RemoveElementByHash(pH,elem,h);
}else{
elem->data = data;
}
return old_data;
}
if( data==0 ) return 0;
if( (pH->htsize==0 && fts3Rehash(pH,8))
|| (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
){
pH->count = 0;
return data;
}
assert( pH->htsize>0 );
new_elem = (Fts3HashElem*)fts3HashMalloc( sizeof(Fts3HashElem) );
if( new_elem==0 ) return data;
if( pH->copyKey && pKey!=0 ){
new_elem->pKey = fts3HashMalloc( nKey );
if( new_elem->pKey==0 ){
fts3HashFree(new_elem);
return data;
}
memcpy((void*)new_elem->pKey, pKey, nKey);
}else{
new_elem->pKey = (void*)pKey;
}
new_elem->nKey = nKey;
pH->count++;
assert( pH->htsize>0 );
assert( (pH->htsize & (pH->htsize-1))==0 );
h = hraw & (pH->htsize-1);
fts3HashInsertElement(pH, &pH->ht[h], new_elem);
new_elem->data = data;
return 0;
}
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
|
36c545e682c9ce93b28337922633fbac6cf6b0c9
|
cff4428975e403e4ef02d75498b78cd1a610a01a
|
/src/lua/fiber_cond.c
|
251f328f24b0d49010fe683b95540d4aff4a3b02
|
[
"BSD-2-Clause"
] |
permissive
|
tarantool/tarantool
|
c1f252b642d223af62485dc21165c7f7c3354e7e
|
f58cc96f2798ddc5f492223897d0b77e4f902128
|
refs/heads/master
| 2023-09-03T15:16:29.144171
| 2023-08-31T11:39:28
| 2023-09-01T12:39:29
| 911,980
| 3,205
| 490
|
NOASSERTION
| 2023-09-14T17:58:17
| 2010-09-15T07:59:26
|
Lua
|
UTF-8
|
C
| false
| false
| 4,369
|
c
|
fiber_cond.c
|
/*
* Copyright 2010-2017, Tarantool AUTHORS, please see AUTHORS file.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* 1. Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY AUTHORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include "lua/fiber_cond.h"
#include <tarantool_ev.h>
#include "lua/utils.h"
#include "fiber.h"
#include <fiber_cond.h>
static const char cond_typename[] = "fiber.cond";
static int
luaT_fiber_cond_new(struct lua_State *L)
{
struct fiber_cond *e = lua_newuserdata(L, sizeof(*e));
if (e == NULL)
luaL_error(L, "fiber.cond: not enough memory");
fiber_cond_create(e);
luaL_getmetatable(L, cond_typename);
lua_setmetatable(L, -2);
return 1;
}
static struct fiber_cond *
luaT_isfibercond(struct lua_State *L, int index)
{
if (index > lua_gettop(L))
return NULL;
return luaL_checkudata(L, index, cond_typename);
}
struct fiber_cond *
luaT_checkfibercond(struct lua_State *L, int index)
{
struct fiber_cond *fiber_cond = luaT_isfibercond(L, index);
if (fiber_cond == NULL) {
luaL_error(L, "Invalid argument #%d "
"(fiber.cond expected, got %s)", index,
lua_typename(L, lua_type(L, index)));
}
return fiber_cond;
}
static int
luaT_fiber_cond_gc(struct lua_State *L)
{
struct fiber_cond *fiber_cond = luaT_isfibercond(L, 1);
if (fiber_cond == NULL)
luaL_error(L, "usage: cond:destroy()");
fiber_cond_destroy(fiber_cond);
return 0;
}
static int
luaT_fiber_cond_signal(struct lua_State *L)
{
struct fiber_cond *fiber_cond = luaT_isfibercond(L, 1);
if (fiber_cond == NULL)
luaL_error(L, "usage: cond:signal()");
fiber_cond_signal(fiber_cond);
return 0;
}
static int
luaT_fiber_cond_broadcast(struct lua_State *L)
{
struct fiber_cond *fiber_cond = luaT_isfibercond(L, 1);
if (fiber_cond == NULL)
luaL_error(L, "usage: cond:broadcast()");
fiber_cond_broadcast(fiber_cond);
return 0;
}
static int
luaT_fiber_cond_wait(struct lua_State *L)
{
int rc;
struct fiber_cond *e = luaT_isfibercond(L, 1);
if (e == NULL)
luaL_error(L, "usage: cond:wait([timeout])");
ev_tstamp timeout = TIMEOUT_INFINITY;
if (!lua_isnoneornil(L, 2)) {
if (!lua_isnumber(L, 2) ||
(timeout = lua_tonumber(L, 2)) < .0) {
luaL_error(L, "usage: cond:wait([timeout])");
}
}
rc = fiber_cond_wait_timeout(e, timeout);
if (rc != 0)
luaL_testcancel(L);
lua_pushboolean(L, rc == 0);
return 1;
}
static int
luaT_fiber_cond_tostring(struct lua_State *L)
{
struct fiber_cond *cond = luaT_checkfibercond(L, 1);
if (cond == NULL)
luaL_error(L, "usage: tostring(cond)");
lua_pushstring(L, "cond");
return 1;
}
void
tarantool_lua_fiber_cond_init(struct lua_State *L)
{
static const struct luaL_Reg cond_meta[] = {
{"__gc", luaT_fiber_cond_gc},
{"__tostring", luaT_fiber_cond_tostring},
{"signal", luaT_fiber_cond_signal},
{"broadcast", luaT_fiber_cond_broadcast},
{"wait", luaT_fiber_cond_wait},
{NULL, NULL}
};
luaL_register_type(L, cond_typename, cond_meta);
/* Get fiber module. */
lua_getfield(L, LUA_GLOBALSINDEX, "require");
lua_pushstring(L, "fiber");
lua_call(L, 1, 1);
static const struct luaL_Reg cond_lib[] = {
{"cond", luaT_fiber_cond_new},
{NULL, NULL}
};
luaL_setfuncs(L, cond_lib, 0);
/* Pop fiber module. */
lua_pop(L, 1);
}
|
a512962ced71e0aba57a9f917bd1ea5d554a676a
|
07bbe7a0a829cfbc9789831d981aedf36e4e94d9
|
/source/lexbor/html/interfaces/source_element.h
|
9379b49b9ee9d859c2ef0104bd2ff38e6f2aacfa
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
lexbor/lexbor
|
0bf3a22898d8e295fa20cc1391e31a68502c458a
|
31e3d9d7f9032cd475d5afa788999de2d4b891dd
|
refs/heads/master
| 2023-08-31T23:25:49.903737
| 2023-08-30T08:25:12
| 2023-08-30T08:25:12
| 122,375,902
| 758
| 95
|
Apache-2.0
| 2023-08-30T08:25:13
| 2018-02-21T18:28:52
|
C
|
UTF-8
|
C
| false
| false
| 689
|
h
|
source_element.h
|
/*
* Copyright (C) 2018 Alexander Borisov
*
* Author: Alexander Borisov <borisov@lexbor.com>
*/
#ifndef LEXBOR_HTML_SOURCE_ELEMENT_H
#define LEXBOR_HTML_SOURCE_ELEMENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lexbor/html/interface.h"
#include "lexbor/html/interfaces/element.h"
struct lxb_html_source_element {
lxb_html_element_t element;
};
LXB_API lxb_html_source_element_t *
lxb_html_source_element_interface_create(lxb_html_document_t *document);
LXB_API lxb_html_source_element_t *
lxb_html_source_element_interface_destroy(lxb_html_source_element_t *source_element);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LEXBOR_HTML_SOURCE_ELEMENT_H */
|
49d6f6f898e6333fe620513dba971c7f5c1cbf94
|
104a1d21cf0916eee13cb65056ce1dc6aff59704
|
/align/bsplinetool/filtinterpol2Dtran.h
|
4ab03bf8d807108c00c6cc098d7884765820c361
|
[
"MIT"
] |
permissive
|
JeffFessler/mirt
|
f82da11fa1af4e6fc747332ab86eb94bcb303a7c
|
e3475cc504a1fb72e096de5df9dc07a51644e533
|
refs/heads/main
| 2023-06-22T02:41:06.886967
| 2023-06-10T13:27:32
| 2023-06-10T13:27:32
| 190,079,355
| 130
| 58
|
MIT
| 2023-06-10T13:20:56
| 2019-06-03T20:42:27
|
MATLAB
|
UTF-8
|
C
| false
| false
| 1,451
|
h
|
filtinterpol2Dtran.h
|
/*******************************************************************************
Transpose interpolation of grid locations of points using filtering
technique (kernel) with zero boundary condition
Created by Se Young Chun, Nov 2, 2006, the University of Michigan
*******************************************************************************/
extern void FiltInterpolatedValue2DTranZero (
double *Bout, /* output interpolated value */
double *Bcoeff, /* input B-spline coeff array */
int Width, /* width of coeff array */
int Height, /* height of coeff array */
int nx, /* width of Bout */
int offx, /* offset of x direction */
int mx, /* magnif facor for x direction */
int ny, /* height of Bout */
int offy, /* offset of y direction */
int my, /* magnif facor for y direction */
double *kernelx, /* kernelx applied in x direction */
int nkx, /* kernelx length */
double *kernely, /* kernely applied in y direction */
int nky /* kernely length */
);
|
a58b7a2958dc1f3dc5e498e6eccb42e1deff04de
|
fbbffcc0c0d689b0bca759c37399374c3772f922
|
/weChatApi/weChatApi/httpServer.h
|
4248c9db14b5f830c6de22a2de7a489dc5972437
|
[] |
no_license
|
holdyeah/wechat-pc-hook-python
|
147872ce9818541e367319ea63eba40ddbb90ad5
|
763a882de5c8aa4f9bb71855a74e02ee66a9e563
|
refs/heads/master
| 2023-03-17T06:17:30.988003
| 2023-03-04T08:44:37
| 2023-03-04T08:44:37
| 204,273,242
| 284
| 86
| null | null | null | null |
UTF-8
|
C
| false
| false
| 49
|
h
|
httpServer.h
|
#pragma once
#include "pch.h"
void httpServer();
|
1b98cdee35b34d1b7d77fcabb62e4c1c0b162c8f
|
32be357e08164f0434174b4402b1a63a09be7d55
|
/CosBase/tests/src/ut_proxy.c
|
ef166b199bcadc6a13089bdbc946e3911c42a14c
|
[
"Apache-2.0"
] |
permissive
|
CObjectSystem/COS
|
e4a4c284c870b875e5fb949282a6d3cffa58a771
|
fc2f3ed275d2291d3fb2499fa3572dcfe3dd9db2
|
refs/heads/master
| 2023-07-24T21:13:15.083070
| 2023-01-08T15:31:16
| 2023-01-08T15:31:16
| 2,830,240
| 341
| 49
|
Apache-2.0
| 2023-07-22T09:55:49
| 2011-11-22T19:16:13
|
C
|
UTF-8
|
C
| false
| false
| 2,201
|
c
|
ut_proxy.c
|
/**
* C Object System
* COS testsuites - proxy
*
* Copyright 2006+ Laurent Deniau <laurent.deniau@gmail.com>
*
* 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.
*/
#include <cos/Object.h>
#include <cos/gen/object.h>
#include <cos/gen/value.h>
#include <cos/utest.h>
#include "tests.h"
#include "generics.h"
#include <string.h>
static BOOL
check_gmf(OBJ cls, STR res)
{
useclass(PA);
OBJ _1 = gnew(cls);
OBJ pxy = gnewWith(PA, _1);
STR s = gstr(_1);
BOOL ret;
grelease(_1);
gcatStr(pxy, " understands gcatStr");
ret = !strcmp(s, res);
grelease(pxy);
return ret;
}
static BOOL
check_vmf(OBJ cls, STR res)
{
useclass(PA);
OBJ _1 = gnew(cls);
OBJ pxy = gnewWith(PA, _1);
STR s = gstr(_1);
BOOL ret;
grelease(_1);
gvputStr(pxy, "%s understands %s", gclassName(_1), "gvputStr");
ret = !strcmp(s, res);
grelease(pxy);
return ret;
}
void
ut_proxy(void)
{
useclass(A,B,C,D,E);
UTEST_START("proxy & message intercept")
UTEST( check_gmf(A, "A understands gcatStr (through proxy PA)") );
UTEST( check_gmf(B, "B understands gcatStr (through proxy PA)") );
UTEST( check_gmf(C, "C understands gcatStr (through proxy PA)") );
UTEST( check_gmf(D, "D understands gcatStr (through proxy PA)") );
UTEST( check_gmf(E, "E understands gcatStr (through proxy PA)") );
UTEST( check_vmf(A, "A does not understand gvputStr") );
UTEST( check_vmf(B, "B does not understand gvputStr") );
UTEST( check_vmf(C, "C understands gvputStr (through proxy PA)") );
UTEST( check_vmf(D, "D understands gvputStr (through proxy PA)") );
UTEST( check_vmf(E, "E understands gvputStr (through proxy PA)") );
UTEST_END
}
|
8c47ccad2bbf8fda1c86acd66467cb75c432f329
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/sysutils/htop/patches/patch-solaris_Platform.h
|
fcad1e91adac70c9337a4ce82a12c5d7d162c51d
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 572
|
h
|
patch-solaris_Platform.h
|
$NetBSD: patch-solaris_Platform.h,v 1.1 2022/05/16 12:14:22 jperkin Exp $
Remove unwanted and breaking includes.
--- solaris/Platform.h.orig 2022-05-01 06:31:20.000000000 +0000
+++ solaris/Platform.h
@@ -17,16 +17,12 @@ in the source distribution for its full
* Since ncruses macros use the ERR macro, we can not use another name.
*/
#undef ERR
-#include <libproc.h>
#undef ERR
#define ERR (-1)
#include <signal.h>
#include <stdbool.h>
-#include <sys/mkdev.h>
-#include <sys/proc.h>
-#include <sys/types.h>
#include "Action.h"
#include "BatteryMeter.h"
|
04f8a011755cb23f0c89f2b7cc6cde5e5268a382
|
9ca19ee62e2c985be413bd12e5eb63b44833750d
|
/src/app/esp32/timergroup.c
|
be1c4149ac47a240adbba0bb7fdba5b86bbebf81
|
[
"MIT"
] |
permissive
|
MitchBradley/cforth
|
4cb523847c552b2e32e5e50a328b8e263a074d85
|
bae39263f2615e1d260426e3eca0ab32816f54ef
|
refs/heads/master
| 2023-08-31T17:23:00.037535
| 2023-08-17T09:01:57
| 2023-08-17T09:01:57
| 12,050,604
| 142
| 43
|
NOASSERTION
| 2023-08-21T16:36:56
| 2013-08-12T07:50:31
|
C
|
UTF-8
|
C
| false
| false
| 6,267
|
c
|
timergroup.c
|
void IRAM_ATTR bare_timer_isr()
{
/* Clear the interrupt */
TIMERG0.int_clr_timers.t0 = 1;
gpio->w1ts = 1<<4;
gpio->w1tc = 1<<4;
/* Re-enable the alarm */
TIMERG0.hw_timer[TIMER0].config.alarm_en = TIMER_ALARM_EN;
}
/*
* Initialize selected timer of the timer group 0
*
* timer_idx - the timer number to initialize
* timer_interval_sec - the interval of alarm to set
*/
#if 0
// For reference:
esp_err_t timerg0n0_isr_register(void (*fn)(void*), void * arg, int intr_alloc_flags, timer_isr_handle_t *handle)
{
int intr_source = 0;
uint32_t status_reg = 0;
int mask = 0;
if((intr_alloc_flags & ESP_INTR_FLAG_EDGE) == 0) {
intr_source = ETS_TG0_T0_LEVEL_INTR_SOURCE + timer_num;
} else {
intr_source = ETS_TG0_T0_EDGE_INTR_SOURCE + timer_num;
}
status_reg = TIMG_INT_ST_TIMERS_REG(0);
mask = 1<<timer_num;
// return esp_intr_alloc_intrstatus(intr_source, intr_alloc_flags, status_reg, mask, fn, arg, handle);
// esp_err_t esp_intr_alloc_intrstatus(int source, int flags, uint32_t intrstatusreg, uint32_t intrstatusmask, intr_handler_t handler,
void *arg, intr_handle_t *ret_handle)
//Default to prio 1 for shared interrupts. Default to prio 1, 2 or 3 for non-shared interrupts.
if ((flags&ESP_INTR_FLAG_LEVELMASK)==0) {
if (flags&ESP_INTR_FLAG_SHARED) {
flags|=ESP_INTR_FLAG_LEVEL1;
} else {
flags|=ESP_INTR_FLAG_LOWMED;
}
}
portENTER_CRITICAL(&spinlock);
int cpu=xPortGetCoreID();
//See if we can find an interrupt that matches the flags.
int intr=get_available_int(flags, cpu, force, source);
//Allocate that int!
if (flags&ESP_INTR_FLAG_SHARED) {
xt_set_interrupt_handler(intr, shared_intr_isr, NULLVD);
} else {
xt_set_interrupt_handler(intr, handler, arg);
if (flags&ESP_INTR_FLAG_EDGE) xthal_set_intclear(1 << intr);
}
if (flags&ESP_INTR_FLAG_IRAM) {
non_iram_int_mask[cpu]&=~(1<<intr);
} else {
non_iram_int_mask[cpu]|=(1<<intr);
}
intr_matrix_set(cpu, source, intr);
//Enable int at CPU-level;
ESP_INTR_ENABLE(intr); // === xt_ints_on((1<<inum))
free(ret);
portEXIT_CRITICAL(&spinlock);
return ESP_OK;
}
#endif
#define L5_LEVEL_INUM 31
void app_ticker(void)
{
for (int i = 2; i--; ) {
gpio->w1ts = 1<<4;
gpio->w1tc = 1<<4;
}
// 14,
intr_matrix_set(1, ETS_TG0_T0_LEVEL_INTR_SOURCE, L5_LEVEL_INUM);
// Don't need to call xt_set_interrupt_handler() because it is hardcoded in the vector
xt_ints_on(1 << 31);
while (1)
;
}
cell app_ticker_address()
{
return (cell)app_ticker;
}
void appCoreTask(void *pvParameters)
{
tg0_timer_init();
ESP_LOGI("", "hello from core no. 2");
while (1) {
vTaskDelay(5000 / portTICK_PERIOD_MS);
// ESP_LOGI("", "hello from core no. 2");
}
}
// xTaskCreatePinnedToCore(&appCoreTask, "appCoreTask", 2048, NULL, 20, NULL, 1);
void IRAM_ATTR timer_group0_fast_isr()
{
/* Manually reload */
if (!reload)
TIMERG0.hw_timer[TIMER0].reload = 1;
/* Clear the interrupt */
// Not: TIMERG0.int_clr_timers.t0 = 1;
// Faster, not RMW
TIMERG0.int_clr_timers.val = (1<<TIMER0);
gpio->w1ts = 1<<4;
volatile int tmp;
int i;
for(i = loopcnt; i--;)
tmp = 0;
gpio->w1tc = 1<<4;
/* Re-enable the alarm */
// XXX Speedup: Write the entire register in one go instead of setting
// the bit, which is read/modify/write
TIMERG0.hw_timer[TIMER0].config.alarm_en = TIMER_ALARM_EN;
}
void IRAM_ATTR timer_group0_isr(void *para)
{
/* Manually reload */
if (!reload)
TIMERG0.hw_timer[TIMER0].reload = 1;
/* Clear the interrupt */
// TIMERG0.int_clr_timers.t0 = 1;
// Faster, not RMW
TIMERG0.int_clr_timers.val = (1<<TIMER0);
gpio->w1ts = 1<<4;
volatile int tmp;
int i;
for(i = loopcnt; i--;)
tmp = 0;
gpio->w1tc = 1<<4;
/* Re-enable the alarm */
// XXX Speedup: Write the entire register in one go instead of setting
// the bit, which is read/modify/write
TIMERG0.hw_timer[TIMER0].config.alarm_en = TIMER_ALARM_EN;
}
esp_err_t xtimer_isr_register(timer_group_t group_num, timer_idx_t timer_num, void (*fn)(void*), void * arg, int intr_alloc_flags, timer_isr_handle_t *handle)
{
int intr_source = 0;
if((intr_alloc_flags & ESP_INTR_FLAG_EDGE) == 0) {
intr_source = ETS_TG0_T0_LEVEL_INTR_SOURCE + timer_num;
} else {
intr_source = ETS_TG0_T0_EDGE_INTR_SOURCE + timer_num;
}
return esp_intr_alloc(intr_source, intr_alloc_flags, fn, arg, handle);
}
static void tg0_timer_init()
{
/* Select and initialize basic parameters of the timer */
timer_config_t config;
config.divider = TIMER_DIVIDER;
config.counter_dir = TIMER_COUNT_UP;
config.counter_en = TIMER_PAUSE;
config.alarm_en = TIMER_ALARM_EN;
config.intr_type = TIMER_INTR_LEVEL;
config.auto_reload = reload;
timer_init(TIMER_GROUP_0, TIMER0, &config);
/* Timer's counter will initially start from value below.
Also, if reload is set, this value will be automatically reload on alarm */
timer_set_counter_value(TIMER_GROUP_0, TIMER0, 0x00000000ULL);
// int pri = ESP_INTR_FLAG_LEVEL3;
int pri = 0;
int type = config.intr_type == TIMER_INTR_LEVEL ? 0 : ESP_INTR_FLAG_EDGE;
/* Configure the alarm value and the interrupt on alarm. */
timer_set_alarm_value(TIMER_GROUP_0, TIMER0, timer_interval_usecs * TIMER_SCALE);
timer_enable_intr(TIMER_GROUP_0, TIMER0);
timer_isr_register(TIMER_GROUP_0, TIMER0, timer_group0_isr, 0, ESP_INTR_FLAG_IRAM | type | pri, NULL);
// xtimer_isr_register(TIMER_GROUP_0, TIMER0, timer_group0_isr, (void *) timer_idx, ESP_INTR_FLAG_IRAM | type | ESP_INTR_FLAG_LEVEL3, NULL);
// int cpu=xPortGetCoreID();
// int intr=get_available_int(flags, ESP_INTR_FLAG_IRAM|ESP_INTR_FLAG_LOWMED, 0, TIMER_GROUP_0);
// xt_set_interrupt_handler(intr, timer_group0_isr, 0);
// esp_timer_impl_init(esp_timer_isr);
timer_start(TIMER_GROUP_0, TIMER0);
}
|
5d8feb7f0b4009b49e675c47b652f62dd260794f
|
e5f4f37d941ceb8145d65f92028cc54658b1ac01
|
/Data/Base/Shaders/Pipeline/ReflectionIrradianceConstants.h
|
4951e51f19a23c8080703ed92a0a11a2733652eb
|
[
"MIT"
] |
permissive
|
ezEngine/ezEngine
|
19983d2733a5409fb2665c6c3a0a575dadcefb50
|
c46e3b4b2cd46798e4abb4938fbca281c054b039
|
refs/heads/dev
| 2023-09-06T02:17:28.152665
| 2023-09-05T18:25:43
| 2023-09-05T18:25:43
| 18,179,848
| 1,050
| 165
|
MIT
| 2023-09-14T21:44:39
| 2014-03-27T15:02:16
|
C++
|
UTF-8
|
C
| false
| false
| 235
|
h
|
ReflectionIrradianceConstants.h
|
#pragma once
#include "../Common/Platforms.h"
#include "../Common/ConstantBufferMacros.h"
CONSTANT_BUFFER(ezReflectionIrradianceConstants, 3)
{
FLOAT1(LodLevel);
FLOAT1(Intensity);
FLOAT1(Saturation);
UINT1(OutputIndex);
};
|
716f480a5667272f6faab4cab6b7c8646c2024aa
|
3d44c763f0bd72117579cdd87bbf305ffd191e8b
|
/src/core/stream.c
|
418bfb159f701bd18bf17dbdb6e605af74d7e94d
|
[
"MIT"
] |
permissive
|
nanomsg/nng
|
6e597e664a4126c3d8e8b16e9c22a33ac773c9c4
|
5ac5be5cacacdb8d6cac2fa362fce6d78e4dc389
|
refs/heads/master
| 2023-08-31T04:28:18.215853
| 2023-08-23T19:23:18
| 2023-08-28T05:58:40
| 76,157,774
| 3,407
| 489
|
MIT
| 2023-09-14T09:01:13
| 2016-12-11T06:14:28
|
C
|
UTF-8
|
C
| false
| false
| 13,919
|
c
|
stream.c
|
//
// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt). A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//
// This provides an abstraction for byte streams, allowing polymorphic
// use of them in rather flexible contexts.
#include <string.h>
#include "core/nng_impl.h"
#include <nng/supplemental/tls/tls.h>
#include "core/tcp.h"
#include "supplemental/tls/tls_api.h"
#include "supplemental/websocket/websocket.h"
static struct {
const char *scheme;
int (*dialer_alloc)(nng_stream_dialer **, const nng_url *);
int (*listener_alloc)(nng_stream_listener **, const nng_url *);
} stream_drivers[] = {
{
.scheme = "ipc",
.dialer_alloc = nni_ipc_dialer_alloc,
.listener_alloc = nni_ipc_listener_alloc,
},
#ifdef NNG_PLATFORM_POSIX
{
.scheme = "unix",
.dialer_alloc = nni_ipc_dialer_alloc,
.listener_alloc = nni_ipc_listener_alloc,
},
#endif
#ifdef NNG_HAVE_ABSTRACT_SOCKETS
{
.scheme = "abstract",
.dialer_alloc = nni_ipc_dialer_alloc,
.listener_alloc = nni_ipc_listener_alloc,
},
#endif
{
.scheme = "tcp",
.dialer_alloc = nni_tcp_dialer_alloc,
.listener_alloc = nni_tcp_listener_alloc,
},
{
.scheme = "tcp4",
.dialer_alloc = nni_tcp_dialer_alloc,
.listener_alloc = nni_tcp_listener_alloc,
},
{
.scheme = "tcp6",
.dialer_alloc = nni_tcp_dialer_alloc,
.listener_alloc = nni_tcp_listener_alloc,
},
{
.scheme = "tls+tcp",
.dialer_alloc = nni_tls_dialer_alloc,
.listener_alloc = nni_tls_listener_alloc,
},
{
.scheme = "tls+tcp4",
.dialer_alloc = nni_tls_dialer_alloc,
.listener_alloc = nni_tls_listener_alloc,
},
{
.scheme = "tls+tcp6",
.dialer_alloc = nni_tls_dialer_alloc,
.listener_alloc = nni_tls_listener_alloc,
},
{
.scheme = "ws",
.dialer_alloc = nni_ws_dialer_alloc,
.listener_alloc = nni_ws_listener_alloc,
},
{
.scheme = "ws4",
.dialer_alloc = nni_ws_dialer_alloc,
.listener_alloc = nni_ws_listener_alloc,
},
{
.scheme = "ws6",
.dialer_alloc = nni_ws_dialer_alloc,
.listener_alloc = nni_ws_listener_alloc,
},
{
.scheme = "wss",
.dialer_alloc = nni_ws_dialer_alloc,
.listener_alloc = nni_ws_listener_alloc,
},
{
.scheme = NULL,
},
};
void
nng_stream_close(nng_stream *s)
{
s->s_close(s);
}
void
nng_stream_free(nng_stream *s)
{
if (s != NULL) {
s->s_free(s);
}
}
void
nng_stream_send(nng_stream *s, nng_aio *aio)
{
s->s_send(s, aio);
}
void
nng_stream_recv(nng_stream *s, nng_aio *aio)
{
s->s_recv(s, aio);
}
int
nni_stream_get(
nng_stream *s, const char *nm, void *data, size_t *szp, nni_type t)
{
return (s->s_get(s, nm, data, szp, t));
}
int
nni_stream_set(
nng_stream *s, const char *nm, const void *data, size_t sz, nni_type t)
{
return (s->s_set(s, nm, data, sz, t));
}
void
nng_stream_dialer_close(nng_stream_dialer *d)
{
d->sd_close(d);
}
void
nng_stream_dialer_free(nng_stream_dialer *d)
{
if (d != NULL) {
d->sd_free(d);
}
}
void
nng_stream_dialer_dial(nng_stream_dialer *d, nng_aio *aio)
{
d->sd_dial(d, aio);
}
int
nng_stream_dialer_alloc_url(nng_stream_dialer **dp, const nng_url *url)
{
int rv;
if ((rv = nni_init()) != 0) {
return (rv);
}
for (int i = 0; stream_drivers[i].scheme != NULL; i++) {
if (strcmp(stream_drivers[i].scheme, url->u_scheme) == 0) {
return (stream_drivers[i].dialer_alloc(dp, url));
}
}
return (NNG_ENOTSUP);
}
int
nng_stream_dialer_alloc(nng_stream_dialer **dp, const char *uri)
{
nng_url *url;
int rv;
if ((rv = nni_init()) != 0) {
return (rv);
}
if ((rv = nng_url_parse(&url, uri)) != 0) {
return (rv);
}
rv = nng_stream_dialer_alloc_url(dp, url);
nng_url_free(url);
return (rv);
}
int
nni_stream_dialer_get(
nng_stream_dialer *d, const char *nm, void *data, size_t *szp, nni_type t)
{
return (d->sd_get(d, nm, data, szp, t));
}
int
nni_stream_dialer_set(nng_stream_dialer *d, const char *nm, const void *data,
size_t sz, nni_type t)
{
return (d->sd_set(d, nm, data, sz, t));
}
void
nng_stream_listener_close(nng_stream_listener *l)
{
l->sl_close(l);
}
void
nng_stream_listener_free(nng_stream_listener *l)
{
if (l != NULL) {
l->sl_free(l);
}
}
int
nng_stream_listener_listen(nng_stream_listener *l)
{
return (l->sl_listen(l));
}
void
nng_stream_listener_accept(nng_stream_listener *l, nng_aio *aio)
{
l->sl_accept(l, aio);
}
int
nni_stream_listener_get(nng_stream_listener *l, const char *nm, void *data,
size_t *szp, nni_type t)
{
return (l->sl_get(l, nm, data, szp, t));
}
int
nni_stream_listener_set(nng_stream_listener *l, const char *nm,
const void *data, size_t sz, nni_type t)
{
return (l->sl_set(l, nm, data, sz, t));
}
int
nng_stream_listener_alloc_url(nng_stream_listener **lp, const nng_url *url)
{
int rv;
if ((rv = nni_init()) != 0) {
return (rv);
}
for (int i = 0; stream_drivers[i].scheme != NULL; i++) {
if (strcmp(stream_drivers[i].scheme, url->u_scheme) == 0) {
return (stream_drivers[i].listener_alloc(lp, url));
}
}
return (NNG_ENOTSUP);
}
int
nng_stream_listener_alloc(nng_stream_listener **lp, const char *uri)
{
nng_url *url;
int rv;
if ((rv = nni_init()) != 0) {
return (rv);
}
if ((rv = nng_url_parse(&url, uri)) != 0) {
return (rv);
}
rv = nng_stream_listener_alloc_url(lp, url);
nng_url_free(url);
return (rv);
}
// Public stream options.
int
nng_stream_get(nng_stream *s, const char *n, void *v, size_t *szp)
{
return (nni_stream_get(s, n, v, szp, NNI_TYPE_OPAQUE));
}
int
nng_stream_get_int(nng_stream *s, const char *n, int *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_INT32));
}
int
nng_stream_get_bool(nng_stream *s, const char *n, bool *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_BOOL));
}
int
nng_stream_get_size(nng_stream *s, const char *n, size_t *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_SIZE));
}
int
nng_stream_get_uint64(nng_stream *s, const char *n, uint64_t *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_UINT64));
}
int
nng_stream_get_string(nng_stream *s, const char *n, char **v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_STRING));
}
int
nng_stream_get_ptr(nng_stream *s, const char *n, void **v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_POINTER));
}
int
nng_stream_get_ms(nng_stream *s, const char *n, nng_duration *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_DURATION));
}
int
nng_stream_get_addr(nng_stream *s, const char *n, nng_sockaddr *v)
{
return (nni_stream_get(s, n, v, NULL, NNI_TYPE_SOCKADDR));
}
int
nng_stream_dialer_get(
nng_stream_dialer *d, const char *n, void *v, size_t *szp)
{
return (nni_stream_dialer_get(d, n, v, szp, NNI_TYPE_OPAQUE));
}
int
nng_stream_dialer_get_int(nng_stream_dialer *d, const char *n, int *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_INT32));
}
int
nng_stream_dialer_get_bool(nng_stream_dialer *d, const char *n, bool *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_BOOL));
}
int
nng_stream_dialer_get_size(nng_stream_dialer *d, const char *n, size_t *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_SIZE));
}
int
nng_stream_dialer_get_uint64(nng_stream_dialer *d, const char *n, uint64_t *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_UINT64));
}
int
nng_stream_dialer_get_string(nng_stream_dialer *d, const char *n, char **v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_STRING));
}
int
nng_stream_dialer_get_ptr(nng_stream_dialer *d, const char *n, void **v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_POINTER));
}
int
nng_stream_dialer_get_ms(nng_stream_dialer *d, const char *n, nng_duration *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_DURATION));
}
int
nng_stream_dialer_get_addr(
nng_stream_dialer *d, const char *n, nng_sockaddr *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_SOCKADDR));
}
int
nng_stream_listener_get(
nng_stream_listener *l, const char *n, void *v, size_t *szp)
{
return (nni_stream_listener_get(l, n, v, szp, NNI_TYPE_OPAQUE));
}
int
nng_stream_listener_get_int(nng_stream_listener *l, const char *n, int *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_INT32));
}
int
nng_stream_listener_get_bool(nng_stream_listener *l, const char *n, bool *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_BOOL));
}
int
nng_stream_listener_get_size(nng_stream_listener *l, const char *n, size_t *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_SIZE));
}
int
nng_stream_listener_get_uint64(
nng_stream_listener *l, const char *n, uint64_t *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_UINT64));
}
int
nng_stream_listener_get_string(nng_stream_listener *l, const char *n, char **v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_STRING));
}
int
nng_stream_listener_get_ptr(nng_stream_listener *l, const char *n, void **v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_POINTER));
}
int
nng_stream_listener_get_ms(
nng_stream_listener *l, const char *n, nng_duration *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_DURATION));
}
int
nng_stream_listener_get_addr(
nng_stream_listener *l, const char *n, nng_sockaddr *v)
{
return (nni_stream_listener_get(l, n, v, NULL, NNI_TYPE_SOCKADDR));
}
int
nng_stream_set(nng_stream *s, const char *n, const void *v, size_t sz)
{
return (nni_stream_set(s, n, v, sz, NNI_TYPE_OPAQUE));
}
int
nng_stream_set_int(nng_stream *s, const char *n, int v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_INT32));
}
int
nng_stream_set_bool(nng_stream *s, const char *n, bool v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_BOOL));
}
int
nng_stream_set_size(nng_stream *s, const char *n, size_t v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_SIZE));
}
int
nng_stream_set_uint64(nng_stream *s, const char *n, uint64_t v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_UINT64));
}
int
nng_stream_set_ms(nng_stream *s, const char *n, nng_duration v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_DURATION));
}
int
nng_stream_set_ptr(nng_stream *s, const char *n, void *v)
{
return (nni_stream_set(s, n, &v, sizeof(v), NNI_TYPE_POINTER));
}
int
nng_stream_set_string(nng_stream *s, const char *n, const char *v)
{
return (nni_stream_set(
s, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
int
nng_stream_set_addr(nng_stream *s, const char *n, const nng_sockaddr *v)
{
return (nni_stream_set(s, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
int
nng_stream_dialer_set(
nng_stream_dialer *d, const char *n, const void *v, size_t sz)
{
return (nni_stream_dialer_set(d, n, v, sz, NNI_TYPE_OPAQUE));
}
int
nng_stream_dialer_set_int(nng_stream_dialer *d, const char *n, int v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_INT32));
}
int
nng_stream_dialer_set_bool(nng_stream_dialer *d, const char *n, bool v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_BOOL));
}
int
nng_stream_dialer_set_size(nng_stream_dialer *d, const char *n, size_t v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_SIZE));
}
int
nng_stream_dialer_set_uint64(nng_stream_dialer *d, const char *n, uint64_t v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_UINT64));
}
int
nng_stream_dialer_set_ms(nng_stream_dialer *d, const char *n, nng_duration v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_DURATION));
}
int
nng_stream_dialer_set_ptr(nng_stream_dialer *d, const char *n, void *v)
{
return (nni_stream_dialer_set(d, n, &v, sizeof(v), NNI_TYPE_POINTER));
}
int
nng_stream_dialer_set_string(
nng_stream_dialer *d, const char *n, const char *v)
{
return (nni_stream_dialer_set(
d, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
int
nng_stream_dialer_set_addr(
nng_stream_dialer *d, const char *n, const nng_sockaddr *v)
{
return (nni_stream_dialer_set(d, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
int
nng_stream_listener_set(
nng_stream_listener *l, const char *n, const void *v, size_t sz)
{
return (nni_stream_listener_set(l, n, v, sz, NNI_TYPE_OPAQUE));
}
int
nng_stream_listener_set_int(nng_stream_listener *l, const char *n, int v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_INT32));
}
int
nng_stream_listener_set_bool(nng_stream_listener *l, const char *n, bool v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_BOOL));
}
int
nng_stream_listener_set_size(nng_stream_listener *l, const char *n, size_t v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_SIZE));
}
int
nng_stream_listener_set_uint64(
nng_stream_listener *l, const char *n, uint64_t v)
{
return (nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_UINT64));
}
int
nng_stream_listener_set_ms(
nng_stream_listener *l, const char *n, nng_duration v)
{
return (
nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_DURATION));
}
int
nng_stream_listener_set_ptr(nng_stream_listener *l, const char *n, void *v)
{
return (
nni_stream_listener_set(l, n, &v, sizeof(v), NNI_TYPE_POINTER));
}
int
nng_stream_listener_set_string(
nng_stream_listener *l, const char *n, const char *v)
{
return (nni_stream_listener_set(
l, n, v, v == NULL ? 0 : strlen(v) + 1, NNI_TYPE_STRING));
}
int
nng_stream_listener_set_addr(
nng_stream_listener *l, const char *n, const nng_sockaddr *v)
{
return (
nni_stream_listener_set(l, n, v, sizeof(*v), NNI_TYPE_SOCKADDR));
}
|
991a3f8cfd06dd88725dc240c74768e61a4a71d2
|
010279e2ba272d09e9d2c4e903722e5faba2cf7a
|
/contrib/libs/clapack/dgeequb.c
|
fbaeb2f60982ac060fe99db8d5f6dd28e7087a21
|
[
"Apache-2.0",
"BSD-3-Clause"
] |
permissive
|
catboost/catboost
|
854c1a1f439a96f1ae6b48e16644be20aa04dba2
|
f5042e35b945aded77b23470ead62d7eacefde92
|
refs/heads/master
| 2023-09-01T12:14:14.174108
| 2023-09-01T10:01:01
| 2023-09-01T10:22:12
| 97,556,265
| 8,012
| 1,425
|
Apache-2.0
| 2023-09-11T03:32:32
| 2017-07-18T05:29:04
|
Python
|
UTF-8
|
C
| false
| false
| 8,658
|
c
|
dgeequb.c
|
/* dgeequb.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Subroutine */ int dgeequb_(integer *m, integer *n, doublereal *a, integer *
lda, doublereal *r__, doublereal *c__, doublereal *rowcnd, doublereal
*colcnd, doublereal *amax, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2;
doublereal d__1, d__2, d__3;
/* Builtin functions */
double log(doublereal), pow_di(doublereal *, integer *);
/* Local variables */
integer i__, j;
doublereal radix, rcmin, rcmax;
extern doublereal dlamch_(char *);
extern /* Subroutine */ int xerbla_(char *, integer *);
doublereal bignum, logrdx, smlnum;
/* -- LAPACK routine (version 3.2) -- */
/* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
/* -- Jason Riedy of Univ. of California Berkeley. -- */
/* -- November 2008 -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley and NAG Ltd. -- */
/* .. */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* Purpose */
/* ======= */
/* DGEEQUB computes row and column scalings intended to equilibrate an */
/* M-by-N matrix A and reduce its condition number. R returns the row */
/* scale factors and C the column scale factors, chosen to try to make */
/* the largest element in each row and column of the matrix B with */
/* elements B(i,j)=R(i)*A(i,j)*C(j) have an absolute value of at most */
/* the radix. */
/* R(i) and C(j) are restricted to be a power of the radix between */
/* SMLNUM = smallest safe number and BIGNUM = largest safe number. Use */
/* of these scaling factors is not guaranteed to reduce the condition */
/* number of A but works well in practice. */
/* This routine differs from DGEEQU by restricting the scaling factors */
/* to a power of the radix. Baring over- and underflow, scaling by */
/* these factors introduces no additional rounding errors. However, the */
/* scaled entries' magnitured are no longer approximately 1 but lie */
/* between sqrt(radix) and 1/sqrt(radix). */
/* Arguments */
/* ========= */
/* M (input) INTEGER */
/* The number of rows of the matrix A. M >= 0. */
/* N (input) INTEGER */
/* The number of columns of the matrix A. N >= 0. */
/* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
/* The M-by-N matrix whose equilibration factors are */
/* to be computed. */
/* LDA (input) INTEGER */
/* The leading dimension of the array A. LDA >= max(1,M). */
/* R (output) DOUBLE PRECISION array, dimension (M) */
/* If INFO = 0 or INFO > M, R contains the row scale factors */
/* for A. */
/* C (output) DOUBLE PRECISION array, dimension (N) */
/* If INFO = 0, C contains the column scale factors for A. */
/* ROWCND (output) DOUBLE PRECISION */
/* If INFO = 0 or INFO > M, ROWCND contains the ratio of the */
/* smallest R(i) to the largest R(i). If ROWCND >= 0.1 and */
/* AMAX is neither too large nor too small, it is not worth */
/* scaling by R. */
/* COLCND (output) DOUBLE PRECISION */
/* If INFO = 0, COLCND contains the ratio of the smallest */
/* C(i) to the largest C(i). If COLCND >= 0.1, it is not */
/* worth scaling by C. */
/* AMAX (output) DOUBLE PRECISION */
/* Absolute value of largest matrix element. If AMAX is very */
/* close to overflow or very close to underflow, the matrix */
/* should be scaled. */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, and i is */
/* <= M: the i-th row of A is exactly zero */
/* > M: the (i-M)-th column of A is exactly zero */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Test the input parameters. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
--r__;
--c__;
/* Function Body */
*info = 0;
if (*m < 0) {
*info = -1;
} else if (*n < 0) {
*info = -2;
} else if (*lda < max(1,*m)) {
*info = -4;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("DGEEQUB", &i__1);
return 0;
}
/* Quick return if possible. */
if (*m == 0 || *n == 0) {
*rowcnd = 1.;
*colcnd = 1.;
*amax = 0.;
return 0;
}
/* Get machine constants. Assume SMLNUM is a power of the radix. */
smlnum = dlamch_("S");
bignum = 1. / smlnum;
radix = dlamch_("B");
logrdx = log(radix);
/* Compute row scale factors. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
r__[i__] = 0.;
/* L10: */
}
/* Find the maximum element in each row. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
i__2 = *m;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = r__[i__], d__3 = (d__1 = a[i__ + j * a_dim1], abs(d__1));
r__[i__] = max(d__2,d__3);
/* L20: */
}
/* L30: */
}
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
if (r__[i__] > 0.) {
i__2 = (integer) (log(r__[i__]) / logrdx);
r__[i__] = pow_di(&radix, &i__2);
}
}
/* Find the maximum and minimum scale factors. */
rcmin = bignum;
rcmax = 0.;
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
/* Computing MAX */
d__1 = rcmax, d__2 = r__[i__];
rcmax = max(d__1,d__2);
/* Computing MIN */
d__1 = rcmin, d__2 = r__[i__];
rcmin = min(d__1,d__2);
/* L40: */
}
*amax = rcmax;
if (rcmin == 0.) {
/* Find the first zero scale factor and return an error code. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
if (r__[i__] == 0.) {
*info = i__;
return 0;
}
/* L50: */
}
} else {
/* Invert the scale factors. */
i__1 = *m;
for (i__ = 1; i__ <= i__1; ++i__) {
/* Computing MIN */
/* Computing MAX */
d__2 = r__[i__];
d__1 = max(d__2,smlnum);
r__[i__] = 1. / min(d__1,bignum);
/* L60: */
}
/* Compute ROWCND = min(R(I)) / max(R(I)). */
*rowcnd = max(rcmin,smlnum) / min(rcmax,bignum);
}
/* Compute column scale factors */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
c__[j] = 0.;
/* L70: */
}
/* Find the maximum element in each column, */
/* assuming the row scaling computed above. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
i__2 = *m;
for (i__ = 1; i__ <= i__2; ++i__) {
/* Computing MAX */
d__2 = c__[j], d__3 = (d__1 = a[i__ + j * a_dim1], abs(d__1)) *
r__[i__];
c__[j] = max(d__2,d__3);
/* L80: */
}
if (c__[j] > 0.) {
i__2 = (integer) (log(c__[j]) / logrdx);
c__[j] = pow_di(&radix, &i__2);
}
/* L90: */
}
/* Find the maximum and minimum scale factors. */
rcmin = bignum;
rcmax = 0.;
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
/* Computing MIN */
d__1 = rcmin, d__2 = c__[j];
rcmin = min(d__1,d__2);
/* Computing MAX */
d__1 = rcmax, d__2 = c__[j];
rcmax = max(d__1,d__2);
/* L100: */
}
if (rcmin == 0.) {
/* Find the first zero scale factor and return an error code. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
if (c__[j] == 0.) {
*info = *m + j;
return 0;
}
/* L110: */
}
} else {
/* Invert the scale factors. */
i__1 = *n;
for (j = 1; j <= i__1; ++j) {
/* Computing MIN */
/* Computing MAX */
d__2 = c__[j];
d__1 = max(d__2,smlnum);
c__[j] = 1. / min(d__1,bignum);
/* L120: */
}
/* Compute COLCND = min(C(J)) / max(C(J)). */
*colcnd = max(rcmin,smlnum) / min(rcmax,bignum);
}
return 0;
/* End of DGEEQUB */
} /* dgeequb_ */
|
1d4c62935ff9676288d83fedaec2cabcfae6f363
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/mtd/tests/mtd_nandecctest.c
|
70106607c247289b6328c9ff99321d64ffc49c81
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 8,053
|
c
|
mtd_nandecctest.c
|
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/random.h>
#include <linux/string.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/mtd/nand_ecc.h>
/*
* Test the implementation for software ECC
*
* No actual MTD device is needed, So we don't need to warry about losing
* important data by human error.
*
* This covers possible patterns of corruption which can be reliably corrected
* or detected.
*/
#if defined(CONFIG_MTD_NAND) || defined(CONFIG_MTD_NAND_MODULE)
struct nand_ecc_test {
const char *name;
void (*prepare)(void *, void *, void *, void *, const size_t);
int (*verify)(void *, void *, void *, const size_t);
};
/*
* The reason for this __change_bit_le() instead of __change_bit() is to inject
* bit error properly within the region which is not a multiple of
* sizeof(unsigned long) on big-endian systems
*/
#ifdef __LITTLE_ENDIAN
#define __change_bit_le(nr, addr) __change_bit(nr, addr)
#elif defined(__BIG_ENDIAN)
#define __change_bit_le(nr, addr) \
__change_bit((nr) ^ ((BITS_PER_LONG - 1) & ~0x7), addr)
#else
#error "Unknown byte order"
#endif
static void single_bit_error_data(void *error_data, void *correct_data,
size_t size)
{
unsigned int offset = prandom_u32() % (size * BITS_PER_BYTE);
memcpy(error_data, correct_data, size);
__change_bit_le(offset, error_data);
}
static void double_bit_error_data(void *error_data, void *correct_data,
size_t size)
{
unsigned int offset[2];
offset[0] = prandom_u32() % (size * BITS_PER_BYTE);
do {
offset[1] = prandom_u32() % (size * BITS_PER_BYTE);
} while (offset[0] == offset[1]);
memcpy(error_data, correct_data, size);
__change_bit_le(offset[0], error_data);
__change_bit_le(offset[1], error_data);
}
static unsigned int random_ecc_bit(size_t size)
{
unsigned int offset = prandom_u32() % (3 * BITS_PER_BYTE);
if (size == 256) {
/*
* Don't inject a bit error into the insignificant bits (16th
* and 17th bit) in ECC code for 256 byte data block
*/
while (offset == 16 || offset == 17)
offset = prandom_u32() % (3 * BITS_PER_BYTE);
}
return offset;
}
static void single_bit_error_ecc(void *error_ecc, void *correct_ecc,
size_t size)
{
unsigned int offset = random_ecc_bit(size);
memcpy(error_ecc, correct_ecc, 3);
__change_bit_le(offset, error_ecc);
}
static void double_bit_error_ecc(void *error_ecc, void *correct_ecc,
size_t size)
{
unsigned int offset[2];
offset[0] = random_ecc_bit(size);
do {
offset[1] = random_ecc_bit(size);
} while (offset[0] == offset[1]);
memcpy(error_ecc, correct_ecc, 3);
__change_bit_le(offset[0], error_ecc);
__change_bit_le(offset[1], error_ecc);
}
static void no_bit_error(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
memcpy(error_data, correct_data, size);
memcpy(error_ecc, correct_ecc, 3);
}
static int no_bit_error_verify(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{
unsigned char calc_ecc[3];
int ret;
__nand_calculate_ecc(error_data, size, calc_ecc);
ret = __nand_correct_data(error_data, error_ecc, calc_ecc, size);
if (ret == 0 && !memcmp(correct_data, error_data, size))
return 0;
return -EINVAL;
}
static void single_bit_error_in_data(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
single_bit_error_data(error_data, correct_data, size);
memcpy(error_ecc, correct_ecc, 3);
}
static void single_bit_error_in_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
memcpy(error_data, correct_data, size);
single_bit_error_ecc(error_ecc, correct_ecc, size);
}
static int single_bit_error_correct(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{
unsigned char calc_ecc[3];
int ret;
__nand_calculate_ecc(error_data, size, calc_ecc);
ret = __nand_correct_data(error_data, error_ecc, calc_ecc, size);
if (ret == 1 && !memcmp(correct_data, error_data, size))
return 0;
return -EINVAL;
}
static void double_bit_error_in_data(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
double_bit_error_data(error_data, correct_data, size);
memcpy(error_ecc, correct_ecc, 3);
}
static void single_bit_error_in_data_and_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
single_bit_error_data(error_data, correct_data, size);
single_bit_error_ecc(error_ecc, correct_ecc, size);
}
static void double_bit_error_in_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{
memcpy(error_data, correct_data, size);
double_bit_error_ecc(error_ecc, correct_ecc, size);
}
static int double_bit_error_detect(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{
unsigned char calc_ecc[3];
int ret;
__nand_calculate_ecc(error_data, size, calc_ecc);
ret = __nand_correct_data(error_data, error_ecc, calc_ecc, size);
return (ret == -1) ? 0 : -EINVAL;
}
static const struct nand_ecc_test nand_ecc_test[] = {
{
.name = "no-bit-error",
.prepare = no_bit_error,
.verify = no_bit_error_verify,
},
{
.name = "single-bit-error-in-data-correct",
.prepare = single_bit_error_in_data,
.verify = single_bit_error_correct,
},
{
.name = "single-bit-error-in-ecc-correct",
.prepare = single_bit_error_in_ecc,
.verify = single_bit_error_correct,
},
{
.name = "double-bit-error-in-data-detect",
.prepare = double_bit_error_in_data,
.verify = double_bit_error_detect,
},
{
.name = "single-bit-error-in-data-and-ecc-detect",
.prepare = single_bit_error_in_data_and_ecc,
.verify = double_bit_error_detect,
},
{
.name = "double-bit-error-in-ecc-detect",
.prepare = double_bit_error_in_ecc,
.verify = double_bit_error_detect,
},
};
static void dump_data_ecc(void *error_data, void *error_ecc, void *correct_data,
void *correct_ecc, const size_t size)
{
pr_info("hexdump of error data:\n");
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 4,
error_data, size, false);
print_hex_dump(KERN_INFO, "hexdump of error ecc: ",
DUMP_PREFIX_NONE, 16, 1, error_ecc, 3, false);
pr_info("hexdump of correct data:\n");
print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 4,
correct_data, size, false);
print_hex_dump(KERN_INFO, "hexdump of correct ecc: ",
DUMP_PREFIX_NONE, 16, 1, correct_ecc, 3, false);
}
static int nand_ecc_test_run(const size_t size)
{
int i;
int err = 0;
void *error_data;
void *error_ecc;
void *correct_data;
void *correct_ecc;
error_data = kmalloc(size, GFP_KERNEL);
error_ecc = kmalloc(3, GFP_KERNEL);
correct_data = kmalloc(size, GFP_KERNEL);
correct_ecc = kmalloc(3, GFP_KERNEL);
if (!error_data || !error_ecc || !correct_data || !correct_ecc) {
err = -ENOMEM;
goto error;
}
prandom_bytes(correct_data, size);
__nand_calculate_ecc(correct_data, size, correct_ecc);
for (i = 0; i < ARRAY_SIZE(nand_ecc_test); i++) {
nand_ecc_test[i].prepare(error_data, error_ecc,
correct_data, correct_ecc, size);
err = nand_ecc_test[i].verify(error_data, error_ecc,
correct_data, size);
if (err) {
pr_err("not ok - %s-%zd\n",
nand_ecc_test[i].name, size);
dump_data_ecc(error_data, error_ecc,
correct_data, correct_ecc, size);
break;
}
pr_info("ok - %s-%zd\n",
nand_ecc_test[i].name, size);
}
error:
kfree(error_data);
kfree(error_ecc);
kfree(correct_data);
kfree(correct_ecc);
return err;
}
#else
static int nand_ecc_test_run(const size_t size)
{
return 0;
}
#endif
static int __init ecc_test_init(void)
{
int err;
err = nand_ecc_test_run(256);
if (err)
return err;
return nand_ecc_test_run(512);
}
static void __exit ecc_test_exit(void)
{
}
module_init(ecc_test_init);
module_exit(ecc_test_exit);
MODULE_DESCRIPTION("NAND ECC function test module");
MODULE_AUTHOR("Akinobu Mita");
MODULE_LICENSE("GPL");
|
494607c2b4fa821d5856b1b55a4897efa8fa5b27
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/src/util/slist_debug.h
|
8d0e540c601f55123f70dc9554174e9723ffba91
|
[
"BSD-2-Clause"
] |
permissive
|
embox/embox
|
d6aacec876978522f01cdc4b8de37a668c6f4c80
|
98e3c06e33f3fdac10a29c069c20775568e0a6d1
|
refs/heads/master
| 2023-09-04T03:02:20.165042
| 2023-09-02T14:55:31
| 2023-09-02T14:55:31
| 33,078,138
| 1,087
| 325
|
BSD-2-Clause
| 2023-09-14T16:58:34
| 2015-03-29T15:27:48
|
C
|
UTF-8
|
C
| false
| false
| 1,131
|
h
|
slist_debug.h
|
/**
* @file
* @brief Debug implementation of single linked list utility.
*
* @date 17.04.11
* @author Eldar Abusalimov
*/
#ifndef UTIL_SLIST_DEBUG_H_
#define UTIL_SLIST_DEBUG_H_
#include <assert.h>
#include <stddef.h>
struct slist;
struct slist_link;
struct __slist_link;
struct slist {
unsigned int poison;
int offset;
struct __slist_link l;
};
struct slist_link {
unsigned int poison;
struct slist *slist;
struct __slist_link l;
};
#define __SLIST_POISON 0x0f00
#define __SLIST_LINK_POISON 0x0b0b
#define __SLIST_INIT(slist) \
{ \
.poison = __SLIST_POISON, \
.offset = -1, \
.l = __SLIST_LINK_INIT__(&(slist)->l), \
}
#define __SLIST_LINK_INIT(link) \
{ \
.poison = __SLIST_LINK_POISON, \
.slist = NULL, \
.l = __SLIST_LINK_INIT__(&(link)->l), \
}
#define __slist_check(expr) \
({ \
typeof(expr) __slist_expr = (expr); \
assert(__slist_expr != NULL); \
__slist_expr; \
})
#endif /* UTIL_SLIST_DEBUG_H_ */
|
4b2b9cd6b3f29d614c09c7f4fe80d5e23b3b865b
|
c475cd8531a94ffae69cc92371d41531dbbddb6c
|
/Projects/bullet3-2.89/Extras/ConvexDecomposition/vlookup.h
|
8120def436b3423bd3aecf2350bdf794830eeb64
|
[
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"Zlib"
] |
permissive
|
WolfireGames/overgrowth
|
72d3dd29cbd7254337265c29f8de3e5c32400114
|
594a2a4f9da0855304ee8cd5335d042f8e954ce1
|
refs/heads/main
| 2023-08-15T19:36:56.156578
| 2023-05-17T08:17:53
| 2023-05-17T08:20:36
| 467,448,492
| 2,264
| 245
|
Apache-2.0
| 2023-05-09T07:29:58
| 2022-03-08T09:38:54
|
C++
|
UTF-8
|
C
| false
| false
| 4,470
|
h
|
vlookup.h
|
#ifndef VLOOKUP_H
#define VLOOKUP_H
/*----------------------------------------------------------------------
Copyright (c) 2004 Open Dynamics Framework Group
www.physicstools.org
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the Open Dynamics Framework Group nor the names of its contributors may
be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE INTEL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-----------------------------------------------------------------------*/
// http://codesuppository.blogspot.com
//
// mailto: jratcliff@infiniplex.net
//
// http://www.amillionpixels.us
//
// CodeSnippet provided by John W. Ratcliff
// on March 23, 2006.
//
// mailto: jratcliff@infiniplex.net
//
// Personal website: http://jratcliffscarab.blogspot.com
// Coding Website: http://codesuppository.blogspot.com
// FundRaising Blog: http://amillionpixels.blogspot.com
// Fundraising site: http://www.amillionpixels.us
// New Temple Site: http://newtemple.blogspot.com
//
// This snippet shows how to 'hide' the complexity of
// the STL by wrapping some useful piece of functionality
// around a handful of discrete API calls.
//
// This API allows you to create an indexed triangle list
// from a collection of raw input triangles. Internally
// it uses an STL set to build the lookup table very rapidly.
//
// Here is how you would use it to build an indexed triangle
// list from a raw list of triangles.
//
// (1) create a 'VertexLookup' interface by calling
//
// VertexLook vl = Vl_createVertexLookup();
//
// (2) For each vertice in each triangle call:
//
// unsigned int i1 = Vl_getIndex(vl,p1);
// unsigned int i2 = Vl_getIndex(vl,p2);
// unsigned int i3 = Vl_getIndex(vl,p3);
//
// save the 3 indices into your triangle list array.
//
// (3) Get the vertex array by calling:
//
// const float *vertices = Vl_getVertices(vl);
//
// (4) Get the number of vertices so you can copy them into
// your own buffer.
// unsigned int vcount = Vl_getVcount(vl);
//
// (5) Release the VertexLookup interface when you are done with it.
// Vl_releaseVertexLookup(vl);
//
// Teaches the following lessons:
//
// How to wrap the complexity of STL and C++ classes around a
// simple API interface.
//
// How to use an STL set and custom comparator operator for
// a complex data type.
//
// How to create a template class.
//
// How to achieve significant performance improvements by
// taking advantage of built in STL containers in just
// a few lines of code.
//
// You could easily modify this code to support other vertex
// formats with any number of interpolants.
//
// Hide C++ classes from the rest of your application by
// keeping them in the CPP and wrapping them in a namespace
// Uses an STL set to create an index table for a bunch of vertex positions
// used typically to re-index a collection of raw triangle data.
typedef void *VertexLookup;
VertexLookup Vl_createVertexLookup(void);
void Vl_releaseVertexLookup(VertexLookup vlook);
unsigned int Vl_getIndex(VertexLookup vlook, const float *pos); // get index.
const float *Vl_getVertices(VertexLookup vlook);
unsigned int Vl_getVcount(VertexLookup vlook);
#endif
|
fda0275e315f6acb3d185f16d78a76d5a4682130
|
317410b28757af216145d23259d63fc96d07f613
|
/apps/common/third_party_profile/sig_mesh/api/cfg_cli.h
|
09b91dcf95586ce7a547c414e35c26528b6c15d2
|
[
"Apache-2.0"
] |
permissive
|
Jieli-Tech/fw-AC63_BT_SDK
|
48c757dca7e8000ec763bf5466583a4cd8c4a11c
|
393d63758081d56f0bf0a39ac596bee32c33d493
|
refs/heads/master
| 2023-07-18T02:14:56.187266
| 2023-06-21T03:14:20
| 2023-06-21T03:14:20
| 272,586,610
| 113
| 76
|
Apache-2.0
| 2022-10-20T23:07:31
| 2020-06-16T02:02:15
|
C
|
UTF-8
|
C
| false
| false
| 8,043
|
h
|
cfg_cli.h
|
/** @file
* @brief Bluetooth Mesh Configuration Client Model APIs.
*/
#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_
#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_
/**
* @brief Bluetooth Mesh
* @defgroup bt_mesh_cfg_cli Bluetooth Mesh Configuration Client Model
* @ingroup bt_mesh
* @{
*/
/** Mesh Configuration Client Model Context */
struct bt_mesh_cfg_cli {
struct bt_mesh_model *model;
u32_t op_pending;
void *op_param;
};
extern const struct bt_mesh_model_op bt_mesh_cfg_cli_op[];
#define BT_MESH_MODEL_CFG_CLI(cli_data) \
BT_MESH_MODEL(BT_MESH_MODEL_ID_CFG_CLI, \
bt_mesh_cfg_cli_op, NULL, cli_data)
int bt_mesh_cfg_comp_data_get(u16_t net_idx, u16_t addr, u8_t page,
u8_t *status, struct net_buf_simple *comp);
int bt_mesh_cfg_beacon_get(u16_t net_idx, u16_t addr, u8_t *status);
int bt_mesh_cfg_beacon_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *status);
int bt_mesh_cfg_ttl_get(u16_t net_idx, u16_t addr, u8_t *ttl);
int bt_mesh_cfg_ttl_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *ttl);
int bt_mesh_cfg_friend_get(u16_t net_idx, u16_t addr, u8_t *status);
int bt_mesh_cfg_friend_set(u16_t net_idx, u16_t addr, u8_t val, u8_t *status);
int bt_mesh_cfg_gatt_proxy_get(u16_t net_idx, u16_t addr, u8_t *status);
int bt_mesh_cfg_gatt_proxy_set(u16_t net_idx, u16_t addr, u8_t val,
u8_t *status);
int bt_mesh_cfg_relay_get(u16_t net_idx, u16_t addr, u8_t *status,
u8_t *transmit);
int bt_mesh_cfg_relay_set(u16_t net_idx, u16_t addr, u8_t new_relay,
u8_t new_transmit, u8_t *status, u8_t *transmit);
int bt_mesh_cfg_net_key_add(u16_t net_idx, u16_t addr, u16_t key_net_idx,
const u8_t net_key[16], u8_t *status);
int bt_mesh_cfg_app_key_add(u16_t net_idx, u16_t addr, u16_t key_net_idx,
u16_t key_app_idx, const u8_t app_key[16],
u8_t *status);
int bt_mesh_cfg_mod_app_bind(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_app_idx, u16_t mod_id, u8_t *status);
int bt_mesh_cfg_mod_app_bind_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_app_idx, u16_t mod_id, u16_t cid,
u8_t *status);
/** @def BT_MESH_PUB_PERIOD_100MS
*
* @brief Helper macro to encode model publication period in units of 100ms
*
* @param steps Number of 100ms steps.
*
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
*/
#define BT_MESH_PUB_PERIOD_100MS(steps) ((steps) & BIT_MASK(6))
/** @def BT_MESH_PUB_PERIOD_SEC
*
* @brief Helper macro to encode model publication period in units of 1 second
*
* @param steps Number of 1 second steps.
*
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
*/
#define BT_MESH_PUB_PERIOD_SEC(steps) (((steps) & BIT_MASK(6)) | (1 << 6))
/** @def BT_MESH_PUB_PERIOD_10SEC
*
* @brief Helper macro to encode model publication period in units of 10
* seconds
*
* @param steps Number of 10 second steps.
*
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
*/
#define BT_MESH_PUB_PERIOD_10SEC(steps) (((steps) & BIT_MASK(6)) | (2 << 6))
/** @def BT_MESH_PUB_PERIOD_10MIN
*
* @brief Helper macro to encode model publication period in units of 10
* minutes
*
* @param steps Number of 10 minute steps.
*
* @return Encoded value that can be assigned to bt_mesh_cfg_mod_pub.period
*/
#define BT_MESH_PUB_PERIOD_10MIN(steps) (((steps) & BIT_MASK(6)) | (3 << 6))
struct bt_mesh_cfg_mod_pub {
u16_t addr;
u16_t app_idx;
bool cred_flag;
u8_t ttl;
u8_t period;
u8_t transmit;
};
int bt_mesh_cfg_mod_pub_get(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_id, struct bt_mesh_cfg_mod_pub *pub,
u8_t *status);
int bt_mesh_cfg_mod_pub_get_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_id, u16_t cid,
struct bt_mesh_cfg_mod_pub *pub, u8_t *status);
int bt_mesh_cfg_mod_pub_set(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_id, struct bt_mesh_cfg_mod_pub *pub,
u8_t *status);
int bt_mesh_cfg_mod_pub_set_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t mod_id, u16_t cid,
struct bt_mesh_cfg_mod_pub *pub, u8_t *status);
int bt_mesh_cfg_mod_sub_add(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t sub_addr, u16_t mod_id, u8_t *status);
int bt_mesh_cfg_mod_sub_add_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t sub_addr, u16_t mod_id, u16_t cid,
u8_t *status);
int bt_mesh_cfg_mod_sub_del(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t sub_addr, u16_t mod_id, u8_t *status);
int bt_mesh_cfg_mod_sub_del_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t sub_addr, u16_t mod_id, u16_t cid,
u8_t *status);
int bt_mesh_cfg_mod_sub_overwrite(u16_t net_idx, u16_t addr, u16_t elem_addr,
u16_t sub_addr, u16_t mod_id, u8_t *status);
int bt_mesh_cfg_mod_sub_overwrite_vnd(u16_t net_idx, u16_t addr,
u16_t elem_addr, u16_t sub_addr,
u16_t mod_id, u16_t cid, u8_t *status);
int bt_mesh_cfg_mod_sub_va_add(u16_t net_idx, u16_t addr, u16_t elem_addr,
const u8_t label[16], u16_t mod_id,
u16_t *virt_addr, u8_t *status);
int bt_mesh_cfg_mod_sub_va_add_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
const u8_t label[16], u16_t mod_id,
u16_t cid, u16_t *virt_addr, u8_t *status);
int bt_mesh_cfg_mod_sub_va_del(u16_t net_idx, u16_t addr, u16_t elem_addr,
const u8_t label[16], u16_t mod_id,
u16_t *virt_addr, u8_t *status);
int bt_mesh_cfg_mod_sub_va_del_vnd(u16_t net_idx, u16_t addr, u16_t elem_addr,
const u8_t label[16], u16_t mod_id,
u16_t cid, u16_t *virt_addr, u8_t *status);
int bt_mesh_cfg_mod_sub_va_overwrite(u16_t net_idx, u16_t addr,
u16_t elem_addr, const u8_t label[16],
u16_t mod_id, u16_t *virt_addr,
u8_t *status);
int bt_mesh_cfg_mod_sub_va_overwrite_vnd(u16_t net_idx, u16_t addr,
u16_t elem_addr, const u8_t label[16],
u16_t mod_id, u16_t cid,
u16_t *virt_addr, u8_t *status);
struct bt_mesh_cfg_hb_sub {
u16_t src;
u16_t dst;
u8_t period;
u8_t count;
u8_t min;
u8_t max;
};
int bt_mesh_cfg_hb_sub_set(u16_t net_idx, u16_t addr,
struct bt_mesh_cfg_hb_sub *sub, u8_t *status);
int bt_mesh_cfg_hb_sub_get(u16_t net_idx, u16_t addr,
struct bt_mesh_cfg_hb_sub *sub, u8_t *status);
struct bt_mesh_cfg_hb_pub {
u16_t dst;
u8_t count;
u8_t period;
u8_t ttl;
u16_t feat;
u16_t net_idx;
};
int bt_mesh_cfg_hb_pub_set(u16_t net_idx, u16_t addr,
const struct bt_mesh_cfg_hb_pub *pub, u8_t *status);
int bt_mesh_cfg_hb_pub_get(u16_t net_idx, u16_t addr,
struct bt_mesh_cfg_hb_pub *pub, u8_t *status);
s32_t bt_mesh_cfg_cli_timeout_get(void);
void bt_mesh_cfg_cli_timeout_set(s32_t timeout);
/**
* @}
*/
#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_CFG_CLI_H_ */
|
c40dcbaa3654fdebf1678ea5a02fac80d33128b0
|
14ed2724b7c610543959f23d401e7b90283e63c4
|
/Source/sgl_init.c
|
addb13b054d89ad0a3c5bcb47ad568ed5246ee72
|
[
"MIT"
] |
permissive
|
powervr-graphics/PowerVR-Series1
|
d0ec36623d257e05c078e5d3f4bdfcd786ba46a4
|
c8c11cbe29c5b758ed1ef9600fc8614fc8da618e
|
refs/heads/main
| 2023-08-14T18:42:40.609670
| 2022-03-23T10:29:37
| 2022-03-23T10:29:37
| 467,444,934
| 260
| 17
| null | null | null | null |
UTF-8
|
C
| false
| false
| 15,312
|
c
|
sgl_init.c
|
/**************************************************************************
* Name : sgl_init.c
* Title : SGL intialisation
* Author : Simon James Fenney
* Created : 22 May 1995
*
* Copyright : 1995-2022 Imagination Technologies (c)
* License : MIT
*
* Description : Global Vars/ Routines to initialise SGL. This contains a
* global variable which can be used to test if the system has
* been initialised, and then a routine can be called to actually
* get it flying.
*
* Platform : ANSI
*
* Modifications:-
* $Log: sgl_init.c,v $
* Revision 1.91 1997/11/21 12:03:47 sxy
* made DebugInit() available to TIMING build.
*
* Revision 1.90 1997/09/25 11:46:59 sxy
* changed debug level to MESSAGE for DEBUGDEV, and added some DPFDEV messages.
*
* Revision 1.89 1997/09/24 14:41:47 gdc
* made sgl read in settings work same as new priority ini file reads
*
* Revision 1.88 1997/09/24 09:25:49 sxy
* Made DebugInit() available to DEBUGDEV.
*
* Revision 1.87 1997/07/24 17:14:00 gdc
* removed unneeded windows.h
*
* Revision 1.86 1997/07/14 09:58:53 gdc
* tried to turn off windows include file warnings and failed
*
* Revision 1.85 1997/07/11 16:21:15 gdc
* added two new functions to get ini file stuff in a manner controlled
* by us
*
* Revision 1.84 1997/06/04 15:30:16 gdc
* removed compiler warnings
*
* Revision 1.83 1997/06/02 02:48:24 jop
* Removed no longer need ed mem file stuff
*
* Revision 1.82 1997/05/20 13:58:08 gdc
* removed thread priority code
*
* Revision 1.81 1997/05/14 03:41:26 jop
* Hacked about
*
* Revision 1.80 1997/05/02 16:35:55 jop
* Killed off InitTextureInterface
*
* Revision 1.79 1997/05/01 16:47:30 mjg
* Replaced a UINT32 and added a call to initialise the TEXAPI.
*
* Revision 1.78 1997/04/30 19:21:38 jop
* Put Ed's changes back to how they were
*
* Revision 1.77 1997/04/29 14:51:24 erf
* Added new PVROS API function call mechanism.
*
* Revision 1.76 1997/04/25 21:24:49 mjg
* Changed non-Windows defines.
*
* Revision 1.75 1997/04/25 17:36:01 mjg
* Removed more texturing functions.
*
* Revision 1.74 1997/04/25 11:24:24 gdc
* removed tex heap initialisation that mjg had removed from sgllite
*
* Revision 1.73 1997/04/25 09:46:41 gdc
* hardware and buffer initailisation removed for win32 builds - now
* done in pvros upon physical/virtual device creation
* NOTE: TexParamSize hard coded - this stuff should soon move to texapi
* hopefully
*
* Revision 1.72 1997/04/23 18:22:11 gdc
* chnages for multi context
*
* Revision 1.71 1997/04/22 17:40:46 mjg
* Removed brdsetup.h include and changed a ghTexHeap pointer
*
* Revision 1.70 1997/04/21 18:43:56 sxy
* Added a global variable ghTexHeap for texture heap.
*
* Revision 1.69 1997/04/21 15:30:05 mjg
* Replaced ParamBufferInfo with PVRParamBuffs.
*
* Revision 1.68 1997/04/16 10:02:01 gdc
* added a version.h file which is auto generated by the new make process
* this contains the VER_LIB_XXX defines
*
* Revision 1.67 1997/04/15 13:12:10 mjg
* Moved HWSetupBunchOfBRIDGERegs into ISPTSP brackets and removed the call
* to RnInitialise (replaced with InitRegionDataL() and for now, until the
* VxD will do it, set the Sabre and Texas BufferIds.
*
* Revision 1.66 1997/04/08 11:54:02 jop
* Set default trace output level to warning rather than message
*
* Revision 1.65 1997/04/07 14:59:16 gdc
* RnSetupDefaultCamera now call in with pointer to default camera
*
* Revision 1.64 1997/04/04 13:05:41 jop
* Simplified debug initialisation - now generic
*
* Revision 1.63 1997/04/03 17:55:46 mjg
* Added an include.
*
* Revision 1.62 1997/04/03 13:13:55 mjg
* Included 'hwregs.h'
*
* Revision 1.61 1997/04/02 21:29:41 mjg
* Updated calling conventions.
*
* Revision 1.60 1997/04/01 19:17:41 mjg
* Changed notprintf to PVROSPrintf.
*
* Revision 1.59 1997/03/31 23:57:02 mlj
* Fixed brdsetup.c include
*
* Revision 1.58 1997/03/31 23:41:10 mlj
* Fixes to get DSO32 driver to build
*
* Revision 1.57 1997/03/31 22:09:58 jop
* Sorted out WIN32/DOS32 issues
*
* Revision 1.56 1997/03/13 11:44:25 sxy
* Added a global MemoryRoot, and pass it to InitTextureMemory().
*
* Revision 1.55 1997/02/04 12:27:24 gdc
* reworked sgl_init somewhat so that a separate sgl_lite only dll could be
* built, this mainly meant having some globals defined in rnglobal.c and
* instanced here by externs, and putting calls to InitStateStack and
* RnSetupDefaultCamera here instaed of RnInitialise
*
* Revision 1.54 1996/12/10 23:39:17 erf
* Changed compile switches:
* 1. PCX1 to PCX1 || PCX2.
* 2. MIDASPC1 to ISPTSP.
* 3. Include "pcx2\brdsetup.h" for PCX2.
* 4. Removed defined from ICC and ICL.
*
* Revision 1.53 1996/11/07 19:58:07 jop
* Sorted dodgy include
*
* Revision 1.52 1996/10/29 10:34:05 gdc
* forgot about midas3 when doing texparamsize
*
* Revision 1.51 1996/10/28 12:55:11 gdc
* added facility to changed amount of texture memory used
* by ISP andTSP prameter buffers via an ini file setting
* called TSPParamSize in kb
*
* Revision 1.50 1996/09/27 10:28:14 mjg
* move a line inside a #if WIN32
*
* Revision 1.49 1996/09/19 11:58:49 gdc
* added code to read a value from the sglhw.ini file to control
* how long the render takes to timeout. Ini file entry is
* RenderTimeout and is an integer in tenths of a second, default is 2
*
* Revision 1.48 1996/08/30 14:03:50 pdl
* put back the translucent pixel init
*
* Revision 1.47 1996/08/02 18:06:54 jop
* Removed FPU init - was breaking D3D
*
* Revision 1.46 1996/07/19 19:34:44 jop
* Added createwhitetexture from NTT support
*
* Revision 1.45 1996/07/17 13:59:36 sjf
* Twiddling call now conditional on it being a SIMUALTOR build.
*
* Revision 1.44 1996/07/10 10:44:53 pdl
* shuffled around an inittexturememory call.
*
* Revision 1.43 1996/07/08 04:51:27 sjf
* Added macto so mem logging can be built into release versions.
*
* Revision 1.41 1996/06/28 09:49:05 mal
* Added the HighPriority and DefaultPriority global variables
*
* Revision 1.38 1996/06/26 09:55:58 mal
* Added Thread Priority Read from sglhw.ini.
*
* Revision 1.37 1996/06/19 08:59:19 mal
* Added PCX1 Texture Memory Size Detection
*
* Revision 1.36 1996/06/03 16:41:54 jop
* Now calls exit() if the board init fails
*
* Revision 1.35 1996/06/03 16:29:02 jop
* WIN32 builds now carry out board and VxD init in sgl_init
*
* Revision 1.34 1996/05/30 20:33:37 sjf
* Added texture caching.
*
* Revision 1.33 1996/05/09 17:35:17 jop
* Commented out non-tex translucency stuff
*
* Revision 1.32 1996/04/26 16:55:28 pdl
* changed MIDASPC1 to WIN32.
*
* Revision 1.31 1996/04/26 14:32:27 pdl
* changed a const to a #define
*
* Revision 1.30 1996/04/15 11:42:38 pdl
* added some PCX1 support
*
* Revision 1.29 1996/04/02 16:25:11 jop
* Added ICL support
*
* Revision 1.28 1996/03/19 17:10:47 pdl
* included WIN32 into the condition for memory logging.
*
* Revision 1.27 1996/03/01 13:54:03 jrc
* 1. Removed redundant CheckVersion function and VersionString.
* 2. Added sgl_get_versions().
*
* Revision 1.26 1996/02/26 15:38:14 sjf
* Added memory use logging.
*
* Revision 1.25 1995/11/02 16:55:31 jop
* Added quality default flags init from ini file
*
* Revision 1.24 1995/11/02 13:37:47 jop
* Added optional memory test
*
* Revision 1.23 1995/10/29 14:20:05 jop
* Set base priority to enable normal desktop activity to take
* place, just!
*
* Revision 1.22 1995/10/27 18:13:10 sjf
* Added version printing.
*
* Revision 1.21 1995/10/27 10:15:08 sjf
* Added printout of version information to help prevent confusion
* debug releases.
*
* Revision 1.20 1995/10/27 10:04:30 pdl
* added the variable texture memory.
*
* Revision 1.19 1995/10/20 20:19:42 pdl
* added some register setup calls.
*
* Revision 1.18 1995/10/04 10:39:57 jop
* Added SetupFPU command for WIN32, ICC builds on PCs
*
* Revision 1.17 1995/09/04 13:18:22 jop
* Added fast square root lookup initialisation
*
* Revision 1.16 1995/08/25 10:30:47 pdl
* nothing.
*
* Revision 1.15 1995/08/09 12:25:09 pdl
* added the call to SetupTransPixel.
*
* Revision 1.14 1995/08/07 12:14:08 jop
* Added init-time mesh initialisation
*
* Revision 1.13 1995/08/02 13:23:45 pdl
* removed the volatile.
*
* Revision 1.12 1995/08/01 11:48:57 pdl
* removed TexasSetDim
*
* Revision 1.11 1995/07/30 19:00:09 pdl
* added version checking.
*
* Revision 1.10 1995/07/28 11:29:37 sjf
* Conditionally initialises debug.
*
* Revision 1.9 1995/07/27 10:58:08 sjf
* Initialised debug levels for UNIX versions.
*
* Revision 1.8 1995/07/26 17:37:09 jop
* removed simwin init call
*
* Revision 1.7 1995/07/26 17:00:55 pdl
* Corrected the memory size.
*
* Revision 1.6 1995/07/26 16:58:44 pdl
* Added some texas initialisation.
*
* Revision 1.5 1995/07/25 17:17:54 sjf
* Added parameter memory initialisation.
*
* Revision 1.4 1995/07/25 17:09:58 sjf
* Added RnInitialise.
*
* Revision 1.3 1995/07/23 17:20:49 jop
* Added windows debug initialisation support - a quick hack really
*
* Revision 1.2 1995/05/30 12:29:14 sjf
* Made function name VL standard.
*
* Revision 1.1 1995/05/26 12:39:26 sjf
* Initial revision
*
*
**************************************************************************/
#define MODULE_ID MODID_SGL_INIT
#include <string.h>
#include <stdio.h>
#include "sgl.h"
#include "sgl_defs.h"
#include "pvrosapi.h"
#include "dlnodes.h"
#include "nm_intf.h"
#include "dlglobal.h"
#include "sgl_init.h"
#include "rnglobal.h"
#include "rnstate.h"
#include "rnmesh.h"
#include "dlothers.h"
#include "dvdevice.h"
#include "rncamera.h"
#include "txmops.h"
#include "pmsabre.h"
#include "dregion.h"
#include "sgl_math.h"
#include "pktsp.h"
#include "texapi.h"
#include "parmbuff.h"
#if WIN32 || DOS32
#include "version.h"
#include "hwregs.h" /* For get_texture_memory_size */
#include "brdcfg.h"
#endif
#if ISPTSP
#include "profile.h"
#endif
#if !WIN32
extern sgl_uint32 TexParamSize;
extern HTEXHEAP ghTexHeap;
#endif
/*
// Variable to decide if we have initialised the system or not
// 0 - UNinitialised, NonZero - Initialised
//
// Set it to indicate that the system is uninitialised.
*/
extern int sglSystemInitialised;
extern int HighPrioritySetting;
extern int DefaultPrioritySetting;
extern int nTimeOutTenths;
/* prototype for function in w32dll.c */
sgl_bool CALL_CONV InitEnvironment(void);
/**************************************************************************
* Function Name : sglInitialise
* Inputs : None
* Outputs : None
* Returns : 0 if OK, non zero otherwise.
* Global Used : sglSystemInitialised
* Description : Initialises the system by calling individual initialisation
* routines.
**************************************************************************/
int CALL_CONV SglInitialise(void)
{
int result;
/*
// Assume success until proven otherwise
*/
result = 0;
/*
// If we havent initialised the system, do so
*/
if(sglSystemInitialised == 0)
{
PVROSPrintf("Initialising SGL Ver:%s\n", VER_LIB_TXT);
#if WIN32 || DOS32
if (!InitEnvironment ())
{
exit (1);
}
#endif
#if DEBUG
DebugInit (DBGPRIV_WARNING);
#endif
#if DEBUGDEV || TIMING
DebugInit (DBGPRIV_MESSAGE);
#endif
#if !WIN32
/* get the render timeout in tenths of a second */
nTimeOutTenths = HWRdValFile( "RenderTimeout", 2);
HWReset(); /* this is a full on reset*/
#if ISPTSP
HWSetupBunchOfBRIDGERegs();
#endif
HWSetupBunchOfISPRegs();
HWSetupBunchOfTSPRegs();
#endif
/*
// Initialise the display list editing globals etc
*/
result = InitDisplayLists();
/*
// Initialise the rendering variables
*/
/*
** initialise the default camera - used to be called from within
** RnInitialise
*/
RnSetupDefaultCamera(GetDefaultCamera());
if(result == 0)
{
InitRegionDataL(); /* Previously in a RnInitialise funcion */
result = InitStateStacks();
}
#if !WIN32
if(result == 0)
{
/* read the size for the texture parameter space in 4k pages */
TexParamSize = 1024*HWRdValFile( "TSPParamSize", (TEX_PARAM_SIZE/1024));
result = HWInitParamMem();
}
#endif
/* Initialise the bit twiddling table IF SIMULATOR*/
#if SIMULATOR
InitTwiddle();
#endif
/* Initialise the texture memory manager*/
#if DOS32
InitTextureMemory( 4*1024*1024, ghTexHeap );
#elif !WIN32
InitTextureMemory(TEXTURE_MEMORY_SIZE*2, ghTexHeap);
#endif
/*
// Initialse the texture cache control structure
*/
InitCachedTextures();
#if !WIN32
/* this allocates the overflow area for sabre parameters.
** It HAS to be done in this position/
*/
SetupOverflowArea(TexParamSize);
/* the translucent pixel HAS to be set up after the
texture memory */
TranslucentControlWord=SetupTransPixel();
#endif
/* Initialise some mesh rendering globals */
RnMeshOnSglInitialise ();
/* init fast inverse sqrt lookup table */
MakeInvSqrtLookupTable ();
if(result == 0)
{
sglSystemInitialised = 1;
}
/* read default quality flags from ini file */
InitDefaultQualityFlags ();
}/*End if system not initialised*/
return result;
}
/******************************************************************************
* Function Name: sgl_get_versions
*
* Inputs : -
* Outputs : -
* Returns : Pointer to internal versions structure
* Globals Used : -
*
* Description : See SGL API document
*****************************************************************************/
sgl_versions * CALL_CONV sgl_get_versions()
{
static sgl_versions versions;
versions.library = VER_LIB_TXT;
versions.required_header = SGL_HEADER_VERSION;
return &versions;
}
/***********************************************************************
**
** New recommended way for apps to get a value which they used
** to read from the local ini file eg StrictLocks
**
**
**
***********************************************************************/
sgl_bool CALL_CONV sgl_get_ini_string(char *ReturnData, int ReturnSize,
char *DefaultDataValue,
char *Section, char *Entry)
{
sgl_bool bResult = FALSE;
if(ReturnData==NULL || Section==NULL || Entry==NULL ||
DefaultDataValue==NULL || ReturnSize==0)
{
SglError(sgl_err_bad_parameter);
return FALSE;
}
else
{
strncpy(ReturnData, DefaultDataValue, ReturnSize);
bResult = HWRdValFileString (Entry, ReturnData, ReturnSize);
SglError(sgl_no_err);
return bResult;
}
}
sgl_bool CALL_CONV sgl_get_ini_int(sgl_int32 *ReturnData,
sgl_int32 DefaultValue,
char *Section, char *Entry)
{
if(ReturnData==NULL || Section==NULL || Entry==NULL)
{
SglError(sgl_err_bad_parameter);
return FALSE;
}
else
{
*ReturnData = (sgl_uint32) HWRdValFileInt (Entry, DefaultValue);
SglError(sgl_no_err);
return TRUE;
}
}
/*
// Thats all Folks....
// END OF FILE
*/
|
ee5965460ecd2e106f55890d87d052bc1bfbf8a7
|
03666e5f961946fc1a0ac67781ac1425562ef0d7
|
/src/avt/MIR/Youngs/CellInterfaceTypes.h
|
c3398c8574352b7f05f6268c3c2305e76ca58aff
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
visit-dav/visit
|
e9f81b4d4b9b9930a0db9d5282cd1bcabf465e2e
|
601ae46e0bef2e18425b482a755d03490ade0493
|
refs/heads/develop
| 2023-09-06T08:19:38.397058
| 2023-09-05T21:29:32
| 2023-09-05T21:29:32
| 165,565,988
| 335
| 120
|
BSD-3-Clause
| 2023-09-14T00:53:37
| 2019-01-13T23:27:26
|
C
|
UTF-8
|
C
| false
| false
| 1,596
|
h
|
CellInterfaceTypes.h
|
// Contributed by Thierry Carrard from
// Commissariat a l'Energie Atomique, (CEA)
// BP12, 91297 Arpajon, France
#ifndef __LOVE_REAL_H
#define __LOVE_REAL_H
/*-----------------------------------*
* LOVE *
*-----------------------------------*/
/*!
\brief (component Interface.Outils)
\author Thierry Carrard
\date 4 Decembre 2007
Modifications history :
*/
// par defaut, on est en double
#ifndef REAL_PRECISION
#define REAL_PRECISION 64
#endif
// float = precision la plus basse
#if ( REAL_PRECISION <= 32 )
#define REAL float
#define REAL2 float2
#define REAL3 float3
#define REAL4 float4
#define make_REAL1 make_float1
#define make_REAL2 make_float2
#define make_REAL3 make_float3
#define make_REAL4 make_float4
#define SQRT sqrtf
#define FABS fabsf
#define REAL_CONST(x) ((float)(x)) //( x##f )
// long double = precision la plus haute
#elif ( REAL_PRECISION > 64 )
#define REAL long double
#define REAL2 ldouble2
#define REAL3 ldouble3
#define REAL4 ldouble4
#define make_REAL1 make_ldouble1
#define make_REAL2 make_ldouble2
#define make_REAL3 make_ldouble3
#define make_REAL4 make_ldouble4
#define SQRT sqrtl
#define FABS fabsl
#define REAL_CONST(x) ((long double)(x)) //( x##l )
// double = precision par defaut
#else
#define REAL double
#define REAL2 double2
#define REAL3 double3
#define REAL4 double4
#define make_REAL1 make_double1
#define make_REAL2 make_double2
#define make_REAL3 make_double3
#define make_REAL4 make_double4
#define SQRT sqrt
#define FABS fabs
#define REAL_CONST(x) x
#endif
#endif /* __LOVE_REAL_H */
|
ad7f55a160ded9c40342161d4ef24b57b4f853bf
|
3f97df4f7e06c653be69c547c7e2efb7a9b5aad0
|
/CMSIS/RTOS2/RTX/Config/handlers.c
|
1cc56d770931e7b2e5b4fdfb14158c1754ffb574
|
[
"Apache-2.0"
] |
permissive
|
ARM-software/CMSIS_5
|
ef832c23aa9af025718f5aa3c780b4870d2ff060
|
a75f01746df18bb5b929dfb8dc6c9407fac3a0f3
|
refs/heads/develop
| 2023-09-06T02:49:34.281196
| 2023-06-21T12:52:04
| 2023-06-21T12:52:04
| 51,990,771
| 2,872
| 1,356
|
Apache-2.0
| 2023-08-22T09:43:24
| 2016-02-18T08:04:18
|
C
|
UTF-8
|
C
| false
| false
| 6,763
|
c
|
handlers.c
|
/*
* Copyright (c) 2013-2018 Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* 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
*
* 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.
*
* -----------------------------------------------------------------------------
*
* Project: CMSIS-RTOS RTX
* Title: Exception handlers (C functions)
*
* -----------------------------------------------------------------------------
*/
#include "RTE_Components.h"
#include CMSIS_device_header
//Fault Status Register (IFSR/DFSR) definitions
#define FSR_ALIGNMENT_FAULT 0x01 //DFSR only. Fault on first lookup
#define FSR_INSTRUCTION_CACHE_MAINTENANCE 0x04 //DFSR only - async/external
#define FSR_SYNC_EXT_TTB_WALK_FIRST 0x0c //sync/external
#define FSR_SYNC_EXT_TTB_WALK_SECOND 0x0e //sync/external
#define FSR_SYNC_PARITY_TTB_WALK_FIRST 0x1c //sync/external
#define FSR_SYNC_PARITY_TTB_WALK_SECOND 0x1e //sync/external
#define FSR_TRANSLATION_FAULT_FIRST 0x05 //MMU Fault - internal
#define FSR_TRANSLATION_FAULT_SECOND 0x07 //MMU Fault - internal
#define FSR_ACCESS_FLAG_FAULT_FIRST 0x03 //MMU Fault - internal
#define FSR_ACCESS_FLAG_FAULT_SECOND 0x06 //MMU Fault - internal
#define FSR_DOMAIN_FAULT_FIRST 0x09 //MMU Fault - internal
#define FSR_DOMAIN_FAULT_SECOND 0x0b //MMU Fault - internal
#define FSR_PERMISSION_FAULT_FIRST 0x0f //MMU Fault - internal
#define FSR_PERMISSION_FAULT_SECOND 0x0d //MMU Fault - internal
#define FSR_DEBUG_EVENT 0x02 //internal
#define FSR_SYNC_EXT_ABORT 0x08 //sync/external
#define FSR_TLB_CONFLICT_ABORT 0x10 //sync/external
#define FSR_LOCKDOWN 0x14 //internal
#define FSR_COPROCESSOR_ABORT 0x1a //internal
#define FSR_SYNC_PARITY_ERROR 0x19 //sync/external
#define FSR_ASYNC_EXTERNAL_ABORT 0x16 //DFSR only - async/external
#define FSR_ASYNC_PARITY_ERROR 0x18 //DFSR only - async/external
void CDAbtHandler(uint32_t DFSR, uint32_t DFAR, uint32_t LR) {
uint32_t FS = (DFSR & (1U << 10U)) >> 6U | (DFSR & 0x0FU); //Store Fault Status
(void)DFAR;
(void)LR;
switch(FS) {
//Synchronous parity errors - retry
case FSR_SYNC_PARITY_ERROR:
case FSR_SYNC_PARITY_TTB_WALK_FIRST:
case FSR_SYNC_PARITY_TTB_WALK_SECOND:
return;
//Your code here. Value in DFAR is invalid for some fault statuses.
case FSR_ALIGNMENT_FAULT:
case FSR_INSTRUCTION_CACHE_MAINTENANCE:
case FSR_SYNC_EXT_TTB_WALK_FIRST:
case FSR_SYNC_EXT_TTB_WALK_SECOND:
case FSR_TRANSLATION_FAULT_FIRST:
case FSR_TRANSLATION_FAULT_SECOND:
case FSR_ACCESS_FLAG_FAULT_FIRST:
case FSR_ACCESS_FLAG_FAULT_SECOND:
case FSR_DOMAIN_FAULT_FIRST:
case FSR_DOMAIN_FAULT_SECOND:
case FSR_PERMISSION_FAULT_FIRST:
case FSR_PERMISSION_FAULT_SECOND:
case FSR_DEBUG_EVENT:
case FSR_SYNC_EXT_ABORT:
case FSR_TLB_CONFLICT_ABORT:
case FSR_LOCKDOWN:
case FSR_COPROCESSOR_ABORT:
case FSR_ASYNC_EXTERNAL_ABORT: //DFAR invalid
case FSR_ASYNC_PARITY_ERROR: //DFAR invalid
default:
while(1);
}
}
void CPAbtHandler(uint32_t IFSR, uint32_t IFAR, uint32_t LR) {
uint32_t FS = (IFSR & (1U << 10U)) >> 6U | (IFSR & 0x0FU); //Store Fault Status
(void)IFAR;
(void)LR;
switch(FS) {
//Synchronous parity errors - retry
case FSR_SYNC_PARITY_ERROR:
case FSR_SYNC_PARITY_TTB_WALK_FIRST:
case FSR_SYNC_PARITY_TTB_WALK_SECOND:
return;
//Your code here. Value in IFAR is invalid for some fault statuses.
case FSR_SYNC_EXT_TTB_WALK_FIRST:
case FSR_SYNC_EXT_TTB_WALK_SECOND:
case FSR_TRANSLATION_FAULT_FIRST:
case FSR_TRANSLATION_FAULT_SECOND:
case FSR_ACCESS_FLAG_FAULT_FIRST:
case FSR_ACCESS_FLAG_FAULT_SECOND:
case FSR_DOMAIN_FAULT_FIRST:
case FSR_DOMAIN_FAULT_SECOND:
case FSR_PERMISSION_FAULT_FIRST:
case FSR_PERMISSION_FAULT_SECOND:
case FSR_DEBUG_EVENT: //IFAR invalid
case FSR_SYNC_EXT_ABORT:
case FSR_TLB_CONFLICT_ABORT:
case FSR_LOCKDOWN:
case FSR_COPROCESSOR_ABORT:
default:
while(1);
}
}
//returns amount to decrement lr by
//this will be 0 when we have emulated the instruction and want to execute the next instruction
//this will be 2 when we have performed some maintenance and want to retry the instruction in Thumb (state == 2)
//this will be 4 when we have performed some maintenance and want to retry the instruction in Arm (state == 4)
uint32_t CUndefHandler(uint32_t opcode, uint32_t state, uint32_t LR) {
const uint32_t THUMB = 2U;
const uint32_t ARM = 4U;
(void)LR;
//Lazy VFP/NEON initialisation and switching
// (Arm Architecture Reference Manual section A7.5) VFP data processing instruction?
// (Arm Architecture Reference Manual section A7.6) VFP/NEON register load/store instruction?
// (Arm Architecture Reference Manual section A7.8) VFP/NEON register data transfer instruction?
// (Arm Architecture Reference Manual section A7.9) VFP/NEON 64-bit register data transfer instruction?
if ((state == ARM && ((opcode & 0x0C000000U) >> 26U == 0x03U)) ||
(state == THUMB && ((opcode & 0xEC000000U) >> 26U == 0x3BU))) {
if (((opcode & 0x00000E00U) >> 9U) == 5U) {
__FPU_Enable();
return state;
}
}
// (Arm Architecture Reference Manual section A7.4) NEON data processing instruction?
if ((state == ARM && ((opcode & 0xFE000000U) >> 24U == 0xF2U)) ||
(state == THUMB && ((opcode & 0xEF000000U) >> 24U == 0xEFU)) ||
// (Arm Architecture Reference Manual section A7.7) NEON load/store instruction?
(state == ARM && ((opcode >> 24U) == 0xF4U)) ||
(state == THUMB && ((opcode >> 24U) == 0xF9U))) {
__FPU_Enable();
return state;
}
//Add code here for other Undef cases
while(1);
}
|
c6cf453fa99d56a3abff3bb20b4c75b59b269f5b
|
89db60818afeb3dc7c3b7abe9ceae155f074f7f2
|
/src/cmd/eqn/font.c
|
961c7bb21564c686fdceaf843be425754a7f50d0
|
[
"bzip2-1.0.6",
"LPL-1.02",
"MIT"
] |
permissive
|
9fans/plan9port
|
63c3d01928c6f8a8617d3ea6ecc05bac72391132
|
65c090346a38a8c30cb242d345aa71060116340c
|
refs/heads/master
| 2023-08-25T17:14:26.233105
| 2023-08-23T13:21:37
| 2023-08-23T18:47:08
| 26,095,474
| 1,645
| 468
|
NOASSERTION
| 2023-09-05T16:55:41
| 2014-11-02T22:40:13
|
C
|
UTF-8
|
C
| false
| false
| 1,532
|
c
|
font.c
|
# include "e.h"
void setfont(char *ch1)
{
yyval = ft;
if (strcmp(ch1, "I") == 0) { /* I and italic mean merely position 2 */
*ch1 = '2';
ft = ITAL;
} else if (strcmp(ch1, "B") == 0) { /* and similarly for B & bold */
*ch1 = '3';
ft = BLD;
} else if (strcmp(ch1, "R") == 0) { /* and R and roman */
*ch1 = '1';
ft = ROM;
} else {
ft = ROM; /* assume it's a roman style */
}
ftp++;
if (ftp >= &ftstack[10])
ERROR "font stack overflow (10)" FATAL;
ftp->ft = ft;
if (ch1[1] == 0) { /* 1-char name */
ftp->name[0] = *ch1;
ftp->name[1] = '\0';
} else
sprintf(ftp->name, "(%s", ch1);
dprintf(".\tsetfont %s %c\n", ch1, ft);
}
void font(int p1, int p2)
{
/* old font in p1, new in ft */
yyval = p2;
lfont[yyval] = rfont[yyval] = ft==ITAL ? ITAL : ROM;
ftp--;
ft = p1;
}
void globfont(void)
{
char temp[20];
getstr(temp, sizeof(temp));
yyval = eqnreg = 0;
if (strcmp(temp, "I") == 0 || strncmp(temp, "it", 2) == 0) {
ft = ITAL;
strcpy(temp, "2");
} else if (strcmp(temp, "B") == 0 || strncmp(temp, "bo", 2) == 0) {
ft = BLD;
strcpy(temp, "3");
} else if (strcmp(temp, "R") == 0 || strncmp(temp, "ro", 2) == 0) {
ft = ROM;
strcpy(temp, "1");
} else {
ft = ROM; /* assume it's a roman style */
}
ftstack[0].ft = ft;
if (temp[1] == 0) /* 1-char name */
strcpy(ftstack[0].name, temp);
else
sprintf(ftstack[0].name, "(%.2s", temp);
}
void fatbox(int p)
{
extern double Fatshift;
yyval = p;
printf(".ds %d \\*(%d\\h'-\\w'\\*(%d'u+%gm'\\*(%d\n", p, p, p, Fatshift, p);
}
|
a640448ba6bc4a65aeaed203e735c86f868eca85
|
e8c76797b194bce6702adf9721a96c2b440efd5c
|
/modules/generators/mod_cgi.c
|
421124a0cb13358fc62c79fc06da852be1ad6928
|
[
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"Apache-2.0",
"LicenseRef-scancode-zeusbench",
"BSD-3-Clause",
"RSA-MD",
"LicenseRef-scancode-rsa-1990",
"Beerware",
"LicenseRef-scancode-other-permissive",
"Spencer-94",
"metamail",
"LicenseRef-scancode-rsa-md4",
"HPND-sell-variant"
] |
permissive
|
apache/httpd
|
86bfac3d6e2e9b48f5bfca5be7ec616fa9b14e9a
|
b9e029c8036fd036281ac266010db91aed6079b2
|
refs/heads/trunk
| 2023-09-04T07:18:59.681233
| 2023-08-30T12:56:11
| 2023-08-30T12:56:11
| 205,423
| 3,159
| 1,329
|
Apache-2.0
| 2023-09-11T13:50:41
| 2009-05-20T02:02:59
|
C
|
UTF-8
|
C
| false
| false
| 26,307
|
c
|
mod_cgi.c
|
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
/*
* http_script: keeps all script-related ramblings together.
*
* Compliant to CGI/1.1 spec
*
* Adapted by rst from original NCSA code by Rob McCool
*
* This modules uses a httpd core function (ap_add_common_vars) to add some new env vars,
* like REDIRECT_URL and REDIRECT_QUERY_STRING for custom error responses and DOCUMENT_ROOT.
* It also adds SERVER_ADMIN - useful for scripts to know who to mail when they fail.
*
*/
#include "apr.h"
#include "apr_strings.h"
#include "apr_thread_proc.h" /* for RLIMIT stuff */
#include "apr_optional.h"
#include "apr_buckets.h"
#include "apr_lib.h"
#include "apr_poll.h"
#define APR_WANT_STRFUNC
#define APR_WANT_MEMFUNC
#include "apr_want.h"
#include "util_filter.h"
#include "ap_config.h"
#include "httpd.h"
#include "http_config.h"
#include "http_request.h"
#include "http_core.h"
#include "http_protocol.h"
#include "http_main.h"
#include "http_log.h"
#include "util_script.h"
#include "ap_mpm.h"
#include "mod_core.h"
#include "mod_cgi.h"
#if APR_HAVE_STRUCT_RLIMIT
#if defined (RLIMIT_CPU) || defined (RLIMIT_NPROC) || defined (RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS)
#define AP_CGI_USE_RLIMIT
#endif
#endif
module AP_MODULE_DECLARE_DATA cgi_module;
static APR_OPTIONAL_FN_TYPE(ap_cgi_build_command) *cgi_build_command;
/* Read and discard the data in the brigade produced by a CGI script */
static void discard_script_output(apr_bucket_brigade *bb);
/* KLUDGE --- for back-combatibility, we don't have to check ExecCGI
* in ScriptAliased directories, which means we need to know if this
* request came through ScriptAlias or not... so the Alias module
* leaves a note for us.
*/
static int is_scriptaliased(request_rec *r)
{
const char *t = apr_table_get(r->notes, "alias-forced-type");
return t && (!strcasecmp(t, "cgi-script"));
}
/* Configuration stuff */
#define DEFAULT_LOGBYTES 10385760
#define DEFAULT_BUFBYTES 1024
typedef struct {
const char *logname;
long logbytes;
apr_size_t bufbytes;
} cgi_server_conf;
typedef struct {
apr_interval_time_t timeout;
} cgi_dirconf;
#if APR_FILES_AS_SOCKETS
#define WANT_CGI_BUCKET
#endif
#include "cgi_common.h"
static void *create_cgi_config(apr_pool_t *p, server_rec *s)
{
cgi_server_conf *c =
(cgi_server_conf *) apr_pcalloc(p, sizeof(cgi_server_conf));
c->logname = NULL;
c->logbytes = DEFAULT_LOGBYTES;
c->bufbytes = DEFAULT_BUFBYTES;
return c;
}
static void *merge_cgi_config(apr_pool_t *p, void *basev, void *overridesv)
{
cgi_server_conf *base = (cgi_server_conf *) basev,
*overrides = (cgi_server_conf *) overridesv;
return overrides->logname ? overrides : base;
}
static void *create_cgi_dirconf(apr_pool_t *p, char *dummy)
{
cgi_dirconf *c = (cgi_dirconf *) apr_pcalloc(p, sizeof(cgi_dirconf));
return c;
}
static const char *set_scriptlog(cmd_parms *cmd, void *dummy, const char *arg)
{
server_rec *s = cmd->server;
cgi_server_conf *conf = ap_get_module_config(s->module_config,
&cgi_module);
conf->logname = ap_server_root_relative(cmd->pool, arg);
if (!conf->logname) {
return apr_pstrcat(cmd->pool, "Invalid ScriptLog path ",
arg, NULL);
}
return NULL;
}
static const char *set_scriptlog_length(cmd_parms *cmd, void *dummy,
const char *arg)
{
server_rec *s = cmd->server;
cgi_server_conf *conf = ap_get_module_config(s->module_config,
&cgi_module);
conf->logbytes = atol(arg);
return NULL;
}
static const char *set_scriptlog_buffer(cmd_parms *cmd, void *dummy,
const char *arg)
{
server_rec *s = cmd->server;
cgi_server_conf *conf = ap_get_module_config(s->module_config,
&cgi_module);
conf->bufbytes = atoi(arg);
return NULL;
}
static const char *set_script_timeout(cmd_parms *cmd, void *dummy, const char *arg)
{
cgi_dirconf *dc = dummy;
if (ap_timeout_parameter_parse(arg, &dc->timeout, "s") != APR_SUCCESS) {
return "CGIScriptTimeout has wrong format";
}
return NULL;
}
static const command_rec cgi_cmds[] =
{
AP_INIT_TAKE1("ScriptLog", set_scriptlog, NULL, RSRC_CONF,
"the name of a log for script debugging info"),
AP_INIT_TAKE1("ScriptLogLength", set_scriptlog_length, NULL, RSRC_CONF,
"the maximum length (in bytes) of the script debug log"),
AP_INIT_TAKE1("ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF,
"the maximum size (in bytes) to record of a POST request"),
AP_INIT_TAKE1("CGIScriptTimeout", set_script_timeout, NULL, RSRC_CONF | ACCESS_CONF,
"The amount of time to wait between successful reads from "
"the CGI script, in seconds."),
{NULL}
};
static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
char *dbuf, const char *sbuf, apr_bucket_brigade *bb,
apr_file_t *script_err)
{
const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
const apr_table_entry_t *hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
char argsbuffer[HUGE_STRING_LEN];
apr_file_t *f = NULL;
apr_bucket *e;
const char *buf;
apr_size_t len;
apr_status_t rv;
int first;
int i;
apr_finfo_t finfo;
char time_str[APR_CTIME_LEN];
/* XXX Very expensive mainline case! Open, then getfileinfo! */
if (!conf->logname ||
((apr_stat(&finfo, conf->logname,
APR_FINFO_SIZE, r->pool) == APR_SUCCESS) &&
(finfo.size > conf->logbytes)) ||
(apr_file_open(&f, conf->logname,
APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT,
r->pool) != APR_SUCCESS)) {
/* Soak up script output */
discard_script_output(bb);
log_script_err(r, script_err);
return ret;
}
/* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
apr_ctime(time_str, apr_time_now());
apr_file_printf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri,
r->args ? "?" : "", r->args ? r->args : "", r->protocol);
/* "%% 500 /usr/local/apache/cgi-bin" */
apr_file_printf(f, "%%%% %d %s\n", ret, r->filename);
apr_file_puts("%request\n", f);
for (i = 0; i < hdrs_arr->nelts; ++i) {
if (!hdrs[i].key)
continue;
apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
}
if ((r->method_number == M_POST || r->method_number == M_PUT) &&
*dbuf) {
apr_file_printf(f, "\n%s\n", dbuf);
}
apr_file_puts("%response\n", f);
hdrs_arr = apr_table_elts(r->err_headers_out);
hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
for (i = 0; i < hdrs_arr->nelts; ++i) {
if (!hdrs[i].key)
continue;
apr_file_printf(f, "%s: %s\n", hdrs[i].key, hdrs[i].val);
}
if (sbuf && *sbuf)
apr_file_printf(f, "%s\n", sbuf);
first = 1;
for (e = APR_BRIGADE_FIRST(bb);
e != APR_BRIGADE_SENTINEL(bb);
e = APR_BUCKET_NEXT(e))
{
if (APR_BUCKET_IS_EOS(e)) {
break;
}
rv = apr_bucket_read(e, &buf, &len, APR_BLOCK_READ);
if (rv != APR_SUCCESS || (len == 0)) {
break;
}
if (first) {
apr_file_puts("%stdout\n", f);
first = 0;
}
apr_file_write(f, buf, &len);
apr_file_puts("\n", f);
}
if (apr_file_gets(argsbuffer, HUGE_STRING_LEN, script_err) == APR_SUCCESS) {
apr_file_puts("%stderr\n", f);
apr_file_puts(argsbuffer, f);
while (apr_file_gets(argsbuffer, HUGE_STRING_LEN,
script_err) == APR_SUCCESS) {
apr_file_puts(argsbuffer, f);
}
apr_file_puts("\n", f);
}
apr_brigade_destroy(bb);
apr_file_close(script_err);
apr_file_close(f);
return ret;
}
/* This is the special environment used for running the "exec cmd="
* variety of SSI directives.
*/
static void add_ssi_vars(request_rec *r)
{
apr_table_t *e = r->subprocess_env;
if (r->path_info && r->path_info[0] != '\0') {
request_rec *pa_req;
apr_table_setn(e, "PATH_INFO", ap_escape_shell_cmd(r->pool,
r->path_info));
pa_req = ap_sub_req_lookup_uri(ap_escape_uri(r->pool, r->path_info),
r, NULL);
if (pa_req->filename) {
apr_table_setn(e, "PATH_TRANSLATED",
apr_pstrcat(r->pool, pa_req->filename,
pa_req->path_info, NULL));
}
ap_destroy_sub_req(pa_req);
}
if (r->args) {
char *arg_copy = apr_pstrdup(r->pool, r->args);
apr_table_setn(e, "QUERY_STRING", r->args);
ap_unescape_url(arg_copy);
apr_table_setn(e, "QUERY_STRING_UNESCAPED",
ap_escape_shell_cmd(r->pool, arg_copy));
}
}
static void cgi_child_errfn(apr_pool_t *pool, apr_status_t err,
const char *description)
{
apr_file_t *stderr_log;
apr_file_open_stderr(&stderr_log, pool);
/* Escape the logged string because it may be something that
* came in over the network.
*/
apr_file_printf(stderr_log,
"(%d)%pm: %s\n",
err,
&err,
#ifndef AP_UNSAFE_ERROR_LOG_UNESCAPED
ap_escape_logitem(pool,
#endif
description
#ifndef AP_UNSAFE_ERROR_LOG_UNESCAPED
)
#endif
);
}
static apr_status_t run_cgi_child(apr_file_t **script_out,
apr_file_t **script_in,
apr_file_t **script_err,
const char *command,
const char * const argv[],
request_rec *r,
apr_pool_t *p,
cgi_exec_info_t *e_info)
{
const char * const *env;
apr_procattr_t *procattr;
apr_proc_t *procnew;
apr_status_t rc = APR_SUCCESS;
#ifdef AP_CGI_USE_RLIMIT
core_dir_config *conf = ap_get_core_module_config(r->per_dir_config);
#endif
#ifdef DEBUG_CGI
#ifdef OS2
/* Under OS/2 need to use device con. */
FILE *dbg = fopen("con", "w");
#else
FILE *dbg = fopen("/dev/tty", "w");
#endif
int i;
#endif
RAISE_SIGSTOP(CGI_CHILD);
#ifdef DEBUG_CGI
fprintf(dbg, "Attempting to exec %s as CGI child (argv0 = %s)\n",
r->filename, argv[0]);
#endif
env = (const char * const *)ap_create_environment(p, r->subprocess_env);
#ifdef DEBUG_CGI
fprintf(dbg, "Environment: \n");
for (i = 0; env[i]; ++i)
fprintf(dbg, "'%s'\n", env[i]);
fclose(dbg);
#endif
/* Transmute ourselves into the script.
* NB only ISINDEX scripts get decoded arguments.
*/
if (((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
((rc = apr_procattr_io_set(procattr,
e_info->in_pipe,
e_info->out_pipe,
e_info->err_pipe)) != APR_SUCCESS) ||
((rc = apr_procattr_dir_set(procattr,
ap_make_dirstr_parent(r->pool,
r->filename))) != APR_SUCCESS) ||
#if defined(RLIMIT_CPU) && defined(AP_CGI_USE_RLIMIT)
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_CPU,
conf->limit_cpu)) != APR_SUCCESS) ||
#endif
#if defined(AP_CGI_USE_RLIMIT) && (defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_AS))
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_MEM,
conf->limit_mem)) != APR_SUCCESS) ||
#endif
#if defined(RLIMIT_NPROC) && defined(AP_CGI_USE_RLIMIT)
((rc = apr_procattr_limit_set(procattr, APR_LIMIT_NPROC,
conf->limit_nproc)) != APR_SUCCESS) ||
#endif
((rc = apr_procattr_cmdtype_set(procattr,
e_info->cmd_type)) != APR_SUCCESS) ||
((rc = apr_procattr_detach_set(procattr,
e_info->detached)) != APR_SUCCESS) ||
((rc = apr_procattr_addrspace_set(procattr,
e_info->addrspace)) != APR_SUCCESS) ||
((rc = apr_procattr_child_errfn_set(procattr, cgi_child_errfn)) != APR_SUCCESS)) {
/* Something bad happened, tell the world. */
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, APLOGNO(01216)
"couldn't set child process attributes: %s", r->filename);
}
else {
procnew = apr_pcalloc(p, sizeof(*procnew));
rc = ap_os_create_privileged_process(r, procnew, command, argv, env,
procattr, p);
if (rc != APR_SUCCESS) {
/* Bad things happened. Everyone should have cleaned up. */
/* Intentional no APLOGNO */
ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_TOCLIENT, rc, r,
"couldn't create child process: %d: %s", rc,
apr_filepath_name_get(r->filename));
}
else {
cgi_dirconf *dc = ap_get_module_config(r->per_dir_config, &cgi_module);
apr_interval_time_t timeout = dc->timeout > 0 ? dc->timeout : r->server->timeout;
apr_pool_note_subprocess(p, procnew, APR_KILL_AFTER_TIMEOUT);
*script_in = procnew->out;
if (!*script_in)
return APR_EBADF;
apr_file_pipe_timeout_set(*script_in, timeout);
if (e_info->prog_type == RUN_AS_CGI) {
*script_out = procnew->in;
if (!*script_out)
return APR_EBADF;
apr_file_pipe_timeout_set(*script_out, timeout);
*script_err = procnew->err;
if (!*script_err)
return APR_EBADF;
apr_file_pipe_timeout_set(*script_err, timeout);
}
}
}
return (rc);
}
static apr_status_t default_build_command(const char **cmd, const char ***argv,
request_rec *r, apr_pool_t *p,
cgi_exec_info_t *e_info)
{
int numwords, x, idx;
char *w;
const char *args = NULL;
if (e_info->process_cgi) {
*cmd = r->filename;
/* Do not process r->args if they contain an '=' assignment
*/
if (r->args && r->args[0] && !ap_strchr_c(r->args, '=')) {
args = r->args;
}
}
if (!args) {
numwords = 1;
}
else {
/* count the number of keywords */
for (x = 0, numwords = 2; args[x]; x++) {
if (args[x] == '+') {
++numwords;
}
}
}
/* Everything is - 1 to account for the first parameter
* which is the program name.
*/
if (numwords > APACHE_ARG_MAX - 1) {
numwords = APACHE_ARG_MAX - 1; /* Truncate args to prevent overrun */
}
*argv = apr_palloc(p, (numwords + 2) * sizeof(char *));
(*argv)[0] = *cmd;
for (x = 1, idx = 1; x < numwords; x++) {
w = ap_getword_nulls(p, &args, '+');
ap_unescape_url(w);
(*argv)[idx++] = ap_escape_shell_cmd(p, w);
}
(*argv)[idx] = NULL;
return APR_SUCCESS;
}
static int cgi_handler(request_rec *r)
{
int nph;
apr_size_t dbufsize;
const char *argv0;
const char *command;
const char **argv;
char *dbuf = NULL;
apr_file_t *script_out = NULL, *script_in = NULL, *script_err = NULL;
conn_rec *c = r->connection;
apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc);
apr_bucket *b;
int is_included;
apr_pool_t *p;
cgi_server_conf *conf;
apr_status_t rv;
cgi_exec_info_t e_info;
cgi_dirconf *dc = ap_get_module_config(r->per_dir_config, &cgi_module);
apr_interval_time_t timeout = dc->timeout > 0 ? dc->timeout : r->server->timeout;
if (strcmp(r->handler, CGI_MAGIC_TYPE) && strcmp(r->handler, "cgi-script")) {
return DECLINED;
}
is_included = !strcmp(r->protocol, "INCLUDED");
p = r->main ? r->main->pool : r->pool;
argv0 = apr_filepath_name_get(r->filename);
nph = !(strncmp(argv0, "nph-", 4));
conf = ap_get_module_config(r->server->module_config, &cgi_module);
if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r))
return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02809),
"Options ExecCGI is off in this directory");
if (nph && is_included)
return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02810),
"attempt to include NPH CGI script");
if (r->finfo.filetype == APR_NOFILE)
return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, APLOGNO(02811),
"script not found or unable to stat");
if (r->finfo.filetype == APR_DIR)
return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(02812),
"attempt to invoke directory as script");
if ((r->used_path_info == AP_REQ_REJECT_PATH_INFO) &&
r->path_info && *r->path_info)
{
/* default to accept */
return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, APLOGNO(02813),
"AcceptPathInfo off disallows user's path");
}
/*
if (!ap_suexec_enabled) {
if (!ap_can_exec(&r->finfo))
return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, APLOGNO(03194)
"file permissions deny server execution");
}
*/
ap_add_common_vars(r);
ap_add_cgi_vars(r);
e_info.process_cgi = 1;
e_info.cmd_type = APR_PROGRAM;
e_info.detached = 0;
e_info.in_pipe = APR_CHILD_BLOCK;
e_info.out_pipe = APR_CHILD_BLOCK;
e_info.err_pipe = APR_CHILD_BLOCK;
e_info.prog_type = RUN_AS_CGI;
e_info.bb = NULL;
e_info.ctx = NULL;
e_info.next = NULL;
e_info.addrspace = 0;
/* build the command line */
if ((rv = cgi_build_command(&command, &argv, r, p, &e_info)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01222)
"don't know how to spawn child process: %s",
r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
/* run the script in its own process */
if ((rv = run_cgi_child(&script_out, &script_in, &script_err,
command, argv, r, p, &e_info)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01223)
"couldn't spawn child process: %s", r->filename);
return HTTP_INTERNAL_SERVER_ERROR;
}
/* Buffer for logging script stdout. */
if (conf->logname) {
dbufsize = conf->bufbytes;
dbuf = apr_palloc(r->pool, dbufsize + 1);
}
else {
dbufsize = 0;
dbuf = NULL;
}
/* Read the request body. */
rv = cgi_handle_request(r, script_out, bb, dbuf, dbufsize);
if (rv) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01225)
"Error reading request entity data");
return ap_map_http_request_error(rv, HTTP_BAD_REQUEST);
}
/* Is this flush really needed? */
apr_file_flush(script_out);
apr_file_close(script_out);
AP_DEBUG_ASSERT(script_in != NULL);
#if APR_FILES_AS_SOCKETS
b = cgi_bucket_create(r, dc->timeout, script_in, script_err, c->bucket_alloc);
if (b == NULL)
return HTTP_INTERNAL_SERVER_ERROR;
#else
b = apr_bucket_pipe_create(script_in, c->bucket_alloc);
#endif
APR_BRIGADE_INSERT_TAIL(bb, b);
b = apr_bucket_eos_create(c->bucket_alloc);
APR_BRIGADE_INSERT_TAIL(bb, b);
return cgi_handle_response(r, nph, bb, timeout, conf, dbuf, script_err);
}
/*============================================================================
*============================================================================
* This is the beginning of the cgi filter code moved from mod_include. This
* is the code required to handle the "exec" SSI directive.
*============================================================================
*============================================================================*/
static apr_status_t include_cgi(include_ctx_t *ctx, ap_filter_t *f,
apr_bucket_brigade *bb, char *s)
{
request_rec *r = f->r;
request_rec *rr = ap_sub_req_lookup_uri(s, r, f->next);
int rr_status;
if (rr->status != HTTP_OK) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
/* No hardwired path info or query allowed */
if ((rr->path_info && rr->path_info[0]) || rr->args) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
if (rr->finfo.filetype != APR_REG) {
ap_destroy_sub_req(rr);
return APR_EGENERAL;
}
/* Script gets parameters of the *document*, for back compatibility */
rr->path_info = r->path_info; /* hard to get right; see mod_cgi.c */
rr->args = r->args;
/* Force sub_req to be treated as a CGI request, even if ordinary
* typing rules would have called it something else.
*/
ap_set_content_type(rr, CGI_MAGIC_TYPE);
/* Run it. */
rr_status = ap_run_sub_req(rr);
if (ap_is_HTTP_REDIRECT(rr_status)) {
const char *location = apr_table_get(rr->headers_out, "Location");
if (location) {
char *buffer;
location = ap_escape_html(rr->pool, location);
buffer = apr_pstrcat(ctx->pool, "<a href=\"", location, "\">",
location, "</a>", NULL);
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_pool_create(buffer,
strlen(buffer), ctx->pool,
f->c->bucket_alloc));
}
}
ap_destroy_sub_req(rr);
return APR_SUCCESS;
}
static apr_status_t include_cmd(include_ctx_t *ctx, ap_filter_t *f,
apr_bucket_brigade *bb, const char *command)
{
cgi_exec_info_t e_info;
const char **argv;
apr_file_t *script_out = NULL, *script_in = NULL, *script_err = NULL;
apr_status_t rv;
request_rec *r = f->r;
add_ssi_vars(r);
e_info.process_cgi = 0;
e_info.cmd_type = APR_SHELLCMD;
e_info.detached = 0;
e_info.in_pipe = APR_NO_PIPE;
e_info.out_pipe = APR_FULL_BLOCK;
e_info.err_pipe = APR_NO_PIPE;
e_info.prog_type = RUN_AS_SSI;
e_info.bb = &bb;
e_info.ctx = ctx;
e_info.next = f->next;
e_info.addrspace = 0;
if ((rv = cgi_build_command(&command, &argv, r, r->pool,
&e_info)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01226)
"don't know how to spawn cmd child process: %s",
r->filename);
return rv;
}
/* run the script in its own process */
if ((rv = run_cgi_child(&script_out, &script_in, &script_err,
command, argv, r, r->pool,
&e_info)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01227)
"couldn't spawn child process: %s", r->filename);
return rv;
}
APR_BRIGADE_INSERT_TAIL(bb, apr_bucket_pipe_create(script_in,
f->c->bucket_alloc));
ctx->flush_now = 1;
/* We can't close the pipe here, because we may return before the
* full CGI has been sent to the network. That's okay though,
* because we can rely on the pool to close the pipe for us.
*/
return APR_SUCCESS;
}
static int cgi_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
/* This is the means by which unusual (non-unix) os's may find alternate
* means to run a given command (e.g. shebang/registry parsing on Win32)
*/
cgi_build_command = APR_RETRIEVE_OPTIONAL_FN(ap_cgi_build_command);
if (!cgi_build_command) {
cgi_build_command = default_build_command;
}
return OK;
}
static void register_hooks(apr_pool_t *p)
{
static const char * const aszPre[] = { "mod_include.c", NULL };
ap_hook_handler(cgi_handler, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_config(cgi_post_config, aszPre, NULL, APR_HOOK_REALLY_FIRST);
ap_hook_optional_fn_retrieve(cgi_optfns_retrieve, NULL, NULL, APR_HOOK_MIDDLE);
}
AP_DECLARE_MODULE(cgi) =
{
STANDARD20_MODULE_STUFF,
create_cgi_dirconf, /* dir config creater */
NULL, /* dir merger --- default is to override */
create_cgi_config, /* server config */
merge_cgi_config, /* merge server config */
cgi_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};
|
30028669e2e24b98941160e98e100fcb1b49a1e6
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/fs/xfs/xfs_extent_busy.c
|
85e9f87a1a7ce7945da58e305a21818262542cfa
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 15,688
|
c
|
xfs_extent_busy.c
|
/*
* Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
* Copyright (c) 2010 David Chinner.
* Copyright (c) 2011 Christoph Hellwig.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "xfs.h"
#include "xfs_fs.h"
#include "xfs_types.h"
#include "xfs_log.h"
#include "xfs_trans.h"
#include "xfs_sb.h"
#include "xfs_ag.h"
#include "xfs_mount.h"
#include "xfs_bmap_btree.h"
#include "xfs_alloc.h"
#include "xfs_inode.h"
#include "xfs_extent_busy.h"
#include "xfs_trace.h"
void
xfs_extent_busy_insert(
struct xfs_trans *tp,
xfs_agnumber_t agno,
xfs_agblock_t bno,
xfs_extlen_t len,
unsigned int flags)
{
struct xfs_extent_busy *new;
struct xfs_extent_busy *busyp;
struct xfs_perag *pag;
struct rb_node **rbp;
struct rb_node *parent = NULL;
new = kmem_zalloc(sizeof(struct xfs_extent_busy), KM_MAYFAIL);
if (!new) {
/*
* No Memory! Since it is now not possible to track the free
* block, make this a synchronous transaction to insure that
* the block is not reused before this transaction commits.
*/
trace_xfs_extent_busy_enomem(tp->t_mountp, agno, bno, len);
xfs_trans_set_sync(tp);
return;
}
new->agno = agno;
new->bno = bno;
new->length = len;
INIT_LIST_HEAD(&new->list);
new->flags = flags;
/* trace before insert to be able to see failed inserts */
trace_xfs_extent_busy(tp->t_mountp, agno, bno, len);
pag = xfs_perag_get(tp->t_mountp, new->agno);
spin_lock(&pag->pagb_lock);
rbp = &pag->pagb_tree.rb_node;
while (*rbp) {
parent = *rbp;
busyp = rb_entry(parent, struct xfs_extent_busy, rb_node);
if (new->bno < busyp->bno) {
rbp = &(*rbp)->rb_left;
ASSERT(new->bno + new->length <= busyp->bno);
} else if (new->bno > busyp->bno) {
rbp = &(*rbp)->rb_right;
ASSERT(bno >= busyp->bno + busyp->length);
} else {
ASSERT(0);
}
}
rb_link_node(&new->rb_node, parent, rbp);
rb_insert_color(&new->rb_node, &pag->pagb_tree);
list_add(&new->list, &tp->t_busy);
spin_unlock(&pag->pagb_lock);
xfs_perag_put(pag);
}
/*
* Search for a busy extent within the range of the extent we are about to
* allocate. You need to be holding the busy extent tree lock when calling
* xfs_extent_busy_search(). This function returns 0 for no overlapping busy
* extent, -1 for an overlapping but not exact busy extent, and 1 for an exact
* match. This is done so that a non-zero return indicates an overlap that
* will require a synchronous transaction, but it can still be
* used to distinguish between a partial or exact match.
*/
int
xfs_extent_busy_search(
struct xfs_mount *mp,
xfs_agnumber_t agno,
xfs_agblock_t bno,
xfs_extlen_t len)
{
struct xfs_perag *pag;
struct rb_node *rbp;
struct xfs_extent_busy *busyp;
int match = 0;
pag = xfs_perag_get(mp, agno);
spin_lock(&pag->pagb_lock);
rbp = pag->pagb_tree.rb_node;
/* find closest start bno overlap */
while (rbp) {
busyp = rb_entry(rbp, struct xfs_extent_busy, rb_node);
if (bno < busyp->bno) {
/* may overlap, but exact start block is lower */
if (bno + len > busyp->bno)
match = -1;
rbp = rbp->rb_left;
} else if (bno > busyp->bno) {
/* may overlap, but exact start block is higher */
if (bno < busyp->bno + busyp->length)
match = -1;
rbp = rbp->rb_right;
} else {
/* bno matches busyp, length determines exact match */
match = (busyp->length == len) ? 1 : -1;
break;
}
}
spin_unlock(&pag->pagb_lock);
xfs_perag_put(pag);
return match;
}
/*
* The found free extent [fbno, fend] overlaps part or all of the given busy
* extent. If the overlap covers the beginning, the end, or all of the busy
* extent, the overlapping portion can be made unbusy and used for the
* allocation. We can't split a busy extent because we can't modify a
* transaction/CIL context busy list, but we can update an entries block
* number or length.
*
* Returns true if the extent can safely be reused, or false if the search
* needs to be restarted.
*/
STATIC bool
xfs_extent_busy_update_extent(
struct xfs_mount *mp,
struct xfs_perag *pag,
struct xfs_extent_busy *busyp,
xfs_agblock_t fbno,
xfs_extlen_t flen,
bool userdata)
{
xfs_agblock_t fend = fbno + flen;
xfs_agblock_t bbno = busyp->bno;
xfs_agblock_t bend = bbno + busyp->length;
/*
* This extent is currently being discarded. Give the thread
* performing the discard a chance to mark the extent unbusy
* and retry.
*/
if (busyp->flags & XFS_EXTENT_BUSY_DISCARDED) {
spin_unlock(&pag->pagb_lock);
delay(1);
spin_lock(&pag->pagb_lock);
return false;
}
/*
* If there is a busy extent overlapping a user allocation, we have
* no choice but to force the log and retry the search.
*
* Fortunately this does not happen during normal operation, but
* only if the filesystem is very low on space and has to dip into
* the AGFL for normal allocations.
*/
if (userdata)
goto out_force_log;
if (bbno < fbno && bend > fend) {
/*
* Case 1:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +---------+
* fbno fend
*/
/*
* We would have to split the busy extent to be able to track
* it correct, which we cannot do because we would have to
* modify the list of busy extents attached to the transaction
* or CIL context, which is immutable.
*
* Force out the log to clear the busy extent and retry the
* search.
*/
goto out_force_log;
} else if (bbno >= fbno && bend <= fend) {
/*
* Case 2:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-----------------+
* fbno fend
*
* Case 3:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +--------------------------+
* fbno fend
*
* Case 4:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +--------------------------+
* fbno fend
*
* Case 5:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-----------------------------------+
* fbno fend
*
*/
/*
* The busy extent is fully covered by the extent we are
* allocating, and can simply be removed from the rbtree.
* However we cannot remove it from the immutable list
* tracking busy extents in the transaction or CIL context,
* so set the length to zero to mark it invalid.
*
* We also need to restart the busy extent search from the
* tree root, because erasing the node can rearrange the
* tree topology.
*/
rb_erase(&busyp->rb_node, &pag->pagb_tree);
busyp->length = 0;
return false;
} else if (fend < bend) {
/*
* Case 6:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +---------+
* fbno fend
*
* Case 7:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +------------------+
* fbno fend
*
*/
busyp->bno = fend;
} else if (bbno < fbno) {
/*
* Case 8:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-------------+
* fbno fend
*
* Case 9:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +----------------------+
* fbno fend
*/
busyp->length = fbno - busyp->bno;
} else {
ASSERT(0);
}
trace_xfs_extent_busy_reuse(mp, pag->pag_agno, fbno, flen);
return true;
out_force_log:
spin_unlock(&pag->pagb_lock);
xfs_log_force(mp, XFS_LOG_SYNC);
trace_xfs_extent_busy_force(mp, pag->pag_agno, fbno, flen);
spin_lock(&pag->pagb_lock);
return false;
}
/*
* For a given extent [fbno, flen], make sure we can reuse it safely.
*/
void
xfs_extent_busy_reuse(
struct xfs_mount *mp,
xfs_agnumber_t agno,
xfs_agblock_t fbno,
xfs_extlen_t flen,
bool userdata)
{
struct xfs_perag *pag;
struct rb_node *rbp;
ASSERT(flen > 0);
pag = xfs_perag_get(mp, agno);
spin_lock(&pag->pagb_lock);
restart:
rbp = pag->pagb_tree.rb_node;
while (rbp) {
struct xfs_extent_busy *busyp =
rb_entry(rbp, struct xfs_extent_busy, rb_node);
xfs_agblock_t bbno = busyp->bno;
xfs_agblock_t bend = bbno + busyp->length;
if (fbno + flen <= bbno) {
rbp = rbp->rb_left;
continue;
} else if (fbno >= bend) {
rbp = rbp->rb_right;
continue;
}
if (!xfs_extent_busy_update_extent(mp, pag, busyp, fbno, flen,
userdata))
goto restart;
}
spin_unlock(&pag->pagb_lock);
xfs_perag_put(pag);
}
/*
* For a given extent [fbno, flen], search the busy extent list to find a
* subset of the extent that is not busy. If *rlen is smaller than
* args->minlen no suitable extent could be found, and the higher level
* code needs to force out the log and retry the allocation.
*/
void
xfs_extent_busy_trim(
struct xfs_alloc_arg *args,
xfs_agblock_t bno,
xfs_extlen_t len,
xfs_agblock_t *rbno,
xfs_extlen_t *rlen)
{
xfs_agblock_t fbno;
xfs_extlen_t flen;
struct rb_node *rbp;
ASSERT(len > 0);
spin_lock(&args->pag->pagb_lock);
restart:
fbno = bno;
flen = len;
rbp = args->pag->pagb_tree.rb_node;
while (rbp && flen >= args->minlen) {
struct xfs_extent_busy *busyp =
rb_entry(rbp, struct xfs_extent_busy, rb_node);
xfs_agblock_t fend = fbno + flen;
xfs_agblock_t bbno = busyp->bno;
xfs_agblock_t bend = bbno + busyp->length;
if (fend <= bbno) {
rbp = rbp->rb_left;
continue;
} else if (fbno >= bend) {
rbp = rbp->rb_right;
continue;
}
/*
* If this is a metadata allocation, try to reuse the busy
* extent instead of trimming the allocation.
*/
if (!args->userdata &&
!(busyp->flags & XFS_EXTENT_BUSY_DISCARDED)) {
if (!xfs_extent_busy_update_extent(args->mp, args->pag,
busyp, fbno, flen,
false))
goto restart;
continue;
}
if (bbno <= fbno) {
/* start overlap */
/*
* Case 1:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +---------+
* fbno fend
*
* Case 2:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-------------+
* fbno fend
*
* Case 3:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-------------+
* fbno fend
*
* Case 4:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-----------------+
* fbno fend
*
* No unbusy region in extent, return failure.
*/
if (fend <= bend)
goto fail;
/*
* Case 5:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +----------------------+
* fbno fend
*
* Case 6:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +--------------------------+
* fbno fend
*
* Needs to be trimmed to:
* +-------+
* fbno fend
*/
fbno = bend;
} else if (bend >= fend) {
/* end overlap */
/*
* Case 7:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +------------------+
* fbno fend
*
* Case 8:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +--------------------------+
* fbno fend
*
* Needs to be trimmed to:
* +-------+
* fbno fend
*/
fend = bbno;
} else {
/* middle overlap */
/*
* Case 9:
* bbno bend
* +BBBBBBBBBBBBBBBBB+
* +-----------------------------------+
* fbno fend
*
* Can be trimmed to:
* +-------+ OR +-------+
* fbno fend fbno fend
*
* Backward allocation leads to significant
* fragmentation of directories, which degrades
* directory performance, therefore we always want to
* choose the option that produces forward allocation
* patterns.
* Preferring the lower bno extent will make the next
* request use "fend" as the start of the next
* allocation; if the segment is no longer busy at
* that point, we'll get a contiguous allocation, but
* even if it is still busy, we will get a forward
* allocation.
* We try to avoid choosing the segment at "bend",
* because that can lead to the next allocation
* taking the segment at "fbno", which would be a
* backward allocation. We only use the segment at
* "fbno" if it is much larger than the current
* requested size, because in that case there's a
* good chance subsequent allocations will be
* contiguous.
*/
if (bbno - fbno >= args->maxlen) {
/* left candidate fits perfect */
fend = bbno;
} else if (fend - bend >= args->maxlen * 4) {
/* right candidate has enough free space */
fbno = bend;
} else if (bbno - fbno >= args->minlen) {
/* left candidate fits minimum requirement */
fend = bbno;
} else {
goto fail;
}
}
flen = fend - fbno;
}
spin_unlock(&args->pag->pagb_lock);
if (fbno != bno || flen != len) {
trace_xfs_extent_busy_trim(args->mp, args->agno, bno, len,
fbno, flen);
}
*rbno = fbno;
*rlen = flen;
return;
fail:
/*
* Return a zero extent length as failure indications. All callers
* re-check if the trimmed extent satisfies the minlen requirement.
*/
spin_unlock(&args->pag->pagb_lock);
trace_xfs_extent_busy_trim(args->mp, args->agno, bno, len, fbno, 0);
*rbno = fbno;
*rlen = 0;
}
STATIC void
xfs_extent_busy_clear_one(
struct xfs_mount *mp,
struct xfs_perag *pag,
struct xfs_extent_busy *busyp)
{
if (busyp->length) {
trace_xfs_extent_busy_clear(mp, busyp->agno, busyp->bno,
busyp->length);
rb_erase(&busyp->rb_node, &pag->pagb_tree);
}
list_del_init(&busyp->list);
kmem_free(busyp);
}
/*
* Remove all extents on the passed in list from the busy extents tree.
* If do_discard is set skip extents that need to be discarded, and mark
* these as undergoing a discard operation instead.
*/
void
xfs_extent_busy_clear(
struct xfs_mount *mp,
struct list_head *list,
bool do_discard)
{
struct xfs_extent_busy *busyp, *n;
struct xfs_perag *pag = NULL;
xfs_agnumber_t agno = NULLAGNUMBER;
list_for_each_entry_safe(busyp, n, list, list) {
if (busyp->agno != agno) {
if (pag) {
spin_unlock(&pag->pagb_lock);
xfs_perag_put(pag);
}
pag = xfs_perag_get(mp, busyp->agno);
spin_lock(&pag->pagb_lock);
agno = busyp->agno;
}
if (do_discard && busyp->length &&
!(busyp->flags & XFS_EXTENT_BUSY_SKIP_DISCARD))
busyp->flags = XFS_EXTENT_BUSY_DISCARDED;
else
xfs_extent_busy_clear_one(mp, pag, busyp);
}
if (pag) {
spin_unlock(&pag->pagb_lock);
xfs_perag_put(pag);
}
}
/*
* Callback for list_sort to sort busy extents by the AG they reside in.
*/
int
xfs_extent_busy_ag_cmp(
void *priv,
struct list_head *a,
struct list_head *b)
{
return container_of(a, struct xfs_extent_busy, list)->agno -
container_of(b, struct xfs_extent_busy, list)->agno;
}
|
f55bef4db0b8ec79f2877b9a92c0546790cd55eb
|
de22e1e826e75096c32fd4685b377e2e750f94c8
|
/tests/slicing/sources/test7.c
|
58f7095174ab4153946437d2ca22b2708a4751a0
|
[
"MIT"
] |
permissive
|
mchalupa/dg
|
bb1430ebe5c9957d5f1b1278567674bdc03546ce
|
df6e4e23d2a0740ec9d9fa38e80032bd80556c95
|
refs/heads/master
| 2023-09-05T02:57:01.261394
| 2022-06-29T12:53:04
| 2022-12-19T10:12:03
| 31,018,102
| 458
| 146
|
MIT
| 2023-05-02T12:43:24
| 2015-02-19T14:12:47
|
C++
|
UTF-8
|
C
| false
| false
| 235
|
c
|
test7.c
|
void set(int **y, int *x) { *y = x; }
int main(void) {
int a = 1, b = 2, *p;
if (a > b) {
set(&p, &b);
*p = 3;
} else {
set(&p, &a);
*p = 4;
}
test_assert(a == 4);
return 0;
}
|
a2c6e9903cd41c69eec7c29ec039fd7b63fa1a69
|
58fe7cb3949dd1930e709696659a0296500b64a6
|
/tests/testlib/s2n_ktls_test_utils.c
|
08c1a060d41321469a063fd1e84e583ae91139e3
|
[
"Apache-2.0",
"MIT"
] |
permissive
|
aws/s2n-tls
|
3344638a6a69c6f20665cf6847e1bc4b85f2e558
|
62dc7a6d4876e5eee0dea3690d528a4c7080a1d5
|
refs/heads/main
| 2023-08-31T23:26:33.780048
| 2023-08-31T05:17:33
| 2023-08-31T05:17:33
| 21,287,076
| 513
| 213
|
Apache-2.0
| 2023-09-13T23:52:29
| 2014-06-27T19:37:59
|
C
|
UTF-8
|
C
| false
| false
| 9,719
|
c
|
s2n_ktls_test_utils.c
|
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
#include "testlib/s2n_ktls_test_utils.h"
S2N_RESULT s2n_ktls_set_control_data(struct msghdr *msg, char *buf, size_t buf_size,
int cmsg_type, uint8_t record_type);
S2N_RESULT s2n_ktls_get_control_data(struct msghdr *msg, int cmsg_type, uint8_t *record_type);
/* Since it is possible to read partial data, we need a way to update the length
* of the previous record for the mock stuffer IO implementation. */
static S2N_RESULT s2n_test_ktls_update_prev_header_len(struct s2n_test_ktls_io_stuffer *io_ctx,
uint16_t remaining_len)
{
RESULT_ENSURE_REF(io_ctx);
RESULT_ENSURE(remaining_len > 0, S2N_ERR_IO);
/* rewind so we can read the last header with the updated len */
RESULT_GUARD_POSIX(s2n_stuffer_rewind_read(&io_ctx->ancillary_buffer, S2N_TEST_KTLS_MOCK_HEADER_SIZE));
/* get position for the last header's length */
uint32_t rewrite_len_ptr = io_ctx->ancillary_buffer.read_cursor + S2N_TEST_KTLS_MOCK_HEADER_TAG_SIZE;
/* create a new stuffer pointing to len data and rewrite it */
struct s2n_stuffer rewrite_len_stuffer = io_ctx->ancillary_buffer;
RESULT_GUARD_POSIX(s2n_stuffer_rewrite(&rewrite_len_stuffer));
RESULT_GUARD_POSIX(s2n_stuffer_skip_write(&rewrite_len_stuffer, rewrite_len_ptr));
RESULT_GUARD_POSIX(s2n_stuffer_write_uint16(&rewrite_len_stuffer, remaining_len));
return S2N_RESULT_OK;
}
ssize_t s2n_test_ktls_sendmsg_io_stuffer(void *io_context, const struct msghdr *msg)
{
errno = EINVAL;
POSIX_ENSURE_REF(msg);
struct s2n_test_ktls_io_stuffer *io_ctx = (struct s2n_test_ktls_io_stuffer *) io_context;
POSIX_ENSURE_REF(io_ctx);
struct s2n_stuffer *data_buffer = &io_ctx->data_buffer;
io_ctx->sendmsg_invoked_count++;
uint8_t record_type = 0;
struct msghdr msg_to_parse = *msg;
POSIX_GUARD_RESULT(s2n_ktls_get_control_data(&msg_to_parse, S2N_TLS_SET_RECORD_TYPE, &record_type));
size_t total_len = 0;
for (size_t count = 0; count < msg->msg_iovlen; count++) {
POSIX_ENSURE_REF(msg->msg_iov);
uint8_t *buf = msg->msg_iov[count].iov_base;
size_t len = msg->msg_iov[count].iov_len;
if (s2n_stuffer_write_bytes(data_buffer, buf, len) != S2N_SUCCESS) {
size_t partial_len = MIN(len, s2n_stuffer_space_remaining(data_buffer));
POSIX_GUARD(s2n_stuffer_write_bytes(data_buffer, buf, partial_len));
total_len += partial_len;
if (total_len) {
break;
}
errno = EAGAIN;
return -1;
}
total_len += len;
}
if (total_len) {
/* write record_type and len after some data was written successfully */
POSIX_GUARD(s2n_stuffer_write_uint8(&io_ctx->ancillary_buffer, record_type));
POSIX_GUARD(s2n_stuffer_write_uint16(&io_ctx->ancillary_buffer, total_len));
}
return total_len;
}
/* In userspace TLS, s2n first reads the header to determine the length of next record
* and then reads the entire record into conn->in. In kTLS it is not possible to know
* the length of the next record. Instead the socket returns the minimum of
* bytes-requested and data-available, reading multiple consecutive records if they
* are of the same type. */
ssize_t s2n_test_ktls_recvmsg_io_stuffer(void *io_context, struct msghdr *msg)
{
errno = EINVAL;
POSIX_ENSURE_REF(msg);
POSIX_ENSURE_REF(msg->msg_iov);
struct s2n_test_ktls_io_stuffer *io_ctx = (struct s2n_test_ktls_io_stuffer *) io_context;
POSIX_ENSURE_REF(io_ctx);
io_ctx->recvmsg_invoked_count++;
uint8_t *buf = msg->msg_iov->iov_base;
POSIX_ENSURE_REF(buf);
/* There is no data available so return blocked */
if (!s2n_stuffer_data_available(&io_ctx->ancillary_buffer)) {
errno = EAGAIN;
return -1;
}
/* s2n only receives using msg_iovlen of 1 */
POSIX_ENSURE_EQ(msg->msg_iovlen, 1);
size_t size = msg->msg_iov->iov_len;
uint8_t record_type = 0;
POSIX_GUARD(s2n_stuffer_read_uint8(&io_ctx->ancillary_buffer, &record_type));
POSIX_GUARD_RESULT(s2n_ktls_set_control_data(msg, msg->msg_control, msg->msg_controllen,
S2N_TLS_GET_RECORD_TYPE, record_type));
ssize_t bytes_read = 0;
while (bytes_read < size) {
uint16_t n_avail = 0;
POSIX_GUARD(s2n_stuffer_read_uint16(&io_ctx->ancillary_buffer, &n_avail));
size_t n_read = MIN(size - bytes_read, n_avail);
POSIX_ENSURE_GT(n_read, 0);
POSIX_GUARD(s2n_stuffer_read_bytes(&io_ctx->data_buffer, buf + bytes_read, n_read));
bytes_read += n_read;
/* handle partially read records */
ssize_t remaining_len = n_avail - n_read;
if (remaining_len) {
POSIX_GUARD_RESULT(s2n_test_ktls_update_prev_header_len(io_ctx, remaining_len));
break;
}
/* attempt to read multiple records (must be of the same type) */
uint8_t next_record_type = 0;
int ret = s2n_stuffer_peek_char(&io_ctx->ancillary_buffer, (char *) &next_record_type);
bool no_more_records = ret != S2N_SUCCESS;
if (no_more_records) {
break;
}
bool next_record_different_type = next_record_type != record_type;
if (next_record_different_type) {
break;
}
POSIX_GUARD(s2n_stuffer_skip_read(&io_ctx->ancillary_buffer, sizeof(record_type)));
}
return bytes_read;
}
S2N_RESULT s2n_test_init_ktls_io_stuffer_send(struct s2n_connection *conn,
struct s2n_test_ktls_io_stuffer *io)
{
RESULT_ENSURE_REF(conn);
RESULT_ENSURE_REF(io);
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io->data_buffer, 0));
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io->ancillary_buffer, 0));
RESULT_GUARD(s2n_ktls_set_sendmsg_cb(conn, s2n_test_ktls_sendmsg_io_stuffer, io));
return S2N_RESULT_OK;
}
S2N_RESULT s2n_test_init_ktls_io_stuffer(struct s2n_connection *server,
struct s2n_connection *client, struct s2n_test_ktls_io_stuffer_pair *io_pair)
{
RESULT_ENSURE_REF(server);
RESULT_ENSURE_REF(client);
RESULT_ENSURE_REF(io_pair);
/* setup stuffer IO */
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io_pair->server_in.data_buffer, 0));
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io_pair->server_in.ancillary_buffer, 0));
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io_pair->client_in.data_buffer, 0));
RESULT_GUARD_POSIX(s2n_stuffer_growable_alloc(&io_pair->client_in.ancillary_buffer, 0));
RESULT_GUARD(s2n_ktls_set_sendmsg_cb(server, s2n_test_ktls_sendmsg_io_stuffer, &io_pair->client_in));
RESULT_GUARD(s2n_ktls_set_recvmsg_cb(server, s2n_test_ktls_recvmsg_io_stuffer, &io_pair->server_in));
RESULT_GUARD(s2n_ktls_set_sendmsg_cb(client, s2n_test_ktls_sendmsg_io_stuffer, &io_pair->server_in));
RESULT_GUARD(s2n_ktls_set_recvmsg_cb(client, s2n_test_ktls_recvmsg_io_stuffer, &io_pair->client_in));
return S2N_RESULT_OK;
}
S2N_CLEANUP_RESULT s2n_ktls_io_stuffer_free(struct s2n_test_ktls_io_stuffer *io)
{
RESULT_ENSURE_REF(io);
RESULT_GUARD_POSIX(s2n_stuffer_free(&io->data_buffer));
RESULT_GUARD_POSIX(s2n_stuffer_free(&io->ancillary_buffer));
return S2N_RESULT_OK;
}
S2N_CLEANUP_RESULT s2n_ktls_io_stuffer_pair_free(struct s2n_test_ktls_io_stuffer_pair *pair)
{
RESULT_ENSURE_REF(pair);
RESULT_GUARD(s2n_ktls_io_stuffer_free(&pair->client_in));
RESULT_GUARD(s2n_ktls_io_stuffer_free(&pair->server_in));
return S2N_RESULT_OK;
}
S2N_RESULT s2n_test_validate_data(struct s2n_test_ktls_io_stuffer *ktls_io, uint8_t *expected_data,
uint16_t expected_len)
{
RESULT_ENSURE_REF(ktls_io);
RESULT_ENSURE_REF(expected_data);
struct s2n_stuffer validate_data_stuffer = ktls_io->data_buffer;
RESULT_ENSURE_EQ(s2n_stuffer_data_available(&validate_data_stuffer), expected_len);
uint8_t *data_ptr = s2n_stuffer_raw_read(&validate_data_stuffer, expected_len);
RESULT_ENSURE_REF(data_ptr);
RESULT_ENSURE_EQ(memcmp(data_ptr, expected_data, expected_len), 0);
return S2N_RESULT_OK;
}
S2N_RESULT s2n_test_validate_ancillary(struct s2n_test_ktls_io_stuffer *ktls_io,
uint8_t expected_record_type, uint16_t expected_len)
{
RESULT_ENSURE_REF(ktls_io);
struct s2n_stuffer validate_ancillary_stuffer = ktls_io->ancillary_buffer;
uint8_t tag = 0;
RESULT_GUARD_POSIX(s2n_stuffer_read_uint8(&validate_ancillary_stuffer, &tag));
RESULT_ENSURE_EQ(tag, expected_record_type);
uint16_t len = 0;
RESULT_GUARD_POSIX(s2n_stuffer_read_uint16(&validate_ancillary_stuffer, &len));
RESULT_ENSURE_EQ(len, expected_len);
return S2N_RESULT_OK;
}
S2N_RESULT s2n_test_records_in_ancillary(struct s2n_test_ktls_io_stuffer *ktls_io,
uint16_t expected_records)
{
RESULT_ENSURE_REF(ktls_io);
size_t size = s2n_stuffer_data_available(&ktls_io->ancillary_buffer);
size_t records = size / S2N_TEST_KTLS_MOCK_HEADER_SIZE;
size_t extra = size % S2N_TEST_KTLS_MOCK_HEADER_SIZE;
RESULT_ENSURE_EQ(records, expected_records);
RESULT_ENSURE_EQ(extra, 0);
return S2N_RESULT_OK;
}
|
ee0a1487117643e0d1664528b6c71c6254e08b02
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/databases/openldap/patches/patch-libraries_libldap_ldap-int.h
|
d681aad8b9df76d24407fe8375b46a297b57361d
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 495
|
h
|
patch-libraries_libldap_ldap-int.h
|
$NetBSD: patch-libraries_libldap_ldap-int.h,v 1.1 2021/08/23 09:58:58 adam Exp $
--- libraries/libldap/ldap-int.h.orig 2021-07-27 17:44:47.000000000 +0000
+++ libraries/libldap/ldap-int.h
@@ -866,7 +866,7 @@ LDAP_F (int) ldap_int_sasl_close LDAP_P(
LDAP_F (int) ldap_int_sasl_external LDAP_P((
LDAP *ld, LDAPConn *conn,
- const char* authid, ber_len_t ssf ));
+ const char* authid, ber_uint_t ssf ));
LDAP_F (int) ldap_int_sasl_get_option LDAP_P(( LDAP *ld,
int option, void *arg ));
|
00a6322010e8d7f4139c6179390005b1a1217e12
|
1598858ecbcaa8a03feec79f2cbb39e0bb9add3f
|
/Silicon/MeteorlakePkg/Include/AcpiDebug.h
|
583861398013c538f2f803fcb1f6b5ca9681d459
|
[
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause-Patent"
] |
permissive
|
slimbootloader/slimbootloader
|
def5dc5a4743d74d7349d79710b758c476e33cc6
|
ec5c39e35a3ab798c6509652869d2e951ede7b61
|
refs/heads/master
| 2023-08-25T08:53:17.422999
| 2023-08-23T12:18:51
| 2023-08-24T16:52:21
| 148,708,107
| 379
| 196
|
NOASSERTION
| 2023-09-14T05:49:16
| 2018-09-13T23:07:33
|
C
|
UTF-8
|
C
| false
| false
| 438
|
h
|
AcpiDebug.h
|
/** @file
Header file for ACPI ADBG enable/disable.
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef _ACPI_DEBUG_H_
#define _ACPI_DEBUG_H_
#define ADBG(x) //remove all ADBG and ASRT references
#define ASRT(x, y)
#define ACPI_DEBUG_EXTERNAL_REFERENCE //remove all external references for ADBG and ASRT
#define ACPI_ASSERT_EXTERNAL_REFERENCE
#endif
|
f75577c017c50547cfd8e68d26dc4644fb89882d
|
07327b5e8b2831b12352bf7c6426bfda60129da7
|
/Debuggers/x64/sdk/samples/simplext/simple.c
|
2167007a2d5e8d15e0d10fb78e123220b0b435c6
|
[] |
no_license
|
tpn/winsdk-10
|
ca279df0fce03f92036e90fb04196d6282a264b7
|
9b69fd26ac0c7d0b83d378dba01080e93349c2ed
|
refs/heads/master
| 2021-01-10T01:56:18.586459
| 2018-02-19T21:26:31
| 2018-02-19T21:29:50
| 44,352,845
| 218
| 432
| null | null | null | null |
UTF-8
|
C
| false
| false
| 1,430
|
c
|
simple.c
|
/*++
Copyright (c) 2000 Microsoft Corporation
Module Name:
simple.c
--*/
#include "simple.h"
#include <ntverp.h>
//
// globals
//
EXT_API_VERSION ApiVersion = { 1, 0, EXT_API_VERSION_NUMBER64, 0 };
WINDBG_EXTENSION_APIS ExtensionApis;
ULONG SavedMajorVersion;
ULONG SavedMinorVersion;
DllInit(
HANDLE hModule,
DWORD dwReason,
DWORD dwReserved
)
{
switch (dwReason) {
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_PROCESS_ATTACH:
break;
}
return TRUE;
}
VOID
WinDbgExtensionDllInit(
PWINDBG_EXTENSION_APIS lpExtensionApis,
USHORT MajorVersion,
USHORT MinorVersion
)
{
ExtensionApis = *lpExtensionApis;
SavedMajorVersion = MajorVersion;
SavedMinorVersion = MinorVersion;
return;
}
LPEXT_API_VERSION
ExtensionApiVersion(
VOID
)
{
//
// ExtensionApiVersion should return EXT_API_VERSION_NUMBER64 in order for APIs
// to recognize 64 bit addresses. KDEXT_64BIT also has to be defined before including
// wdbgexts.h to get 64 bit headers for WINDBG_EXTENSION_APIS
//
return &ApiVersion;
}
//
// Routine called by debugger after load
//
VOID
CheckVersion(
VOID
)
{
return;
}
|
e72f86f25c946deeb6ca1246f755bb7d3dc7ba3a
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/src/net/l4/udp.c
|
bb0505836a969972a3ed21b7a0d9041063ff0c00
|
[
"BSD-2-Clause"
] |
permissive
|
embox/embox
|
d6aacec876978522f01cdc4b8de37a668c6f4c80
|
98e3c06e33f3fdac10a29c069c20775568e0a6d1
|
refs/heads/master
| 2023-09-04T03:02:20.165042
| 2023-09-02T14:55:31
| 2023-09-02T14:55:31
| 33,078,138
| 1,087
| 325
|
BSD-2-Clause
| 2023-09-14T16:58:34
| 2015-03-29T15:27:48
|
C
|
UTF-8
|
C
| false
| false
| 4,576
|
c
|
udp.c
|
/**
* @file
* @brief The User Datagram Protocol (UDP).
* @details RFC 768
*
* @date 26.03.09
* @author Nikolay Korotky
* @author Ilia Vaprol
*/
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
#include <arpa/inet.h>
#include <embox/net/proto.h>
#include <net/l3/ipv4/ip.h>
#include <net/l3/ipv6.h>
#include <net/l4/udp.h>
#include <net/lib/udp.h>
#include <net/l3/icmpv4.h>
#include <net/l2/ethernet.h>
#include <net/socket/inet_sock.h>
#include <net/netdevice.h>
#include <framework/mod/options.h>
#include <net/lib/ipv4.h>
#include <net/lib/ipv6.h>
#define MODOPS_VERIFY_CHKSUM OPTION_GET(BOOLEAN, verify_chksum)
EMBOX_NET_PROTO(ETH_P_IP, IPPROTO_UDP, udp_rcv, udp_err);
EMBOX_NET_PROTO(ETH_P_IPV6, IPPROTO_UDP, udp_rcv,
net_proto_handle_error_none);
static int udp4_rcv_tester(const struct sock *sk,
const struct sk_buff *skb) {
assert(sk != NULL);
#if defined(NET_NAMESPACE_ENABLED) && (NET_NAMESPACE_ENABLED == 1)
if (!cmp_net_ns(sk->net_ns, skb->dev->net_ns))
return 0;
#endif
return (sk->opt.so_domain == AF_INET)
&& ip_tester_dst_or_any(sk, skb)
&& (sock_inet_get_src_port(sk) == udp_hdr(skb)->dest);
}
static int udp6_rcv_tester(const struct sock *sk,
const struct sk_buff *skb) {
assert(sk != NULL);
return (sk->opt.so_domain == AF_INET6)
&& ip6_tester_dst_or_any(sk, skb)
&& (sock_inet_get_src_port(sk) == udp_hdr(skb)->dest);
}
static int udp4_accept_dst(const struct sock *sk,
const struct sk_buff *skb) {
assert(sk != NULL);
return (sk->opt.so_domain == AF_INET)
&& ip_tester_src_or_any(sk, skb)
&& ((sock_inet_get_dst_port(sk)
== udp_hdr(skb)->source)
|| (sock_inet_get_dst_port(sk) == 0))
&& ((sk->opt.so_bindtodevice == skb->dev)
|| (sk->opt.so_bindtodevice == NULL));
}
static int udp6_accept_dst(const struct sock *sk,
const struct sk_buff *skb) {
assert(sk != NULL);
return (sk->opt.so_domain == AF_INET6)
&& ip6_tester_src_or_any(sk, skb)
&& ((sock_inet_get_dst_port(sk)
== udp_hdr(skb)->source)
|| (sock_inet_get_dst_port(sk) == 0))
&& ((sk->opt.so_bindtodevice == skb->dev)
|| (sk->opt.so_bindtodevice == NULL));
}
static int udp_rcv(struct sk_buff *skb) {
struct sock *sk;
assert(skb != NULL);
assert(ip_check_version(ip_hdr(skb))
|| ip6_check_version(ip6_hdr(skb)));
/* Check CRC */
if (MODOPS_VERIFY_CHKSUM) {
uint16_t old_check;
old_check = skb->h.uh->check;
udp_set_check_field(skb->h.uh, skb->nh.raw);
if (old_check != skb->h.uh->check) {
return 0; /* error: bad checksum */
}
}
sk = sock_lookup(NULL, udp_sock_ops,
ip_check_version(ip_hdr(skb))
? udp4_rcv_tester : udp6_rcv_tester,
skb);
if (sk != NULL) {
if (ip_check_version(ip_hdr(skb))
? udp4_accept_dst(sk, skb)
: udp6_accept_dst(sk, skb)) {
sock_rcv(sk, skb, skb->h.raw + UDP_HEADER_SIZE,
udp_data_length(udp_hdr(skb)));
}
else {
skb_free(skb);
}
}
else {
icmp_discard(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH);
}
return 0;
}
static int udp_err_tester(const struct sock *sk,
const struct sk_buff *skb) {
const struct inet_sock *in_sk;
const struct iphdr *emb_pack_iphdr;
const struct udphdr *emb_pack_udphdr;
struct icmphdr *icmph;
struct icmpbody_dest_unreach *dest_unreach;
in_sk = (const struct inet_sock *)sk;
assert(in_sk != NULL);
assert(in_sk->src_in.sin_family == AF_INET);
assert(in_sk->dst_in.sin_family == AF_INET);
assert(skb != NULL);
icmph = icmp_hdr(skb);
dest_unreach = &(icmph->body.dest_unreach);
emb_pack_iphdr = (iphdr_t *)(dest_unreach->msg);
emb_pack_udphdr = (udphdr_t *)((unsigned char *)emb_pack_iphdr + IP_HEADER_SIZE(emb_pack_iphdr));
return (((in_sk->src_in.sin_addr.s_addr == skb->nh.iph->daddr)
&& (in_sk->src_in.sin_addr.s_addr == emb_pack_iphdr->saddr))
|| (in_sk->src_in.sin_addr.s_addr == INADDR_ANY))
&& (in_sk->src_in.sin_port == emb_pack_udphdr->source)
&& (((in_sk->dst_in.sin_addr.s_addr == skb->nh.iph->saddr)
&& (in_sk->dst_in.sin_addr.s_addr == emb_pack_iphdr->daddr))
|| (in_sk->dst_in.sin_addr.s_addr == INADDR_ANY))
&& ((in_sk->dst_in.sin_port == emb_pack_udphdr->dest)
|| (in_sk->dst_in.sin_port == 0))
&& (in_sk->sk.opt.so_protocol == emb_pack_iphdr->proto)
&& ((in_sk->sk.opt.so_bindtodevice == skb->dev)
|| (in_sk->sk.opt.so_bindtodevice == NULL));
}
static void udp_err(const struct sk_buff *skb, int error_info) {
struct sock *sk;
sk = NULL;
while (1) {
sk = sock_lookup(sk, udp_sock_ops, udp_err_tester, skb);
if (sk == NULL) {
break;
}
sock_set_so_error(sk, error_info);
}
}
|
a5ac158271713465684bda059e405c7ed12c8485
|
abbd5e415b921ae0acf1d36912878f698ad93caf
|
/meka/srcs/areplay.h
|
975b4e838d768e09c9148fcafef3676a724d94be
|
[] |
no_license
|
ocornut/meka
|
c82cec459a4d2baf6d20ceaa079e7ba5ee1dc89e
|
88c2965632d81567faeb306bdf3891aa310f6276
|
refs/heads/master
| 2023-09-04T16:35:54.800980
| 2023-08-27T17:21:09
| 2023-08-27T17:24:27
| 31,816,255
| 294
| 61
| null | 2023-08-27T17:18:44
| 2015-03-07T15:29:40
|
C++
|
UTF-8
|
C
| false
| false
| 309
|
h
|
areplay.h
|
//-----------------------------------------------------------------------------
// MEKA - areplay.h
// Action Replay Emulation - Headers
//-----------------------------------------------------------------------------
// ...
//-----------------------------------------------------------------------------
|
77f95fb529d127db8bb9103ca8e3b22047455ff0
|
b6acd6eed2b8946c1c1e19fa30081cbab0a2954f
|
/starry_fmu/Framework/source/Console/msh_usr_cmd.c
|
2ed9abf1db5db569d22fc1a863528c351ebbc145
|
[
"BSD-3-Clause"
] |
permissive
|
JcZou/StarryPilot
|
7ce1ed454f133ccd30d71916811e2bf23196d2eb
|
97af0338a54e1eeece877c72222aeaf4b7e80ad7
|
refs/heads/master
| 2023-03-12T19:10:17.225314
| 2021-11-27T19:44:26
| 2021-11-27T19:44:26
| 137,048,745
| 304
| 172
|
BSD-3-Clause
| 2020-08-26T07:34:49
| 2018-06-12T09:27:59
|
C
|
UTF-8
|
C
| false
| false
| 15,044
|
c
|
msh_usr_cmd.c
|
/*
* File : msh_usr_cmd.c
*
*
* Change Logs:
* Date Author Notes
* 2018-06-13 zoujiachi the first version
*/
#include <rtthread.h>
#include <finsh.h>
#include <shell.h>
#include <string.h>
#include "calibration.h"
#include "starryio_uploader.h"
#include "pos_estimator.h"
#include "msh_usr_cmd.h"
#include "msh.h"
#include "console.h"
typedef int (*shell_handle_func)(int, char**, int, sh_optv*);
int shell_cmd_process(int argc, char** argv, shell_handle_func func)
{
int res = 1;
int arg_c = 0;
int opt_c = 0;
char **arg_v = NULL;
sh_optv *opt_v = NULL;
// pre-process to determine arguments and options count
for(int i = 0 ; i < argc ; i++){
if(argv[i][0] == '-'){
opt_c++;
}else{
arg_c++;
}
}
arg_v = (char**)rt_malloc(arg_c*sizeof(char*));
if(arg_v == NULL)
return 1;
if(opt_c){
opt_v = (sh_optv*)rt_malloc(opt_c*sizeof(sh_optv));
if(opt_v == NULL){
rt_free(arg_v);
return 1;
}
}
int arg_cnt = 0;
int opt_cnt = 0;
// process for arguments and options
for(int i = 0 ; i < argc ; i++){
if(argv[i][0] == '-'){
/* handle option */
int opt_len = strlen(argv[i]);
int val_len = 0;
int val_start;
// find option value
for(int n = 1 ; n < opt_len ; n++){
if(argv[i][n] == '='){
val_len = opt_len-n-1;
val_len = val_len > 0 ? val_len : 0;
opt_len = opt_len - val_len - 1;
opt_len = opt_len > 0 ? opt_len : 0;
val_start = n+1;
}
}
opt_v[opt_cnt].opt = (char*)rt_malloc(opt_len+1); // 1byte for '\0'
if(opt_v[opt_cnt].opt == NULL){
Console.print("opt malloc err\n");
goto opt_release;
}
memcpy(opt_v[opt_cnt].opt, argv[i], opt_len);
opt_v[opt_cnt].opt[opt_len] = '\0';
if(val_len){
opt_v[opt_cnt].val = (char*)rt_malloc(val_len+1);
if(opt_v[opt_cnt].val == NULL){
Console.print("opt val malloc err\n");
goto opt_release;
}
memcpy(opt_v[opt_cnt].val, &argv[i][val_start], val_len);
opt_v[opt_cnt].val[val_len] = '\0';
}else{
opt_v[opt_cnt].val = NULL;
}
//Console.print("opt:%s val:%s\n", opt_v[opt_cnt].opt, opt_v[opt_cnt].val);
opt_cnt++;
}else{
/* handle argument */
int arg_len = strlen(argv[i]);
arg_v[arg_cnt] = (char*)rt_malloc(arg_len+1);
if(arg_v[arg_cnt] == NULL){
Console.print("arg malloc err\n");
goto opt_release;
}
memcpy(arg_v[arg_cnt], argv[i], arg_len);
arg_v[arg_cnt][arg_len] = '\0';
//Console.print("arg:%s\n", arg_v[arg_cnt]);
arg_cnt++;
}
}
// invoke handle function
if(func != NULL){
res = func(arg_c, arg_v, opt_c, opt_v);
}
opt_release:
// release memory
if(arg_v != NULL){
for(int i = 0 ; i < arg_c ; i++){
if(arg_v[i] != NULL){
rt_free(arg_v[i]);
}
}
rt_free(arg_v);
}
if(opt_v != NULL){
for(int i = 0 ; i < opt_c ; i++){
if(opt_v[i].opt != NULL){
rt_free(opt_v[i].opt);
}
if(opt_v[i].val != NULL){
rt_free(opt_v[i].val);
}
}
rt_free(opt_v);
}
return res;
}
int handle_help_shell_cmd(int argc, char** argv)
{
if(argc > 1){
if( strcmp(argv[1], "help") == 0 ){
Console.print("StarryPilot shell help.\n");
Console.print("Usage: help [command]\n");
}
if( strcmp(argv[1], "reboot") == 0 ){
Console.print("Reboot system.\n");
}
if( strcmp(argv[1], "sys") == 0 ){
Console.print("Show system status.\n");
}
if( strcmp(argv[1], "calib") == 0 ){
Console.print("Calibrate sensors.\n");
Console.print("Usage: cali <sensor>\n");
Console.print("\n");
Console.print("sensor:\n");
Console.print("%9s,\t%s\n", "gyr", "Calibrate the gyroscope.");
Console.print("%8s,\t%s\n", "acc", "Calibrate the accelerometer.");
Console.print("%8s,\t%s\n", "mag", "Calibrate the magnetometer.");
}
if( strcmp(argv[1], "uploader") == 0 ){
Console.print("Upload bin file to starry io.\n");
}
if( strcmp(argv[1], "sensor") == 0 ){
Console.print("Get sensor information.\n");
Console.print("Usage: sensor <sensor> [-n <cnt> | -t <period> | -r | -nc]\n");
Console.print("\n");
Console.print("sensor:\n");
Console.print("\t%-5s - %s\n", "gyr", "Get gyroscope data.");
Console.print("\t%-5s - %s\n", "acc", "Get accelerometer data.");
Console.print("\t%-5s - %s\n", "mag", "Get magnetometer data.");
Console.print("-n <cnt>:\n");
Console.print("\t%s\n", "Set repeat count.");
Console.print("-t <period>:\n");
Console.print("\t%s\n", "Set repeat period (ms).");
Console.print("-r:\n");
Console.print("\t%s\n", "Show raw data.");
Console.print("-nc:\n");
Console.print("\t%s\n", "Show not calibrated data.");
}
if( strcmp(argv[1], "motor") == 0 ){
Console.print("Motor operations.\n");
Console.print("Usage: motor <action> [...]\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-33s - %s\n", "setall <throttle>", "Set throttle for all motors.");
Console.print("\t%-33s - %s\n", "set <throttle1, throttle2, ...>", "Set throttle for each motor.");
Console.print("\t%-33s - %s\n", "get", "Get current motor throttle.");
Console.print("\t%-33s - %s\n", "switch <on | off>", "Switch motor status.");
}
if( strcmp(argv[1], "rc") == 0 ){
Console.print("Remote Controller information.\n");
Console.print("Usage: rc <action> [...]\n");
Console.print("\n");
Console.print("action:\n");
Console.print("%8s,\t%s\n", "status", "Show RC status.");
}
if( strcmp(argv[1], "param") == 0 ){
Console.print("Configure parameters.\n");
Console.print("Usage: param <action> [...]\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-29s - %s\n", "load", "Load parameter from file.");
Console.print("\t%-29s - %s\n", "store", "Store parameter to file.");
Console.print("\t%-29s - %s\n", "get [group [param] | -g]", "Get parameter value.");
Console.print("\t%-29s - %s\n", "set <group> <param> <value>", "Set parameter value.");
}
if( strcmp(argv[1], "test") == 0 ){
Console.print("Customn test function.\n");
}
if( strcmp(argv[1], "ls") == 0 ){
Console.print("List files/directories.\n");
Console.print("Usage: ls [-l]\n");
Console.print("\n");
Console.print("-l:\n");
Console.print("\t%s\n", "Show detail information.");
}
if( strcmp(argv[1], "cd") == 0 ){
Console.print("Change current directory.\n");
Console.print("Usage: cd <dir>\n");
}
if( strcmp(argv[1], "mv") == 0 ){
Console.print("Move file/directory.\n");
Console.print("Usage: mv <src> <des>\n");
}
if( strcmp(argv[1], "rm") == 0 ){
Console.print("Remove file/directory.\n");
Console.print("Usage: rm <file | dir> <des>\n");
}
if( strcmp(argv[1], "cat") == 0 ){
Console.print("Show file content.\n");
Console.print("Usage: cat <file> <des>\n");
}
if( strcmp(argv[1], "mkfs") == 0 ){
Console.print("Formate file system.\n");
}
if( strcmp(argv[1], "getfree") == 0 ){
Console.print("Show storage usage.\n");
}
if( strcmp(argv[1], "rtt") == 0 ){
Console.print("RT-Thread system commands.\n");
Console.print("Usage: rtt <action>\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-15s - %s\n", "list_thread", "List thread.");
Console.print("\t%-15s - %s\n", "list_sem", "List semaphone in system.");
Console.print("\t%-15s - %s\n", "list_event", "List event in system.");
Console.print("\t%-15s - %s\n", "list_mutex", "List mutex in system.");
Console.print("\t%-15s - %s\n", "list_mailbox", "List mail box in system.");
Console.print("\t%-15s - %s\n", "list_msgqueue", "List message queue in system.");
Console.print("\t%-15s - %s\n", "list_mempool", "List memory pool in system.");
Console.print("\t%-15s - %s\n", "list_timer", "List timer in system.");
Console.print("\t%-15s - %s\n", "list_device", "List device in system.");
}
if( strcmp(argv[1], "att_est") == 0 ){
Console.print("Attitude estimator commands.\n");
Console.print("Usage: att_est <action>\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-7s - %s\n", "show", "Show attitude information.");
Console.print("\t%-7s - %s\n", "reset", "Reset attitude estimator.");
}
if( strcmp(argv[1], "att_est") == 0 ){
Console.print("Attitude estimator commands.\n");
Console.print("Usage: att_est <action>\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-7s - %s\n", "show", "Show attitude information.");
Console.print("\t%-7s - %s\n", "reset", "Reset attitude estimator.");
}
if( strcmp(argv[1], "logger") == 0 ){
Console.print("Log operations.\n");
Console.print("Usage: logger <action> [...]\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-23s - %s\n", "start <file> [period]", "Start logger.");
Console.print("\t%-23s - %s\n", "stop", "Stop logger.");
Console.print("\t%-23s - %s\n", "info <file>", "Show log file information.");
}
if( strcmp(argv[1], "control") == 0 ){
Console.print("Control commands.\n");
Console.print("Usage: control <action> [...]\n");
Console.print("\n");
Console.print("action:\n");
Console.print("\t%-13s - %s\n", "request", "Request control permission.");
Console.print("\t%-13s - %s\n", "release", "Release control permission.");
Console.print("\t%-13s - %s\n", "set <param>", "Set the value of control parameter.");
Console.print("\t%-13s - %s\n", "get", "Get the value of control parameter.");
}
}else{
// list all commands
struct finsh_syscall *index;
Console.print("StarryPilot shell commands:\n");
for (index = _syscall_table_begin;
index < _syscall_table_end;
FINSH_NEXT_SYSCALL(index))
{
if (strncmp(index->name, "__cmd_", 6) != 0) continue;
#if defined(FINSH_USING_DESCRIPTION) && defined(FINSH_USING_SYMTAB)
Console.print("%-16s - %s\n", &index->name[6], index->desc);
#else
Console.print("%s ", &index->name[6]);
#endif
}
}
Console.print("\n");
return 0;
}
int cmd_reboot(int argc, char** argv)
{
rt_kprintf("rebooting...\n\n");
NVIC_SystemReset();
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_reboot, __cmd_reboot, reboot the system);
int handle_sys_shell_cmd(int argc, char** argv);
int cmd_sys(int argc, char** argv)
{
return handle_sys_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_sys, __cmd_sys, system status);
int handle_calib_shell_cmd(int argc, char** argv);
int cmd_calib(int argc, char** argv)
{
return handle_calib_shell_cmd(argc, argv);
return 0;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_calib, __cmd_calib, calibrate the acc and mag sensor.);
int cmd_uploader(int argc, char** argv)
{
starryio_upload();
return 1;
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_uploader, __cmd_uploader, upload bin file to starryio.);
int handle_sensor_shell_cmd(int argc, char** argv);
int cmd_sensor(int argc, char** argv)
{
return handle_sensor_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_sensor, __cmd_sensor, get sensor information.);
int handle_gps_shell_cmd(int argc, char** argv);
int cmd_gps(int argc, char** argv)
{
return handle_gps_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_gps, __cmd_gps, get gps information.);
int handle_motor_shell_cmd(int argc, char** argv, int optc, sh_optv* optv);
int cmd_motor(int argc, char** argv)
{
return shell_cmd_process(argc, argv, handle_motor_shell_cmd);
//return handle_motor_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_motor, __cmd_motor, motor operation);
int handle_rc_shell_cmd(int argc, char** argv);
int cmd_rc(int argc, char** argv)
{
return handle_rc_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_rc, __cmd_rc, rc operation);
int handle_param_shell_cmd(int argc, char** argv);
int cmd_param(int argc, char** argv)
{
return handle_param_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_param, __cmd_param, configure parameter);
int handle_test_shell_cmd(int argc, char** argv);
int cmd_test(int argc, char** argv)
{
return handle_test_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_test, __cmd_test, test function);
int handle_fm_shell_cmd(int argc, char** argv);
int cmd_ls(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_ls, __cmd_ls, list files/directories);
int cmd_cd(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_cd, __cmd_cd, change directory);
int cmd_mkdir(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkdir, __cmd_mkdir, make directory);
int cmd_rm(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_rm, __cmd_rm, remove file/directory);
int cmd_mkfs(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_mkfs, __cmd_mkfs, make file system);
int cmd_getfree(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_getfree, __cmd_getfree, get total space and free space of the file system);
int cmd_cat(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_cat, __cmd_cat, read the contents of files);
int cmd_mv(int argc, char** argv)
{
return handle_fm_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_mv, __cmd_mv, move or rename files and directories);
int handle_rtt_shell_cmd(int argc, char** argv);
int cmd_rtt(int argc, char** argv)
{
return handle_rtt_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_rtt, __cmd_rtt, rt-thread rtos commands);
int handle_att_est_shell_cmd(int argc, char** argv);
int cmd_att_est(int argc, char** argv)
{
return handle_att_est_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_att_est, __cmd_att_est, attitude estimator commands);
int handle_pos_est_shell_cmd(int argc, char** argv);
int cmd_pos_est(int argc, char** argv)
{
return handle_pos_est_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_pos_est, __cmd_pos_est, position estimator commands);
int handle_mavproxy_shell_cmd(int argc, char** argv);
int cmd_mavproxy(int argc, char** argv)
{
return handle_mavproxy_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_mavproxy, __cmd_mavproxy, mavlink proxy commands);
int handle_exit_shell_cmd(int argc, char** argv);
int cmd_exit(int argc, char** argv)
{
return handle_exit_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_exit, __cmd_exit, redirect console device);
int handle_logger_shell_cmd(int argc, char** argv);
int cmd_logger(int argc, char** argv)
{
return handle_logger_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_logger, __cmd_logger, log operations);
int handle_control_shell_cmd(int argc, char** argv);
int cmd_control(int argc, char** argv)
{
return handle_control_shell_cmd(argc, argv);
}
FINSH_FUNCTION_EXPORT_ALIAS(cmd_control, __cmd_control, control operations);
|
764991211862848e31f10c4d15036b8b755a5e3d
|
fbe68d84e97262d6d26dd65c704a7b50af2b3943
|
/third_party/virtualbox/src/VBox/Devices/Network/lwip-new/vbox/sys_arch.c
|
e908373d7a033f5d902263cf4c75f1a5025c6e15
|
[
"MIT",
"GPL-2.0-only",
"LicenseRef-scancode-unknown-license-reference",
"CDDL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-2.0-or-later",
"MPL-1.0",
"LicenseRef-scancode-generic-exception",
"Apache-2.0",
"OpenSSL",
"BSD-3-Clause"
] |
permissive
|
thalium/icebox
|
c4e6573f2b4f0973b6c7bb0bf068fe9e795fdcfb
|
6f78952d58da52ea4f0e55b2ab297f28e80c1160
|
refs/heads/master
| 2022-08-14T00:19:36.984579
| 2022-02-22T13:10:31
| 2022-02-22T13:10:31
| 190,019,914
| 585
| 109
|
MIT
| 2022-01-13T20:58:15
| 2019-06-03T14:18:12
|
C++
|
UTF-8
|
C
| false
| false
| 13,928
|
c
|
sys_arch.c
|
/** $Id: sys_arch.c $ */
/** @file
* System dependent parts of lwIP, implemented with IPRT.
*/
/*
* Copyright (C) 2007-2017 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <lwip/sys.h>
#include <iprt/assert.h>
#include <iprt/err.h>
#include <iprt/mem.h>
#include <iprt/string.h>
#include <iprt/critsect.h>
#include <iprt/thread.h>
#include <iprt/time.h>
/** @todo during my tests on Debian Lenny 64 bit I ran into trouble using
* mutex semaphores (crash deep down in the pthreads lib). Using the write
* case of rw semaphores also gives mutual exclusion, and didn't show those
* crashes. Should be investigated, because this "fix" might be just covering
* the symptoms of a bug elsewhere. */
#if HC_ARCH_BITS == 64 && defined RT_ARCH_LINUX
#define LWIPMUTEXTYPE RTSEMRW
#define LWIPMutexCreate RTSemRWCreate
#define LWIPMutexDestroy RTSemRWDestroy
#define LWIPMutexRequest(m) RTSemRWRequestWrite((m), RT_INDEFINITE_WAIT)
#define LWIPMutexRelease RTSemRWReleaseWrite
#else
#define LWIPMUTEXTYPE RTSEMMUTEX
#define LWIPMutexCreate RTSemMutexCreate
#define LWIPMutexDestroy RTSemMutexDestroy
#define LWIPMutexRequest(m) RTSemMutexRequest((m), RT_INDEFINITE_WAIT)
#define LWIPMutexRelease RTSemMutexRelease
#endif
/** Maximum number of threads lwIP is allowed to create. */
#define THREADS_MAX 5
/** Maximum number of mbox entries needed for reasonable performance. */
#define MBOX_ENTRIES_MAX 128
/** Data type for slots in TLS. */
typedef struct
{
RTTHREAD tid;
void (* thread)(void *arg);
void *arg;
#if 0
struct sys_timeouts timeouts;
#endif
} THREADLOCALSTORAGE;
/** Actual declaration of the mbox type. */
/** @todo magic - ??? */
struct sys_mbox
{
LWIPMUTEXTYPE mutex;
RTSEMEVENTMULTI nonempty, nonfull;
void *apvEntries[MBOX_ENTRIES_MAX];
u32_t head, tail;
int valid;
};
#if SYS_LIGHTWEIGHT_PROT
/** Critical section variable for short term synchronization. */
static RTCRITSECT g_ProtCritSect;
#else
/** Synchronization for thread creation handling. */
static RTSEMEVENT g_ThreadSem;
#endif
/** Number of threads currently created by lwIP. */
static u32_t g_cThreads = 2;
/** The simulated thread local storage for lwIP things. */
static THREADLOCALSTORAGE g_aTLS[THREADS_MAX];
/**
* Initialize the port to IPRT.
*/
void sys_init(void)
{
int rc;
unsigned i;
#if SYS_LIGHTWEIGHT_PROT
rc = RTCritSectInit(&g_ProtCritSect);
AssertRC(rc);
#else
rc = RTSemEventCreate(&g_ThreadSem);
AssertRC(rc);
rc = RTSemEventSignal(g_ThreadSem);
AssertRC(rc);
#endif
for (i = 0; i < THREADS_MAX; i++)
g_aTLS[i].tid = NIL_RTTHREAD;
}
/**
* Create a new (binary) semaphore.
*/
err_t sys_sem_new(sys_sem_t *pSem, u8_t count)
{
int rc;
err_t rcLwip = ERR_ARG;
if (!pSem)
return ERR_ARG;
Assert(count <= 1);
rc = RTSemEventCreate(pSem);
AssertRCReturn(rc, ERR_ARG);
rcLwip = ERR_OK;
if (count == 1)
{
rc = RTSemEventSignal(*pSem);
AssertRCReturn(rc, ERR_VAL);
}
return rcLwip;
}
/**
* Destroy a (binary) semaphore.
*/
void sys_sem_free(sys_sem_t *sem)
{
int rc;
rc = RTSemEventDestroy(*sem);
AssertRC(rc);
}
/**
* Signal a (binary) semaphore.
*/
void sys_sem_signal(sys_sem_t *sem)
{
int rc;
rc = RTSemEventSignal(*sem);
AssertRC(rc);
}
/**
* Wait for a (binary) semaphore.
*/
u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
{
int rc;
RTMSINTERVAL cMillies;
uint64_t tsStart, tsEnd;
tsStart = RTTimeMilliTS();
if (timeout == 0)
cMillies = RT_INDEFINITE_WAIT;
else
cMillies = timeout;
rc = RTSemEventWait(*sem, cMillies);
if (rc == VERR_TIMEOUT)
return SYS_ARCH_TIMEOUT;
AssertRC(rc);
tsEnd = RTTimeMilliTS();
return tsEnd - tsStart;
}
/**
* Create new mbox.
*/
err_t sys_mbox_new(sys_mbox_t *pvMbox, int size)
{
int rc;
struct sys_mbox *mbox = NULL;
RT_NOREF(size); /** @todo safe to ignore this? */
if (pvMbox == NULL)
return ERR_ARG;
mbox = RTMemAllocZ(sizeof(struct sys_mbox));
Assert(mbox != NULL);
if (!mbox)
return ERR_MEM;
rc = LWIPMutexCreate(&mbox->mutex);
AssertRC(rc);
if (RT_FAILURE(rc))
{
RTMemFree(mbox);
return ERR_VAL;
}
rc = RTSemEventMultiCreate(&mbox->nonempty);
AssertRC(rc);
if (RT_FAILURE(rc))
{
rc = LWIPMutexDestroy(mbox->mutex);
AssertRC(rc);
RTMemFree(mbox);
return ERR_VAL;
}
rc = RTSemEventMultiCreate(&mbox->nonfull);
AssertRC(rc);
if (RT_FAILURE(rc))
{
rc = RTSemEventMultiDestroy(mbox->nonempty);
AssertRC(rc);
rc = LWIPMutexDestroy(mbox->mutex);
AssertRC(rc);
RTMemFree(mbox);
return ERR_VAL;
}
mbox->valid = 1;
*pvMbox = mbox;
return ERR_OK;
}
/**
* Free an mbox.
*/
void sys_mbox_free(sys_mbox_t *pvMbox)
{
struct sys_mbox *mbox = NULL;
Assert(pvMbox && *pvMbox);
mbox = (struct sys_mbox*)*pvMbox;
LWIPMutexDestroy((mbox)->mutex);
RTSemEventMultiDestroy((mbox)->nonempty);
RTSemEventMultiDestroy((mbox)->nonfull);
RTMemFree(mbox);
*pvMbox = NULL;
}
/**
* Place an entry in an mbox, waiting for a free slot if necessary.
*/
void sys_mbox_post(sys_mbox_t *pvMbox, void *msg)
{
int rc;
struct sys_mbox *mbox = NULL;
Assert(pvMbox && *pvMbox);
mbox = (struct sys_mbox*)*pvMbox;
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
while (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
/* (mbox) is full, have to wait until a slot becomes available. */
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
rc = RTSemEventMultiWait((mbox)->nonfull, RT_INDEFINITE_WAIT);
AssertRC(rc);
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
}
if ((mbox)->head == (mbox)->tail)
{
rc = RTSemEventMultiSignal((mbox)->nonempty);
AssertRC(rc);
}
(mbox)->apvEntries[(mbox)->head] = msg;
(mbox)->head++;
(mbox)->head %= MBOX_ENTRIES_MAX;
if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
rc = RTSemEventMultiReset((mbox)->nonfull);
AssertRC(rc);
}
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
}
/**
* Try to place an entry in an mbox if there is a free slot.
*/
err_t sys_mbox_trypost(sys_mbox_t *pvMbox, void *msg)
{
int rc;
struct sys_mbox *mbox = NULL;
AssertReturn(pvMbox && *pvMbox, ERR_ARG);
mbox = (struct sys_mbox*)*pvMbox;
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
/* (mbox) is full */
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
return ERR_MEM;
}
if ((mbox)->head == (mbox)->tail)
{
rc = RTSemEventMultiSignal((mbox)->nonempty);
AssertRC(rc);
}
(mbox)->apvEntries[(mbox)->head] = msg;
(mbox)->head++;
(mbox)->head %= MBOX_ENTRIES_MAX;
if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
rc = RTSemEventMultiReset((mbox)->nonfull);
AssertRC(rc);
}
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
return ERR_OK;
}
/**
* Get an entry from an mbox.
*/
u32_t sys_arch_mbox_fetch(sys_mbox_t *pvMbox, void **msg, u32_t timeout)
{
int rc;
RTMSINTERVAL cMillies;
uint64_t tsStart, tsEnd;
struct sys_mbox *mbox = NULL;
if (!pvMbox || !*pvMbox) return 0;
mbox = (struct sys_mbox*)*pvMbox;
tsStart = RTTimeMilliTS();
if (timeout == 0)
cMillies = RT_INDEFINITE_WAIT;
else
cMillies = timeout;
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
while ((mbox)->head == (mbox)->tail)
{
/* (mbox) is empty, have to wait until a slot is filled. */
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
if (timeout != 0)
{
tsEnd = RTTimeMilliTS();
if (tsEnd - tsStart >= cMillies)
return SYS_ARCH_TIMEOUT;
cMillies -= tsEnd - tsStart;
}
rc = RTSemEventMultiWait((mbox)->nonempty, cMillies);
if (rc == VERR_TIMEOUT)
return SYS_ARCH_TIMEOUT;
AssertRC(rc);
if (timeout != 0)
{
tsEnd = RTTimeMilliTS();
if (tsEnd - tsStart >= cMillies)
return SYS_ARCH_TIMEOUT;
cMillies -= tsEnd - tsStart;
}
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
}
if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
rc = RTSemEventMultiSignal((mbox)->nonfull);
AssertRC(rc);
}
if (msg != NULL)
*msg = (mbox)->apvEntries[(mbox)->tail];
(mbox)->tail++;
(mbox)->tail %= MBOX_ENTRIES_MAX;
rc = RTSemEventMultiSignal((mbox)->nonfull);
if ((mbox)->head == (mbox)->tail)
{
rc = RTSemEventMultiReset((mbox)->nonempty);
AssertRC(rc);
}
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
tsEnd = RTTimeMilliTS();
return tsEnd - tsStart;
}
/**
* Try to get an entry from an mbox.
*/
u32_t sys_arch_mbox_tryfetch(sys_mbox_t *pvMbox, void **msg)
{
int rc;
struct sys_mbox *mbox = NULL;
if (!pvMbox || !*pvMbox) return SYS_MBOX_EMPTY;
mbox = (struct sys_mbox*)*pvMbox;
rc = LWIPMutexRequest((mbox)->mutex);
AssertRC(rc);
if ((mbox)->head == (mbox)->tail)
{
/* (mbox) is empty, don't wait */
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
return SYS_MBOX_EMPTY;
}
if (((mbox)->head + 1) % MBOX_ENTRIES_MAX == (mbox)->tail)
{
rc = RTSemEventMultiSignal((mbox)->nonfull);
AssertRC(rc);
}
if (msg != NULL)
*msg = (mbox)->apvEntries[(mbox)->tail];
(mbox)->tail++;
(mbox)->tail %= MBOX_ENTRIES_MAX;
rc = RTSemEventMultiSignal((mbox)->nonfull);
if ((mbox)->head == (mbox)->tail)
{
rc = RTSemEventMultiReset((mbox)->nonempty);
AssertRC(rc);
}
rc = LWIPMutexRelease((mbox)->mutex);
AssertRC(rc);
return 0;
}
/** Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid */
int sys_mbox_valid(sys_mbox_t *pvMbox)
{
struct sys_mbox *mbox = NULL;
if (!pvMbox || !*pvMbox) return 0;
mbox = (struct sys_mbox*)*pvMbox;
return (mbox)->valid;
}
/** Set an mbox invalid so that sys_mbox_valid returns 0 */
void sys_mbox_set_invalid(sys_mbox_t *pvMbox)
{
struct sys_mbox *mbox = NULL;
if (!pvMbox || !*pvMbox)
return;
mbox = (struct sys_mbox *)*pvMbox;
mbox->valid = 0;
}
#if 0
/**
* Grab the pointer to this thread's timeouts from TLS.
*/
struct sys_timeouts *sys_arch_timeouts(void)
{
unsigned i;
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_DECL_PROTECT(old_level);
#endif
RTTHREAD myself;
struct sys_timeouts *to = NULL;
myself = RTThreadSelf();
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_PROTECT(old_level);
#else
RTSemEventWait(g_ThreadSem, RT_INDEFINITE_WAIT);
#endif
for (i = 0; i < g_cThreads; i++)
{
if (g_aTLS[i].tid == myself)
{
to = &g_aTLS[i].timeouts;
break;
}
}
/* Auto-adopt new threads which use lwIP as they pop up. */
if (!to)
{
unsigned id;
id = g_cThreads;
g_cThreads++;
Assert(g_cThreads <= THREADS_MAX);
g_aTLS[id].tid = myself;
to = &g_aTLS[id].timeouts;
}
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_UNPROTECT(old_level);
#else
RTSemEventSignal(g_ThreadSem);
#endif
return to;
}
#endif
/**
* Internal: thread main function adapter, dropping the first parameter. Needed
* to make lwip thread main function compatible with IPRT thread main function.
*/
static DECLCALLBACK(int) sys_thread_adapter(RTTHREAD hThreadSelf, void *pvUser)
{
THREADLOCALSTORAGE *tls = (THREADLOCALSTORAGE *)pvUser;
RT_NOREF(hThreadSelf);
tls->thread(tls->arg);
return VINF_SUCCESS;
}
/**
* Create new thread.
*/
sys_thread_t sys_thread_new(const char*name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
{
int rc;
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_DECL_PROTECT(old_level);
#endif
unsigned id;
RTTHREAD tid;
RT_NOREF(prio, stacksize, name);
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_PROTECT(old_level);
#else
RTSemEventWait(g_ThreadSem, RT_INDEFINITE_WAIT);
#endif
id = g_cThreads;
g_cThreads++;
Assert(g_cThreads <= THREADS_MAX);
g_aTLS[id].thread = thread;
g_aTLS[id].arg = arg;
rc = RTThreadCreateF(&tid, sys_thread_adapter, &g_aTLS[id], 0,
RTTHREADTYPE_IO, 0, "lwIP%u", id);
if (RT_FAILURE(rc))
{
g_cThreads--;
tid = NIL_RTTHREAD;
}
else
g_aTLS[id].tid = tid;
#if SYS_LIGHTWEIGHT_PROT
SYS_ARCH_UNPROTECT(old_level);
#else
RTSemEventSignal(g_ThreadSem);
#endif
AssertRC(rc);
return tid;
}
#if SYS_LIGHTWEIGHT_PROT
/**
* Start a short critical section.
*/
sys_prot_t sys_arch_protect(void)
{
int rc;
rc = RTCritSectEnter(&g_ProtCritSect);
AssertRC(rc);
return NULL;
}
#endif
#if SYS_LIGHTWEIGHT_PROT
/**
* End a short critical section.
*/
void sys_arch_unprotect(sys_prot_t pval)
{
int rc;
(void)pval;
rc = RTCritSectLeave(&g_ProtCritSect);
AssertRC(rc);
}
#endif
|
86bb458e8bb2931b551d71afad46fa9e84e65cb4
|
f728b4fa5156d20abc60634bc4f8b10c9226613d
|
/src/context_utils.h
|
eab9616598566d8118c0035d7a1dec805b90c825
|
[
"MIT"
] |
permissive
|
datoviz/datoviz
|
802ae333b462d98468b5b7c57ed44871602b2cb8
|
9b934e6dc2d02b91ab60a8e3763fa565440e3ea0
|
refs/heads/main
| 2023-07-11T16:16:08.605371
| 2023-07-04T16:52:46
| 2023-07-04T16:52:46
| 281,501,204
| 476
| 24
|
MIT
| 2023-07-04T16:52:48
| 2020-07-21T20:48:09
|
C
|
UTF-8
|
C
| false
| false
| 9,626
|
h
|
context_utils.h
|
#ifndef DVZ_CONTEXT_UTILS_HEADER
#define DVZ_CONTEXT_UTILS_HEADER
#include "../include/datoviz/context.h"
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************************************/
/* Staging buffer */
/*************************************************************************************************/
// Get the staging buffer, and make sure it can contain `size` bytes.
static DvzBuffer* staging_buffer(DvzContext* context, VkDeviceSize size)
{
log_trace("requesting staging buffer of size %s", pretty_size(size));
DvzBuffer* staging = (DvzBuffer*)dvz_container_get(&context->buffers, DVZ_BUFFER_TYPE_STAGING);
ASSERT(staging != NULL);
ASSERT(staging->buffer != VK_NULL_HANDLE);
// Make sure the staging buffer is idle before using it.
// TODO: optimize this and avoid hard synchronization here before copying data into
// the staging buffer.
// dvz_queue_wait(context->gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
// Resize the staging buffer is needed.
// TODO: keep staging buffer fixed and copy parts of the data to staging buffer in several
// steps?
if (staging->size < size)
{
VkDeviceSize new_size = dvz_next_pow2(size);
log_debug("reallocating staging buffer to %s", pretty_size(new_size));
dvz_buffer_resize(staging, new_size);
}
ASSERT(staging->size >= size);
return staging;
}
static void _copy_buffer_from_staging(
DvzContext* context, DvzBufferRegions br, VkDeviceSize offset, VkDeviceSize size)
{
ASSERT(context != NULL);
DvzGpu* gpu = context->gpu;
ASSERT(gpu != NULL);
DvzBuffer* staging = staging_buffer(context, size);
ASSERT(staging != NULL);
// Take transfer cmd buf.
DvzCommands cmds_ = dvz_commands(gpu, 0, 1);
DvzCommands* cmds = &cmds_;
dvz_cmd_reset(cmds, 0);
dvz_cmd_begin(cmds, 0);
VkBufferCopy region = {0};
region.size = size;
region.srcOffset = 0;
region.dstOffset = br.offsets[0] + offset;
vkCmdCopyBuffer(cmds->cmds[0], staging->buffer, br.buffer->buffer, br.count, ®ion);
dvz_cmd_end(cmds, 0);
// Wait for the render queue to be idle.
// TODO: less brutal synchronization with semaphores. Here we stop all
// rendering so that we're sure that the buffer we're going to write to is not
// being used by the GPU.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_RENDER);
// Submit the commands to the transfer queue.
DvzSubmit submit = dvz_submit(gpu);
dvz_submit_commands(&submit, cmds);
log_debug("copy %s from staging buffer", pretty_size(size));
dvz_submit_send(&submit, 0, NULL, 0);
// Wait for the transfer queue to be idle.
// TODO: less brutal synchronization with semaphores. Here we wait for the
// transfer to be complete before we send new rendering commands.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
}
static void _copy_buffer_to_staging(
DvzContext* context, DvzBufferRegions br, VkDeviceSize offset, VkDeviceSize size)
{
ASSERT(context != NULL);
DvzGpu* gpu = context->gpu;
ASSERT(gpu != NULL);
DvzBuffer* staging = staging_buffer(context, size);
ASSERT(staging != NULL);
// Take transfer cmd buf.
DvzCommands cmds_ = dvz_commands(gpu, 0, 1);
DvzCommands* cmds = &cmds_;
dvz_cmd_reset(cmds, 0);
dvz_cmd_begin(cmds, 0);
// Determine the offset in the source buffer.
// Should be consecutive offsets.
VkDeviceSize vk_offset = br.offsets[0];
uint32_t n_regions = br.count;
for (uint32_t i = 1; i < n_regions; i++)
{
ASSERT(br.offsets[i] == vk_offset + i * size);
}
// Take into account the transfer offset.
vk_offset += offset;
// Copy to staging buffer
ASSERT(br.buffer != 0);
dvz_cmd_copy_buffer(cmds, 0, br.buffer, vk_offset, staging, 0, size * n_regions);
dvz_cmd_end(cmds, 0);
// Wait for the compute queue to be idle, as we assume the buffer to be copied from may
// be modified by compute shaders.
// TODO: more efficient synchronization (semaphores?)
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_COMPUTE);
// Submit the commands to the transfer queue.
DvzSubmit submit = dvz_submit(gpu);
dvz_submit_commands(&submit, cmds);
log_debug("copy %s to staging buffer", pretty_size(size));
dvz_submit_send(&submit, 0, NULL, 0);
// Wait for the transfer queue to be idle.
// TODO: less brutal synchronization with semaphores. Here we wait for the
// transfer to be complete before we send new rendering commands.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
}
static void _copy_texture_from_staging(
DvzContext* context, DvzTexture* texture, uvec3 offset, uvec3 shape, VkDeviceSize size)
{
ASSERT(context != NULL);
DvzGpu* gpu = context->gpu;
ASSERT(gpu != NULL);
DvzBuffer* staging = staging_buffer(context, size);
ASSERT(staging != NULL);
// Take transfer cmd buf.
DvzCommands cmds_ = dvz_commands(gpu, 0, 1);
DvzCommands* cmds = &cmds_;
dvz_cmd_reset(cmds, 0);
dvz_cmd_begin(cmds, 0);
// Image transition.
DvzBarrier barrier = dvz_barrier(gpu);
dvz_barrier_stages(&barrier, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
ASSERT(texture != NULL);
ASSERT(texture->image != NULL);
dvz_barrier_images(&barrier, texture->image);
dvz_barrier_images_layout(
&barrier, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
dvz_barrier_images_access(&barrier, 0, VK_ACCESS_TRANSFER_WRITE_BIT);
dvz_cmd_barrier(cmds, 0, &barrier);
// Copy to staging buffer
dvz_cmd_copy_buffer_to_image(cmds, 0, staging, texture->image);
// Image transition.
dvz_barrier_images_layout(
&barrier, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, texture->image->layout);
dvz_barrier_images_access(&barrier, VK_ACCESS_TRANSFER_WRITE_BIT, VK_ACCESS_MEMORY_READ_BIT);
dvz_cmd_barrier(cmds, 0, &barrier);
dvz_cmd_end(cmds, 0);
// Wait for the render queue to be idle.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_RENDER);
// Submit the commands to the transfer queue.
DvzSubmit submit = dvz_submit(gpu);
dvz_submit_commands(&submit, cmds);
dvz_submit_send(&submit, 0, NULL, 0);
// Wait for the transfer queue to be idle.
// TODO: less brutal synchronization with semaphores. Here we wait for the
// transfer to be complete before we send new rendering commands.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
}
static void _copy_texture_to_staging(
DvzContext* context, DvzTexture* texture, uvec3 offset, uvec3 shape, VkDeviceSize size)
{
ASSERT(context != NULL);
DvzGpu* gpu = context->gpu;
ASSERT(gpu != NULL);
DvzBuffer* staging = staging_buffer(context, size);
ASSERT(staging != NULL);
// Take transfer cmd buf.
DvzCommands cmds_ = dvz_commands(gpu, 0, 1);
DvzCommands* cmds = &cmds_;
dvz_cmd_reset(cmds, 0);
dvz_cmd_begin(cmds, 0);
// Image transition.
DvzBarrier barrier = dvz_barrier(gpu);
dvz_barrier_stages(&barrier, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT);
ASSERT(texture != NULL);
ASSERT(texture->image != NULL);
dvz_barrier_images(&barrier, texture->image);
dvz_barrier_images_layout(
&barrier, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
dvz_barrier_images_access(&barrier, 0, VK_ACCESS_TRANSFER_READ_BIT);
dvz_cmd_barrier(cmds, 0, &barrier);
// Copy to staging buffer
dvz_cmd_copy_image_to_buffer(cmds, 0, texture->image, staging);
// Image transition.
dvz_barrier_images_layout(
&barrier, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, texture->image->layout);
dvz_barrier_images_access(&barrier, VK_ACCESS_TRANSFER_READ_BIT, VK_ACCESS_MEMORY_READ_BIT);
dvz_cmd_barrier(cmds, 0, &barrier);
dvz_cmd_end(cmds, 0);
// Wait for the render queue to be idle.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_RENDER);
// Submit the commands to the transfer queue.
DvzSubmit submit = dvz_submit(gpu);
dvz_submit_commands(&submit, cmds);
dvz_submit_send(&submit, 0, NULL, 0);
// Wait for the transfer queue to be idle.
// TODO: less brutal synchronization with semaphores. Here we wait for the
// transfer to be complete before we send new rendering commands.
// dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
}
/*************************************************************************************************/
/* Default resources */
/*************************************************************************************************/
static DvzTexture* _default_transfer_texture(DvzContext* context)
{
ASSERT(context != NULL);
DvzGpu* gpu = context->gpu;
ASSERT(gpu != NULL);
uvec3 shape = {256, 1, 1};
DvzTexture* texture = dvz_ctx_texture(context, 1, shape, VK_FORMAT_R32_SFLOAT);
float* tex_data = (float*)calloc(256, sizeof(float));
for (uint32_t i = 0; i < 256; i++)
tex_data[i] = i / 255.0;
dvz_texture_address_mode(texture, DVZ_TEXTURE_AXIS_U, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE);
uvec3 offset = {0, 0, 0};
dvz_texture_upload(texture, offset, offset, 256 * sizeof(float), tex_data);
dvz_queue_wait(gpu, DVZ_DEFAULT_QUEUE_TRANSFER);
FREE(tex_data);
return texture;
}
#ifdef __cplusplus
}
#endif
#endif
|
24dfbd0c79ddcf01a10bcbf83380769ba45e7b6d
|
581731c0a1c166a00d2e18ecf5e73da155fad8d1
|
/src/cjk.h
|
e2454cda109afbaae15ba42da4d343579e7d3fda
|
[
"DOC"
] |
permissive
|
andwn/cave-story-md
|
03e9004ab643574601726c41a851190c1adb25f6
|
2b225269c56dd7877e140f9012f8c233270cf966
|
refs/heads/master
| 2023-06-22T21:33:09.710999
| 2023-06-21T11:52:35
| 2023-06-21T11:52:35
| 32,826,698
| 531
| 47
| null | 2023-04-04T00:36:56
| 2015-03-24T21:39:08
|
C
|
UTF-8
|
C
| false
| false
| 894
|
h
|
cjk.h
|
enum { CJK_TITLE, CJK_MESSAGE, CJK_CREDITS };
// Reset VRAM cursor and clear message tilemap cache
// Possible VRAM Mode values are in the above enum
// Tiles will get allocated to different places depending on this "mode"
void cjk_reset(uint16_t vramMode);
// Call this at the end of a line or string. It will reset the shift value,
// preventing the next char from overlapping the previous one
void cjk_newline();
// Scroll the message window (redraw row 2-3 in row 1-2 rows and clear row 3)
void cjk_winscroll(uint16_t win_x, uint16_t win_y);
// Render a 12x16 text glyph to the screen
void cjk_draw(uint16_t plan, uint16_t chr, uint16_t x, uint16_t y, uint16_t backCol, uint16_t shadow);
// Wrapper for cjk_draw to generate sprite tiles for map name (3x2 sprite = 2 glyphs)
// chr2 may be 0 if only 1 glyph is needed
void cjk_drawsprite(uint16_t offset, uint16_t chr1, uint16_t chr2);
|
d7409c020d67f3afcd7ffe864745c798cda3df3e
|
de21f9075f55640514c29ef0f1fe3f0690845764
|
/regression/ansi-c/enum9/main.c
|
437213acd72c5bffcb52f33c1c07534826f18e8b
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause"
] |
permissive
|
diffblue/cbmc
|
975a074ac445febb3b5715f8792beb545522dc18
|
decd2839c2f51a54b2ad0f3e89fdc1b4bf78cd16
|
refs/heads/develop
| 2023-08-31T05:52:05.342195
| 2023-08-30T13:31:51
| 2023-08-30T13:31:51
| 51,877,056
| 589
| 309
|
NOASSERTION
| 2023-09-14T18:49:17
| 2016-02-16T23:03:52
|
C++
|
UTF-8
|
C
| false
| false
| 210
|
c
|
main.c
|
typedef enum : unsigned
{
X
} my_enum1;
enum my_enum2 : unsigned
{
Y
};
struct S
{
enum my_enum2 : unsigned a;
enum my_enum2 : unsigned b : 2;
};
int main()
{
enum my_enum2 : unsigned enum_var1;
}
|
facf21007d3a21b03e7073de242add75c26a0f9f
|
e683a0b8dbb87c7ceb99e0d06896174a559d2c67
|
/Appl/Breadbox/Graph/GRAPH.H
|
371cf3414bc03e5562e8edb504d1fc7e5cf7ef62
|
[
"Apache-2.0"
] |
permissive
|
bluewaysw/pcgeos
|
f093d79567d977d992f47065056d14d5a04b9f14
|
c6ae4c8e77b54b9ff654c3916f2191f8b1a1b65d
|
refs/heads/master
| 2023-08-31T00:17:54.481175
| 2023-08-29T19:00:49
| 2023-08-29T19:00:49
| 157,968,410
| 603
| 88
|
Apache-2.0
| 2023-09-13T07:44:06
| 2018-11-17T09:09:55
|
Assembly
|
UTF-8
|
C
| false
| false
| 13,009
|
h
|
GRAPH.H
|
/********************************************************************
*
* Copyright (c) 1996 Ken Sievers -- All rights reserved.
* Portions Copyright (c) 1996 Blue Marsh Softworks
*
* Program : Graph
* File : graph.h
*
* Programers : Joe Barbara, jab315@psu.edu
* Tom Denn, tomtom4828@aol.com
* Nathan Fiedler, nfiedler@aol.com
* Ken Sievers, sievers@epix.net
* Lee Stover, lxs137@psu.edu
*
* Compiler : Borland C++
*
* REVISION HISTORY:
* Name Date Description
* ---- ---- -----------
* KS 12/04/95 Initial version
* KS 03/14/96 Prototype
* KS 03/14/96 Working version
* KS 03/29/96 GEOS version
* KS 04/16/96 Changed struct returns to passing pointers.
* NF 04/16/96 Changed naming convention
* NF 04/18/96 Added new functions (search on 4/17 and 4/18)
*
* DESCRIPTION:
* This header file contains all the ADT definitions for an
* Adjancy Matrix. This includes the point, vertex, edge, and
* graph functions and data structures.
*
*******************************************************************/
// ***** Constants *****
// Constants pertaining to vertices.
#define VERTEX_MAX_COUNT 50
#define VERTEX_INVALID_NUM VERTEX_MAX_COUNT
// Constants pertaining to edges.
#define EDGE_MAX_COST 32767
#define EDGE_MAX_COUNT VERTEX_MAX_COUNT * VERTEX_MAX_COUNT
#define EDGE_INVALID_NUM EDGE_MAX_COUNT
// Define the TRUE and FALSE constants.
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE -1
#endif
// Contants for the displaying of the vertices.
#define VERTEX_WIDTH 30
#define VERTEX_RADIUS VERTEX_WIDTH / 2
// Constants for the displaying of the edges.
#define EDGE_THICKNESS 2
// Constants for the displaying of the directed edges.
#define EDGE_ARROW_WIDTH 10
#define EDGE_ARROW_HEIGHT 20
// ***** External Variables *****
extern char chCharacter_g;
// ***** Basic Data Structures *****
typedef char boolean; // TRUE/FALSE type
// ***** Color Type & Definitions *****
typedef int ElementColor;
#define C_BLACK 0
#define C_BLUE 1
#define C_GREEN 2
#define C_CYAN 3
#define C_RED 4
#define C_VIOLET 5
#define C_BROWN 6
#define C_LIGHT_GRAY 7
#define C_DARK_GRAY 8
#define C_LIGHT_BLUE 9
#define C_LIGHT_GREEN 10
#define C_LIGHT_CYAN 11
#define C_LIGHT_RED 12
#define C_LIGHT_VIOLET 13
#define C_YELLOW 14
#define C_WHITE 15
// Basic graph element color.
#define C_NORMAL C_BLACK
// Selected edge
#define C_SELECTED C_YELLOW
// Current edge being visited in operations.
#define C_CURRENT C_BLUE
// Second edge being visited in dual operations.
#define C_CURRENT2 C_RED
// Already visited edges.
#define C_VISITED C_GREEN
// Second edge in already visited dual operations.
#define C_VISITED2 C_VIOLET
/********************************************************************
* ADT point
********************************************************************
* This holds the x and y position of the point.
*******************************************************************/
typedef int Cost; // Cost of edge or vertex.
typedef struct {
unsigned int P_x; // X position
unsigned int P_y; // Y position
} Point_t;
Cost PointCalcEdgeCost( Point_t P1, Point_t P2 );
/********************************************************************
* ADT vertex
********************************************************************
* Stores the x,y pair, the state and the cost of a vertex.
*******************************************************************/
typedef unsigned int VertexNumber; // Vertex ID #
typedef unsigned int Degree; // Degree for an undirected vertex
typedef int VertexState;
#define VS_SELECTED 0x80 // Means vertex is highlighted.
#define VS_KNOWN 0x40 // Means vertex has been visited.
typedef struct {
Point_t V_point; // X, Y coordinates
VertexState V_state; // State of the vertex
// Degree V_degreeIn; // Edges entering vertex.
// Degree V_degreeOut; // Edges leaving vertex.
// Degree V_degree; // Edges entering and leaving vertex.
Cost V_cost; // Cost to make this vertex.
} Vertex;
//void VertexDraw( Vertex V, ElementColor c );
/********************************************************************
* ADT Vertex List
********************************************************************
* Stores an array of vertices and an count of how many are
* currently used.
*******************************************************************/
typedef struct {
Vertex VL_vertices[ VERTEX_MAX_COUNT ];
VertexNumber VL_count;
} VertexList;
//void VertexListDraw( VertexList * V, ElementColor c );
/********************************************************************
* ADT Vertex Number List.
********************************************************************
* Stores an array of vertex numbers and an index of how many are
* currently used. This acts as a list of pointers to the Adjacency
* Matrix.
*******************************************************************/
typedef struct {
VertexNumber VNL_vertices[ VERTEX_MAX_COUNT ];
VertexNumber VNL_count;
} VertexNumList;
void VertexNumListAddNumber( VertexNumList * VL, VertexNumber V );
boolean VertexNumListIsVertexInList( VertexNumList * VL, VertexNumber V );
boolean VertexNumListRemoveNumber( VertexNumList * VL, VertexNumber V );
/********************************************************************
* ADT Edge
********************************************************************
* Stores the state of each edge.
*******************************************************************/
typedef unsigned int EdgeNumber; // Edge ID #
typedef int EdgeState;
#define ES_SELECTED 0x80 // Means edge is highlighted.
#define ES_DIRECTED 0x40 // Means edge is directional.
typedef struct {
// VertexNumber E_fromVertex; // Vertex starting this edge.
// VertexNumber E_toVertex; // Vertex ending this edge.
// Cost E_cost; // Cost of this edge.
EdgeState E_state; // State of this edge.
} Edge;
/********************************************************************
* ADT Edge Number List
********************************************************************
* Stores an array of edge numbers and an index of how many are
* currently used. This acts as a list of pointers to the Adjancy Matrix.
*******************************************************************/
typedef struct {
EdgeNumber ENL_edges[ EDGE_MAX_COUNT ];
EdgeNumber ENL_count;
} EdgeNumList;
void EdgeNumListDoubleDraw( EdgeNumList E1, ElementColor c1,
EdgeNumList E2, ElementColor c2 );
void EdgeNumListDraw( EdgeNumList E, ElementColor c );
/********************************************************************
* ADT Adjacency Matrix
********************************************************************
* Stores the list of vertices, edge cost matrix, and list
* of edges.
*******************************************************************/
typedef struct {
// A list of vertices containing vertex information.
Vertex AM_vertices[ VERTEX_MAX_COUNT ];
// Number of vertices in the list.
VertexNumber AM_vertexCount;
// Edge Matrix containing the costs.
Cost AM_costs[ VERTEX_MAX_COUNT ][ VERTEX_MAX_COUNT ];
// List of edges containing other edge information.
Edge AM_edges[ EDGE_MAX_COUNT ];
// Number of valid edges in list and matrix.
EdgeNumber AM_edgeCount;
} AdjMatrix;
// ***** Graph Operations for an Adjacency Matrix. *****
// Defined in GRAPH.C
void AMInitializeGraph( void );
void AMMakeCompleteGraph( void );
void AMMakeSelectedComplete( void );
// ***** Search Operations for an Adjacency Matrix. *****
// Defined in GRAPH.C
boolean BFS( VertexNumber startVertex,
VertexNumber goalVertex,
EdgeNumList * bfs_edgelist );
boolean DFS( VertexNumber startVertex,
VertexNumber goalVertex,
EdgeNumList * dfs_edgelist );
// ***** MST Operations for an Adjacency Matrix. *****
// Defined in GRAPH.C
void Kruskal( EdgeNumList * eNL );
void Prim( VertexNumber startVertex, EdgeNumList * eNumList );
// ***** File I/O for an Adjacency Matrix *****
// Defined in GRAPH.C
void writeAdjList( /* FILE */ unsigned fileName );
void writeAdjMatrix( /* FILE */ unsigned fileName );
void readAdjList( /* FILE */ unsigned fileName );
void readAdjMatrix( /* FILE */ unsigned fileName );
// ***** Drawing functions for an Adjacency Matrix *****
// Defined in GRAPH.C
void AMDrawDoubleEdgeList( EdgeNumList * E1, EdgeNumList * E2 );
void AMDrawDoubleEdgeListInSeries( EdgeNumList * E1, EdgeNumList * E2 );
void AMDrawEdge( Edge E, EdgeNumber e, ElementColor c );
void AMDrawEdgeList( EdgeNumList * E );
void AMDrawEdgeNum( EdgeNumber eN, ElementColor c );
void AMDrawGraph( void );
void AMDrawVertexNum( VertexNumber V, ElementColor c );
// ***** Vertex Operations for an Adjacency Matrix. *****
// Defined in VERTEX.C
VertexNumber AMAddVertex( Point_t newPt );
void AMGenerateRandomVertices( VertexNumber n );
void AMGetAdjacentVertices( VertexNumber v, VertexNumList * vnl );
void AMGetSelectedVertices( VertexNumList * vlist );
VertexState AMGetVertexState( VertexNumber v );
VertexNumber AMLocateVertex( int x, int y );
void AMRemoveVertex( VertexNumber V );
void AMSelectAllVertices( void );
void AMSetVertexState( VertexNumber v, VertexState s );
void AMUnselectAllVertices( void );
// ***** Vertex List Operations for an Adjacency Matrix. *****
// Defined in VERTEX.C
//void AMReadVertexList( char * fileName );
void AMRemoveVertexList( VertexNumList * vnl );
// ***** Edge Operations for an Adjacency Matrix. *****
// Defined in EDGE.C
void AMAddEdge( VertexNumber V1, VertexNumber V2, boolean directed );
void AMAddEdgeNoCheck( VertexNumber V1, VertexNumber V2, boolean directed );
void AMGenerateRandomEdges( EdgeNumber n );
//void AMGetAdjacentEdges( VertexNumber V, EdgeNumList * enl );
VertexNumber AMGetEdgeFromVertex( EdgeNumber eN );
EdgeNumber AMGetEdgeNumber( VertexNumber V1, VertexNumber V2 );
EdgeState AMGetEdgeNumState( EdgeNumber e );
VertexNumber AMGetEdgeToVertex( EdgeNumber eN );
void AMGetSelectedEdges( EdgeNumList * enl );
EdgeNumber AMLocateEdge( int x1, int y1, int x2, int y2 );
void AMRemoveEdge( EdgeNumber en, boolean directed );
void AMRemoveEdgeList( EdgeNumList * enl );
void AMSelectAllEdges( void );
void AMSetEdgeNumState( EdgeNumber e, EdgeState s );
void AMUnselectAllEdges( void );
// ***** Other Operations for an Adjacency Matrix. *****
boolean ShortestPath( VertexNumber startVertex,
VertexNumber goalVertex,
EdgeNumList * eNumList,
EdgeNumList * path );
//************************************************************************
// UNION & FIND.
//************************************************************************
// Defined in SUPPORT.C
typedef int DISJ_SET[ VERTEX_MAX_COUNT + 1 ];
typedef unsigned int set_type;
typedef unsigned int element_type;
set_type find( element_type x, DISJ_SET S );
void initializeSet( DISJ_SET S );
void set_union( DISJ_SET S, set_type root1, set_type root2 );
void set_union_by_height( DISJ_SET S, set_type root1, set_type root2 );
/************************************************************************
* Supporting Functions
********************************************************************
* Written to make Graph work in alternate environments. When porting
* to other systems, modify these routines.
************************************************************************/
// Defined in GRAPH.C
int abs( int x );
long BetterRandom( long max, boolean randomize );
double fabs( double x );
char getch( void );
// Defined in PROCESS.GOC
void drawLine( int x1, int y1, int x2, int y2, EdgeState es,
ElementColor c, Cost cost );
void drawNode( int x, int y, ElementColor c, VertexState s, int n );
void ErrorMessage( unsigned char * errorString );
void FileReadEOL( unsigned fileHan );
unsigned FileReadInt( unsigned fileHan );
void FileWriteEOL( unsigned fileHan );
void FileWriteInt( unsigned fileHan, unsigned int i );
long TimeGetMinSec( void );
|
232b125ae21ebd0def265bb0e91e37dc0047dcf0
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/aarch64-linux-musl/bits/fenv.h
|
f2de6e6a172a512b9d434e8bfb6dba3c8baf5a20
|
[
"MIT"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 414
|
h
|
fenv.h
|
#define FE_INVALID 1
#define FE_DIVBYZERO 2
#define FE_OVERFLOW 4
#define FE_UNDERFLOW 8
#define FE_INEXACT 16
#define FE_ALL_EXCEPT 31
#define FE_TONEAREST 0
#define FE_DOWNWARD 0x800000
#define FE_UPWARD 0x400000
#define FE_TOWARDZERO 0xc00000
typedef unsigned int fexcept_t;
typedef struct {
unsigned int __fpcr;
unsigned int __fpsr;
} fenv_t;
#define FE_DFL_ENV ((const fenv_t *) -1)
|
40ff59c996c6cf6fcc3ff2d4adf8dce3649ebedf
|
9819c45475d0cd2dd4748c809e6db173c18bff37
|
/memory.c
|
04afc238c890abf2cf4f8f6cf9db2bb509d73677
|
[
"MIT"
] |
permissive
|
GrapheneOS/hardened_malloc
|
8fe46cbba026b7d0ad7825eb3111f0a9746a3978
|
2d302f7d85944bcaa1ce6419a4c51732f76daaa6
|
refs/heads/main
| 2023-08-23T21:51:23.120660
| 2023-06-10T18:58:33
| 2023-06-10T18:58:33
| 145,801,335
| 972
| 97
|
MIT
| 2023-09-04T19:37:50
| 2018-08-23T04:43:10
|
C
|
UTF-8
|
C
| false
| false
| 2,811
|
c
|
memory.c
|
#include <errno.h>
#include <sys/mman.h>
#ifdef LABEL_MEMORY
#include <sys/prctl.h>
#endif
#ifndef PR_SET_VMA
#define PR_SET_VMA 0x53564d41
#endif
#ifndef PR_SET_VMA_ANON_NAME
#define PR_SET_VMA_ANON_NAME 0
#endif
#include "memory.h"
#include "util.h"
void *memory_map(size_t size) {
void *p = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
if (unlikely(p == MAP_FAILED)) {
if (errno != ENOMEM) {
fatal_error("non-ENOMEM mmap failure");
}
return NULL;
}
return p;
}
bool memory_map_fixed(void *ptr, size_t size) {
void *p = mmap(ptr, size, PROT_NONE, MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0);
bool ret = p == MAP_FAILED;
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM MAP_FIXED mmap failure");
}
return ret;
}
bool memory_unmap(void *ptr, size_t size) {
bool ret = munmap(ptr, size);
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM munmap failure");
}
return ret;
}
static bool memory_protect_prot(void *ptr, size_t size, int prot, UNUSED int pkey) {
#ifdef USE_PKEY
bool ret = pkey_mprotect(ptr, size, prot, pkey);
#else
bool ret = mprotect(ptr, size, prot);
#endif
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM mprotect failure");
}
return ret;
}
bool memory_protect_ro(void *ptr, size_t size) {
return memory_protect_prot(ptr, size, PROT_READ, -1);
}
bool memory_protect_rw(void *ptr, size_t size) {
return memory_protect_prot(ptr, size, PROT_READ|PROT_WRITE, -1);
}
bool memory_protect_rw_metadata(void *ptr, size_t size) {
return memory_protect_prot(ptr, size, PROT_READ|PROT_WRITE, get_metadata_key());
}
#ifdef HAVE_COMPATIBLE_MREMAP
bool memory_remap(void *old, size_t old_size, size_t new_size) {
void *ptr = mremap(old, old_size, new_size, 0);
bool ret = ptr == MAP_FAILED;
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM mremap failure");
}
return ret;
}
bool memory_remap_fixed(void *old, size_t old_size, void *new, size_t new_size) {
void *ptr = mremap(old, old_size, new_size, MREMAP_MAYMOVE|MREMAP_FIXED, new);
bool ret = ptr == MAP_FAILED;
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM MREMAP_FIXED mremap failure");
}
return ret;
}
#endif
bool memory_purge(void *ptr, size_t size) {
int ret = madvise(ptr, size, MADV_DONTNEED);
if (unlikely(ret) && errno != ENOMEM) {
fatal_error("non-ENOMEM MADV_DONTNEED madvise failure");
}
return ret;
}
bool memory_set_name(UNUSED void *ptr, UNUSED size_t size, UNUSED const char *name) {
#ifdef LABEL_MEMORY
return prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, ptr, size, name);
#else
return false;
#endif
}
|
1859b2645d7865c93a26736e3c34ce2f90a0c61a
|
b9dc55919b29da24c24f8ee367c5618c9532f56f
|
/Code_source/Compiled/signal/sfz~/sfizz/library/external/st_audiofile/thirdparty/dr_libs/tests/external/miniaudio/tests/test_filtering/ma_test_filtering_hpf.c
|
39f5a2bf6fb31182fba73aa65fc41926b9739828
|
[
"BSD-3-Clause",
"MIT-0",
"ISC",
"BSL-1.0",
"Apache-2.0",
"LGPL-2.0-or-later",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LGPL-2.1-only",
"WTFPL",
"MIT",
"Unlicense",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
porres/pd-else
|
075e8b7ac7a78f442055fbd30d6602cae49c887e
|
b30e8c13c88bb9752c08f78514d64c6206d6678b
|
refs/heads/master
| 2023-08-18T22:26:31.120893
| 2023-08-18T00:46:59
| 2023-08-18T00:46:59
| 56,870,805
| 238
| 42
|
WTFPL
| 2023-09-12T15:55:56
| 2016-04-22T16:45:29
|
C
|
UTF-8
|
C
| false
| false
| 7,111
|
c
|
ma_test_filtering_hpf.c
|
ma_result hpf_init_decoder_and_encoder(const char* pInputFilePath, const char* pOutputFilePath, ma_format format, ma_decoder* pDecoder, ma_encoder* pEncoder)
{
return filtering_init_decoder_and_encoder(pInputFilePath, pOutputFilePath, format, 0, 0, pDecoder, pEncoder);
}
ma_result test_hpf1__by_format(const char* pInputFilePath, const char* pOutputFilePath, ma_format format)
{
ma_result result;
ma_decoder decoder;
ma_encoder encoder;
ma_hpf1_config hpfConfig;
ma_hpf1 hpf;
printf(" %s\n", pOutputFilePath);
result = hpf_init_decoder_and_encoder(pInputFilePath, pOutputFilePath, format, &decoder, &encoder);
if (result != MA_SUCCESS) {
return result;
}
hpfConfig = ma_hpf1_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000);
result = ma_hpf1_init(&hpfConfig, &hpf);
if (result != MA_SUCCESS) {
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return result;
}
for (;;) {
ma_uint8 tempIn[4096];
ma_uint8 tempOut[4096];
ma_uint64 tempCapIn = sizeof(tempIn) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 tempCapOut = sizeof(tempOut) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 framesToRead;
ma_uint64 framesJustRead;
framesToRead = ma_min(tempCapIn, tempCapOut);
framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead);
/* Filter */
ma_hpf1_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead);
/* Write to the WAV file. */
ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead);
if (framesJustRead < framesToRead) {
break;
}
}
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return MA_SUCCESS;
}
ma_result test_hpf1__f32(const char* pInputFilePath)
{
return test_hpf1__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf1_f32.wav", ma_format_f32);
}
ma_result test_hpf1__s16(const char* pInputFilePath)
{
return test_hpf1__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf1_s16.wav", ma_format_s16);
}
ma_result test_hpf2__by_format(const char* pInputFilePath, const char* pOutputFilePath, ma_format format)
{
ma_result result;
ma_decoder decoder;
ma_encoder encoder;
ma_hpf2_config hpfConfig;
ma_hpf2 hpf;
printf(" %s\n", pOutputFilePath);
result = hpf_init_decoder_and_encoder(pInputFilePath, pOutputFilePath, format, &decoder, &encoder);
if (result != MA_SUCCESS) {
return result;
}
hpfConfig = ma_hpf2_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 0);
result = ma_hpf2_init(&hpfConfig, &hpf);
if (result != MA_SUCCESS) {
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return result;
}
for (;;) {
ma_uint8 tempIn[4096];
ma_uint8 tempOut[4096];
ma_uint64 tempCapIn = sizeof(tempIn) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 tempCapOut = sizeof(tempOut) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 framesToRead;
ma_uint64 framesJustRead;
framesToRead = ma_min(tempCapIn, tempCapOut);
framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead);
/* Filter */
ma_hpf2_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead);
/* Write to the WAV file. */
ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead);
if (framesJustRead < framesToRead) {
break;
}
}
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return MA_SUCCESS;
}
ma_result test_hpf2__f32(const char* pInputFilePath)
{
return test_hpf2__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf2_f32.wav", ma_format_f32);
}
ma_result test_hpf2__s16(const char* pInputFilePath)
{
return test_hpf2__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf2_s16.wav", ma_format_s16);
}
ma_result test_hpf3__by_format(const char* pInputFilePath, const char* pOutputFilePath, ma_format format)
{
ma_result result;
ma_decoder decoder;
ma_encoder encoder;
ma_hpf_config hpfConfig;
ma_hpf hpf;
printf(" %s\n", pOutputFilePath);
result = hpf_init_decoder_and_encoder(pInputFilePath, pOutputFilePath, format, &decoder, &encoder);
if (result != MA_SUCCESS) {
return result;
}
hpfConfig = ma_hpf_config_init(decoder.outputFormat, decoder.outputChannels, decoder.outputSampleRate, 2000, 3);
result = ma_hpf_init(&hpfConfig, &hpf);
if (result != MA_SUCCESS) {
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return result;
}
for (;;) {
ma_uint8 tempIn[4096];
ma_uint8 tempOut[4096];
ma_uint64 tempCapIn = sizeof(tempIn) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 tempCapOut = sizeof(tempOut) / ma_get_bytes_per_frame(decoder.outputFormat, decoder.outputChannels);
ma_uint64 framesToRead;
ma_uint64 framesJustRead;
framesToRead = ma_min(tempCapIn, tempCapOut);
framesJustRead = ma_decoder_read_pcm_frames(&decoder, tempIn, framesToRead);
/* Filter */
ma_hpf_process_pcm_frames(&hpf, tempOut, tempIn, framesJustRead);
/* Write to the WAV file. */
ma_encoder_write_pcm_frames(&encoder, tempOut, framesJustRead);
if (framesJustRead < framesToRead) {
break;
}
}
ma_decoder_uninit(&decoder);
ma_encoder_uninit(&encoder);
return MA_SUCCESS;
}
ma_result test_hpf3__f32(const char* pInputFilePath)
{
return test_hpf3__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf3_f32.wav", ma_format_f32);
}
ma_result test_hpf3__s16(const char* pInputFilePath)
{
return test_hpf3__by_format(pInputFilePath, TEST_OUTPUT_DIR"/hpf3_s16.wav", ma_format_s16);
}
int test_entry__hpf(int argc, char** argv)
{
ma_result result;
ma_bool32 hasError = MA_FALSE;
const char* pInputFilePath;
if (argc < 2) {
printf("No input file.\n");
return -1;
}
pInputFilePath = argv[1];
result = test_hpf1__f32(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
result = test_hpf1__s16(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
result = test_hpf2__f32(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
result = test_hpf2__s16(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
result = test_hpf3__f32(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
result = test_hpf3__s16(pInputFilePath);
if (result != MA_SUCCESS) {
hasError = MA_TRUE;
}
if (hasError) {
return -1;
} else {
return 0;
}
}
|
69afd435400d848381c954443505f6e77716f73e
|
e7aad0b1c5d8907dbb52000c482c396d1b801751
|
/modules/cas_cache/volume/obj_blk.h
|
281446e6d3d208414accaec221887f7d72e2d3bc
|
[
"BSD-3-Clause",
"MIT"
] |
permissive
|
Open-CAS/open-cas-linux
|
c57d60f860702d7bc380c5d85cf502c0bf5e1bae
|
93334b4675afee8815f8ea12bb7297e0fd2a4195
|
refs/heads/master
| 2023-07-12T10:32:26.921455
| 2023-07-03T12:24:47
| 2023-07-03T12:24:47
| 178,356,155
| 202
| 84
|
BSD-3-Clause
| 2023-07-03T12:24:49
| 2019-03-29T07:37:15
|
Python
|
UTF-8
|
C
| false
| false
| 1,002
|
h
|
obj_blk.h
|
/*
* Copyright(c) 2012-2022 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __OBJ_BLK_H__
#define __OBJ_BLK_H__
#include "vol_block_dev_bottom.h"
#include "vol_block_dev_top.h"
struct cas_disk;
struct bd_object {
struct cas_disk *dsk;
struct block_device *btm_bd;
uint32_t expobj_valid : 1;
/*!< Bit indicates that exported object was created */
uint32_t expobj_locked : 1;
/*!< Non zero value indicates data exported object is locked */
uint32_t opened_by_bdev : 1;
/*!< Opened by supplying bdev manually */
atomic64_t pending_rqs;
/*!< This fields describes in flight IO requests */
struct workqueue_struct *btm_wq;
/*< Workqueue for I/O internally trigerred in bottom vol */
struct workqueue_struct *expobj_wq;
/*< Workqueue for I/O handled by top vol */
ocf_volume_t front_volume;
/*< Cache/core front volume */
};
static inline struct bd_object *bd_object(ocf_volume_t vol)
{
return ocf_volume_get_priv(vol);
}
#endif /* __OBJ_BLK_H__ */
|
38a6e95e915e6cb00b478b5b4a3d80cab09d2048
|
0b14d5cfe1b86910b0d42dace139343fbbc5359b
|
/tests/tools/decomp/func_cond_two_arg.c
|
11f494c67a61b12ffa07a9ef92865113b38dab3d
|
[
"Apache-2.0"
] |
permissive
|
lifting-bits/rellic
|
8e01d39f1240429633699d4045bf8d954f30ba47
|
6226304d78a142f61fa2866533383f111f9e8913
|
refs/heads/master
| 2023-08-19T11:01:16.515039
| 2023-07-28T08:21:07
| 2023-07-28T08:21:07
| 161,553,342
| 344
| 31
|
Apache-2.0
| 2023-07-28T08:21:09
| 2018-12-12T22:32:12
|
C++
|
UTF-8
|
C
| false
| false
| 130
|
c
|
func_cond_two_arg.c
|
unsigned f(int a, int b) { return a < b; }
int x = 0;
int y = 1;
int main(void) {
if (f(x, y)) {
return 1;
}
return 0;
}
|
6eed94a0dd8f505d176f4274a964b69812abb199
|
dae15b230f6a39e8451420b2dea61fb719f9ffdf
|
/example/socket/socket_util.h
|
d9935f1bea23d15bc67aa2c7b39056d50095e3fc
|
[
"BSD-3-Clause",
"GPL-1.0-or-later"
] |
permissive
|
OpenFastPath/ofp
|
2b97bbd152fd877cb8b2125128d6826c0f4491dd
|
6b48500af9752c7d51a290390751988759a8256d
|
refs/heads/master
| 2023-05-25T15:21:17.682339
| 2023-05-10T07:14:01
| 2023-05-10T11:01:16
| 37,121,923
| 367
| 146
|
BSD-3-Clause
| 2023-09-13T14:19:24
| 2015-06-09T09:08:43
|
C
|
UTF-8
|
C
| false
| false
| 410
|
h
|
socket_util.h
|
/* Copyright (c) 2014, ENEA Software AB
* Copyright (c) 2014, Nokia
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __SOCKET_UTIL_H__
#define __SOCKET_UTIL_H__
#include <getopt.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#define TEST_PORT 54321
#define IP4(a, b, c, d) (a|(b<<8)|(c<<16)|(d<<24))
#endif /*__SOCKET_UTIL_H__*/
|
578cb16f69d1a8417a7d1202b0881283aedbb368
|
1efd2de8bf77ec00eb2fcaf5749278495946d920
|
/src/object/obj_utils.c
|
8312c6719d89a3e344d9be32bf32c1c386093811
|
[
"BSD-2-Clause",
"BSD-2-Clause-Patent"
] |
permissive
|
daos-stack/daos
|
6f55bf3061fd830d5b8d28506e1295e2d3a27c38
|
ed5eed5df43a68571afe123132a743824c02637a
|
refs/heads/master
| 2023-08-31T21:43:37.606145
| 2023-08-31T16:38:00
| 2023-08-31T16:38:00
| 69,390,670
| 631
| 300
|
NOASSERTION
| 2023-09-14T18:55:15
| 2016-09-27T19:21:29
|
C
|
UTF-8
|
C
| false
| false
| 4,684
|
c
|
obj_utils.c
|
/**
* (C) Copyright 2018-2022 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
/**
* common helper functions for object
*/
#define DDSUBSYS DDFAC(object)
#include <daos_types.h>
#include "obj_internal.h"
static daos_size_t
daos_iod_len(daos_iod_t *iod)
{
daos_size_t len;
int i;
if (iod->iod_size == DAOS_REC_ANY)
return -1; /* unknown size */
len = 0;
if (iod->iod_type == DAOS_IOD_SINGLE) {
len += iod->iod_size;
} else {
if (iod->iod_recxs == NULL)
return 0;
for (i = 0, len = 0; i < iod->iod_nr; i++)
len += iod->iod_size * iod->iod_recxs[i].rx_nr;
}
return len;
}
daos_size_t
daos_iods_len(daos_iod_t *iods, int nr)
{
daos_size_t iod_length = 0;
int i;
for (i = 0; i < nr; i++) {
daos_size_t len = daos_iod_len(&iods[i]);
if (len == (daos_size_t)-1) /* unknown */
return -1;
iod_length += len;
}
return iod_length;
}
int
daos_iod_copy(daos_iod_t *dst, daos_iod_t *src)
{
int rc;
rc = daos_iov_copy(&dst->iod_name, &src->iod_name);
if (rc)
return rc;
dst->iod_type = src->iod_type;
dst->iod_size = src->iod_size;
dst->iod_nr = src->iod_nr;
dst->iod_recxs = src->iod_recxs;
return 0;
}
void
daos_iods_free(daos_iod_t *iods, int nr, bool need_free)
{
int i;
for (i = 0; i < nr; i++) {
daos_iov_free(&iods[i].iod_name);
if (iods[i].iod_recxs)
D_FREE(iods[i].iod_recxs);
}
if (need_free)
D_FREE(iods);
}
struct recx_rec {
daos_recx_t *rr_recx;
};
static int
recx_key_cmp(struct btr_instance *tins, struct btr_record *rec, d_iov_t *key)
{
struct recx_rec *r = umem_off2ptr(&tins->ti_umm, rec->rec_off);
daos_recx_t *key_recx = (daos_recx_t *)(key->iov_buf);
D_ASSERT(key->iov_len == sizeof(*key_recx));
if (DAOS_RECX_PTR_OVERLAP(r->rr_recx, key_recx)) {
D_ERROR("recx overlap between ["DF_U64", "DF_U64"], "
"["DF_U64", "DF_U64"].\n", r->rr_recx->rx_idx,
r->rr_recx->rx_nr, key_recx->rx_idx, key_recx->rx_nr);
return BTR_CMP_ERR;
}
/* will never return BTR_CMP_EQ */
D_ASSERT(r->rr_recx->rx_idx != key_recx->rx_idx);
if (r->rr_recx->rx_idx < key_recx->rx_idx)
return BTR_CMP_LT;
return BTR_CMP_GT;
}
static int
recx_rec_alloc(struct btr_instance *tins, d_iov_t *key, d_iov_t *val,
struct btr_record *rec, d_iov_t *val_out)
{
struct recx_rec *r;
umem_off_t roff;
daos_recx_t *key_recx = (daos_recx_t *)(key->iov_buf);
if (key_recx == NULL || key->iov_len != sizeof(*key_recx))
return -DER_INVAL;
roff = umem_zalloc(&tins->ti_umm, sizeof(*r));
if (UMOFF_IS_NULL(roff))
return tins->ti_umm.umm_nospc_rc;
r = umem_off2ptr(&tins->ti_umm, roff);
r->rr_recx = key_recx;
rec->rec_off = roff;
return 0;
}
static int
recx_rec_free(struct btr_instance *tins, struct btr_record *rec, void *args)
{
umem_free(&tins->ti_umm, rec->rec_off);
return 0;
}
static int
recx_rec_update(struct btr_instance *tins, struct btr_record *rec,
d_iov_t *key, d_iov_t *val, d_iov_t *val_out)
{
D_ASSERTF(0, "recx_rec_update should never be called.\n");
return 0;
}
static int
recx_rec_fetch(struct btr_instance *tins, struct btr_record *rec,
d_iov_t *key, d_iov_t *val)
{
D_ASSERTF(0, "recx_rec_fetch should never be called.\n");
return 0;
}
static void
recx_key_encode(struct btr_instance *tins, d_iov_t *key,
daos_anchor_t *anchor)
{
D_ASSERTF(0, "recx_key_encode should never be called.\n");
}
static void
recx_key_decode(struct btr_instance *tins, d_iov_t *key,
daos_anchor_t *anchor)
{
D_ASSERTF(0, "recx_key_decode should never be called.\n");
}
static char *
recx_rec_string(struct btr_instance *tins, struct btr_record *rec, bool leaf,
char *buf, int buf_len)
{
struct recx_rec *r = NULL;
daos_recx_t *recx;
if (!leaf) {
/* no record body on intermediate node */
snprintf(buf, buf_len, "--");
} else {
r = (struct recx_rec *)umem_off2ptr(&tins->ti_umm,
rec->rec_off);
recx = r->rr_recx;
snprintf(buf, buf_len, "rx_idx - "DF_U64" : rx_nr - "DF_U64,
recx->rx_idx, recx->rx_nr);
}
return buf;
}
static btr_ops_t recx_btr_ops = {
.to_key_cmp = recx_key_cmp,
.to_rec_alloc = recx_rec_alloc,
.to_rec_free = recx_rec_free,
.to_rec_fetch = recx_rec_fetch,
.to_rec_update = recx_rec_update,
.to_rec_string = recx_rec_string,
.to_key_encode = recx_key_encode,
.to_key_decode = recx_key_decode
};
int
obj_utils_init(void)
{
int rc;
rc = dbtree_class_register(DBTREE_CLASS_RECX, BTR_FEAT_DIRECT_KEY,
&recx_btr_ops);
if (rc != 0 && rc != -DER_EXIST) {
D_ERROR("failed to register DBTREE_CLASS_RECX: "DF_RC"\n",
DP_RC(rc));
D_GOTO(failed, rc);
}
return 0;
failed:
D_ERROR("Failed to initialize DAOS object utilities\n");
return rc;
}
void
obj_utils_fini(void)
{
}
|
19b7bd583cddb190803335eb8af19c02ae063800
|
eac80658fb291b4d449c37aa0767b1390be9ef53
|
/src/tracer/include/agz/tracer/create/camera.h
|
fe8505f104d6cf877cb82a5d9a74810e64ee495f
|
[
"MIT"
] |
permissive
|
AirGuanZ/Atrc
|
92e357a0b18bb8b9b2bbc1eb234f549aba6589ad
|
9bf8fdbb74affaa047bc40bb452c0d2c9bf0d121
|
refs/heads/master
| 2023-07-11T06:31:09.259287
| 2023-06-25T08:00:10
| 2023-06-25T08:00:10
| 147,777,386
| 484
| 30
|
MIT
| 2023-03-07T13:25:58
| 2018-09-07T05:56:14
|
C++
|
UTF-8
|
C
| false
| false
| 270
|
h
|
camera.h
|
#pragma once
#include <agz/tracer/core/camera.h>
AGZ_TRACER_BEGIN
RC<Camera> create_thin_lens_camera(
real film_aspect,
const FVec3 &pos,
const FVec3 &dst,
const FVec3 &up,
real fov,
real lens_radius,
real focal_distance);
AGZ_TRACER_END
|
47a71009f37e466db300ae942e1f4f11d84ee7e9
|
676acab8ff535019faff7da3afb8eecc3fa127f5
|
/target/coolfly/chuanyun_f2s/libraries/artosyn/ar1002_lib/Driver/Configure/Inc/memory_config.h
|
8da907fc15c9b99676dfbbea9b0259e77676c591
|
[
"Apache-2.0"
] |
permissive
|
Firmament-Autopilot/FMT-Firmware
|
f8c324577245bd7e91af436954b4ce9421acbb41
|
0212fe89820376bfbedaded519552f6b011a7b8a
|
refs/heads/master
| 2023-09-01T11:37:46.194145
| 2023-08-29T06:33:10
| 2023-08-29T06:33:10
| 402,557,689
| 351
| 143
|
Apache-2.0
| 2023-09-12T05:28:39
| 2021-09-02T20:42:56
|
C
|
UTF-8
|
C
| false
| false
| 15,505
|
h
|
memory_config.h
|
#ifndef __MEMORYCONFIG_H
#define __MEMORYCONFIG_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
//---------------------------------------------------------------------------------
//Board Memory Mapping
//---------------------------------------------------------------------------------
#define ITCM0_BASE 0x00000000
#define ITCM_BASE 0x00080000
#define QUAD_SPI_BASE 0x10000000
#define DTCM0_BASE 0x20000000
#define DTCM_BASE 0x20040000
#define SRAM_BASE 0x21000000
#define AHB2APB1_BASE 0x40000000
#define APB2APB2_BASE 0x41000000
#define AXI2APB_BASE 0x42000000
#define USB_BASE 0x43000000
#define CPU1_ITCM_BASE 0x44000000
#define CPU1_DTCM_BASE 0x44080000
#define CPU2_ITCM_BASE 0x44100000
#define CPU2_DTCM_BASE 0x44180000
#define DMA_BASE 0x45000000
#define LEON_SRAM_BASE 0x80000000
#define SDRAM_BASE 0x81000000
#define UART_APB_BASE 0xA0000000
#define VIDEO_APB_BASE 0xA0010000
#define WATCH_DOG_BASE 0xA0020000
#define GLOBAL_REGISTER2_BASE 0xA0030000
#define SPI_BASE 0xA0040000
#define I2C 0xA0050000
#define CPU3_ITCM_BASE 0xB0000000
#define CPU3_DTCM_BASE 0xB0080000
//====================================================================
//DMA addr mapping
//====================================================================
#define BASE_ADDR_DMA 0x45000000
#define ADDR_ChEnReg 0x3a0
#define ADDR_ClearBlock 0x340
#define ADDR_ClearSrcTran 0x348
#define ADDR_ClearDstTran 0x350
#define ADDR_ClearErr 0x358
#define ADDR_ClearTfr 0x338
#define ADDR_SAR0 0x000
#define ADDR_DAR0 0x008
#define ADDR_LLP0 0x010
#define ADDR_CTL0_LOW32 0x018
#define ADDR_CTL0_HIGH32 0x01c
#define ADDR_DmaCfgReg 0x398
#define ADDR_CFG0_LOW32 0x040
#define ADDR_CFG0_HIGH32 0x044
#define ADDR_MaskTfr 0x310
#define ADDR_MaskBlock 0x318
#define ADDR_MaskSrcTran 0x320
#define ADDR_MaskDstTran 0x328
#define ADDR_MaskErr 0x330
#define ADDR_StatusTfr 0x2e8 //read only
#define ADDR_StatusBlock 0x2f0 //read only
//====================================================================
//DMA default value
//====================================================================
#define DATA_ChEnReg 0x0000ffff //0x3a0
#define DATA_ClearBlock 0x00000001 //0x340
#define DATA_ClearSrcTran 0x00000001 //0x348
#define DATA_ClearDstTran 0x00000001 //0x350
#define DATA_ClearErr 0x00000001 //0x358
#define DATA_ClearTfr 0x00000001 //0x338
#define DATA_SAR0 0x00000004 //0x000
#define DATA_DAR0 0x00000000 //0x008
#define DATA_LLP0 0x00000000 //0x010
#define DATA_CTL0_LOW32 0x00804825 //0x018
#define DATA_CTL0_HIGH32 0x00001004 //0x01c
#define DATA_DmaCfgReg 0x00000001 //0x398
#define DATA_CFG0_LOW32 0x00800c00 //0x040
#define DATA_CFG0_HIGH32 0x00000000 //0x044
#define DATA_MaskTfr 0x00000101 //0x310
#define DATA_MaskBlock 0x00000101 //0x318
#define DATA_MaskSrcTran 0x00000000 //0x320
#define DATA_MaskDstTran 0x00000000 //0x328
#define DATA_MaskErr 0x00000101 //0x330
#define INTER_CORE_TRIGGER_REG_ADDR 0xA003004C
#define INTER_CORE_TRIGGER_IRQ0_BITMAP 0x00000001
#define INTER_CORE_TRIGGER_IRQ1_BITMAP 0x00000002
//====================================================================
//MOBILE STORAGE RELATED
//====================================================================
#define SDMMC_BASE 0x42000000
//====================================================================
//SRAM MEMORY MAP
// ------------------------------------------ <------ 0x21000000
// 8K video buff (cached)
// ------------------------------------------ <------ 0x21002000
// 8K video buff (cached)
// ------------------------------------------ <------ 0x21004000
// 256 Byte inter core message (non cached)
// ------------------------------------------ <------ 0x21004100
// 256 Byte module lock (non cached)
// ------------------------------------------ <------ 0x21004200
// 256 Byte module share (non cached)
// ------------------------------------------ <------ 0x21004300
// 512 Byte bb status (non cached)
// ------------------------------------------ <------ 0x21004500
// 1K bb uart for session 1 RX buffer (non cached)
// ------------------------------------------ <------ 0x21004900
// 1K bb uart for session 2 RX buffer (non cached)
// ------------------------------------------ <------ 0x21004D00
// 1K bb uart for session 3 RX buffer (non cached)
// ------------------------------------------ <------ 0x21005100
// 1K bb uart for session 4 RX buffer (non cached)
// ------------------------------------------ <------ 0x21005500
// 1K bb uart tx buffer (non cached)
// ------------------------------------------ <------ 0x21005900
// 2K bb uart high tx queue (non cached)
// ------------------------------------------ <------ 0x21006100
// 2K bb uart low tx queue (non cached)
// ------------------------------------------ <------ 0x21006900
// 512 Byte NV (non cached)
// ------------------------------------------ <------ 0x21006B00
// not occupied
// ------------------------------------------ <------ 0x21008000
// 4K System Configure (non cached)
// ------------------------------------------
//====================================================================
#define SRAM_BASE_ADDRESS 0x21000000 /* start address of SRAM */
#define SRAM_SIZE (64 * 1024) /* size of SRAM */
/* 8K video0 */
#define SRAM_BB_VIDEO_BUFFER_0_ST_ADDRESS SRAM_BASE_ADDRESS
#define SRAM_BB_VIDEO_BUFFER_0_SIZE 0x2000
/* 8K video1*/
#define SRAM_BB_VIDEO_BUFFER_1_ST_ADDRESS (SRAM_BB_VIDEO_BUFFER_0_ST_ADDRESS + SRAM_BB_VIDEO_BUFFER_0_SIZE)
#define SRAM_BB_VIDEO_BUFFER_1_SIZE 0x2000
/* 16K non-cache start, initialized by inter core module.*/
// 256 inter core message
#define SRAM_INTER_CORE_MSG_SHARE_MEMORY_ST_ADDRESS (SRAM_BB_VIDEO_BUFFER_1_ST_ADDRESS + SRAM_BB_VIDEO_BUFFER_1_SIZE)
#define SRAM_INTER_CORE_MSG_SHARE_MEMORY_SIZE 0x2B0
// 256 module lock
#define SRAM_MODULE_LOCK_ST_ADDRESS (SRAM_INTER_CORE_MSG_SHARE_MEMORY_ST_ADDRESS + SRAM_INTER_CORE_MSG_SHARE_MEMORY_SIZE)
#define SRAM_MODULE_LOCK_SIZE 0x20
#define SRAM_MODULE_LOCK_BB_UART_MUTEX_FLAG (SRAM_MODULE_LOCK_ST_ADDRESS)
#define SRAM_MODULE_LOCK_BB_UART_INIT_FLAG (SRAM_MODULE_LOCK_ST_ADDRESS + 4)
// 256 module share
#define SRAM_MODULE_SHARE_ST_ADDRESS (SRAM_MODULE_LOCK_ST_ADDRESS + SRAM_MODULE_LOCK_SIZE)
#define SRAM_MODULE_SHARE_SIZE 0x30
#define SRAM_MODULE_SHARE_PLL_INIT_FLAG (SRAM_MODULE_SHARE_ST_ADDRESS)
#define SRAM_MODULE_SHARE_PLL_CPU0CPU1 (SRAM_MODULE_SHARE_ST_ADDRESS + 4)
#define SRAM_MODULE_SHARE_PLL_CPU2 (SRAM_MODULE_SHARE_ST_ADDRESS + 8)
#define SRAM_MODULE_SHARE_AUDIO_PCM (SRAM_MODULE_SHARE_ST_ADDRESS + 12)
#define SRAM_MODULE_SHARE_AUDIO_RATE (SRAM_MODULE_SHARE_ST_ADDRESS + 16)
#define SRAM_MODULE_SHARE_AVSYNC_TICK (SRAM_MODULE_SHARE_ST_ADDRESS + 20)
#define SRAM_MODULE_WATCHDOG_BASE_TICK (SRAM_MODULE_SHARE_ST_ADDRESS + 24)
#define SRAM_MODULE_WATCHDOG_CPU1_TICK (SRAM_MODULE_SHARE_ST_ADDRESS + 28)
#define SRAM_MODULE_WATCHDOG_CPU2_TICK (SRAM_MODULE_SHARE_ST_ADDRESS + 32)
#define SRAM_MODULE_SHARE_POWER_OFFSET (SRAM_MODULE_SHARE_ST_ADDRESS + 36)
// 512 bb status
#define SRAM_BB_STATUS_SHARE_MEMORY_ST_ADDR (SRAM_MODULE_SHARE_ST_ADDRESS + SRAM_MODULE_SHARE_SIZE)
#define SRAM_BB_STATUS_SHARE_MEMORY_SIZE 0x200
// 1K bb uart com for each session RX buffer
#define SRAM_BB_UART_COM_SESSION_1_SHARE_MEMORY_ST_ADDR (SRAM_BB_STATUS_SHARE_MEMORY_ST_ADDR + SRAM_BB_STATUS_SHARE_MEMORY_SIZE)
#define SRAM_BB_UART_COM_SESSION_1_SHARE_MEMORY_SIZE 0x400
#define SRAM_BB_UART_COM_SESSION_2_SHARE_MEMORY_ST_ADDR (SRAM_BB_UART_COM_SESSION_1_SHARE_MEMORY_ST_ADDR + SRAM_BB_UART_COM_SESSION_1_SHARE_MEMORY_SIZE)
#define SRAM_BB_UART_COM_SESSION_2_SHARE_MEMORY_SIZE 0x400
#define SRAM_BB_UART_COM_SESSION_3_SHARE_MEMORY_ST_ADDR (SRAM_BB_UART_COM_SESSION_2_SHARE_MEMORY_ST_ADDR + SRAM_BB_UART_COM_SESSION_2_SHARE_MEMORY_SIZE)
#define SRAM_BB_UART_COM_SESSION_3_SHARE_MEMORY_SIZE 0x800
#define SRAM_BB_UART_COM_SESSION_4_SHARE_MEMORY_ST_ADDR (SRAM_BB_UART_COM_SESSION_3_SHARE_MEMORY_ST_ADDR + SRAM_BB_UART_COM_SESSION_3_SHARE_MEMORY_SIZE)
#define SRAM_BB_UART_COM_SESSION_4_SHARE_MEMORY_SIZE 0x400
//4K bb com TX buffer with High priority
#define SRAM_BB_COM_TX_HIGH_PRIO_SHARE_MEMORY_ST_ADDR (SRAM_BB_UART_COM_SESSION_4_SHARE_MEMORY_ST_ADDR + SRAM_BB_UART_COM_SESSION_4_SHARE_MEMORY_SIZE)
#define SRAM_BB_COM_TX_HIGH_PRIO_SHARE_MEMORY_SIZE 0x1000
//4K bb com TX buffer with Low priority
#define SRAM_BB_COM_TX_LOW_PRIO_SHARE_MEMORY_ST_ADDR (SRAM_BB_COM_TX_HIGH_PRIO_SHARE_MEMORY_ST_ADDR + SRAM_BB_COM_TX_HIGH_PRIO_SHARE_MEMORY_SIZE)
#define SRAM_BB_COM_TX_LOW_PRIO_SHARE_MEMORY_SIZE 0x1000
// 256 bytes, nonvolatile variable,stored in flash
#define SRAM_NV_MEMORY_ST_ADDR (SRAM_BB_COM_TX_LOW_PRIO_SHARE_MEMORY_ST_ADDR + SRAM_BB_COM_TX_LOW_PRIO_SHARE_MEMORY_SIZE)
#define SRAM_NV_MEMORY_SIZE (0x100)
// 256 byte for periperial mutex reserved
#define SRAM_PERIPERIAL_MUTEX_ADDR (SRAM_NV_MEMORY_ST_ADDR + SRAM_NV_MEMORY_SIZE)
#define SRAM_PERIPERIAL_MUTEX_SIZE 64
// 64 byte for bb data transmission buffer(grd -> sky)
#define SRAM_BB_DT_ST_ADDR (SRAM_PERIPERIAL_MUTEX_ADDR + SRAM_PERIPERIAL_MUTEX_SIZE)
#define SRAM_BB_DT_SIZE (64)
// 32 byte for share flag
#define SRAM_SHARE_FLAG_ST_ADDR (SRAM_BB_DT_ST_ADDR + SRAM_BB_DT_SIZE)
#define SRAM_SHARE_FLAG_SIZE (32)
#define SHARE_FLAG_RC_ID_OFFSET (0)
#define SHARE_FLAG_CHIP_ID_OFFSET (5)
// 32 byte for spi data trans
#define SRAM_SPI_DATA_TRANS_ST_ADDR (SRAM_SHARE_FLAG_ST_ADDR + SRAM_SHARE_FLAG_SIZE)
#define SRAM_SPI_DATA_TRANS_SIZE (32)
// 2K usr nv data buffer
#define SRAM_USR_NV_MEMORY_ST_ADDR (SRAM_SPI_DATA_TRANS_ST_ADDR + SRAM_SPI_DATA_TRANS_SIZE)
#define SRAM_USR_NV_MEMORY_SIZE (0x800)
// 32 byte for SKY or Grd select
#define SRAM_USR_GRD_SKY_SELECT_ST_ADDR (SRAM_USR_NV_MEMORY_ST_ADDR + SRAM_USR_NV_MEMORY_SIZE)
#define SRAM_USR_GRD_SKY_SELECT_SIZE (32)
#define SRAM_CONFIGURE_MEMORY_ST_ADDR (SRAM_BASE_ADDRESS + 0x8700)
#define SRAM_CONFIGURE_MEMORY_SIZE (0x1000)
#define CONFIGURE_INIT_FLAG_VALUE SRAM_CONFIGURE_MEMORY_ST_ADDR
#define GET_WORD_FROM_ANY_ADDR(any_addr) ((uint32_t)(*any_addr) | \
(((uint32_t)(*(any_addr+1))) << 8) | \
(((uint32_t)(*(any_addr+2))) << 16) | \
((uint32_t)((*(any_addr+3))) << 24))
// nonvolatile variable management struct
typedef struct
{
uint8_t u8_nvChg; // TRUE: some nv changed,FALSE: nv not change.
uint8_t u8_nvPrc; // TRUE: nv in writing flash,FLASE: not being write flash
uint8_t u8_nvUpd; // TRUE: nv in updating,FLASE: not being update
uint8_t u8_nvVld; // TRUE: nv is valid,FALSE: nv is invalid,and set to default value.
uint32_t u32_nvInitFlag; //0x23178546 nv have inited.
}STRU_NV_MNG;
// nonvolatile variable data struct
typedef struct
{
uint8_t u8_nvChk __attribute__ ((aligned (4))); //RC id data checksum,in bytes.
uint8_t u8_nvBbRcId[5] __attribute__ ((aligned (4))); //RC id
uint8_t u8_nvBbVtId[2] __attribute__ ((aligned (4))); //Vt id, use 2bytes
uint8_t u8_nvChipId[5] __attribute__ ((aligned (4))); //chip id
uint8_t u8_reserve[3] __attribute__ ((aligned (4))); //reserve
}STRU_NV_DATA;
typedef struct
{
STRU_NV_MNG st_nvMng;
STRU_NV_DATA st_nvDataUpd; // use to update nv in sram
STRU_NV_DATA st_nvDataPrc; // use to write nv to flash
}STRU_NV;
typedef struct
{
#define USR_NV_UNIT_MAX_DATA_LEN (130)
uint32_t addr; //
uint8_t valid; // 1:valid,0:invalid
uint8_t len; //
uint8_t data[USR_NV_UNIT_MAX_DATA_LEN];
}STRU_USR_NV_UNIT;
#define SPI_DATA_TRANS_MAX_LEN (25)
typedef struct
{
uint8_t init : 1;
uint8_t busy : 1;
uint8_t valid : 1;
uint8_t rsv : 5;
uint8_t max_len;
uint8_t real_len;
uint8_t data[SPI_DATA_TRANS_MAX_LEN];
}STRU_SPI_DATA_SAVE_FORMAT;
typedef struct
{
uint8_t valid : 1;
uint8_t len : 7;
uint8_t data[SPI_DATA_TRANS_MAX_LEN];
}STRU_SPI_DATA_TRANS_FORMAT;
#define SRAM_CF_LOG_BUFFER_ST_ADDR (SRAM_BASE_ADDRESS + SRAM_SIZE - (16 * 1024)) // 0x2100E000
/* 8K debug log buffer at the end of the SRAM. */
#define SRAM_DEBUG_LOG_BUFFER_ST_ADDR (SRAM_BASE_ADDRESS + SRAM_SIZE - (8 * 1024)) // 0x2100E000
// 512 debug log input buffer
#define SRAM_DEBUG_LOG_INPUT_BUFFER_ST_ADDR SRAM_DEBUG_LOG_BUFFER_ST_ADDR
#define SRAM_DEBUG_LOG_INPUT_BUFFER_SIZE 0x200
// 2.5K * 3 debug log output buffer
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_0 (SRAM_DEBUG_LOG_INPUT_BUFFER_ST_ADDR + SRAM_DEBUG_LOG_INPUT_BUFFER_SIZE)
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_END_ADDR_0 (SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_0 + 0xA00 - 1)
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_1 (SRAM_DEBUG_LOG_OUTPUT_BUFFER_END_ADDR_0 + 1)
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_END_ADDR_1 (SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_1 + 0xA00 - 1)
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_2 (SRAM_DEBUG_LOG_OUTPUT_BUFFER_END_ADDR_1 + 1)
#define SRAM_DEBUG_LOG_OUTPUT_BUFFER_END_ADDR_2 (SRAM_DEBUG_LOG_OUTPUT_BUFFER_ST_ADDR_2 + 0xA00 - 1)
//--------------------------------------------------------------------
// flash memory address space define here
//--------------------------------------------------------------------
#define NV_FLASH_USR_SIZE (64 * 1024)
#define NV_FLASH_USR_ADDR2 (4 * 1024 * 1024 - NV_FLASH_USR_SIZE)
#define NV_FLASH_USR_ADDR1 (NV_FLASH_USR_ADDR2 - NV_FLASH_USR_SIZE)
#define NV_FLASH_SIZE (4 * 1024)
#define NV_FLASH_ADDR2 (NV_FLASH_USR_ADDR1 - NV_FLASH_SIZE)
#define NV_FLASH_ADDR1 (NV_FLASH_ADDR2 - NV_FLASH_SIZE)
#define NV_FLASH_FCT_SIZE (32 * 1024)
#define NV_FLASH_FCT_START_ADDR_0 (NV_FLASH_ADDR1 - NV_FLASH_FCT_SIZE)
#define NV_FLASH_FCT_START_ADDR_1 (NV_FLASH_ADDR1 - NV_FLASH_FCT_SIZE / 2)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MEMORYCONFIG_H */
|
1d8f778760fcb2d2e10a80fb9c3c59576225393f
|
37137e3e5b5d739f911e1beb4d4cd6c485874256
|
/codes/CProgramming/ch02_C语言基本概念/ex_08.c
|
23a88f99adc8de6876fc73120b73b7c3656f0242
|
[] |
no_license
|
demon90s/CppStudy
|
3710f6188d880ec1633df8be79f8025453103c94
|
f3dc951b77bd031e7ffdef60218fe13fe34b7145
|
refs/heads/master
| 2021-12-01T14:42:34.162240
| 2021-11-27T16:10:21
| 2021-11-27T16:10:21
| 104,697,460
| 157
| 63
| null | null | null | null |
UTF-8
|
C
| false
| false
| 408
|
c
|
ex_08.c
|
/*
* 编写一个程序,要求用户输入一个美金数量,然后显示出加了5%税率的相应金额。格式如下所示:
* Enter a dollar amount: 100.00
* With tax added: 105.00
*/
#include <stdio.h>
#define TAX_RATE 0.05
int main()
{
float amount;
printf("Enter a dollar amount: ");
scanf("%f", &amount);
printf("With tax added: %.2f\n", amount + amount * TAX_RATE);
return 0;
}
|
c6efbd56c06ce7924bad62c10b5573254a6e7228
|
64d56bac24e169958ae028d2c3dad038634f7cf6
|
/src/sound/beep.h
|
3ef7c169e85f63997c47d1932055ff1f8ca2276d
|
[
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
septag/rizz
|
485b5a70dbbcaf429efb300c19b24b021d9c19e4
|
b52a7f8e1ccc4371a641ab67d5ca69df9d18fce7
|
refs/heads/master
| 2023-08-23T20:23:02.473579
| 2022-10-24T11:04:04
| 2022-10-24T11:04:04
| 178,582,437
| 820
| 45
|
BSD-2-Clause
| 2022-10-20T15:53:44
| 2019-03-30T16:19:41
|
C
|
UTF-8
|
C
| false
| false
| 14,429
|
h
|
beep.h
|
static const uint8_t k__snd_beep[1960] =
{
0x32, 0x30, 0x2e, 0x2c, 0x29, 0x28, 0x25, 0x24, 0x22, 0x1f, 0x1e, 0x1b, 0x1a, 0x18, 0x15, 0x14, // 20.,)(%$".......
0x11, 0x10, 0x0e, 0x0b, 0x0a, 0x07, 0x06, 0x04, 0x01, 0x00, 0xfd, 0xfc, 0xfa, 0xf8, 0xf6, 0xf3, // ................
0xf2, 0xef, 0xee, 0xeb, 0xea, 0xe8, 0xe5, 0xe4, 0xe1, 0xe1, 0xdf, 0xdc, 0xdb, 0xd8, 0xd7, 0xd5, // ................
0xd2, 0xd1, 0xcf, 0x18, 0x30, 0x2d, 0x2c, 0x29, 0x28, 0x25, 0x24, 0x21, 0x20, 0x1e, 0x1d, 0x1a, // ....0-,)(%$! ...
0x19, 0x16, 0x15, 0x12, 0x11, 0x0e, 0x0d, 0x0a, 0x09, 0x06, 0x05, 0x02, 0x01, 0xff, 0xfc, 0xfb, // ................
0xf9, 0xf6, 0xf5, 0xf2, 0xf0, 0xef, 0xec, 0xeb, 0xe8, 0xe7, 0xe4, 0xe3, 0xe1, 0xde, 0xdd, 0xda, // ................
0xd9, 0xd7, 0xd4, 0xd3, 0xd0, 0xcf, 0xf9, 0x31, 0x2e, 0x2d, 0x2a, 0x29, 0x27, 0x24, 0x23, 0x20, // .......1.-*)'$#
0x1f, 0x1d, 0x1a, 0x19, 0x16, 0x15, 0x13, 0x11, 0x0f, 0x0c, 0x0b, 0x08, 0x07, 0x05, 0x03, 0x01, // ................
0xff, 0xfc, 0xfb, 0xf8, 0xf7, 0xf5, 0xf4, 0xf1, 0xf0, 0xed, 0xec, 0xe9, 0xe8, 0xe5, 0xe4, 0xe1, // ................
0xe0, 0xdd, 0xdc, 0xda, 0xd8, 0xd6, 0xd3, 0xd2, 0xcf, 0xdb, 0x32, 0x2f, 0x2e, 0x2c, 0x29, 0x28, // ..........2/.,)(
0x25, 0x24, 0x22, 0x1f, 0x1e, 0x1b, 0x1a, 0x18, 0x15, 0x14, 0x11, 0x10, 0x0d, 0x0c, 0x09, 0x08, // %$".............
0x05, 0x04, 0x02, 0x00, 0xfe, 0xfc, 0xf9, 0xf8, 0xf5, 0xf4, 0xf1, 0xf0, 0xee, 0xec, 0xea, 0xe8, // ................
0xe5, 0xe4, 0xe1, 0xe0, 0xdd, 0xdc, 0xda, 0xd8, 0xd6, 0xd5, 0xd2, 0xd1, 0xce, 0x1f, 0x2f, 0x2e, // ............../.
0x2b, 0x2a, 0x27, 0x26, 0x23, 0x22, 0x1f, 0x1e, 0x1c, 0x1a, 0x18, 0x15, 0x14, 0x11, 0x10, 0x0f, // +*'&#"..........
0x0c, 0x0b, 0x08, 0x07, 0x04, 0x03, 0x00, 0xff, 0xfd, 0xfb, 0xf8, 0xf7, 0xf5, 0xf3, 0xf1, 0xee, // ................
0xed, 0xea, 0xe9, 0xe7, 0xe4, 0xe3, 0xe0, 0xdf, 0xdd, 0xda, 0xd9, 0xd6, 0xd5, 0xd2, 0xd1, 0xce, // ................
0x00, 0x30, 0x2f, 0x2c, 0x2b, 0x29, 0x26, 0x25, 0x23, 0x20, 0x1f, 0x1c, 0x1b, 0x18, 0x17, 0x14, // .0/,+)&%# ......
0x13, 0x10, 0x0e, 0x0d, 0x0b, 0x09, 0x06, 0x05, 0x02, 0x01, 0xfe, 0xfd, 0xfa, 0xf9, 0xf6, 0xf5, // ................
0xf3, 0xf1, 0xee, 0xed, 0xea, 0xea, 0xe7, 0xe6, 0xe4, 0xe1, 0xe0, 0xdd, 0xdc, 0xd9, 0xd8, 0xd5, // ................
0xd4, 0xd1, 0xcf, 0xe1, 0x30, 0x30, 0x2d, 0x2c, 0x29, 0x28, 0x26, 0x23, 0x22, 0x1f, 0x1e, 0x1b, // ....00-,)(&#"...
0x1a, 0x17, 0x16, 0x14, 0x11, 0x10, 0x0d, 0x0c, 0x09, 0x08, 0x06, 0x04, 0x01, 0x00, 0xfd, 0xfc, // ................
0xfa, 0xf7, 0xf6, 0xf3, 0xf2, 0xf0, 0xed, 0xec, 0xe9, 0xe8, 0xe5, 0xe4, 0xe1, 0xe0, 0xdd, 0xdc, // ................
0xda, 0xd7, 0xd6, 0xd4, 0xd1, 0xd0, 0xcd, 0x25, 0x2f, 0x2e, 0x2c, 0x29, 0x28, 0x25, 0x24, 0x22, // .......%/.,)(%$"
0x20, 0x1e, 0x1c, 0x1a, 0x18, 0x16, 0x14, 0x12, 0x10, 0x0e, 0x0c, 0x0a, 0x08, 0x06, 0x04, 0x02, // ...............
0x01, 0xff, 0xfd, 0xfb, 0xf9, 0xf6, 0xf5, 0xf2, 0xf1, 0xef, 0xec, 0xeb, 0xe8, 0xe7, 0xe5, 0xe2, // ................
0xe1, 0xdf, 0xdd, 0xdb, 0xd9, 0xd8, 0xd5, 0xd4, 0xd1, 0xd0, 0x06, 0x2f, 0x2e, 0x2b, 0x2a, 0x27, // .........../.+*'
0x26, 0x24, 0x21, 0x20, 0x1e, 0x1b, 0x1a, 0x17, 0x16, 0x14, 0x11, 0x11, 0x0e, 0x0d, 0x0b, 0x08, // &$! ............
0x07, 0x04, 0x03, 0x00, 0xff, 0xfc, 0xfb, 0xf9, 0xf7, 0xf6, 0xf4, 0xf1, 0xf0, 0xed, 0xec, 0xe9, // ................
0xe8, 0xe7, 0xe5, 0xe3, 0xe0, 0xdf, 0xdc, 0xdb, 0xd8, 0xd8, 0xd5, 0xd4, 0xd1, 0xe8, 0x2e, 0x2d, // ...............-
0x2b, 0x29, 0x26, 0x25, 0x23, 0x21, 0x20, 0x1e, 0x1b, 0x1a, 0x17, 0x16, 0x13, 0x12, 0x11, 0x0e, // +)&%#! .........
0x0d, 0x0a, 0x09, 0x06, 0x05, 0x02, 0x02, 0xff, 0xfd, 0xfc, 0xf9, 0xf8, 0xf6, 0xf5, 0xf2, 0xf1, // ................
0xef, 0xec, 0xec, 0xe9, 0xe8, 0xe5, 0xe4, 0xe2, 0xe1, 0xde, 0xdd, 0xdb, 0xd9, 0xd8, 0xd6, 0xd3, // ................
0xd2, 0x27, 0x2c, 0x2a, 0x28, 0x25, 0x25, 0x22, 0x21, 0x1f, 0x1d, 0x1a, 0x1a, 0x17, 0x16, 0x14, // .',*(%%"!.......
0x11, 0x11, 0x0e, 0x0d, 0x0a, 0x09, 0x07, 0x06, 0x04, 0x02, 0xff, 0xff, 0xfc, 0xfb, 0xf8, 0xf7, // ................
0xf5, 0xf4, 0xf1, 0xf0, 0xee, 0xed, 0xea, 0xe9, 0xe7, 0xe6, 0xe3, 0xe2, 0xe1, 0xde, 0xdd, 0xda, // ................
0xda, 0xd8, 0xd5, 0xd5, 0x0a, 0x2b, 0x28, 0x27, 0x26, 0x23, 0x22, 0x1f, 0x1f, 0x1c, 0x1b, 0x18, // .....+('&#".....
0x18, 0x15, 0x14, 0x11, 0x10, 0x0e, 0x0d, 0x0b, 0x09, 0x08, 0x05, 0x04, 0x02, 0x01, 0xfe, 0xfd, // ................
0xfc, 0xf9, 0xf8, 0xf6, 0xf5, 0xf3, 0xf0, 0xf0, 0xed, 0xec, 0xea, 0xe9, 0xe6, 0xe6, 0xe3, 0xe2, // ................
0xe0, 0xdf, 0xdc, 0xdc, 0xd9, 0xd8, 0xd6, 0xf0, 0x29, 0x28, 0x26, 0x25, 0x23, 0x20, 0x20, 0x1e, // ........)(&%# .
0x1b, 0x1b, 0x18, 0x17, 0x15, 0x14, 0x12, 0x10, 0x0f, 0x0c, 0x0b, 0x0a, 0x08, 0x06, 0x05, 0x02, // ................
0x01, 0xff, 0xfe, 0xfc, 0xfa, 0xf9, 0xf7, 0xf6, 0xf4, 0xf3, 0xf0, 0xef, 0xed, 0xec, 0xe9, 0xe8, // ................
0xe7, 0xe5, 0xe4, 0xe1, 0xe0, 0xdf, 0xdd, 0xdc, 0xda, 0xd8, 0xd7, 0x29, 0x26, 0x26, 0x24, 0x21, // ...........)&&$!
0x21, 0x1e, 0x1d, 0x1b, 0x1a, 0x18, 0x17, 0x15, 0x13, 0x12, 0x0f, 0x0f, 0x0c, 0x0b, 0x09, 0x08, // !...............
0x06, 0x05, 0x02, 0x02, 0x00, 0xff, 0xfd, 0xfb, 0xfa, 0xf8, 0xf6, 0xf5, 0xf3, 0xf2, 0xf0, 0xee, // ................
0xed, 0xeb, 0xe9, 0xe9, 0xe6, 0xe6, 0xe3, 0xe2, 0xe0, 0xdf, 0xdd, 0xdc, 0xda, 0xd9, 0x0e, 0x26, // ...............&
0x24, 0x23, 0x20, 0x20, 0x1e, 0x1d, 0x1b, 0x19, 0x18, 0x15, 0x15, 0x12, 0x12, 0x0f, 0x0e, 0x0d, // $# ............
0x0a, 0x0a, 0x08, 0x06, 0x05, 0x03, 0x02, 0x01, 0xfe, 0xfe, 0xfb, 0xfb, 0xf8, 0xf8, 0xf6, 0xf5, // ................
0xf3, 0xf2, 0xf0, 0xee, 0xed, 0xeb, 0xea, 0xe8, 0xe7, 0xe5, 0xe4, 0xe3, 0xe0, 0xe0, 0xdd, 0xdd, // ................
0xda, 0xf7, 0x25, 0x24, 0x22, 0x20, 0x1f, 0x1d, 0x1c, 0x1a, 0x19, 0x17, 0x15, 0x14, 0x12, 0x11, // ..%$" ..........
0x0f, 0x0e, 0x0c, 0x0b, 0x09, 0x08, 0x06, 0x06, 0x03, 0x03, 0x01, 0xff, 0xfe, 0xfc, 0xfb, 0xf9, // ................
0xf8, 0xf6, 0xf5, 0xf3, 0xf3, 0xf1, 0xef, 0xee, 0xec, 0xeb, 0xea, 0xe8, 0xe7, 0xe5, 0xe4, 0xe3, // ................
0xe1, 0xe0, 0xde, 0xdd, 0xe1, 0x23, 0x22, 0x20, 0x20, 0x1e, 0x1c, 0x1b, 0x19, 0x18, 0x16, 0x15, // .....#" .......
0x14, 0x13, 0x11, 0x10, 0x0e, 0x0d, 0x0b, 0x0a, 0x09, 0x07, 0x06, 0x04, 0x03, 0x02, 0x00, 0xfe, // ................
0xfd, 0xfb, 0xfb, 0xf8, 0xf8, 0xf6, 0xf4, 0xf4, 0xf1, 0xf1, 0xf0, 0xed, 0xed, 0xea, 0xea, 0xe9, // ................
0xe6, 0xe6, 0xe5, 0xe2, 0xe2, 0xe1, 0xde, 0xde, 0x11, 0x20, 0x20, 0x1f, 0x1c, 0x1c, 0x1a, 0x18, // ......... .....
0x18, 0x15, 0x15, 0x13, 0x11, 0x11, 0x0f, 0x0e, 0x0d, 0x0a, 0x0a, 0x08, 0x07, 0x05, 0x05, 0x02, // ................
0x02, 0x00, 0xff, 0xfd, 0xfd, 0xfb, 0xf9, 0xf9, 0xf6, 0xf6, 0xf5, 0xf2, 0xf2, 0xf0, 0xef, 0xee, // ................
0xec, 0xec, 0xe9, 0xe9, 0xe8, 0xe5, 0xe5, 0xe4, 0xe2, 0xe1, 0xdf, 0xfc, 0x1f, 0x1f, 0x1e, 0x1c, // ................
0x1a, 0x1a, 0x17, 0x17, 0x15, 0x14, 0x12, 0x12, 0x10, 0x0f, 0x0d, 0x0c, 0x0b, 0x09, 0x09, 0x06, // ................
0x06, 0x04, 0x03, 0x01, 0x01, 0x00, 0xfd, 0xfd, 0xfc, 0xfa, 0xf9, 0xf7, 0xf7, 0xf5, 0xf4, 0xf2, // ................
0xf2, 0xf0, 0xef, 0xee, 0xed, 0xeb, 0xea, 0xe8, 0xe8, 0xe6, 0xe6, 0xe4, 0xe2, 0xe2, 0xe9, 0x1f, // ................
0x1d, 0x1c, 0x1a, 0x1a, 0x19, 0x16, 0x16, 0x15, 0x13, 0x12, 0x10, 0x10, 0x0e, 0x0d, 0x0b, 0x0b, // ................
0x09, 0x09, 0x07, 0x05, 0x05, 0x03, 0x02, 0x00, 0x00, 0xfe, 0xfe, 0xfb, 0xfb, 0xfa, 0xf8, 0xf8, // ................
0xf5, 0xf5, 0xf3, 0xf3, 0xf1, 0xf1, 0xef, 0xed, 0xed, 0xeb, 0xeb, 0xea, 0xe8, 0xe6, 0xe6, 0xe4, // ................
0xe4, 0xe3, 0x11, 0x1d, 0x1a, 0x1a, 0x18, 0x18, 0x16, 0x15, 0x14, 0x13, 0x12, 0x10, 0x0f, 0x0d, // ................
0x0d, 0x0b, 0x0b, 0x09, 0x08, 0x07, 0x05, 0x05, 0x03, 0x03, 0x01, 0x00, 0xfe, 0xfe, 0xfc, 0xfc, // ................
0xfb, 0xfa, 0xf8, 0xf7, 0xf5, 0xf5, 0xf3, 0xf3, 0xf1, 0xf1, 0xef, 0xee, 0xec, 0xec, 0xea, 0xea, // ................
0xe8, 0xe8, 0xe6, 0xe6, 0xe5, 0x00, 0x1a, 0x1a, 0x19, 0x17, 0x17, 0x15, 0x15, 0x12, 0x12, 0x11, // ................
0x0f, 0x0f, 0x0e, 0x0c, 0x0c, 0x09, 0x09, 0x07, 0x07, 0x06, 0x04, 0x04, 0x03, 0x01, 0x01, 0xff, // ................
0xff, 0xfc, 0xfc, 0xfb, 0xf9, 0xf9, 0xf8, 0xf7, 0xf6, 0xf4, 0xf4, 0xf2, 0xf2, 0xf0, 0xf0, 0xef, // ................
0xed, 0xed, 0xeb, 0xeb, 0xe9, 0xe9, 0xe7, 0xe7, 0xf0, 0x1a, 0x18, 0x18, 0x16, 0x16, 0x15, 0x13, // ................
0x13, 0x11, 0x10, 0x0e, 0x0e, 0x0c, 0x0c, 0x0b, 0x0a, 0x09, 0x07, 0x07, 0x05, 0x05, 0x04, 0x03, // ................
0x02, 0x01, 0x00, 0xff, 0xfe, 0xfd, 0xfb, 0xfb, 0xf9, 0xf9, 0xf7, 0xf7, 0xf5, 0xf5, 0xf4, 0xf3, // ................
0xf2, 0xf1, 0xf0, 0xef, 0xee, 0xed, 0xec, 0xeb, 0xea, 0xe9, 0xe8, 0xe6, 0x12, 0x17, 0x17, 0x15, // ................
0x15, 0x13, 0x13, 0x11, 0x11, 0x10, 0x0e, 0x0e, 0x0c, 0x0c, 0x0b, 0x09, 0x09, 0x07, 0x07, 0x05, // ................
0x05, 0x03, 0x02, 0x02, 0x00, 0x00, 0xfe, 0xfe, 0xfd, 0xfc, 0xfc, 0xfb, 0xf9, 0xf9, 0xf7, 0xf7, // ................
0xf5, 0xf5, 0xf3, 0xf3, 0xf1, 0xf0, 0xf1, 0xef, 0xef, 0xed, 0xed, 0xec, 0xea, 0xea, 0xe8, 0x03, // ................
0x15, 0x16, 0x14, 0x14, 0x12, 0x12, 0x10, 0x10, 0x0e, 0x0e, 0x0d, 0x0b, 0x0b, 0x09, 0x08, 0x09, // ................
0x07, 0x07, 0x05, 0x05, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0xfe, 0xfe, 0xfc, 0xfc, 0xfa, 0xfa, // ................
0xf9, 0xf9, 0xf7, 0xf7, 0xf5, 0xf5, 0xf3, 0xf4, 0xf2, 0xf2, 0xf0, 0xf0, 0xef, 0xef, 0xee, 0xed, // ................
0xeb, 0xeb, 0xf4, 0x15, 0x13, 0x13, 0x12, 0x12, 0x10, 0x10, 0x0f, 0x0d, 0x0d, 0x0b, 0x0c, 0x0b, // ................
0x09, 0x09, 0x07, 0x07, 0x06, 0x06, 0x04, 0x04, 0x02, 0x02, 0x02, 0x00, 0x00, 0xfe, 0xfe, 0xfd, // ................
0xfc, 0xfc, 0xfb, 0xf9, 0xf9, 0xf8, 0xf8, 0xf7, 0xf6, 0xf5, 0xf5, 0xf4, 0xf2, 0xf2, 0xf1, 0xf1, // ................
0xef, 0xef, 0xef, 0xee, 0xec, 0xec, 0x10, 0x13, 0x12, 0x10, 0x11, 0x0f, 0x0f, 0x0e, 0x0c, 0x0d, // ................
0x0b, 0x0b, 0x09, 0x09, 0x08, 0x08, 0x07, 0x05, 0x05, 0x04, 0x04, 0x03, 0x01, 0x02, 0x00, 0x00, // ................
0xff, 0xfe, 0xfe, 0xfd, 0xfc, 0xfb, 0xfb, 0xf9, 0xf9, 0xf8, 0xf8, 0xf6, 0xf7, 0xf5, 0xf5, 0xf4, // ................
0xf3, 0xf3, 0xf2, 0xf1, 0xf1, 0xef, 0xf0, 0xef, 0xed, 0x05, 0x11, 0x11, 0x0f, 0x0f, 0x0e, 0x0e, // ................
0x0c, 0x0c, 0x0c, 0x0a, 0x0a, 0x09, 0x09, 0x07, 0x07, 0x07, 0x05, 0x05, 0x05, 0x03, 0x03, 0x01, // ................
0x02, 0x01, 0xff, 0x00, 0xff, 0xfd, 0xfe, 0xfc, 0xfc, 0xfc, 0xfa, 0xfa, 0xf9, 0xf9, 0xf7, 0xf8, // ................
0xf6, 0xf6, 0xf5, 0xf4, 0xf4, 0xf4, 0xf3, 0xf2, 0xf2, 0xf1, 0xf1, 0xf0, 0xfa, 0x10, 0x10, 0x0f, // ................
0x0e, 0x0e, 0x0c, 0x0c, 0x0b, 0x0b, 0x0a, 0x09, 0x09, 0x07, 0x08, 0x06, 0x06, 0x05, 0x05, 0x03, // ................
0x04, 0x02, 0x02, 0x02, 0x00, 0x01, 0xff, 0xff, 0xfe, 0xfd, 0xfd, 0xfc, 0xfc, 0xfc, 0xfa, 0xfa, // ................
0xf9, 0xf9, 0xf8, 0xf8, 0xf7, 0xf6, 0xf6, 0xf5, 0xf5, 0xf5, 0xf3, 0xf3, 0xf2, 0xf2, 0xf1, 0xf1, // ................
0x0e, 0x0e, 0x0e, 0x0c, 0x0c, 0x0c, 0x0a, 0x0b, 0x09, 0x09, 0x08, 0x08, 0x07, 0x07, 0x05, 0x06, // ................
0x04, 0x05, 0x04, 0x03, 0x03, 0x01, 0x02, 0x00, 0x01, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfc, 0xfd, // ................
0xfb, 0xfc, 0xfa, 0xfb, 0xfa, 0xf9, 0xf9, 0xf7, 0xf8, 0xf6, 0xf7, 0xf5, 0xf6, 0xf4, 0xf5, 0xf3, // ................
0xf4, 0xf2, 0xf3, 0x04, 0x0d, 0x0c, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x08, 0x09, 0x07, 0x07, 0x07, // ................
0x05, 0x06, 0x04, 0x05, 0x03, 0x04, 0x03, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0xff, 0xff, 0xff, // ................
0xfd, 0xfe, 0xfd, 0xfc, 0xfc, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xfa, 0xf8, 0xf9, 0xf7, 0xf8, 0xf6, // ................
0xf7, 0xf5, 0xf6, 0xf4, 0xf5, 0xf5, 0xfd, 0x0a, 0x0b, 0x09, 0x0a, 0x0a, 0x08, 0x09, 0x07, 0x08, // ................
0x06, 0x07, 0x05, 0x06, 0x04, 0x05, 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x02, 0x00, 0x01, 0xff, // ................
0x00, 0xfe, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfc, 0xfb, 0xfb, 0xfa, 0xfb, 0xf9, 0xfa, // ................
0xf8, 0xf9, 0xf8, 0xf8, 0xf7, 0xf7, 0xf6, 0xf6, 0xf6, 0xf7, 0x09, 0x0a, 0x08, 0x09, 0x08, 0x08, // ................
0x06, 0x07, 0x06, 0x06, 0x05, 0x05, 0x04, 0x05, 0x03, 0x04, 0x02, 0x03, 0x02, 0x02, 0x02, 0x01, // ................
0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfe, 0xfc, 0xfd, 0xfc, 0xfb, 0xfc, // ................
0xfb, 0xfa, 0xfb, 0xf9, 0xfa, 0xf9, 0xfa, 0xf9, 0xf9, 0xf8, 0xf8, 0xf7, 0xf8, 0x03, 0x08, 0x08, // ................
0x06, 0x07, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, // ................
0x01, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xfd, 0xfe, 0xfe, 0xfc, // ................
0xfd, 0xfc, 0xfd, 0xfc, 0xfc, 0xfb, 0xfc, 0xfa, 0xfb, 0xfb, 0xfa, 0xfa, 0xf9, 0xfa, 0xf9, 0xf9, // ................
0xfe, 0x07, 0x06, 0x05, 0x06, 0x04, 0x05, 0x04, 0x05, 0x03, 0x04, 0x04, 0x02, 0x03, 0x02, 0x03, // ................
0x01, 0x02, 0x02, 0x02, 0x00, 0x01, 0x00, 0x01, 0xff, 0xff, 0x00, 0xff, 0xff, 0xfe, 0xff, 0xff, // ................
0xff, 0xfd, 0xfe, 0xfd, 0xfe, 0xfc, 0xfc, 0xfd, 0xfc, 0xfd, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, // ................
0xfb, 0xfa, 0xfb, 0xfc, 0x05, 0x05, 0x04, 0x04, 0x03, 0x04, 0x03, 0x04, 0x03, 0x02, 0x03, 0x02, // ................
0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x00, 0x01, 0x00, 0x01, 0x01, 0xff, 0x00, 0xff, 0x00, 0x00, // ................
0xfe, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xfd, 0xfe, 0xfd, 0xfe, 0xfe, 0xfd, 0xfd, 0xfc, // ................
0xfd, 0xfd, 0xfc, 0xfd, 0xfc, 0xfd, 0xfb, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, // ................
0x01, 0x02, 0x01, 0x02, 0x01, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0xff, 0x00, 0x00, 0xff, // ................
0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfe, // ................
0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfe, 0xfd, 0xfe, 0xff, 0x02, 0x02, 0x02, 0x02, 0x01, // ................
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, // ................
0xff, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, // ................
0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, // ................
0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, // ........
};
|
d5db2e2757824094b3ce1379fe3a53b9d48dbad4
|
d9bde3779ade5dc45058447e7bd5c42b3971977a
|
/print-dvmrp.c
|
6d6d7c19b738409e14165ed4aa075f311c92fd8c
|
[
"BSD-3-Clause"
] |
permissive
|
the-tcpdump-group/tcpdump
|
60e6d0e705ba9a6e6c29d5d9782aff214ca4d61b
|
d6734adaa3aba89bf73eec03837b41aa064c8fb5
|
refs/heads/master
| 2023-08-14T06:11:14.949694
| 2023-08-13T07:57:20
| 2023-08-13T07:59:12
| 9,435,882
| 2,394
| 894
|
NOASSERTION
| 2023-09-12T08:53:57
| 2013-04-14T21:46:15
|
C
|
UTF-8
|
C
| false
| false
| 8,150
|
c
|
print-dvmrp.c
|
/*
* Copyright (c) 1995, 1996
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that: (1) source code distributions
* retain the above copyright notice and this paragraph in its entirety, (2)
* distributions including binary code include the above copyright notice and
* this paragraph in its entirety in the documentation or other materials
* provided with the distribution, and (3) all advertising materials mentioning
* features or use of this software display the following acknowledgement:
* ``This product includes software developed by the University of California,
* Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
* the University nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior
* written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
/* \summary: Distance Vector Multicast Routing Protocol printer */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "netdissect-stdinc.h"
#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
/*
* See: RFC 1075 and draft-ietf-idmr-dvmrp-v3
*
* DVMRP message types and flag values shamelessly stolen from
* mrouted/dvmrp.h.
*/
#define DVMRP_PROBE 1 /* for finding neighbors */
#define DVMRP_REPORT 2 /* for reporting some or all routes */
#define DVMRP_ASK_NEIGHBORS 3 /* sent by mapper, asking for a list */
/* of this router's neighbors */
#define DVMRP_NEIGHBORS 4 /* response to such a request */
#define DVMRP_ASK_NEIGHBORS2 5 /* as above, want new format reply */
#define DVMRP_NEIGHBORS2 6
#define DVMRP_PRUNE 7 /* prune message */
#define DVMRP_GRAFT 8 /* graft message */
#define DVMRP_GRAFT_ACK 9 /* graft acknowledgement */
static const struct tok dvmrp_msgtype_str[] = {
{ DVMRP_PROBE, "Probe" },
{ DVMRP_REPORT, "Report" },
{ DVMRP_ASK_NEIGHBORS, "Ask-neighbors(old)" },
{ DVMRP_NEIGHBORS, "Neighbors(old)" },
{ DVMRP_ASK_NEIGHBORS2, "Ask-neighbors2" },
{ DVMRP_NEIGHBORS2, "Neighbors2" },
{ DVMRP_PRUNE, "Prune" },
{ DVMRP_GRAFT, "Graft" },
{ DVMRP_GRAFT_ACK, "Graft-ACK" },
{ 0, NULL }
};
/*
* 'flags' byte values in DVMRP_NEIGHBORS2 reply.
*/
#define DVMRP_NF_TUNNEL 0x01 /* neighbors reached via tunnel */
#define DVMRP_NF_SRCRT 0x02 /* tunnel uses IP source routing */
#define DVMRP_NF_DOWN 0x10 /* kernel state of interface */
#define DVMRP_NF_DISABLED 0x20 /* administratively disabled */
#define DVMRP_NF_QUERIER 0x40 /* I am the subnet's querier */
static void print_probe(netdissect_options *, const u_char *, u_int);
static void print_report(netdissect_options *, const u_char *, u_int);
static void print_neighbors(netdissect_options *, const u_char *, u_int);
static void print_neighbors2(netdissect_options *, const u_char *, u_int, uint8_t, uint8_t);
void
dvmrp_print(netdissect_options *ndo,
const u_char *bp, u_int len)
{
u_char type;
uint8_t major_version, minor_version;
ndo->ndo_protocol = "dvmrp";
if (len < 8) {
ND_PRINT(" [length %u < 8]", len);
goto invalid;
}
type = GET_U_1(bp + 1);
/* Skip IGMP header */
bp += 8;
len -= 8;
ND_PRINT(" %s", tok2str(dvmrp_msgtype_str, "[type %u]", type));
switch (type) {
case DVMRP_PROBE:
if (ndo->ndo_vflag) {
print_probe(ndo, bp, len);
}
break;
case DVMRP_REPORT:
if (ndo->ndo_vflag > 1) {
print_report(ndo, bp, len);
}
break;
case DVMRP_NEIGHBORS:
print_neighbors(ndo, bp, len);
break;
case DVMRP_NEIGHBORS2:
/*
* extract version from IGMP group address field
*/
bp -= 4;
major_version = GET_U_1(bp + 3);
minor_version = GET_U_1(bp + 2);
bp += 4;
print_neighbors2(ndo, bp, len, major_version, minor_version);
break;
case DVMRP_PRUNE:
ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
ND_PRINT(" timer ");
unsigned_relts_print(ndo, GET_BE_U_4(bp + 8));
break;
case DVMRP_GRAFT:
ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
break;
case DVMRP_GRAFT_ACK:
ND_PRINT(" src %s grp %s", GET_IPADDR_STRING(bp), GET_IPADDR_STRING(bp + 4));
break;
}
return;
invalid:
nd_print_invalid(ndo);
}
static void
print_report(netdissect_options *ndo,
const u_char *bp,
u_int len)
{
uint32_t mask, origin;
u_int metric, done;
u_int i, width;
while (len > 0) {
if (len < 3) {
ND_PRINT(" [length %u < 3]", len);
goto invalid;
}
mask = (uint32_t)0xff << 24 | GET_U_1(bp) << 16 |
GET_U_1(bp + 1) << 8 | GET_U_1(bp + 2);
width = 1;
if (GET_U_1(bp))
width = 2;
if (GET_U_1(bp + 1))
width = 3;
if (GET_U_1(bp + 2))
width = 4;
ND_PRINT("\n\tMask %s", intoa(htonl(mask)));
bp += 3;
len -= 3;
do {
if (len < width + 1) {
ND_PRINT("\n\t [Truncated Report]");
goto invalid;
}
origin = 0;
for (i = 0; i < width; ++i) {
origin = origin << 8 | GET_U_1(bp);
bp++;
}
for ( ; i < 4; ++i)
origin <<= 8;
metric = GET_U_1(bp);
bp++;
done = metric & 0x80;
metric &= 0x7f;
ND_PRINT("\n\t %s metric %u", intoa(htonl(origin)),
metric);
len -= width + 1;
} while (!done);
}
return;
invalid:
nd_print_invalid(ndo);
}
static void
print_probe(netdissect_options *ndo,
const u_char *bp,
u_int len)
{
if (len < 4) {
ND_PRINT(" [full length %u < 4]", len);
goto invalid;
}
ND_PRINT(ndo->ndo_vflag > 1 ? "\n\t" : " ");
ND_PRINT("genid %u", GET_BE_U_4(bp));
if (ndo->ndo_vflag < 2)
return;
bp += 4;
len -= 4;
while (len > 0) {
if (len < 4) {
ND_PRINT("[remaining length %u < 4]", len);
goto invalid;
}
ND_PRINT("\n\tneighbor %s", GET_IPADDR_STRING(bp));
bp += 4; len -= 4;
}
return;
invalid:
nd_print_invalid(ndo);
}
static void
print_neighbors(netdissect_options *ndo,
const u_char *bp,
u_int len)
{
const u_char *laddr;
u_char metric;
u_char thresh;
int ncount;
while (len > 0) {
if (len < 7) {
ND_PRINT(" [length %u < 7]", len);
goto invalid;
}
laddr = bp;
bp += 4;
metric = GET_U_1(bp);
bp++;
thresh = GET_U_1(bp);
bp++;
ncount = GET_U_1(bp);
bp++;
len -= 7;
while (--ncount >= 0) {
if (len < 4) {
ND_PRINT(" [length %u < 4]", len);
goto invalid;
}
ND_PRINT(" [%s ->", GET_IPADDR_STRING(laddr));
ND_PRINT(" %s, (%u/%u)]",
GET_IPADDR_STRING(bp), metric, thresh);
bp += 4;
len -= 4;
}
}
return;
invalid:
nd_print_invalid(ndo);
}
static void
print_neighbors2(netdissect_options *ndo,
const u_char *bp,
u_int len, uint8_t major_version,
uint8_t minor_version)
{
const u_char *laddr;
u_char metric, thresh, flags;
int ncount;
ND_PRINT(" (v %u.%u):", major_version, minor_version);
while (len > 0) {
if (len < 8) {
ND_PRINT(" [length %u < 8]", len);
goto invalid;
}
laddr = bp;
bp += 4;
metric = GET_U_1(bp);
bp++;
thresh = GET_U_1(bp);
bp++;
flags = GET_U_1(bp);
bp++;
ncount = GET_U_1(bp);
bp++;
len -= 8;
while (--ncount >= 0 && len > 0) {
if (len < 4) {
ND_PRINT(" [length %u < 4]", len);
goto invalid;
}
ND_PRINT(" [%s -> ", GET_IPADDR_STRING(laddr));
ND_PRINT("%s (%u/%u", GET_IPADDR_STRING(bp),
metric, thresh);
if (flags & DVMRP_NF_TUNNEL)
ND_PRINT("/tunnel");
if (flags & DVMRP_NF_SRCRT)
ND_PRINT("/srcrt");
if (flags & DVMRP_NF_QUERIER)
ND_PRINT("/querier");
if (flags & DVMRP_NF_DISABLED)
ND_PRINT("/disabled");
if (flags & DVMRP_NF_DOWN)
ND_PRINT("/down");
ND_PRINT(")]");
bp += 4;
len -= 4;
}
if (ncount != -1) {
ND_PRINT(" [ncount %d]", ncount);
goto invalid;
}
}
return;
invalid:
nd_print_invalid(ndo);
}
|
764f4e21da67f1a1b0adf4358f80dcacd4f66d18
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/input/misc/gpio_axis.c
|
0acf4a576f53a2df35c0574dfda4019d6ebaa2e1
|
[
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 5,861
|
c
|
gpio_axis.c
|
/* drivers/input/misc/gpio_axis.c
*
* Copyright (C) 2007 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/gpio_event.h>
#include <linux/interrupt.h>
#include <linux/slab.h>
struct gpio_axis_state {
struct gpio_event_input_devs *input_devs;
struct gpio_event_axis_info *info;
uint32_t pos;
};
uint16_t gpio_axis_4bit_gray_map_table[] = {
[0x0] = 0x0, [0x1] = 0x1, /* 0000 0001 */
[0x3] = 0x2, [0x2] = 0x3, /* 0011 0010 */
[0x6] = 0x4, [0x7] = 0x5, /* 0110 0111 */
[0x5] = 0x6, [0x4] = 0x7, /* 0101 0100 */
[0xc] = 0x8, [0xd] = 0x9, /* 1100 1101 */
[0xf] = 0xa, [0xe] = 0xb, /* 1111 1110 */
[0xa] = 0xc, [0xb] = 0xd, /* 1010 1011 */
[0x9] = 0xe, [0x8] = 0xf, /* 1001 1000 */
};
uint16_t gpio_axis_4bit_gray_map(struct gpio_event_axis_info *info, uint16_t in)
{
return gpio_axis_4bit_gray_map_table[in];
}
uint16_t gpio_axis_5bit_singletrack_map_table[] = {
[0x10] = 0x00, [0x14] = 0x01, [0x1c] = 0x02, /* 10000 10100 11100 */
[0x1e] = 0x03, [0x1a] = 0x04, [0x18] = 0x05, /* 11110 11010 11000 */
[0x08] = 0x06, [0x0a] = 0x07, [0x0e] = 0x08, /* 01000 01010 01110 */
[0x0f] = 0x09, [0x0d] = 0x0a, [0x0c] = 0x0b, /* 01111 01101 01100 */
[0x04] = 0x0c, [0x05] = 0x0d, [0x07] = 0x0e, /* 00100 00101 00111 */
[0x17] = 0x0f, [0x16] = 0x10, [0x06] = 0x11, /* 10111 10110 00110 */
[0x02] = 0x12, [0x12] = 0x13, [0x13] = 0x14, /* 00010 10010 10011 */
[0x1b] = 0x15, [0x0b] = 0x16, [0x03] = 0x17, /* 11011 01011 00011 */
[0x01] = 0x18, [0x09] = 0x19, [0x19] = 0x1a, /* 00001 01001 11001 */
[0x1d] = 0x1b, [0x15] = 0x1c, [0x11] = 0x1d, /* 11101 10101 10001 */
};
uint16_t gpio_axis_5bit_singletrack_map(
struct gpio_event_axis_info *info, uint16_t in)
{
return gpio_axis_5bit_singletrack_map_table[in];
}
static void gpio_event_update_axis(struct gpio_axis_state *as, int report)
{
struct gpio_event_axis_info *ai = as->info;
int i;
int change;
uint16_t state = 0;
uint16_t pos;
uint16_t old_pos = as->pos;
for (i = ai->count - 1; i >= 0; i--)
state = (state << 1) | gpio_get_value(ai->gpio[i]);
pos = ai->map(ai, state);
if (ai->flags & GPIOEAF_PRINT_RAW)
pr_info("axis %d-%d raw %x, pos %d -> %d\n",
ai->type, ai->code, state, old_pos, pos);
if (report && pos != old_pos) {
if (ai->type == EV_REL) {
change = (ai->decoded_size + pos - old_pos) %
ai->decoded_size;
if (change > ai->decoded_size / 2)
change -= ai->decoded_size;
if (change == ai->decoded_size / 2) {
if (ai->flags & GPIOEAF_PRINT_EVENT)
pr_info("axis %d-%d unknown direction, "
"pos %d -> %d\n", ai->type,
ai->code, old_pos, pos);
change = 0; /* no closest direction */
}
if (ai->flags & GPIOEAF_PRINT_EVENT)
pr_info("axis %d-%d change %d\n",
ai->type, ai->code, change);
input_report_rel(as->input_devs->dev[ai->dev],
ai->code, change);
} else {
if (ai->flags & GPIOEAF_PRINT_EVENT)
pr_info("axis %d-%d now %d\n",
ai->type, ai->code, pos);
input_event(as->input_devs->dev[ai->dev],
ai->type, ai->code, pos);
}
input_sync(as->input_devs->dev[ai->dev]);
}
as->pos = pos;
}
static irqreturn_t gpio_axis_irq_handler(int irq, void *dev_id)
{
struct gpio_axis_state *as = dev_id;
gpio_event_update_axis(as, 1);
return IRQ_HANDLED;
}
int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
struct gpio_event_info *info, void **data, int func)
{
int ret;
int i;
int irq;
struct gpio_event_axis_info *ai;
struct gpio_axis_state *as;
ai = container_of(info, struct gpio_event_axis_info, info);
if (func == GPIO_EVENT_FUNC_SUSPEND) {
for (i = 0; i < ai->count; i++)
disable_irq(gpio_to_irq(ai->gpio[i]));
return 0;
}
if (func == GPIO_EVENT_FUNC_RESUME) {
for (i = 0; i < ai->count; i++)
enable_irq(gpio_to_irq(ai->gpio[i]));
return 0;
}
if (func == GPIO_EVENT_FUNC_INIT) {
*data = as = kmalloc(sizeof(*as), GFP_KERNEL);
if (as == NULL) {
ret = -ENOMEM;
goto err_alloc_axis_state_failed;
}
as->input_devs = input_devs;
as->info = ai;
if (ai->dev >= input_devs->count) {
pr_err("gpio_event_axis: bad device index %d >= %d "
"for %d:%d\n", ai->dev, input_devs->count,
ai->type, ai->code);
ret = -EINVAL;
goto err_bad_device_index;
}
input_set_capability(input_devs->dev[ai->dev],
ai->type, ai->code);
if (ai->type == EV_ABS) {
input_set_abs_params(input_devs->dev[ai->dev], ai->code,
0, ai->decoded_size - 1, 0, 0);
}
for (i = 0; i < ai->count; i++) {
ret = gpio_request(ai->gpio[i], "gpio_event_axis");
if (ret < 0)
goto err_request_gpio_failed;
ret = gpio_direction_input(ai->gpio[i]);
if (ret < 0)
goto err_gpio_direction_input_failed;
ret = irq = gpio_to_irq(ai->gpio[i]);
if (ret < 0)
goto err_get_irq_num_failed;
ret = request_irq(irq, gpio_axis_irq_handler,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING,
"gpio_event_axis", as);
if (ret < 0)
goto err_request_irq_failed;
}
gpio_event_update_axis(as, 0);
return 0;
}
ret = 0;
as = *data;
for (i = ai->count - 1; i >= 0; i--) {
free_irq(gpio_to_irq(ai->gpio[i]), as);
err_request_irq_failed:
err_get_irq_num_failed:
err_gpio_direction_input_failed:
gpio_free(ai->gpio[i]);
err_request_gpio_failed:
;
}
err_bad_device_index:
kfree(as);
*data = NULL;
err_alloc_axis_state_failed:
return ret;
}
|
23e01bb16929b307f27685ab00dcee98ebe26817
|
095e5e86c931af6553996b0a128c07d94b38cbca
|
/hpy/debug/src/debug_ctx.c
|
fbcb0b21e5ea49ea57c48a91e9a0a3f36d701c37
|
[
"MIT"
] |
permissive
|
hpyproject/hpy
|
1dc9e5e855fa006b1728703c5925addbb43cf792
|
8310a762d78e3412464b1869959a77da013e6307
|
refs/heads/master
| 2023-09-03T21:18:17.273371
| 2023-07-24T07:26:14
| 2023-07-24T07:26:14
| 196,559,763
| 681
| 41
|
MIT
| 2023-07-24T07:26:16
| 2019-07-12T10:27:56
|
Python
|
UTF-8
|
C
| false
| false
| 22,779
|
c
|
debug_ctx.c
|
#include <string.h>
#include <stdio.h>
#include "debug_internal.h"
#include "autogen_debug_ctx_init.h"
#include "hpy/runtime/ctx_funcs.h"
#if defined(_MSC_VER)
# include <malloc.h> /* for alloca() */
#endif
static struct _HPyContext_s g_debug_ctx = {
.name = "HPy Debug Mode ABI",
._private = NULL,
.abi_version = HPY_ABI_VERSION,
};
static HPyDebugCtxInfo *init_ctx_info(HPyContext *dctx, HPyContext *uctx) {
HPyDebugCtxInfo *ctx_info = (HPyDebugCtxInfo*) malloc(sizeof(HPyDebugCtxInfo));
if (ctx_info == NULL) {
HPyErr_NoMemory(uctx);
return NULL;
}
dctx->_private = ctx_info;
ctx_info->magic_number = HPY_DEBUG_CTX_INFO_MAGIC;
ctx_info->is_valid = false;
return ctx_info;
}
static HPyContext *copy_debug_context(HPyContext *dctx) {
HPyDebugInfo *info = get_info(dctx);
HPyContext *new_dcxt = (HPyContext *) malloc(sizeof(struct _HPyContext_s));
memcpy(new_dcxt, dctx, sizeof(struct _HPyContext_s));
HPyDebugCtxInfo *ctx_info = init_ctx_info(new_dcxt, info->uctx);
if (ctx_info == NULL) {
return NULL;
}
ctx_info->info = info;
return new_dcxt;
}
static int init_dctx_cache(HPyContext *dctx, HPyDebugInfo *info) {
// We prefill the context cache to keep it simple
for (size_t i = 0; i < HPY_DEBUG_CTX_CACHE_SIZE; ++i) {
info->dctx_cache[i] = copy_debug_context(dctx);
if (info->dctx_cache[i] == NULL) {
return -1;
}
}
info->dctx_cache_current_index = 0;
return 0;
}
// NOTE: at the moment this function assumes that uctx is always the
// same. If/when we migrate to a system in which we can have multiple
// independent contexts, this function should ensure to create a different
// debug wrapper for each of them.
int hpy_debug_ctx_init(HPyContext *dctx, HPyContext *uctx)
{
if (dctx->_private != NULL) {
// already initialized
assert(get_info(dctx)->uctx == uctx); // sanity check
return 0;
}
// initialize debug_info
// XXX: currently we never free this malloc and
// the allocations of the cached debug contexts
HPyDebugCtxInfo *ctx_info = init_ctx_info(dctx, uctx);
if (ctx_info == NULL) {
return -1;
}
ctx_info->is_valid = true;
HPyDebugInfo *info = ctx_info->info = malloc(sizeof(HPyDebugInfo));
if (info == NULL) {
HPyErr_NoMemory(uctx);
return -1;
}
info->magic_number = HPY_DEBUG_INFO_MAGIC;
info->uctx = uctx;
info->current_generation = 0;
info->uh_on_invalid_handle = HPy_NULL;
info->closed_handles_queue_max_size = DEFAULT_CLOSED_HANDLES_QUEUE_MAX_SIZE;
info->protected_raw_data_max_size = DEFAULT_PROTECTED_RAW_DATA_MAX_SIZE;
info->handle_alloc_stacktrace_limit = 0;
info->protected_raw_data_size = 0;
DHQueue_init(&info->open_handles);
DHQueue_init(&info->closed_handles);
DHQueue_init(&info->closed_builder);
debug_ctx_init_fields(dctx, uctx);
if (init_dctx_cache(dctx, info) != 0) {
return -1;
}
return 0;
}
HPyContext * hpy_debug_get_ctx(HPyContext *uctx)
{
HPyContext *dctx = &g_debug_ctx;
if (uctx == dctx) {
HPy_FatalError(uctx, "hpy_debug_get_ctx: expected an universal ctx, "
"got a debug ctx");
}
if (hpy_debug_ctx_init(dctx, uctx) < 0) {
HPyErr_SetString(uctx, uctx->h_SystemError, "Could not create debug context");
return NULL;
}
return dctx;
}
void hpy_debug_set_ctx(HPyContext *dctx)
{
g_debug_ctx = *dctx;
}
HPy hpy_debug_open_handle(HPyContext *dctx, HPy uh)
{
return DHPy_open(dctx, uh);
}
HPy hpy_debug_unwrap_handle(HPyContext *dctx, HPy dh)
{
return DHPy_unwrap(dctx, dh);
}
void hpy_debug_close_handle(HPyContext *dctx, HPy dh)
{
DHPy_close(dctx, dh);
}
// this function is supposed to be called from gdb: it tries to determine
// whether a handle is universal or debug by looking at the last bit
extern struct _HPyContext_s g_universal_ctx;
#ifndef _MSC_VER
__attribute__((unused))
#endif
static void hpy_magic_dump(HPy h)
{
int universal = h._i & 1;
if (universal)
fprintf(stderr, "\nUniversal handle\n");
else
fprintf(stderr, "\nDebug handle\n");
#ifdef _MSC_VER
fprintf(stderr, "raw value: %Ix (%Id)\n", h._i, h._i);
#else
fprintf(stderr, "raw value: %lx (%ld)\n", h._i, h._i);
#endif
if (universal)
_HPy_Dump(&g_universal_ctx, h);
else {
DebugHandle *dh = as_DebugHandle(h);
#ifdef _MSC_VER
fprintf(stderr, "dh->uh: %Ix\n", dh->uh._i);
#else
fprintf(stderr, "dh->uh: %lx\n", dh->uh._i);
#endif
_HPy_Dump(&g_universal_ctx, dh->uh);
}
}
HPyContext* hpy_debug_get_next_dctx_from_cache(HPyContext *dctx) {
HPyDebugInfo *info = get_info(dctx);
HPyContext *result = info->dctx_cache[info->dctx_cache_current_index];
info->dctx_cache_current_index =
(info->dctx_cache_current_index + 1) % HPY_DEBUG_CTX_CACHE_SIZE;
return result;
}
void report_invalid_debug_context() {
fputs("Error: Wrong HPy Context!\n", stderr);
char *stacktrace;
create_stacktrace(&stacktrace, HPY_DEBUG_DEFAULT_STACKTRACE_LIMIT);
if (stacktrace != NULL) {
fputs(stacktrace, stderr);
}
fflush(stderr);
abort();
}
/* ~~~~~~~~~~ manually written wrappers ~~~~~~~~~~ */
void debug_ctx_Close(HPyContext *dctx, DHPy dh)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
UHPy uh = DHPy_unwrap(dctx, dh);
DHPy_close(dctx, dh);
// Note: this may run __del__
get_ctx_info(dctx)->is_valid = false;
HPy_Close(get_info(dctx)->uctx, uh);
get_ctx_info(dctx)->is_valid = true;
}
static void *
protect_and_associate_data_ptr(DHPy h, void *ptr, HPy_ssize_t data_size)
{
DebugHandle *handle = as_DebugHandle(h);
void *new_ptr;
if (ptr != NULL)
{
new_ptr = raw_data_copy(ptr, data_size, true);
handle->associated_data = new_ptr;
handle->associated_data_size = data_size;
return new_ptr;
}
else
{
handle->associated_data = NULL;
handle->associated_data_size = 0;
}
return NULL;
}
const char *debug_ctx_Unicode_AsUTF8AndSize(HPyContext *dctx, DHPy h, HPy_ssize_t *size)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
const char *ptr = HPyUnicode_AsUTF8AndSize(get_info(dctx)->uctx, DHPy_unwrap(dctx, h), size);
HPy_ssize_t data_size = 0;
if (ptr != NULL) {
data_size = size != NULL ? *size + 1 : (HPy_ssize_t) strlen(ptr) + 1;
}
return (const char *)protect_and_associate_data_ptr(h, (void *)ptr, data_size);
}
const char *debug_ctx_Bytes_AsString(HPyContext *dctx, DHPy h)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh = DHPy_unwrap(dctx, h);
const char *ptr = HPyBytes_AsString(uctx, uh);
HPy_ssize_t data_size = 0;
if (ptr != NULL) {
// '+ 1' accountd for the implicit null byte termination
data_size = HPyBytes_Size(uctx, uh) + 1;
}
return (const char *)protect_and_associate_data_ptr(h, (void *)ptr, data_size);
}
const char *debug_ctx_Bytes_AS_STRING(HPyContext *dctx, DHPy h)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh = DHPy_unwrap(dctx, h);
const char *ptr = HPyBytes_AS_STRING(uctx, uh);
HPy_ssize_t data_size = 0;
if (ptr != NULL) {
// '+ 1' accountd for the implicit null byte termination
data_size = HPyBytes_GET_SIZE(uctx, uh) + 1;
}
return (const char *)protect_and_associate_data_ptr(h, (void *)ptr, data_size);
}
DHPy debug_ctx_Tuple_FromArray(HPyContext *dctx, DHPy dh_items[], HPy_ssize_t n)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
UHPy *uh_items = (UHPy *)alloca(n * sizeof(UHPy));
for(int i=0; i<n; i++) {
uh_items[i] = DHPy_unwrap(dctx, dh_items[i]);
}
return DHPy_open(dctx, HPyTuple_FromArray(get_info(dctx)->uctx, uh_items, n));
}
DHPy debug_ctx_Type_GenericNew(HPyContext *dctx, DHPy dh_type, const DHPy *dh_args,
HPy_ssize_t nargs, DHPy dh_kw)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
UHPy uh_type = DHPy_unwrap(dctx, dh_type);
UHPy uh_kw = DHPy_unwrap(dctx, dh_kw);
UHPy *uh_args = (UHPy *)alloca(nargs * sizeof(UHPy));
for(int i=0; i<nargs; i++) {
uh_args[i] = DHPy_unwrap(dctx, dh_args[i]);
}
get_ctx_info(dctx)->is_valid = false;
HPy uh_result = HPyType_GenericNew(get_info(dctx)->uctx, uh_type, uh_args,
nargs, uh_kw);
DHPy dh_result = DHPy_open(dctx, uh_result);
get_ctx_info(dctx)->is_valid = true;
return dh_result;
}
DHPy debug_ctx_Type_FromSpec(HPyContext *dctx, HPyType_Spec *spec, HPyType_SpecParam *dparams)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
// dparams might contain some hidden DHPy: we need to manually unwrap them.
if (dparams != NULL) {
// count the params
HPy_ssize_t n = 1;
for (HPyType_SpecParam *p = dparams; p->kind != 0; p++) {
n++;
}
HPyType_SpecParam *uparams = (HPyType_SpecParam *)alloca(n * sizeof(HPyType_SpecParam));
for (HPy_ssize_t i=0; i<n; i++) {
uparams[i].kind = dparams[i].kind;
uparams[i].object = DHPy_unwrap(dctx, dparams[i].object);
}
return DHPy_open(dctx, HPyType_FromSpec(get_info(dctx)->uctx, spec, uparams));
}
return DHPy_open(dctx, HPyType_FromSpec(get_info(dctx)->uctx, spec, NULL));
}
static const char *get_builtin_shape_name(HPyType_BuiltinShape shape)
{
#define SHAPE_NAME(SHAPE) \
case SHAPE: \
return #SHAPE; \
/* Note: we use a switch here because then the compiler will warn us about
missing cases if shapes are added to enum 'HPyType_BuiltinShape' */
switch (shape)
{
SHAPE_NAME(HPyType_BuiltinShape_Legacy)
SHAPE_NAME(HPyType_BuiltinShape_Object)
SHAPE_NAME(HPyType_BuiltinShape_Type)
SHAPE_NAME(HPyType_BuiltinShape_Long)
SHAPE_NAME(HPyType_BuiltinShape_Float)
SHAPE_NAME(HPyType_BuiltinShape_Unicode)
SHAPE_NAME(HPyType_BuiltinShape_Tuple)
SHAPE_NAME(HPyType_BuiltinShape_List)
}
return "<unknown shape>";
#undef SHAPE_NAME
}
#define MAKE_debug_ctx_AsStruct(SHAPE) \
void *debug_ctx_AsStruct_##SHAPE(HPyContext *dctx, DHPy dh) \
{ \
if (!get_ctx_info(dctx)->is_valid) { \
report_invalid_debug_context(); \
} \
HPyContext *uctx = get_info(dctx)->uctx; \
UHPy uh = DHPy_unwrap(dctx, dh); \
UHPy uh_type = HPy_Type(uctx, uh); \
HPyType_BuiltinShape actual_shape = _HPyType_GetBuiltinShape(uctx, uh_type); \
HPy_Close(uctx, uh_type); \
if (actual_shape != HPyType_BuiltinShape_##SHAPE) { \
const char *actual_shape_name = get_builtin_shape_name(actual_shape); \
static const char *fmt = "Invalid usage of _HPy_AsStruct_%s" \
". Expected shape HPyType_BuiltinShape_%s but got %s"; \
size_t nbuf = strlen(fmt) + 2 * strlen(#SHAPE) + strlen(actual_shape_name) + 1; \
char *buf = (char *)alloca(nbuf); \
snprintf(buf, nbuf, fmt, #SHAPE, #SHAPE, actual_shape_name); \
HPy_FatalError(uctx, buf); \
} \
return _HPy_AsStruct_##SHAPE(uctx, uh); \
}
MAKE_debug_ctx_AsStruct(Legacy)
MAKE_debug_ctx_AsStruct(Object)
MAKE_debug_ctx_AsStruct(Type)
MAKE_debug_ctx_AsStruct(Long)
MAKE_debug_ctx_AsStruct(Float)
MAKE_debug_ctx_AsStruct(Unicode)
MAKE_debug_ctx_AsStruct(Tuple)
MAKE_debug_ctx_AsStruct(List)
/* ~~~ debug mode implementation of HPyTracker ~~~
This is a bit special and it's worth explaining what is going on.
The HPyTracker functions need their own debug mode implementation because
the debug mode needs to be aware of when a DHPy is closed, for the same
reason for why we need debug_ctx_Close.
So, in theory here we should have our own implementation of a
DebugHPyTracker which manages a growable list of handles, and which calls
debug_ctx_Close at the end. But, we ALREADY have the logic available, it's
implemented in ctx_tracker.c.
So, here we simply implement debug_ctx_Tracker_* in terms of ctx_Tracker_*:
but note that it's VERY different than what the autogen wrappers do:
- the autogen wrappers DHPy_unwrap() all the handles before calling the
"super" implementation. Here we don't, we pass the DHPys directly.
- the autogen wrappers pass the uctx to the "super" implementation, here
we pass the dctx.
Conceptually, it is equivalent to just have our own implementation of a
growable array, but by using this trick we can easily reuse the existing
code.
It is better understood if you think of what happens on PyPy (or any other
universal implementation): normally, on PyPy HPyTracker_Add calls PyPy's
own implementation (see interp_tracker.py). But when in debug mode,
HPyTracker_Add will call the ctx_Tracker_Add defined in ctx_tracker.c,
completely bypassing PyPy's own tracker (which is fine). Incidentally, this
also means that if PyPy wants to bundle the debug mode, it also needs to
compile ctx_tracker.c
*/
HPyTracker debug_ctx_Tracker_New(HPyContext *dctx, HPy_ssize_t size)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
return ctx_Tracker_New(dctx, size);
}
int debug_ctx_Tracker_Add(HPyContext *dctx, HPyTracker ht, DHPy dh)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
return ctx_Tracker_Add(dctx, ht, dh);
}
void debug_ctx_Tracker_ForgetAll(HPyContext *dctx, HPyTracker ht)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
ctx_Tracker_ForgetAll(dctx, ht);
}
void debug_ctx_Tracker_Close(HPyContext *dctx, HPyTracker ht)
{
if (!get_ctx_info(dctx)->is_valid) {
report_invalid_debug_context();
}
// note: ctx_Tracker_Close internally calls HPy_Close() to close each
// handle: since we are calling it with the dctx, it will end up calling
// debug_ctx_Close, which is exactly what we need to properly record that
// the handles were closed.
ctx_Tracker_Close(dctx, ht);
}
HPyListBuilder debug_ctx_ListBuilder_New(HPyContext *dctx, HPy_ssize_t size)
{
return DHPyListBuilder_open(dctx, HPyListBuilder_New(get_info(dctx)->uctx, size));
}
void debug_ctx_ListBuilder_Set(HPyContext *dctx, HPyListBuilder builder, HPy_ssize_t index, DHPy h_item)
{
HPyListBuilder_Set(get_info(dctx)->uctx, DHPyListBuilder_unwrap(dctx, builder), index, DHPy_unwrap(dctx, h_item));
}
DHPy debug_ctx_ListBuilder_Build(HPyContext *dctx, HPyListBuilder dh_builder)
{
DebugBuilderHandle *handle = DHPyListBuilder_as_DebugBuilderHandle(dh_builder);
if (handle == NULL)
return HPy_NULL;
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh_result = HPyListBuilder_Build(uctx, DHPyListBuilder_unwrap(dctx, dh_builder));
DHPy_builder_handle_close(dctx, handle);
return DHPy_open(dctx, uh_result);
}
void debug_ctx_ListBuilder_Cancel(HPyContext *dctx, HPyListBuilder dh_builder)
{
DebugBuilderHandle *handle = DHPyListBuilder_as_DebugBuilderHandle(dh_builder);
if (handle == NULL)
return;
HPyContext *uctx = get_info(dctx)->uctx;
HPyListBuilder_Cancel(uctx, DHPyListBuilder_unwrap(dctx, dh_builder));
DHPy_builder_handle_close(dctx, handle);
}
HPyTupleBuilder debug_ctx_TupleBuilder_New(HPyContext *dctx, HPy_ssize_t size)
{
return DHPyTupleBuilder_open(dctx, HPyTupleBuilder_New(get_info(dctx)->uctx, size));
}
void debug_ctx_TupleBuilder_Set(HPyContext *dctx, HPyTupleBuilder builder, HPy_ssize_t index, DHPy h_item)
{
HPyTupleBuilder_Set(get_info(dctx)->uctx, DHPyTupleBuilder_unwrap(dctx, builder), index, DHPy_unwrap(dctx, h_item));
}
DHPy debug_ctx_TupleBuilder_Build(HPyContext *dctx, HPyTupleBuilder dh_builder)
{
DebugBuilderHandle *handle = DHPyTupleBuilder_as_DebugBuilderHandle(dh_builder);
if (handle == NULL)
return HPy_NULL;
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh_result = HPyTupleBuilder_Build(uctx, DHPyTupleBuilder_unwrap(dctx, dh_builder));
DHPy_builder_handle_close(dctx, handle);
return DHPy_open(dctx, uh_result);
}
void debug_ctx_TupleBuilder_Cancel(HPyContext *dctx, HPyTupleBuilder dh_builder)
{
DebugBuilderHandle *handle = DHPyTupleBuilder_as_DebugBuilderHandle(dh_builder);
if (handle == NULL)
return;
HPyContext *uctx = get_info(dctx)->uctx;
HPyTupleBuilder_Cancel(uctx, DHPyTupleBuilder_unwrap(dctx, dh_builder));
DHPy_builder_handle_close(dctx, handle);
}
/*
However, we don't want to raise an exception if you pass a non-type,
because the CPython version (PyObject_TypeCheck) always succeed and it
would be too easy to forget to check the return value. We just raise a
fatal error instead.
*/
int debug_ctx_TypeCheck(HPyContext *dctx, DHPy obj, DHPy type)
{
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh_obj = DHPy_unwrap(dctx, obj);
UHPy uh_type = DHPy_unwrap(dctx, type);
assert(!HPy_IsNull(uh_obj));
assert(!HPy_IsNull(uh_type));
if (!HPy_TypeCheck(uctx, uh_type, uctx->h_TypeType)) {
HPy_FatalError(uctx, "HPy_TypeCheck arg 2 must be a type");
}
return HPy_TypeCheck(uctx, uh_obj, uh_type);
}
int32_t debug_ctx_ContextVar_Get(HPyContext *dctx, DHPy context_var, DHPy default_value, DHPy *result)
{
HPyContext *uctx = get_info(dctx)->uctx;
UHPy uh_context_var = DHPy_unwrap(dctx, context_var);
UHPy uh_default_value = DHPy_unwrap(dctx, default_value);
UHPy uh_result;
assert(!HPy_IsNull(uh_context_var));
int32_t ret = HPyContextVar_Get(uctx, uh_context_var, uh_default_value, &uh_result);
if (ret < 0) {
*result = HPy_NULL;
return ret;
}
*result = DHPy_open(dctx, uh_result);
return ret;
}
const char *debug_ctx_Type_GetName(HPyContext *dctx, DHPy type)
{
HPyDebugCtxInfo *ctx_info;
HPyContext *uctx;
UHPy uh_type;
HPy_ssize_t n_name;
ctx_info = get_ctx_info(dctx);
if (!ctx_info->is_valid) {
report_invalid_debug_context();
}
uh_type = DHPy_unwrap(dctx, type);
uctx = ctx_info->info->uctx;
if (!HPy_TypeCheck(uctx, uh_type, uctx->h_TypeType)) {
HPy_FatalError(uctx, "HPyType_GetName arg must be a type");
}
ctx_info->is_valid = false;
const char *name = HPyType_GetName(uctx, uh_type);
ctx_info->is_valid = true;
n_name = strlen(name);
return (const char *)protect_and_associate_data_ptr(type, (void *)name, n_name);
}
int debug_ctx_Type_IsSubtype(HPyContext *dctx, DHPy sub, DHPy type)
{
HPyDebugCtxInfo *ctx_info;
HPyContext *uctx;
int res;
ctx_info = get_ctx_info(dctx);
if (!ctx_info->is_valid) {
report_invalid_debug_context();
}
UHPy uh_sub = DHPy_unwrap(dctx, sub);
uctx = ctx_info->info->uctx;
if (!HPy_TypeCheck(uctx, uh_sub, uctx->h_TypeType)) {
HPy_FatalError(uctx, "HPyType_IsSubtype arg 1 must be a type");
}
UHPy uh_type = DHPy_unwrap(dctx, type);
if (!HPy_TypeCheck(uctx, uh_type, uctx->h_TypeType)) {
HPy_FatalError(uctx, "HPyType_IsSubtype arg 2 must be a type");
}
ctx_info->is_valid = false;
res = HPyType_IsSubtype(uctx, uh_sub, uh_type);
ctx_info->is_valid = true;
return res;
}
DHPy debug_ctx_Unicode_Substring(HPyContext *dctx, DHPy str, HPy_ssize_t start, HPy_ssize_t end)
{
HPyDebugCtxInfo *ctx_info;
HPyContext *uctx;
ctx_info = get_ctx_info(dctx);
if (!ctx_info->is_valid) {
report_invalid_debug_context();
}
HPy uh_str = DHPy_unwrap(dctx, str);
uctx = ctx_info->info->uctx;
if (!HPy_TypeCheck(uctx, uh_str, uctx->h_UnicodeType)) {
HPy_FatalError(uctx, "HPyUnicode_Substring arg 1 must be a Unicode object");
}
ctx_info->is_valid = false;
HPy universal_result = HPyUnicode_Substring(uctx, uh_str, start, end);
ctx_info->is_valid = true;
return DHPy_open(dctx, universal_result);
}
DHPy debug_ctx_Call(HPyContext *dctx, DHPy dh_callable, const DHPy *dh_args, size_t nargs, DHPy dh_kwnames)
{
HPyDebugCtxInfo *ctx_info;
HPyContext *uctx;
ctx_info = get_ctx_info(dctx);
if (!ctx_info->is_valid) {
report_invalid_debug_context();
}
UHPy uh_callable = DHPy_unwrap(dctx, dh_callable);
UHPy uh_kwnames = DHPy_unwrap(dctx, dh_kwnames);
uctx = ctx_info->info->uctx;
HPy_ssize_t nkw;
if (!HPy_IsNull(uh_kwnames)) {
if (!HPyTuple_Check(uctx, uh_kwnames)) {
HPy_FatalError(uctx, "HPy_Call arg 'kwnames' must be a tuple object or HPy_NULL");
}
nkw = HPy_Length(uctx, uh_kwnames);
if (nkw < 0) {
return HPy_NULL;
}
} else {
nkw = 0;
}
const size_t n_all_args = nargs + nkw;
UHPy *uh_args = (UHPy *)alloca(n_all_args * sizeof(UHPy));
for(size_t i=0; i < n_all_args; i++) {
uh_args[i] = DHPy_unwrap(dctx, dh_args[i]);
}
ctx_info->is_valid = false;
DHPy dh_result = DHPy_open(dctx, HPy_Call(uctx, uh_callable, uh_args, nargs, uh_kwnames));
ctx_info->is_valid = true;
return dh_result;
}
DHPy debug_ctx_CallMethod(HPyContext *dctx, DHPy dh_name, const DHPy *dh_args, size_t nargs, DHPy dh_kwnames)
{
HPyDebugCtxInfo *ctx_info;
HPyContext *uctx;
ctx_info = get_ctx_info(dctx);
if (!ctx_info->is_valid) {
report_invalid_debug_context();
}
UHPy uh_name = DHPy_unwrap(dctx, dh_name);
UHPy uh_kwnames = DHPy_unwrap(dctx, dh_kwnames);
uctx = ctx_info->info->uctx;
HPy_ssize_t nkw;
if (!HPy_IsNull(uh_kwnames)) {
if (!HPyTuple_Check(uctx, uh_kwnames)) {
HPy_FatalError(uctx, "HPy_CallMethod arg 'kwnames' must be a tuple object or HPy_NULL");
}
nkw = HPy_Length(uctx, uh_kwnames);
if (nkw < 0) {
return HPy_NULL;
}
} else {
nkw = 0;
}
const size_t n_all_args = nargs + nkw;
UHPy *uh_args = (UHPy *)alloca(n_all_args * sizeof(UHPy));
for(size_t i=0; i < n_all_args; i++) {
uh_args[i] = DHPy_unwrap(dctx, dh_args[i]);
}
ctx_info->is_valid = false;
DHPy dh_result = DHPy_open(dctx, HPy_CallMethod(uctx, uh_name, uh_args, nargs, uh_kwnames));
ctx_info->is_valid = true;
return dh_result;
}
|
dde7320d06fd09391124cd75de2524c5b1b4247a
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/evbarm/gumstix/gxio.c
|
4dfc46270a4ffdde4a705f0f90b39a5998fa8535
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 15,510
|
c
|
gxio.c
|
/* $NetBSD: gxio.c,v 1.29 2022/10/29 13:10:25 jmcneill Exp $ */
/*
* Copyright (C) 2005, 2006, 2007 WIDE Project and SOUM Corporation.
* All rights reserved.
*
* Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM
* Corporation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the project nor the name of SOUM Corporation
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE PROJECT and SOUM CORPORATION ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT AND SOUM CORPORATION
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: gxio.c,v 1.29 2022/10/29 13:10:25 jmcneill Exp $");
#include "opt_cputypes.h"
#include "opt_gumstix.h"
#include "opt_gxio.h"
#include <sys/param.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <machine/bootconfig.h>
#if defined(CPU_XSCALE)
#include <arm/xscale/pxa2x0cpu.h>
#endif
#include <arm/xscale/pxa2x0reg.h>
#include <arm/xscale/pxa2x0var.h>
#include <arm/xscale/pxa2x0_gpio.h>
#include <evbarm/gumstix/gumstixreg.h>
#include <evbarm/gumstix/gumstixvar.h>
#include "ioconf.h"
#include "locators.h"
struct gxioconf {
const char *name;
void (*config)(void);
};
#if defined(GUMSTIX)
static int gxiomatch(device_t, cfdata_t, void *);
static void gxioattach(device_t, device_t, void *);
static int gxiosearch(device_t, cfdata_t, const int *, void *);
static int gxioprint(void *, const char *);
CFATTACH_DECL_NEW(gxio, sizeof(struct gxio_softc),
gxiomatch, gxioattach, NULL, NULL);
#endif
void gxio_config(void);
void gxio_config_expansion(const char *);
#if defined(GUMSTIX)
static void basix_config(void);
static void cfstix_config(void);
static void etherstix_config(void);
static void netcf_config(void);
static void netcf_vx_config(void);
static void netduommc_config(void);
static void netduo_config(void);
static void netmicrosd_config(void);
static void netwifimicrosd_config(void);
static void netmmc_config(void);
static void wifistix_config(void);
static void wifistix_cf_config(void);
#endif
#if defined(CPU_XSCALE_PXA250)
static struct pxa2x0_gpioconf pxa255dep_gpioconf[] = {
/* Bluetooth module configuration */
{ 7, GPIO_OUT | GPIO_SET }, /* power on */
{ 12, GPIO_ALT_FN_1_OUT }, /* 32kHz out. required by SingleStone */
/* AC97 configuration */
{ 29, GPIO_ALT_FN_1_IN }, /* SDATA_IN0 */
/* FFUART configuration */
{ 35, GPIO_ALT_FN_1_IN }, /* CTS */
{ 41, GPIO_ALT_FN_2_OUT }, /* RTS */
#ifndef GXIO_BLUETOOTH_ON_HWUART
/* BTUART configuration */
{ 44, GPIO_ALT_FN_1_IN }, /* BTCTS */
{ 45, GPIO_ALT_FN_2_OUT }, /* BTRTS */
#else
/* HWUART configuration */
{ 42, GPIO_ALT_FN_3_IN }, /* HWRXD */
{ 43, GPIO_ALT_FN_3_OUT }, /* HWTXD */
{ 44, GPIO_ALT_FN_3_IN }, /* HWCTS */
{ 45, GPIO_ALT_FN_3_OUT }, /* HWRTS */
#endif
#ifndef GXIO_BLUETOOTH_ON_HWUART
/* HWUART configuration */
{ 48, GPIO_ALT_FN_1_OUT }, /* HWTXD */
{ 49, GPIO_ALT_FN_1_IN }, /* HWRXD */
{ 50, GPIO_ALT_FN_1_IN }, /* HWCTS */
{ 51, GPIO_ALT_FN_1_OUT }, /* HWRTS */
#endif
{ -1 }
};
#endif
#if defined(CPU_XSCALE_PXA270)
static struct pxa2x0_gpioconf verdexdep_gpioconf[] = {
/* Bluetooth module configuration */
{ 9, GPIO_ALT_FN_3_OUT }, /* CHOUT<0> */
{ 12, GPIO_OUT | GPIO_SET },
/* LCD configuration */
{ 17, GPIO_IN }, /* backlight on */
/* FFUART configuration */
{ 34, GPIO_ALT_FN_1_IN }, /* FFRXD */
{ 39, GPIO_ALT_FN_2_OUT }, /* FFTXD */
/* BTUART configuration */
{ 42, GPIO_ALT_FN_1_IN }, /* BTRXD */
{ 43, GPIO_ALT_FN_2_OUT }, /* BTTXD */
{ 44, GPIO_ALT_FN_1_IN }, /* BTCTS */
{ 45, GPIO_ALT_FN_2_OUT }, /* BTRTS */
/* AC97 configuration */
{ 29, GPIO_ALT_FN_1_IN }, /* SDATA_IN0 */
{ -1 }
};
#endif
static const struct gxioconf gxioconflist[] = {
#if defined(GUMSTIX)
{ "basix", basix_config },
{ "cfstix", cfstix_config },
{ "etherstix", etherstix_config },
{ "netcf", netcf_config },
{ "netcf-vx", netcf_vx_config },
{ "netduo-mmc", netduommc_config },
{ "netduo", netduo_config },
{ "netmicrosd", netmicrosd_config },
{ "netmicrosd-vx", netmicrosd_config },
{ "netwifimicrosd", netwifimicrosd_config },
{ "netmmc", netmmc_config },
{ "netpro-vx", netwifimicrosd_config },
{ "wifistix-cf", wifistix_cf_config },
{ "wifistix", wifistix_config },
#endif
{ NULL }
};
int gxpcic_gpio_reset;
struct gxpcic_slot_irqs gxpcic_slot_irqs[2] = { { 0, -1, -1 }, { 0, -1, -1 } };
#if defined(GUMSTIX)
/* ARGSUSED */
static int
gxiomatch(device_t parent, cfdata_t match, void *aux)
{
struct pxaip_attach_args *pxa = aux;
bus_space_tag_t iot = &pxa2x0_bs_tag;
bus_space_handle_t ioh;
if (strcmp(pxa->pxa_name, match->cf_name) != 0 ||
pxa->pxa_addr != PXAIPCF_ADDR_DEFAULT)
return 0;
if (bus_space_map(iot,
PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &ioh))
return 0;
bus_space_unmap(iot, ioh, PXA2X0_MEMCTL_SIZE);
/* nothing */
return 1;
}
/* ARGSUSED */
static void
gxioattach(device_t parent, device_t self, void *aux)
{
struct gxio_softc *sc = device_private(self);
aprint_normal("\n");
aprint_naive("\n");
sc->sc_dev = self;
sc->sc_iot = &pxa2x0_bs_tag;
if (bus_space_map(sc->sc_iot,
PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, 0, &sc->sc_ioh))
return;
/*
* Attach each gumstix(busheader)/overo expansion board devices.
*/
config_search(self, NULL,
CFARGS(.search = gxiosearch));
}
/* ARGSUSED */
static int
gxiosearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
{
struct gxio_softc *sc = device_private(parent);
struct gxio_attach_args gxa;
gxa.gxa_sc = sc;
gxa.gxa_iot = sc->sc_iot;
gxa.gxa_addr = cf->cf_loc[GXIOCF_ADDR];
gxa.gxa_gpirq = cf->cf_loc[GXIOCF_GPIRQ];
if (config_probe(parent, cf, &gxa))
config_attach(parent, cf, &gxa, gxioprint, CFARGS_NONE);
return 0;
}
/* ARGSUSED */
static int
gxioprint(void *aux, const char *name)
{
struct gxio_attach_args *gxa = (struct gxio_attach_args *)aux;
if (gxa->gxa_addr != GXIOCF_ADDR_DEFAULT)
printf(" addr 0x%lx", gxa->gxa_addr);
if (gxa->gxa_gpirq > 0)
printf(" gpirq %d", gxa->gxa_gpirq);
return UNCONF;
}
#endif
#if defined(GUMSTIX)
/*
* configure for GPIO pin and expansion boards.
*/
void
gxio_config(void)
{
#if defined(CPU_XSCALE_PXA250)
struct pxa2x0_gpioconf *gumstix_gpioconf[] = {
pxa25x_com_ffuart_gpioconf,
pxa25x_com_stuart_gpioconf,
#ifndef GXIO_BLUETOOTH_ON_HWUART
pxa25x_com_btuart_gpioconf,
#endif
pxa25x_com_hwuart_gpioconf,
pxa25x_i2c_gpioconf,
pxa25x_pxaacu_gpioconf,
pxa255dep_gpioconf,
NULL
};
#endif
#if defined(CPU_XSCALE_PXA270)
struct pxa2x0_gpioconf *verdex_gpioconf[] = {
pxa27x_com_ffuart_gpioconf,
pxa27x_com_stuart_gpioconf,
pxa27x_com_btuart_gpioconf,
pxa27x_i2c_gpioconf,
pxa27x_pxaacu_gpioconf,
pxa27x_pxamci_gpioconf,
pxa27x_ohci_gpioconf,
verdexdep_gpioconf,
NULL
};
#endif
/* XXX: turn off for power of bluetooth module */
#if defined(CPU_XSCALE_PXA250)
pxa2x0_gpio_set_function(7, GPIO_OUT | GPIO_CLR);
#elif defined(CPU_XSCALE_PXA270)
pxa2x0_gpio_set_function(12, GPIO_OUT | GPIO_CLR);
#endif
delay(100);
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
pxa2x0_gpio_config(
(CPU_IS_PXA250) ? gumstix_gpioconf : verdex_gpioconf);
#elif defined(CPU_XSCALE_PXA270) || defined(CPU_XSCALE_PXA250)
#if defined(CPU_XSCALE_PXA270)
pxa2x0_gpio_config(verdex_gpioconf);
#else
pxa2x0_gpio_config(gumstix_gpioconf);
#endif
#endif
}
#endif
static int
gxio_find_default_expansion(void)
{
#ifdef GXIO_DEFAULT_EXPANSION
int i;
/* Find out the default expansion */
for (i = 0; gxioconflist[i].name != NULL; i++)
if (strncasecmp(gxioconflist[i].name, GXIO_DEFAULT_EXPANSION,
strlen(gxioconflist[i].name) + 1) == 0)
break;
return gxioconflist[i].name == NULL ? -1 : i;
#else
return -1;
#endif
}
void
gxio_config_expansion(const char *expansion)
{
int i, d;
d = gxio_find_default_expansion();
/* Print information about expansions */
printf("supported expansions:\n");
for (i = 0; gxioconflist[i].name != NULL; i++)
printf(" %s%s\n", gxioconflist[i].name,
i == d ? " (DEFAULT)" : "");
if (expansion == NULL) {
printf("not specified 'expansion=' in the boot args.\n");
i = -1;
} else {
for (i = 0; gxioconflist[i].name != NULL; i++)
if (strncasecmp(gxioconflist[i].name, expansion,
strlen(gxioconflist[i].name) + 1) == 0)
break;
if (gxioconflist[i].name == NULL) {
printf("unknown expansion specified: %s\n", expansion);
i = -1;
}
}
/*
* Now proceed to configure the default expansion if one was
* specified (and found) or return.
*/
const char *toconfigure;
if (i < 0) {
#ifdef GXIO_DEFAULT_EXPANSION
if (d == -1) {
printf("default expansion (%s) not found\n",
GXIO_DEFAULT_EXPANSION);
return;
}
expansion = GXIO_DEFAULT_EXPANSION;
i = d;
toconfigure = "default";
#else
return;
#endif
} else
toconfigure = "specified";
printf("configure %s expansion (%s)\n", toconfigure, expansion);
gxioconflist[i].config();
}
#if defined(GUMSTIX)
static void
basix_config(void)
{
pxa2x0_gpio_set_function(8, GPIO_ALT_FN_1_OUT); /* MMCCS0 */
pxa2x0_gpio_set_function(53, GPIO_ALT_FN_1_OUT); /* MMCCLK */
#if 0
/* this configuration set by gxmci.c::pxamci_attach() */
pxa2x0_gpio_set_function(11, GPIO_IN); /* nSD_DETECT */
pxa2x0_gpio_set_function(22, GPIO_IN); /* nSD_WP */
#endif
}
static void
cfstix_config(void)
{
u_int gpio, npoe_fn;
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
int bvd = (CPU_IS_PXA250) ? 4 : 111;
#else
#if defined(CPU_XSCALE_PXA270)
const int bvd = 111;
#else
const int bvd = 4;
#endif
#endif
if (CPU_IS_PXA250) {
gxpcic_slot_irqs[0].valid = 1;
gxpcic_slot_irqs[0].cd = 11;
gxpcic_slot_irqs[0].prdy = 26;
gxpcic_gpio_reset = 8;
} else {
gxpcic_slot_irqs[0].valid = 1;
gxpcic_slot_irqs[0].cd = 104;
gxpcic_slot_irqs[0].prdy = 96;
gxpcic_gpio_reset = 97;
}
#if 1
/* PCD/PRDY set by pxa2x0_pcic.c::pxapcic_attach_common() */
#else
pxa2x0_gpio_set_function(11, GPIO_IN); /* PCD1 */
pxa2x0_gpio_set_function(26, GPIO_IN); /* PRDY1/~IRQ1 */
#endif
pxa2x0_gpio_set_function(bvd, GPIO_IN); /* BVD1/~STSCHG1 */
for (gpio = 48, npoe_fn = 0; gpio <= 53 ; gpio++)
npoe_fn |= pxa2x0_gpio_get_function(gpio);
npoe_fn &= GPIO_SET;
pxa2x0_gpio_set_function(48, GPIO_ALT_FN_2_OUT | npoe_fn); /* nPOE */
pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
pxa2x0_gpio_set_function(50, GPIO_ALT_FN_2_OUT); /* nPIOR */
pxa2x0_gpio_set_function(51, GPIO_ALT_FN_2_OUT); /* nPIOW */
if (CPU_IS_PXA250) {
pxa2x0_gpio_set_function(52, GPIO_ALT_FN_2_OUT); /* nPCE1 */
pxa2x0_gpio_set_function(53, GPIO_ALT_FN_2_OUT); /* nPCE2 */
pxa2x0_gpio_set_function(54, GPIO_ALT_FN_2_OUT); /* pSKTSEL */
} else {
pxa2x0_gpio_set_function(102, GPIO_ALT_FN_1_OUT); /* nPCE1 */
pxa2x0_gpio_set_function(105, GPIO_ALT_FN_1_OUT); /* nPCE2 */
pxa2x0_gpio_set_function(79, GPIO_ALT_FN_1_OUT); /* pSKTSEL */
}
pxa2x0_gpio_set_function(55, GPIO_ALT_FN_2_OUT); /* nPREG */
pxa2x0_gpio_set_function(56, GPIO_ALT_FN_1_IN); /* nPWAIT */
pxa2x0_gpio_set_function(57, GPIO_ALT_FN_1_IN); /* nIOIS16 */
}
static void
etherstix_config(void)
{
extern struct cfdata cfdata[];
#if defined(CPU_XSCALE_PXA270) && defined(CPU_XSCALE_PXA250)
int rst = (CPU_IS_PXA250) ? 80 : 32;
int irq = (CPU_IS_PXA250) ? 36 : 99;
#else
#if defined(CPU_XSCALE_PXA270)
const int rst = 32, irq = 99;
#else
const int rst = 80, irq = 36;
#endif
#endif
int i;
pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT); /* nCS 1 */
pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_SET); /* RESET 1 */
delay(1);
pxa2x0_gpio_set_function(rst, GPIO_OUT | GPIO_CLR);
delay(50000);
for (i = 0; cfdata[i].cf_name != NULL; i++)
if (strcmp(cfdata[i].cf_name, "sm") == 0 &&
strcmp(cfdata[i].cf_atname, "sm_gxio") == 0 &&
cfdata[i].cf_loc[GXIOCF_ADDR] == 0x04000300 &&
cfdata[i].cf_loc[GXIOCF_GPIRQ] == GXIOCF_GPIRQ_DEFAULT)
cfdata[i].cf_loc[GXIOCF_GPIRQ] = irq;
}
static void
netcf_config(void)
{
etherstix_config();
cfstix_config();
}
static void
netcf_vx_config(void)
{
/*
* XXXX: More power is necessary for NIC and USB???
* (no document. from Linux)
*/
pxa2x0_gpio_set_function(27, GPIO_IN);
pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR);
pxa2x0_gpio_set_function(118, GPIO_ALT_FN_1_IN | GPIO_CLR);
etherstix_config();
cfstix_config();
if (CPU_IS_PXA270) {
/* Overwrite */
gxpcic_slot_irqs[0].cd = 104;
gxpcic_slot_irqs[0].prdy = 109;
gxpcic_gpio_reset = 110;
};
}
static void
netduommc_config(void)
{
netduo_config();
basix_config();
}
static void
netduo_config(void)
{
etherstix_config();
pxa2x0_gpio_set_function(78, GPIO_ALT_FN_2_OUT); /* nCS 2 */
pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_SET); /* RESET 2 */
delay(1);
pxa2x0_gpio_set_function(52, GPIO_OUT | GPIO_CLR);
delay(50000);
}
static void
netmicrosd_config(void)
{
/* MicroSD(mci) always configure on PXA270 */
pxa2x0_gpio_set_function(49, GPIO_ALT_FN_2_OUT); /* nPWE */
pxa2x0_gpio_set_function(15, GPIO_ALT_FN_2_OUT); /* nCS 1 */
pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_CLR); /* RESET 1 */
delay(hz / 2);
pxa2x0_gpio_set_function(107, GPIO_OUT | GPIO_SET);
delay(50000);
}
static void
netwifimicrosd_config(void)
{
netmicrosd_config();
cfstix_config();
/* However use pxamci. */
pxa2x0_gpio_set_function(111, GPIO_CLR | GPIO_ALT_FN_1_IN);
/* Power to Marvell 88W8385 */
pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
}
static void
netmmc_config(void)
{
etherstix_config();
basix_config();
}
static void
wifistix_config(void)
{
cfstix_config();
/* Power to Marvell 88W8385 */
pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
}
static void
wifistix_cf_config(void)
{
gxpcic_slot_irqs[1].valid = 1;
gxpcic_slot_irqs[1].cd = 36;
gxpcic_slot_irqs[1].prdy = 27;
#if 1
/* this configuration set by pxa2x0_pcic.c::pxapcic_attach_common() */
#else
pxa2x0_gpio_set_function(36, GPIO_IN); /* PCD2 */
pxa2x0_gpio_set_function(27, GPIO_IN); /* PRDY2/~IRQ2 */
#endif
pxa2x0_gpio_set_function(18, GPIO_IN); /* BVD2/~STSCHG2 */
cfstix_config();
/* Power to Marvell 88W8385 */
pxa2x0_gpio_set_function(80, GPIO_OUT | GPIO_SET);
}
#endif
|
5ec418d132b19e69abb97f6435ae24b696dc834b
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/libdrm/src/tests/etnaviv/etnaviv_2d_test.c
|
9fcdae1847c89ddf26682896a4dcfcb7d6c1c633
|
[
"BSD-3-Clause",
"GPL-1.0-or-later",
"MIT",
"GPL-2.0-or-later",
"Apache-2.0",
"LGPL-2.0-or-later"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 8,221
|
c
|
etnaviv_2d_test.c
|
/*
* Copyright (C) 2014-2015 Etnaviv Project
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Authors:
* Christian Gmeiner <christian.gmeiner@gmail.com>
*/
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "xf86drm.h"
#include "etnaviv_drmif.h"
#include "etnaviv_drm.h"
#include "state.xml.h"
#include "state_2d.xml.h"
#include "cmdstream.xml.h"
#include "write_bmp.h"
static inline void etna_emit_load_state(struct etna_cmd_stream *stream,
const uint16_t offset, const uint16_t count)
{
uint32_t v;
v = (VIV_FE_LOAD_STATE_HEADER_OP_LOAD_STATE | VIV_FE_LOAD_STATE_HEADER_OFFSET(offset) |
(VIV_FE_LOAD_STATE_HEADER_COUNT(count) & VIV_FE_LOAD_STATE_HEADER_COUNT__MASK));
etna_cmd_stream_emit(stream, v);
}
static inline void etna_set_state(struct etna_cmd_stream *stream, uint32_t address, uint32_t value)
{
etna_cmd_stream_reserve(stream, 2);
etna_emit_load_state(stream, address >> 2, 1);
etna_cmd_stream_emit(stream, value);
}
static inline void etna_set_state_from_bo(struct etna_cmd_stream *stream,
uint32_t address, struct etna_bo *bo)
{
etna_cmd_stream_reserve(stream, 2);
etna_emit_load_state(stream, address >> 2, 1);
etna_cmd_stream_reloc(stream, &(struct etna_reloc){
.bo = bo,
.flags = ETNA_RELOC_READ,
.offset = 0,
});
}
static void gen_cmd_stream(struct etna_cmd_stream *stream, struct etna_bo *bmp, const int width, const int height)
{
int rec;
static int num_rects = 256;
etna_set_state(stream, VIVS_DE_SRC_STRIDE, 0);
etna_set_state(stream, VIVS_DE_SRC_ROTATION_CONFIG, 0);
etna_set_state(stream, VIVS_DE_SRC_CONFIG, 0);
etna_set_state(stream, VIVS_DE_SRC_ORIGIN, 0);
etna_set_state(stream, VIVS_DE_SRC_SIZE, 0);
etna_set_state(stream, VIVS_DE_SRC_COLOR_BG, 0);
etna_set_state(stream, VIVS_DE_SRC_COLOR_FG, 0);
etna_set_state(stream, VIVS_DE_STRETCH_FACTOR_LOW, 0);
etna_set_state(stream, VIVS_DE_STRETCH_FACTOR_HIGH, 0);
etna_set_state_from_bo(stream, VIVS_DE_DEST_ADDRESS, bmp);
etna_set_state(stream, VIVS_DE_DEST_STRIDE, width*4);
etna_set_state(stream, VIVS_DE_DEST_ROTATION_CONFIG, 0);
etna_set_state(stream, VIVS_DE_DEST_CONFIG,
VIVS_DE_DEST_CONFIG_FORMAT(DE_FORMAT_A8R8G8B8) |
VIVS_DE_DEST_CONFIG_COMMAND_CLEAR |
VIVS_DE_DEST_CONFIG_SWIZZLE(DE_SWIZZLE_ARGB) |
VIVS_DE_DEST_CONFIG_TILED_DISABLE |
VIVS_DE_DEST_CONFIG_MINOR_TILED_DISABLE
);
etna_set_state(stream, VIVS_DE_ROP,
VIVS_DE_ROP_ROP_FG(0xcc) | VIVS_DE_ROP_ROP_BG(0xcc) | VIVS_DE_ROP_TYPE_ROP4);
etna_set_state(stream, VIVS_DE_CLIP_TOP_LEFT,
VIVS_DE_CLIP_TOP_LEFT_X(0) |
VIVS_DE_CLIP_TOP_LEFT_Y(0)
);
etna_set_state(stream, VIVS_DE_CLIP_BOTTOM_RIGHT,
VIVS_DE_CLIP_BOTTOM_RIGHT_X(width) |
VIVS_DE_CLIP_BOTTOM_RIGHT_Y(height)
);
etna_set_state(stream, VIVS_DE_CONFIG, 0); /* TODO */
etna_set_state(stream, VIVS_DE_SRC_ORIGIN_FRACTION, 0);
etna_set_state(stream, VIVS_DE_ALPHA_CONTROL, 0);
etna_set_state(stream, VIVS_DE_ALPHA_MODES, 0);
etna_set_state(stream, VIVS_DE_DEST_ROTATION_HEIGHT, 0);
etna_set_state(stream, VIVS_DE_SRC_ROTATION_HEIGHT, 0);
etna_set_state(stream, VIVS_DE_ROT_ANGLE, 0);
/* Clear color PE20 */
etna_set_state(stream, VIVS_DE_CLEAR_PIXEL_VALUE32, 0xff40ff40);
/* Clear color PE10 */
etna_set_state(stream, VIVS_DE_CLEAR_BYTE_MASK, 0xff);
etna_set_state(stream, VIVS_DE_CLEAR_PIXEL_VALUE_LOW, 0xff40ff40);
etna_set_state(stream, VIVS_DE_CLEAR_PIXEL_VALUE_HIGH, 0xff40ff40);
etna_set_state(stream, VIVS_DE_DEST_COLOR_KEY, 0);
etna_set_state(stream, VIVS_DE_GLOBAL_SRC_COLOR, 0);
etna_set_state(stream, VIVS_DE_GLOBAL_DEST_COLOR, 0);
etna_set_state(stream, VIVS_DE_COLOR_MULTIPLY_MODES, 0);
etna_set_state(stream, VIVS_DE_PE_TRANSPARENCY, 0);
etna_set_state(stream, VIVS_DE_PE_CONTROL, 0);
etna_set_state(stream, VIVS_DE_PE_DITHER_LOW, 0xffffffff);
etna_set_state(stream, VIVS_DE_PE_DITHER_HIGH, 0xffffffff);
/* Queue DE command */
etna_cmd_stream_emit(stream,
VIV_FE_DRAW_2D_HEADER_OP_DRAW_2D | VIV_FE_DRAW_2D_HEADER_COUNT(num_rects) /* render one rectangle */
);
etna_cmd_stream_emit(stream, 0x0); /* rectangles start aligned */
for(rec=0; rec < num_rects; ++rec) {
int x = rec%16;
int y = rec/16;
etna_cmd_stream_emit(stream, VIV_FE_DRAW_2D_TOP_LEFT_X(x*8) | VIV_FE_DRAW_2D_TOP_LEFT_Y(y*8));
etna_cmd_stream_emit(stream, VIV_FE_DRAW_2D_BOTTOM_RIGHT_X(x*8+4) | VIV_FE_DRAW_2D_BOTTOM_RIGHT_Y(y*8+4));
}
etna_set_state(stream, 1, 0);
etna_set_state(stream, 1, 0);
etna_set_state(stream, 1, 0);
etna_set_state(stream, VIVS_GL_FLUSH_CACHE, VIVS_GL_FLUSH_CACHE_PE2D);
}
int etna_check_image(uint32_t *p, int width, int height)
{
int i;
uint32_t expected;
for (i = 0; i < width * height; i++) {
if (i%8 < 4 && i%(width*8) < width*4 && i%width < 8*16 && i < width*8*16)
expected = 0xff40ff40;
else
expected = 0x00000000;
if (p[i] != expected) {
fprintf(stderr, "Offset %d: expected: 0x%08x, got: 0x%08x\n",
i, expected, p[i]);
return -1;
}
}
return 0;
}
int main(int argc, char *argv[])
{
const int width = 256;
const int height = 256;
const size_t bmp_size = width * height * 4;
struct etna_device *dev;
struct etna_gpu *gpu;
struct etna_pipe *pipe;
struct etna_bo *bmp;
struct etna_cmd_stream *stream;
drmVersionPtr version;
int fd, ret = 0;
uint64_t feat;
int core = 0;
if (argc < 2) {
fprintf(stderr, "Usage: %s /dev/dri/<device> [<etna.bmp>]\n", argv[0]);
return 1;
}
fd = open(argv[1], O_RDWR);
if (fd < 0) {
perror(argv[1]);
return 1;
}
version = drmGetVersion(fd);
if (version) {
printf("Version: %d.%d.%d\n", version->version_major,
version->version_minor, version->version_patchlevel);
printf(" Name: %s\n", version->name);
printf(" Date: %s\n", version->date);
printf(" Description: %s\n", version->desc);
drmFreeVersion(version);
}
dev = etna_device_new(fd);
if (!dev) {
perror("etna_device_new");
ret = 2;
goto out;
}
do {
gpu = etna_gpu_new(dev, core);
if (!gpu) {
perror("etna_gpu_new");
ret = 3;
goto out_device;
}
if (etna_gpu_get_param(gpu, ETNA_GPU_FEATURES_0, &feat)) {
perror("etna_gpu_get_param");
ret = 4;
goto out_device;
}
if ((feat & (1 << 9)) == 0) {
/* GPU not 2D capable. */
etna_gpu_del(gpu);
gpu = NULL;
}
core++;
} while (!gpu);
pipe = etna_pipe_new(gpu, ETNA_PIPE_2D);
if (!pipe) {
perror("etna_pipe_new");
ret = 4;
goto out_gpu;
}
bmp = etna_bo_new(dev, bmp_size, ETNA_BO_UNCACHED);
if (!bmp) {
perror("etna_bo_new");
ret = 5;
goto out_pipe;
}
memset(etna_bo_map(bmp), 0, bmp_size);
stream = etna_cmd_stream_new(pipe, 0x300, NULL, NULL);
if (!stream) {
perror("etna_cmd_stream_new");
ret = 6;
goto out_bo;
}
/* generate command sequence */
gen_cmd_stream(stream, bmp, width, height);
etna_cmd_stream_finish(stream);
if (argc > 2)
bmp_dump32(etna_bo_map(bmp), width, height, false, argv[2]);
if (etna_check_image(etna_bo_map(bmp), width, height))
ret = 7;
etna_cmd_stream_del(stream);
out_bo:
etna_bo_del(bmp);
out_pipe:
etna_pipe_del(pipe);
out_gpu:
etna_gpu_del(gpu);
out_device:
etna_device_del(dev);
out:
close(fd);
return ret;
}
|
303faf190efacc67ebfed60eb44f03eaaa5dbbb9
|
1248f70e2bde2898dee5c675adfe36429702b1a0
|
/common/english.c
|
3ff082e751a6aeca534eca4f1876da0619b3b339
|
[] |
no_license
|
dgod/yong
|
d009b12cd6e78eeae33a3a3f4ea445aaa7378c60
|
a7a1f83a0bea4078ee3e615c1a0018f8aef37b2e
|
refs/heads/master
| 2023-06-25T08:48:07.342805
| 2023-06-11T01:55:31
| 2023-06-11T01:55:31
| 62,427,557
| 173
| 46
| null | 2018-08-10T01:31:01
| 2016-07-02T01:03:35
|
C
|
GB18030
|
C
| false
| false
| 23,869
|
c
|
english.c
|
#include <ctype.h>
#include <inttypes.h>
#include <time.h>
#include "yong.h"
#include "common.h"
#include "english.h"
static int EnglishInit(const char *arg);
static void EnglishReset(void);
static char *EnglishGetCandWord(int index);
static int EnglishGetCandWords(int mode);
static int EnglishDestroy(void);
static int EnglishDoInput(int key);
static int PhraseListCount;
static int key_temp_english;
static int en_commit_select;
static int en_degrade;
extern int key_commit;
extern int key_select[9];
static EXTRA_IM EIM={
.Name = "english",
.Reset = EnglishReset,
.DoInput = EnglishDoInput,
.GetCandWords = EnglishGetCandWords,
.GetCandWord = EnglishGetCandWord,
.Init = EnglishInit,
.Destroy = EnglishDestroy
};
static int NumSet(const char *s);
static int NumGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_num={NumSet,NumGet};
static int CalcSet(const char *s);
static int CalcGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_calc={CalcSet,CalcGet};
static int UrlSet(const char *s);
static int UrlGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_url={UrlSet,UrlGet};
static int BdSet(const char *s);
static int BdGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_bd={BdSet,BdGet};
static int MoneySet(const char *s);
static int MoneyGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_money={MoneySet,MoneyGet};
static int HexSet(const char *s);
static int HexGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_hex={HexSet,HexGet};
static void DictLoad(void);
static void DictFree(void);
static int DictSet(const char *s);
static int DictGet(char cand[][MAX_CAND_LEN+1],int pos,int count);
static ENGLISH_IM eim_dict={DictSet,DictGet};
extern ENGLISH_IM eim_book;
static ENGLISH_IM *enim[]={
&eim_num,&eim_calc,&eim_url,&eim_bd,&eim_money,&eim_book,&eim_hex,&eim_dict
};
#define ENIM_COUNT (sizeof(enim)/sizeof(ENGLISH_IM*))
static int EnglishInit(const char *arg)
{
key_temp_english=y_im_get_key("tEN",-1,YK_NONE);
if(key_temp_english!=YK_NONE)
key_temp_english=tolower(key_temp_english);
en_commit_select=y_im_get_config_int("IM","en_commit_select");
en_degrade=y_im_get_config_int("IM","en_degrade");
if(en_degrade)
en_commit_select=1;
EnglishReset();
DictLoad();
return 0;
}
static void EnglishReset(void)
{
int i;
PhraseListCount=0;
EIM.CandWordTotal=0;
EIM.CaretPos=0;
EIM.CodeInput[0]=0;
EIM.CodeLen=0;
EIM.CurCandPage=EIM.CandPageCount=EIM.CandWordCount=0;
EIM.SelectIndex=0;
for(i=0;i<ENIM_COUNT;i++){
ENGLISH_IM *e=enim[i];
e->Count=0;
}
}
static int AutoCompleteByDict(int index)
{
int check=0;
if(index==YK_SPACE)
{
check=1;
index=EIM.SelectIndex;
}
if(EIM.CandWordCount==0 || eim_dict.Count==0)
return 0;
char *phrase=&EIM.CandTable[index][0];
int pos=EIM.CandWordMaxReal*EIM.CurCandPage+index;
int i;
for(i=0;i<ENIM_COUNT;i++)
{
ENGLISH_IM *e=enim[i];
int ec=e->Count;
if(ec==0)
continue;
if(e!=&eim_dict)
{
pos-=ec;
if(pos<0)
return 0;
}
else
{
if(pos>=e->Count)
return 0;
if(check)
return 1;
char *p=LINT_TO_PTR(e->Priv1);
int len=strlen(p);
if(strlen(phrase)<=len)
return 2;
strcat(p,phrase+len);
EIM.CaretPos=EIM.CodeLen=strlen(EIM.CodeInput);
return 1;
}
}
return 0;
}
static char *EnglishGetCandWord(int index)
{
char *ret;
if(index>=EIM.CandWordCount)
return 0;
if(index==-1)
index=EIM.SelectIndex;
ret=&EIM.CandTable[index][0];
if(!en_commit_select && AutoCompleteByDict(index))
{
return NULL;
}
strcpy(EIM.StringGet,ret);
return ret;
}
static int EnglishGetCandWords(int mode)
{
int max;
int i,count,start;
if(mode==PAGE_ASSOC)
return IMR_BLOCK;
max=EIM.CandWordMax;
EIM.CandWordMaxReal=max;
if(mode==PAGE_FIRST) EIM.CurCandPage=0;
else if(mode==PAGE_NEXT && EIM.CurCandPage+1<EIM.CandPageCount)
EIM.CurCandPage++;
else if(mode==PAGE_PREV && EIM.CurCandPage>0)
EIM.CurCandPage--;
if(EIM.CandPageCount==0)
EIM.CandWordCount=0;
else if(EIM.CurCandPage<EIM.CandPageCount-1)
EIM.CandWordCount=max;
else EIM.CandWordCount=PhraseListCount-max*(EIM.CandPageCount-1);
for(i=0;i<EIM.CandWordCount;i++)
EIM.CodeTips[i][0]=0;
start=EIM.CurCandPage*max;count=0;
for(i=0;i<ENIM_COUNT && count<EIM.CandWordCount;i++)
{
ENGLISH_IM *e=enim[i];
int ec=e->Count;
int pos=0;
while(start>0 && ec)
{
start--;
ec--;
pos++;
}
if(!ec) continue;
ec=MIN(ec,EIM.CandWordCount-count);
e->Get(&EIM.CandTable[count],pos,ec);
count+=ec;
}
return IMR_DISPLAY;
}
static int EnglishDestroy(void)
{
DictFree();
return 0;
}
static int EnglishDoSearch(void)
{
int i,max;
char *s=EIM.CodeInput;
PhraseListCount=0;
EIM.CandWordTotal=0;
if(EIM.CodeInput[0]==key_temp_english)
s++;
for(i=0;i<ENIM_COUNT;i++)
{
ENGLISH_IM *e=enim[i];
e->Set(s);
PhraseListCount+=e->Count;
}
EIM.CandWordTotal=PhraseListCount;
max=EIM.CandWordMax;
EIM.CandPageCount=PhraseListCount/max+((PhraseListCount%max)?1:0);
EnglishGetCandWords(PAGE_FIRST);
if(!key_temp_english || ((EIM.CodeInput[0]&0x7f)!=key_temp_english))
strcpy(EIM.StringGet,"> ");
return PhraseListCount;
}
static int key_is_select(int key)
{
if(key==key_commit)
return 1;
for(int i=0;i<9;i++)
{
if(key==key_select[i])
return 1;
}
return 0;
}
static int EnglishDoInput(int key)
{
int i;
key&=~KEYM_BING;
if(key==YK_SPACE)
{
if(en_degrade)
return IMR_NEXT;
if(EIM.CandWordCount && !AutoCompleteByDict(YK_SPACE))
return IMR_NEXT;
}
if(key==YK_BACKSPACE)
{
if(EIM.CodeLen==0)
return IMR_CLEAN_PASS;
if(EIM.CaretPos==0)
return IMR_BLOCK;
for(i=EIM.CaretPos;i<EIM.CodeLen;i++)
EIM.CodeInput[i-1]=EIM.CodeInput[i];
EIM.CodeLen--;
EIM.CaretPos--;
EIM.CodeInput[EIM.CodeLen]=0;
if(EIM.CodeLen==0)
return IMR_CLEAN;
}
else if(key==YK_DELETE)
{
if(EIM.CodeLen==0)
return IMR_PASS;
if(EIM.CodeLen!=EIM.CaretPos)
{
for(i=EIM.CaretPos;i<EIM.CodeLen;i++)
EIM.CodeInput[i]=EIM.CodeInput[i+1];
EIM.CodeLen--;
EIM.CodeInput[EIM.CodeLen]=0;
if(EIM.CodeLen==0)
return IMR_CLEAN;
}
}
else if(key==YK_HOME)
{
if(EIM.CodeLen==0)
return IMR_PASS;
EIM.CaretPos=(EIM.CodeInput[0]==key_temp_english)?1:0;
}
else if(key==YK_END)
{
if(EIM.CodeLen==0)
return IMR_PASS;
EIM.CaretPos=EIM.CodeLen;
}
else if(key==YK_LEFT)
{
if(EIM.CodeLen==0)
return IMR_PASS;
if(EIM.CaretPos==0)
return IMR_DISPLAY;
if(EIM.CaretPos>1 || (EIM.CaretPos==1 && EIM.CodeInput[EIM.CaretPos-1]!=key_temp_english))
EIM.CaretPos--;
}
else if(key==YK_RIGHT)
{
if(EIM.CodeLen==0)
return IMR_PASS;
if(EIM.CaretPos<EIM.CodeLen)
EIM.CaretPos++;
}
else if(key>=0x20 && key<0x80)
{
if(en_degrade && EIM.CodeLen>0 && key_is_select(key))
return IMR_NEXT;
if(en_degrade==2 && key>='0' && key<='9')
return IMR_NEXT;
if(EIM.CodeLen>=MAX_CODE_LEN)
return IMR_BLOCK;
if(EIM.CodeLen==0)
{
EIM.CaretPos=0;
EIM.StringGet[0]=0;
EIM.SelectIndex=0;
}
for(i=EIM.CodeLen-1;i>=EIM.CaretPos;i--)
EIM.CodeInput[i+1]=EIM.CodeInput[i];
EIM.CodeInput[EIM.CaretPos]=key;
EIM.CodeLen++;
EIM.CaretPos++;
EIM.CodeInput[EIM.CodeLen]=0;
}
else if(key==YK_VIRT_REFRESH)
{
}
else
{
return IMR_NEXT;
}
EnglishDoSearch();
return IMR_DISPLAY;
}
void y_english_init(void)
{
}
void y_english_destroy(void)
{
}
void *y_english_eim(void)
{
return &EIM;
}
/*
* english's num translate
*/
static char *ch_0[]={"〇","零"};
static char *ch_19[]={"一二三四五六七八九","壹贰叁肆伍陆柒捌玖"};
static char *cht_19[]={"一二三四五六七八九","壹貳參肆伍陸柒捌玖"};
static char *ch_rq[]={"年月日"};
static char *ch_tm[]={"时点分秒"};
static char *cht_tm[]={"時點分秒"};
static char *ch_dw[]={"十百千万亿","拾佰仟万亿"};
static char *cht_dw[]={"十百千萬億","拾佰仟萬億"};
#define BIT_0(t) (t)
#define BIT_19(t) ((t)<<2)
#define BIT_RQ(t) ((t)<<4)
#define BIT_DW(t) ((t)<<6)
#define BIT_TM(t) ((t)<<8)
#define BIT_INS(t) ((t)<<10)
#define GET_0(t) ((t)&3)
#define GET_19(t) (((t)>>2)&3)
#define GET_RQ(t) (((t)>>4)&3)
#define GET_DW(t) (((t)>>6)&3)
#define GET_TM(t) (((t)>>8)&3)
#define GET_INS(t) (((t)>>10)&3)
static int n_spec_count(const char *in,int spec)
{
int c;
int count=0;
while((c=*in++)!=0)
{
if(c==spec) count++;
}
return count;
}
static int num2hz(const char *in,char *out,int type)
{
int i;
int b,c;
char temp[3];
int num=0;
int ins;
int rq;
ins=GET_INS(type);
rq=GET_RQ(type);
out[0]=0;
for(i=0;(c=in[i])!=0;i++)
{
if(rq) ins=(i>=5);
if(c=='0')
{
b=GET_0(type);
if(b==0)
{
temp[0]=(char)c;
temp[1]=0;
}
else
{
if(ins && num==1)
strcpy(temp,"十");
else
strcpy(temp,ch_0[b-1]);
}
strcat(out,temp);
}
else if(c>='1' && c<='9')
{
b=GET_19(type);
if(b==0)
{
temp[0]=(char)c;
temp[1]=0;
}
else
{
if(ins && num==1)
{
strcpy(temp,"十");
strcat(out,temp);
}
if(ins && c=='1' && isdigit(in[i+1]))
temp[0]=0;
else
{
if(im.Trad)
memcpy(temp,&cht_19[b-1][2*(c-'1')],2);
else
memcpy(temp,&ch_19[b-1][2*(c-'1')],2);
temp[2]=0;
}
}
strcat(out,temp);
num++;
}
else if((b=GET_DW(type))!=0 && strchr("subqwy",c))
{
switch(c){
case 's':case'u':c=0;break;
case 'b':c=1;break;
case 'q':c=2;break;
case 'w':c=3;break;
case 'y':c=4;break;
}
if(im.Trad)
memcpy(temp,&cht_dw[b-1][c*2],2);
else
memcpy(temp,&ch_dw[b-1][c*2],2);
temp[2]=0;
strcat(out,temp);
num=0;
}
else if((b=GET_RQ(type))!=0 && strchr("nyr",c))
{
switch(c){
case 'n':c=0;break;
case 'y':c=1;break;
case 'r':c=2;break;
}
memcpy(temp,&ch_rq[b-1][c*2],2);
temp[2]=0;
strcat(out,temp);
num=0;
}
else if((b=GET_RQ(type))!=0 && c=='.')
{
if(i==4) c=0;
else c=1;
memcpy(temp,&ch_rq[b-1][c*2],2);
temp[2]=0;
strcat(out,temp);
num=0;
}
else if((b=GET_TM(type))!=0 && strchr("sudfm",c))
{
switch(c){
case 's':c=0;break;
case 'u':c=0;break;
case 'd':c=1;break;
case 'f':c=2;break;
case 'm':c=3;break;
}
if(im.Trad)
memcpy(temp,&cht_tm[b-1][c*2],2);
else
memcpy(temp,&ch_tm[b-1][c*2],2);
temp[2]=0;
strcat(out,temp);
num=0;
}
}
if((b=GET_RQ(type))!=0 && n_spec_count(in,'.')==2 &&
in[strlen(in)-1]!='.')
{
strcat(out,"日");
}
return 0;
}
static int n_is_digit(const char *s,int len)
{
int i;
for(i=0;i<len;i++)
{
if(!isdigit(s[i]))
return 0;
}
return 1;
}
static int n_is_hex(const char *s,int len)
{
int i;
if(len<=2)
return 0;
if(s[0]!='0' || s[1]!='x')
return 0;
for(i=2;i<len;i++)
{
if(!isxdigit(s[i]))
return 0;
}
return 1;
}
#define NEED_CH(avail) \
do{ \
int c=*s++; \
if(!c) goto out; \
if(strchr((avail),c)==NULL) \
goto out; \
}while(0)
static int n_is_number(const char *s,int len)
{
int ret=0;
if(s[0]=='0') goto out;
if(!strpbrk(s,"0123456789"))
goto out;
if(strspn(s,"0123456789subqwy")==strlen(s))
ret=1;
out:
return ret;
}
static int n_is_date(const char *s,int len)
{
int ret=0;
if(len<5)
goto out;
NEED_CH("123456789");
NEED_CH("0123456789");
NEED_CH("0123456789");
NEED_CH("0123456789");
NEED_CH("n.");
if(strspn(s-1,"0123456789nyr")==strlen(s-1) ||
(strspn(s-1,"0123456789.")==strlen(s-1) &&
s[0]!='.' && n_spec_count(s,'.')<=1))
{
ret=1;
}
out:
return ret;
}
static int n_is_time(const char *s,int len)
{
int ret=0;
if(len<4)
goto out;
if(!isdigit(s[0]))
goto out;
if(strspn(s,"0123456789sudfm")==len && (s[len-1]=='m' || s[len-1]=='f'))
ret=1;
out:
return ret;
}
static void parse_decimal(int sel,int64_t val,char *s);
static int NumSet(const char *s)
{
ENGLISH_IM *e=&eim_num;
int len;
e->Priv2=(uintptr_t)s;
e->Count=0;
e->Priv1=0;
len=strlen(s);
if(!len)
{
return 0;
}
if(!strcmp(s,"0"))
{
e->Count=2;
e->Priv1=4;
}
else if(n_is_digit(s,len))
{
e->Count=2;
e->Priv1=0;
if(len>1)
e->Count++;
}
else if(n_is_number(s,len))
{
e->Count=2;
e->Priv1=1;
}
else if(n_is_date(s,len))
{
int year=atoi(s);
e->Count=2;
e->Priv1=2;
if(year>1901 && year<2100)
{
int year,month,day;
char c1,c2;
if(5==sscanf(s,"%d%c%d%c%d",&year,&c1,&month,&c2,&day))
e->Count=3;
}
}
else if(n_is_time(s,len))
{
e->Count=2;
e->Priv1=3;
}
//printf("%d %d\n",e->Priv1,e->Count);
return e->Count;
}
static int NumGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
ENGLISH_IM *e=&eim_num;
int i;
static const int type[5][4]={
{BIT_0(2)|BIT_19(1) , BIT_0(2)|BIT_19(2)},
{BIT_0(2)|BIT_19(1)|BIT_DW(1),BIT_0(2)|BIT_19(2)|BIT_DW(2)},
{BIT_0(1)|BIT_19(1)|BIT_RQ(1),BIT_0(0)|BIT_19(0)|BIT_RQ(1)},
{BIT_0(0)|BIT_19(0)|BIT_TM(1),BIT_0(2)|BIT_19(1)|BIT_TM(1)|BIT_INS(1)},
{BIT_0(1),BIT_0(2)},
};
for(i=pos;i<pos+count && i<4;i++)
{
if(e->Priv1==2 && i==2)
{
const char *s=(const char*)e->Priv2;
int year,month,day;
char c1,c2;
struct tm tm;
strcpy(cand[i],"农历");
if(5==sscanf(s,"%d%c%d%c%d",&year,&c1,&month,&c2,&day))
{
memset(&tm,0,sizeof(tm));
tm.tm_year=year-1900;
tm.tm_mon=month-1;
tm.tm_mday=day;
#if defined(_WIN32) && !defined(_WIN64)
y_im_nl_day(_mktime64(&tm),cand[i]+strlen(cand[i]));
#else
y_im_nl_day(mktime(&tm),cand[i]+strlen(cand[i]));
#endif
}
}
else if(e->Priv1==0 && i==2)
{
cand[i][0]=0;
parse_decimal(0,atoi((char*)e->Priv2),cand[i]);;
}
else
{
num2hz((char*)e->Priv2,cand[i],type[(int)e->Priv1][i]);
}
}
return 0;
}
static int y_expr_calc(const char *s,char *res,int len)
{
LVariant var;
if(!strpbrk(s,"+-*/%"))
{
return -1;
}
var=l_expr_calc(s);
switch(var.type){
case L_TYPE_INT:
snprintf(res,len,"%ld",var.v_int);
break;
case L_TYPE_FLOAT:
{
snprintf(res,len,"%.7f",var.v_float);
const char *dot=strchr(res,'.');
if(dot)
{
char *p=res+strlen(res)-1;
while(p>dot+1 && *p=='0')
{
*p--=0;
}
}
break;
}
default:
return -1;
}
return 0;
}
static char calc_res[64];
static int CalcSet(const char *s)
{
ENGLISH_IM *e=&eim_calc;
int ret;
e->Count=0;
if(!strpbrk(s,"0123456789"))
return 0;
if(strspn(s,"0123456789.+-*/%()")!=strlen(s))
return 0;
ret=y_expr_calc(s,calc_res,sizeof(calc_res));
e->Count=ret?0:1;
return e->Count;
}
static int CalcGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
strcpy(cand[0],calc_res);
return 1;
}
static char url_input[64];
static int UrlSet(const char *s)
{
Y_USER_URL *url=y_im_user_urls();
ENGLISH_IM *e=&eim_url;
Y_USER_URL *p;
e->Count=0;
if(strlen(s)<3)
return 0;
for(p=url;p;p=p->next)
{
if(strstr(p->url,s))
e->Count++;
}
strcpy(url_input,s);
return 0;
}
static int UrlGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
Y_USER_URL *url=y_im_user_urls();
Y_USER_URL *p;
int i;
for(i=0,p=url;p && i<pos;p=p->next)
i++;
for(i=0;i<count && p;p=p->next)
{
if(strstr(p->url,url_input))
{
strcpy(cand[i],p->url);
i++;
}
}
return 0;
}
static int BdSet(const char *s)
{
ENGLISH_IM *e=&eim_bd;
CONNECT_ID *id;
id=y_xim_get_connect();
e->Count=0;
if(!id || strlen(s)!=0)
return 0;
if(id->biaodian==LANG_CN)
{
const char *p1;
p1=YongGetPunc(s[-1],LANG_CN,1);
if(p1)
{
e->Count++;
}
}
else
{
if(YongGetPunc(s[-1],LANG_EN,1))
e->Count++;
}
e->Priv1=s[-1];
return 0;
}
static int BdGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
ENGLISH_IM *e=&eim_bd;
CONNECT_ID *id;
int lang=LANG_CN;
id=y_xim_get_connect();
if(id && id->biaodian==LANG_EN)
lang=LANG_EN;
if(count>0 && lang==LANG_EN)
{
const char *p=YongGetPunc((int)e->Priv1,LANG_EN,1);
strcpy(cand[0],p);
}
else if(count>0 && lang==LANG_CN)
{
sprintf(cand[0],"$BD(%c)",(char)e->Priv1);
count--;
}
return 0;
}
static int MoneySet(const char *s)
{
ENGLISH_IM *e=&eim_money;
int ret,pos=0;
int64_t n1;
uint8_t n2=10,n3=10;
e->Count=0;
ret=l_sscanf(s,"%"PRId64".%c%c%n",&n1,&n2,&n3,&pos);
if(ret<1 || (ret==3 && s[pos]) ||
n_spec_count(s,'.')>1 ||
strspn(s,"01234567890.")!=strlen(s))
{
return 0;
}
if(ret==1 && n1==0)
{
return 0;
}
if(n1<0)
{
return 0;
}
if(isdigit(n2))
n2-='0';
if(isdigit(n3))
n3-='0';
e->Priv1=n1;
e->Priv2=n2<<8|n3;
e->Count=1;
return e->Count;
}
static void parse_decimal(int sel,int64_t val,char *s)
{
const char *dw=(im.Trad?cht_dw:ch_dw)[sel];
const char *num=(im.Trad?cht_19:ch_19)[sel];
int len=0;
int empty=0;
int strip_10=0;/*(val/10==1);*/ // 是否忽略拾前面的一
int have_value=0; // 前面是否已经有值出现了
int prev_value=0; // 在上一位非0
// 亿
if(val/100000000)
{
parse_decimal(sel,val / 100000000,s);
len=strlen(s);memcpy(s+len,dw+8,2);len+=2;s[len]=0;
if((val/100000000)%10)
prev_value=1;
val%=100000000;
empty=1;
have_value=1;
}
// 前面已经有值,且上一位为0,且后面有值
if(have_value && !prev_value && val)
{
strcpy(s+len,ch_0[1]);len+=2;
have_value=0; // 避免重复输入多于的0
}
prev_value=0;
// 万
if(val/10000)
{
parse_decimal(sel,val / 10000,s);
len=strlen(s);memcpy(s+len,dw+6,2);len+=2;s[len]=0;
if((val/10000)%10)
prev_value=1;
val%=10000;
empty=1;
have_value=1;
}
if(have_value && !prev_value && val)
{
strcpy(s+len,ch_0[1]);len+=2;
have_value=0;
}
prev_value=0;
// 千
if(val/1000)
{
parse_decimal(sel,val / 1000,s);
len=strlen(s);memcpy(s+len,dw+4,2);len+=2;s[len]=0;
if((val/1000)%10)
prev_value=1;
empty=1;
val%=1000;
have_value=1;
}
if(have_value && !prev_value && val)
{
strcpy(s+len,ch_0[1]);len+=2;
have_value=0;
}
// 百
prev_value=0;
if(val/100)
{
parse_decimal(sel,val / 100,s);
len=strlen(s);memcpy(s+len,dw+2,2);len+=2;s[len]=0;
if((val/100)%10)
prev_value=1;
empty=1;
val%=100;
have_value=1;
}
if(have_value && !prev_value && val)
{
strcpy(s+len,ch_0[1]);//len+=2;
have_value=0;
}
// 十
prev_value=0;
if(val/10)
{
if(!strip_10) parse_decimal(sel,val / 10,s);
len=strlen(s);memcpy(s+len,dw+0,2);len+=2;s[len]=0;
prev_value=1;
empty=0;
val%=10;
have_value=1;
}
if(have_value && !prev_value && val)
{
strcpy(s+len,ch_0[1]);
}
len=strlen(s);
if(empty && val)
{
strcpy(s+len,ch_0[1]);//len+=2;
}
if(val)
{
memcpy(s+len,num+(val-1)*2,2);len+=2;s[len]=0;
}
}
/*
* 测试例子
* 101,100001,208,2008,120000,101101,0.34,0.04
*/
static int MoneyGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
ENGLISH_IM *e=&eim_money;
char *s;
int64_t yuan;
int jiao,fen;
if(count<=0)
return 0;
s=cand[0];s[0]=0;
yuan=(int64_t)e->Priv1;jiao=e->Priv2>>8;fen=e->Priv2&0xff;
if(yuan)
{
parse_decimal(1,yuan,s);
strcat(s,"元");
}
if(jiao<10 && !(jiao==0 && fen==0) && !(jiao==0 && fen==10))
{
const char *num=(im.Trad?cht_19:ch_19)[1];
int len=strlen(s);
if(jiao)
{
memcpy(s+len,num+(jiao-1)*2,2);
len+=2;
}
else if(yuan!=0)
{
strcpy(s+len,ch_0[1]);
len+=2;
}
s[len]=0;
if(jiao>0)
{
strcpy(s+len,"角");
len+=2;
}
if(fen<10)
{
if(fen)
{
memcpy(s+len,num+(fen-1)*2,2);
len+=2;
s[len]=0;
strcpy(s+len,"分");
}
else
{
strcat(s,"整");
}
}
else
{
strcat(s,"整");
}
}
else
{
strcat(s,"整");
}
return 0;
}
static int HexSet(const char *s)
{
ENGLISH_IM *e=&eim_hex;
int len;
len=strlen(s);
if(!len)
{
return 0;
}
if(n_is_digit(s,len))
{
e->Priv2=(uintptr_t)s;
e->Priv1=0;
e->Count=1;
}
else if(n_is_hex(s,len))
{
e->Priv2=(uintptr_t)s;
e->Priv1=1;
e->Count=1;
}
else
{
e->Count=0;
return 0;
}
return 1;
}
static int HexGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
ENGLISH_IM *e=&eim_hex;
char *s=(char*)e->Priv2;
uint32_t temp;
if(e->Priv1==0)
{
temp=(uint32_t)strtoul(s,NULL,10);
sprintf(cand[0],"0x%"PRIx32,temp);
}
else
{
temp=(uint32_t)strtoul(s+2,NULL,16);
sprintf(cand[0],"%"PRIu32,temp);
}
return 0;
}
void y_english_key_desc(const char *code,char *res)
{
int pos=0;
if(key_temp_english && ((EIM.CodeInput[0]&0x7f)==key_temp_english))
{
res[pos++]=key_temp_english;
}
if(!strncasecmp(code+pos,"key ",4))
{
//strcpy(res+pos,"key ");
memcpy(res+pos,code+pos,4);
res[pos+4]=0;
pos+=4;
}
else if(!strncasecmp(code+pos,"miyao ",6))
{
//strcpy(res+1,"miyao ");
memcpy(res+pos,code+pos,6);
res[pos+6]=0;
pos+=6;
}
else
{
//y_im_str_encode(code,res,DONT_ESCAPE);
strcpy(res,code);
return;
}
if(code[pos]==' ')
{
res[pos++]=' ';
}
for(;code[pos]!=0;pos++)
{
res[pos]='*';
}
res[pos]=0;
}
typedef struct{
char *content;
LArray *index[26];
}Dict;
static Dict *dict;
static int DictPhraseCampare(const uint32_t *p1,const uint32_t *p2)
{
const char *s1=dict->content+*p1;
const char *s2=dict->content+*p2;
return strcasecmp(s1,s2);
}
static inline int DictIndex(int i)
{
if(i>='A' && i<='Z')
i-='A';
else if(i>='a' && i<='z')
i-='a';
else
return -1;
return i;
}
static void DictLoad(void)
{
char *content,*p;
int i;
if(dict)
return;
content=l_file_get_contents("mb/english.txt",NULL,
y_im_get_path("HOME"),
y_im_get_path("DATA"),NULL);
if(!content)
return;
p=strchr(content,']');
if(!p)
return;
p++;
while(isspace(*p))
p++;
dict=l_new(Dict);
dict->content=content;
for(i=0;i<26;i++)
{
dict->index[i]=l_array_new(1000,sizeof(uint32_t));
}
while(*p!='\0')
{
char line[128];
uint32_t pos=(uint32_t)(size_t)(p-content);
LArray *a;
for(i=0;i<sizeof(line)-1 && *p!=0;)
{
int c=*p++;
if(c=='\r')
{
p[-1]=0;
continue;
}
if(c=='\n')
{
p[-1]=0;
break;
}
line[i++]=c;
}
line[i]=0;
i=DictIndex(line[0]);
if(i==-1)
continue;
a=dict->index[i];
if(a->len==0 || DictPhraseCampare(&pos,l_array_nth(a,a->len-1))>=0)
l_array_append(a,&pos);
else
l_array_insert_sorted(a,&pos,(LCmpFunc)DictPhraseCampare);
}
}
static void DictFree(void)
{
int i;
if(!dict)
return;
l_free(dict->content);
for(i=0;i<26;i++)
{
l_array_free(dict->index[i],NULL);
}
l_free(dict);
}
static int DictSet(const char *s)
{
int i;
const char *p,*t;
LArray *a;
ENGLISH_IM *e=&eim_dict;
e->Count=0;
if(!dict)
return 0;
// 只有光标在最后的位置,才启用这个功能
if(!(EIM.CaretPos==-1 || EIM.CaretPos==EIM.CodeLen))
{
return 0;
}
if(!strncasecmp(s,"key ",4) || !strncasecmp(s,"miyao ",6))
return 0;
// 寻找最后一个单词的开始位置
p=s;
#if 0
do{
t=strchr(p,' ');
if(!t)
break;
p=t+1;
}while(1);
#else
t=p+strlen(p)-1;
while(t>p)
{
int c=*t;
if(c>='A' && c<='Z' && !(t[-1]>='A' && t[-1]<='Z'))
{
p=t;
break;
}
if(c==' ')
{
p=t+1;
break;
}
t--;
}
#endif
// 检查最后一个字符串是否是纯英文字母组成
for(t=p;*t!=0;t++)
{
if(*t&0x80)
return 0;
if(!isalpha(*t))
return 0;
}
i=DictIndex(p[0]);
if(i==-1)
return 0;
a=dict->index[i];
int len=strlen(p);
int left=-1;
for(i=0;i<a->len;i++)
{
char *item=dict->content+*(uint32_t*)l_array_nth(a,i);
if(!strncasecmp(p,item,len))
{
left=i;
break;
}
}
if(left==-1)
return 0;
for(i++;i<a->len;i++)
{
char *item=dict->content+*(uint32_t*)l_array_nth(a,i);
if(strncasecmp(p,item,len))
break;
}
e->Priv1=(uintptr_t)p;
e->Priv2=left;
e->Count=i-left;
return e->Count;
}
static int DictGet(char cand[][MAX_CAND_LEN+1],int pos,int count)
{
ENGLISH_IM *e=&eim_dict;
if(e->Count==0)
return 0;
const char *p=(const char *)(size_t)e->Priv1;
int i=DictIndex(p[0]);
LArray *a=dict->index[i];
uint32_t *left=l_array_nth(a,(int)e->Priv2+pos);
for(i=0;i<count;i++)
{
strcpy(cand[i],dict->content+left[i]);
}
return 0;
}
|
671342412e1d46e083bb7da710a9dc1e5001d6a9
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/dev/bi/kdbreg.h
|
df2b43d581dfb117e5418d9fcbe68cb95f4aa1c0
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 2,720
|
h
|
kdbreg.h
|
/* $NetBSD: kdbreg.h,v 1.6 2021/07/24 21:31:36 andvar Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)kdbreg.h 7.3 (Berkeley) 6/28/90
*/
/*
* The KDB50 registers are embedded inside the bi interface
* general-purpose registers.
*/
#ifdef notdef
struct kdb_regs {
struct biiregs kdb_bi;
short kdb_xxx; /* first half of GPR 0 unused */
short kdb_ip; /* initialisation and polling */
short kdb_sa; /* status & address (r/o half) */
short kdb_sw; /* status & address (w/o half) */
};
#endif
#define KDB_IP 0xf2
#define KDB_SA 0xf4
#define KDB_SW 0xf6
#define KDBSR_BITS \
"\20\20ERR\17STEP4\16STEP3\15STEP2\14STEP1\13oldNV\12oldQB\11DI\10IE\1GO"
/*
* Asserting KDB_MAP in values placed in mscp_seq.seq_buffer tells
* the KDB to use mscp_seq.seq_mapbase as a set of PTEs and seq_buffer
* as an offset value. Hence we need no mappings; the KDB50 reads
* the hardware page tables directly. (Without KDB_MAP, seq_buffer
* represents the physical memory address instead, and seq_mapbase is
* unused.)
*/
#define KDB_MAP 0x80000000
#define KDB_PHYS 0 /* pseudo flag */
|
cddf44997f61cc0efd34f29b8556b309f397e20c
|
3225f903ab65e9e242f250a02b3b74fc7e34b098
|
/firmware/config.h
|
912bc1cd2aa5b571a1e00197b6005d9546438254
|
[
"MIT",
"BSD-2-Clause"
] |
permissive
|
timvideos/litex-buildenv
|
6f7657a0d2836f66bbc8ad29f89f1f975eda7832
|
fafb0f1c645a0d36ff4947686b4d2d8e3433f686
|
refs/heads/master
| 2022-06-04T18:02:22.567089
| 2022-05-21T15:21:25
| 2022-05-21T15:21:25
| 115,785,208
| 217
| 88
|
BSD-2-Clause
| 2022-05-21T15:21:26
| 2017-12-30T08:50:22
|
Python
|
UTF-8
|
C
| false
| false
| 1,718
|
h
|
config.h
|
/*
* Copyright 2015 / TimVideo.us
* Copyright 2015 / EnjoyDigital
* Copyright 2017 Joel Addison <joel@addison.net.au>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#include "processor.h"
enum {
CONFIG_KEY_RES_PRIMARY = 0,
CONFIG_KEY_RES_SECONDARY,
// Input config
CONFIG_KEY_INPUT0_ENABLED,
CONFIG_KEY_INPUT1_ENABLED,
// Output 0 config
CONFIG_KEY_OUTPUT0_ENABLED,
CONFIG_KEY_OUTPUT0_SOURCE,
// Output 1 config
CONFIG_KEY_OUTPUT1_ENABLED,
CONFIG_KEY_OUTPUT1_SOURCE,
// Encoder config
CONFIG_KEY_ENCODER_ENABLED,
CONFIG_KEY_ENCODER_SOURCE,
CONFIG_KEY_ENCODER_QUALITY,
CONFIG_KEY_ENCODER_FPS,
CONFIG_KEY_FX2_RESET,
// Networking - MAC Address
CONFIG_KEY_NETWORK_MAC0,
CONFIG_KEY_NETWORK_MAC1,
CONFIG_KEY_NETWORK_MAC2,
CONFIG_KEY_NETWORK_MAC3,
CONFIG_KEY_NETWORK_MAC4,
CONFIG_KEY_NETWORK_MAC5,
// Networking - IP address
CONFIG_KEY_NETWORK_IP0,
CONFIG_KEY_NETWORK_IP1,
CONFIG_KEY_NETWORK_IP2,
CONFIG_KEY_NETWORK_IP3,
// Networking - DHCP enabled?
CONFIG_KEY_NETWORK_DHCP,
CONFIG_KEY_COUNT
};
void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);
#endif /* __CONFIG_H */
|
488d5255f204cdbd5f29b8f6a1dcb7ee4c2017d9
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/emulators/darcnes/files/patch-video__svga.c
|
66c002ca9fc3ef793fd0cc69fe3f551d7c202b21
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 206
|
c
|
patch-video__svga.c
|
--- video_svga.c.orig 2000-09-16 23:45:10 UTC
+++ video_svga.c
@@ -52,7 +52,6 @@ unsigned char *vbpfunc8(int line);
void video_events(void);
-__inline__
void input_update()
{
keyboard_update();
|
7f5849393f94e3facf170959d6d5ebacd5e72b55
|
c726145075755c6d3d36b81af64e0f4049451da4
|
/project/include/xcompile/roaraudio/license.h
|
6a56d474d44e88f39a05898b5e7d1ac9be6d7402
|
[
"LGPL-2.0-or-later",
"LGPL-3.0-only",
"GPL-3.0-or-later",
"LGPL-3.0-or-later",
"GPL-1.0-or-later",
"LGPL-2.1-or-later",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"MIT"
] |
permissive
|
haxenme/nme
|
edf20c532aebb7dee24300826fbb39a2d92f4e99
|
059bf21844a13fdcf30633b7d53ce4a3daae17bf
|
refs/heads/master
| 2023-08-17T00:47:15.797892
| 2023-08-13T06:26:32
| 2023-08-13T06:26:32
| 5,051,566
| 205
| 54
|
MIT
| 2023-02-27T11:03:40
| 2012-07-14T22:19:48
|
C
|
UTF-8
|
C
| false
| false
| 1,553
|
h
|
license.h
|
//license.h:
/*
* Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2011-2013
*
* This file is part of RoarAudio,
* a cross-platform sound system for both, home and professional use.
* See README for details.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation.
*
* RoarAudio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* NOTE: Even though this file is LGPLed it (may) include GPLed files
* so the license of this file is/may therefore downgraded to GPL.
* See HACKING for details.
*/
#ifndef _ROARAUDIO_LICENSE_H_
#define _ROARAUDIO_LICENSE_H_
#define ROAR_LICENSE_UNDEF NULL
#define ROAR_LICENSE_PUBLIC_DOMAIN "public domain"
#define ROAR_LICENSE_PD ROAR_LICENSE_PUBLIC_DOMAIN
#define ROAR_LICENSE_GPLv3_0 "GPL-3.0"
#define ROAR_LICENSE_GPLv3_0_OL "GPL-3.0 (or later)"
#define ROAR_LICENSE_LGPLv3_0 "LGPL-3.0"
#define ROAR_LICENSE_LGPLv3_0_OL "LGPL-3.0 (or later)"
#endif
//ll
|
251905ab0dddd469213f88c9f289b5cb032b47cc
|
85ccd32aa73eecf274a937f1fc3b6f4d484b77da
|
/test cases/unit/74 pkgconfig prefixes/val2/val2.c
|
d7d4857303f7f64db100c62b34ce06bccb997546
|
[
"Apache-2.0"
] |
permissive
|
mesonbuild/meson
|
48321cf4235dfcc0194fed90ff43a57367592bf7
|
cf5adf0c646474f0259d123fad60ca5ed38ec891
|
refs/heads/master
| 2023-09-01T05:58:50.807952
| 2023-03-17T20:27:37
| 2023-08-31T11:52:41
| 19,784,232
| 5,122
| 1,848
|
Apache-2.0
| 2023-09-14T15:47:23
| 2014-05-14T15:08:16
|
Python
|
UTF-8
|
C
| false
| false
| 75
|
c
|
val2.c
|
#include "val1.h"
#include "val2.h"
int val2(void) { return val1() + 2; }
|
00ce4dff23e1d47babec841c3b8df14e9c9edec7
|
a411a55762de11dc2c9d913ff33d2f1477ac02cf
|
/lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.c
|
d0171f3475ab7132b3d46ee8ee491e14166ec8bc
|
[
"BSD-3-Clause"
] |
permissive
|
magma/magma
|
0dc48c1513d9968bd05fb7589f302c192b7c0f94
|
0e1d895dfe625681229e181fbc2dbad83e13c5cb
|
refs/heads/master
| 2023-09-04T09:31:56.140395
| 2023-08-29T13:54:49
| 2023-08-29T13:54:49
| 170,803,235
| 1,219
| 525
|
NOASSERTION
| 2023-09-07T17:45:42
| 2019-02-15T04:46:24
|
C++
|
UTF-8
|
C
| false
| false
| 21,976
|
c
|
obj_hashtable.c
|
/*
* Copyright (c) 2015, EURECOM (www.eurecom.fr)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the FreeBSD Project.
*/
/*! \file obj_hashtable.c
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <pthread.h>
#include "lte/gateway/c/core/common/dynamic_memory_check.h"
#include "lte/gateway/c/core/oai/lib/bstr/bstrlib.h"
#include "lte/gateway/c/core/oai/lib/hashtable/obj_hashtable.h"
#define PRINT_HASHTABLE(...)
//------------------------------------------------------------------------------
/*
Default hash function
def_hashfunc() is the default used by hashtable_create() when the user didn't
specify one. This is a simple/naive hash function which adds the key's ASCII
char values. It will probably generate lots of collisions on large hash
tables.
*/
static hash_size_t def_hashfunc(const void* const keyP, const int key_sizeP) {
hash_size_t hash = 0;
int key_size = key_sizeP;
// may use MD4 ?
while (key_size > 0) {
uint32_t val = 0;
int size = sizeof(val);
while ((size > 0) && (key_size > 0)) {
val = val << 8;
val |= ((uint8_t*)keyP)[key_size - 1];
size--;
key_size--;
}
hash ^= val;
}
return hash;
}
//------------------------------------------------------------------------------
/*
* Initialization
* obj_hashtable_init() sets up the initial structure of the hash table. The
* user specified size will be allocated and initialized to NULL. The user can
* also specify a hash function. If the hashfunc argument is NULL, a default
* hash function is used. If an error occurred, NULL is returned. All other
* values in the returned obj_hash_table_t pointer should be released with
* hashtable_destroy().
*
*/
obj_hash_table_t* obj_hashtable_init(obj_hash_table_t* const hashtblP,
const hash_size_t sizeP,
hash_size_t (*hashfuncP)(const void*, int),
void (*freekeyfuncP)(void**),
void (*freedatafuncP)(void**),
bstring display_name_pP) {
hash_size_t size = sizeP;
// upper power of two:
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2Float
// By Sean Eron Anderson
// seander@cs.stanford.edu
// Individually, the code snippets here are in the public domain (unless
// otherwise noted) — feel free to use them however you please. The aggregate
// collection and descriptions are © 1997-2005 Sean Eron Anderson. The code
// and descriptions are distributed in the hope that they will be useful, but
// WITHOUT ANY WARRANTY and without even the implied warranty of
// merchantability or fitness for a particular purpose. As of May 5, 2005, all
// the code has been tested thoroughly. Thousands of people have read it.
// Moreover, Professor Randal Bryant, the Dean of Computer Science at Carnegie
// Mellon University, has personally tested almost everything with his Uclid
// code verification system. What he hasn't tested, I have checked against all
// possible inputs on a 32-bit machine. To the first person to inform me of a
// legitimate bug in the code, I'll pay a bounty of US$10 (by check or
// Paypal). If directed to a charity, I'll pay US$20.
size--;
size |= size >> 1;
size |= size >> 2;
size |= size >> 4;
size |= size >> 8;
size |= size >> 16;
size++;
if (!(hashtblP->nodes = calloc(size, sizeof(obj_hash_node_t*)))) {
free_wrapper((void**)&hashtblP);
return NULL;
}
hashtblP->size = size;
if (hashfuncP)
hashtblP->hashfunc = hashfuncP;
else
hashtblP->hashfunc = def_hashfunc;
if (freekeyfuncP)
hashtblP->freekeyfunc = freekeyfuncP;
else
hashtblP->freekeyfunc = free_wrapper;
if (freedatafuncP)
hashtblP->freedatafunc = freedatafuncP;
else
hashtblP->freedatafunc = free_wrapper;
if (display_name_pP) {
hashtblP->name = bstrcpy(display_name_pP);
} else {
hashtblP->name = bfromcstr("");
btrunc(hashtblP->name, 0);
bassignformat(hashtblP->name, "obj_hashtable%u@%p", size, hashtblP);
}
hashtblP->log_enabled = true;
return hashtblP;
}
//------------------------------------------------------------------------------
/*
Initialization
obj_hashtable_create() allocate and set up the initial structure of the hash
table. The user specified size will be allocated and initialized to NULL. The
user can also specify a hash function. If the hashfunc argument is NULL, a
default hash function is used. If an error occurred, NULL is returned. All
other values in the returned obj_hash_table_t pointer should be released with
hashtable_destroy().
*/
obj_hash_table_t* obj_hashtable_create(
const hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int),
void (*freekeyfuncP)(void**), void (*freedatafuncP)(void**),
bstring display_name_pP) {
obj_hash_table_t* hashtbl = NULL;
if (!(hashtbl = calloc(1, sizeof(obj_hash_table_t)))) return NULL;
return obj_hashtable_init(hashtbl, sizeP, hashfuncP, freekeyfuncP,
freedatafuncP, display_name_pP);
}
//------------------------------------------------------------------------------
/*
Initialization
obj_hashtable_ts_init() sets up the initial structure of the hash table. The
user specified size will be allocated and initialized to NULL. The user can
also specify a hash function. If the hashfunc argument is NULL, a default
hash function is used. If an error occurred, NULL is returned. All other
values in the returned obj_hash_table_t pointer should be released with
hashtable_destroy().
*/
obj_hash_table_t* obj_hashtable_ts_init(
obj_hash_table_t* const hashtblP, const hash_size_t sizeP,
hash_size_t (*hashfuncP)(const void*, int), void (*freekeyfuncP)(void**),
void (*freedatafuncP)(void**), bstring display_name_pP) {
hash_size_t size = sizeP;
// upper power of two:
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2Float
// By Sean Eron Anderson
// seander@cs.stanford.edu
// Individually, the code snippets here are in the public domain (unless
// otherwise noted) — feel free to use them however you please. The aggregate
// collection and descriptions are © 1997-2005 Sean Eron Anderson. The code
// and descriptions are distributed in the hope that they will be useful, but
// WITHOUT ANY WARRANTY and without even the implied warranty of
// merchantability or fitness for a particular purpose. As of May 5, 2005, all
// the code has been tested thoroughly. Thousands of people have read it.
// Moreover, Professor Randal Bryant, the Dean of Computer Science at Carnegie
// Mellon University, has personally tested almost everything with his Uclid
// code verification system. What he hasn't tested, I have checked against all
// possible inputs on a 32-bit machine. To the first person to inform me of a
// legitimate bug in the code, I'll pay a bounty of US$10 (by check or
// Paypal). If directed to a charity, I'll pay US$20.
size--;
size |= size >> 1;
size |= size >> 2;
size |= size >> 4;
size |= size >> 8;
size |= size >> 16;
size++;
if (!(hashtblP->lock_nodes = calloc(size, sizeof(pthread_mutex_t)))) {
free_wrapper((void**)&hashtblP->nodes);
free_wrapper((void**)&hashtblP->name);
free_wrapper((void**)&hashtblP);
return NULL;
}
pthread_mutex_init(&hashtblP->mutex, NULL);
for (int i = 0; i < size; i++) {
pthread_mutex_init(&hashtblP->lock_nodes[i], NULL);
}
hashtblP->log_enabled = true;
return hashtblP;
}
//------------------------------------------------------------------------------
/*
Initialisation
obj_hashtable_ts_create() allocate and sets up the initial structure of the
hash table. The user specified size will be allocated and initialized to
NULL. The user can also specify a hash function. If the hashfunc argument is
NULL, a default hash function is used. If an error occurred, NULL is
returned. All other values in the returned obj_hash_table_t pointer should be
released with hashtable_destroy().
*/
obj_hash_table_t* obj_hashtable_ts_create(
const hash_size_t sizeP, hash_size_t (*hashfuncP)(const void*, int),
void (*freekeyfuncP)(void**), void (*freedatafuncP)(void**),
bstring display_name_pP) {
obj_hash_table_t* hashtbl = NULL;
hash_size_t size = sizeP;
// upper power of two:
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2Float
// By Sean Eron Anderson
// seander@cs.stanford.edu
// Individually, the code snippets here are in the public domain (unless
// otherwise noted) — feel free to use them however you please. The aggregate
// collection and descriptions are © 1997-2005 Sean Eron Anderson. The code
// and descriptions are distributed in the hope that they will be useful, but
// WITHOUT ANY WARRANTY and without even the implied warranty of
// merchantability or fitness for a particular purpose. As of May 5, 2005, all
// the code has been tested thoroughly. Thousands of people have read it.
// Moreover, Professor Randal Bryant, the Dean of Computer Science at Carnegie
// Mellon University, has personally tested almost everything with his Uclid
// code verification system. What he hasn't tested, I have checked against all
// possible inputs on a 32-bit machine. To the first person to inform me of a
// legitimate bug in the code, I'll pay a bounty of US$10 (by check or
// Paypal). If directed to a charity, I'll pay US$20.
size--;
size |= size >> 1;
size |= size >> 2;
size |= size >> 4;
size |= size >> 8;
size |= size >> 16;
size++;
if (!(hashtbl = obj_hashtable_create(size, hashfuncP, freekeyfuncP,
freedatafuncP, display_name_pP))) {
return NULL;
}
return obj_hashtable_ts_init(hashtbl, size, hashfuncP, freekeyfuncP,
freedatafuncP, display_name_pP);
}
//------------------------------------------------------------------------------
/*
Cleanup
The hashtable_destroy() walks through the linked lists for each possible hash
value, and releases the elements. It also releases the nodes array and the
obj_hash_table_t.
*/
hashtable_rc_t obj_hashtable_destroy(obj_hash_table_t* const hashtblP) {
hash_size_t n;
obj_hash_node_t *node, *oldnode;
for (n = 0; n < hashtblP->size; ++n) {
node = hashtblP->nodes[n];
while (node) {
oldnode = node;
node = node->next;
hashtblP->freekeyfunc(&oldnode->key);
hashtblP->freedatafunc(&oldnode->data);
free_wrapper((void**)&oldnode);
}
}
free_wrapper((void**)&hashtblP->nodes);
free_wrapper((void**)&hashtblP->lock_nodes); // mmm....
bdestroy_wrapper(&hashtblP->name);
free_wrapper((void**)&hashtblP);
return HASH_TABLE_OK;
}
//------------------------------------------------------------------------------
/*
Cleanup
The hashtable_destroy() walks through the linked lists for each possible hash
value, and releases the elements. It also releases the nodes array and the
obj_hash_table_t.
*/
hashtable_rc_t obj_hashtable_ts_destroy(obj_hash_table_t* const hashtblP) {
hash_size_t n;
obj_hash_node_t *node, *oldnode;
for (n = 0; n < hashtblP->size; ++n) {
pthread_mutex_lock(&hashtblP->lock_nodes[n]);
node = hashtblP->nodes[n];
while (node) {
oldnode = node;
node = node->next;
hashtblP->freekeyfunc(&oldnode->key);
hashtblP->freedatafunc(&oldnode->data);
free_wrapper((void**)&oldnode);
}
pthread_mutex_unlock(&hashtblP->lock_nodes[n]);
pthread_mutex_destroy(&hashtblP->lock_nodes[n]);
}
free_wrapper((void**)&hashtblP->nodes);
free_wrapper((void**)&hashtblP->lock_nodes);
bdestroy_wrapper(&hashtblP->name);
free_wrapper((void**)&hashtblP);
return HASH_TABLE_OK;
}
//------------------------------------------------------------------------------
/*
Adding a new element
To make sure the hash value is not bigger than size, the result of the user
provided hash function is used modulo size.
*/
hashtable_rc_t obj_hashtable_insert(obj_hash_table_t* const hashtblP,
const void* const keyP, const int key_sizeP,
void* dataP) {
obj_hash_node_t* node;
hash_size_t hash;
if (hashtblP == NULL) {
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
}
if (keyP == NULL) {
PRINT_HASHTABLE(hashtblP, "return HASH_TABLE_BAD_PARAMETER_KEY\n");
return HASH_TABLE_BAD_PARAMETER_KEY;
}
hash = hashtblP->hashfunc(keyP, key_sizeP) % hashtblP->size;
node = hashtblP->nodes[hash];
while (node) {
if (node->key == keyP) {
if (node->data) {
hashtblP->freedatafunc(&node->data);
}
node->data = dataP;
node->key_size = key_sizeP;
// waste of memory here (keyP is lost) we should free_wrapper it now
PRINT_HASHTABLE(
hashtblP,
"%s(%s,key %p data %p) hash %lx return INSERT_OVERWRITTEN_DATA\n",
__FUNCTION__, bdata(hashtblP->name), keyP, dataP, hash);
return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
node = node->next;
}
if (!(node = malloc(sizeof(obj_hash_node_t)))) {
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return SYSTEM_ERROR\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
return HASH_TABLE_SYSTEM_ERROR;
}
if (!(node->key = malloc(key_sizeP))) {
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return SYSTEM_ERROR\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
free_wrapper((void**)&node);
return -1;
}
memcpy(node->key, keyP, key_sizeP);
node->data = dataP;
node->key_size = key_sizeP;
if (hashtblP->nodes[hash]) {
node->next = hashtblP->nodes[hash];
} else {
node->next = NULL;
}
hashtblP->nodes[hash] = node;
__sync_fetch_and_add(&hashtblP->num_elements, 1);
PRINT_HASHTABLE(
hashtblP, "%s(%s,key %p klen %u data %p) hash %lx return OK\n",
__FUNCTION__, bdata(hashtblP->name), keyP, key_sizeP, dataP, hash);
return HASH_TABLE_OK;
}
//------------------------------------------------------------------------------
/*
Adding a new element
To make sure the hash value is not bigger than size, the result of the user
provided hash function is used modulo size.
*/
hashtable_rc_t obj_hashtable_ts_insert(obj_hash_table_t* const hashtblP,
const void* const keyP,
const int key_sizeP, void* dataP) {
obj_hash_node_t* node;
hash_size_t hash;
if (hashtblP == NULL) {
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
}
if (keyP == NULL) {
PRINT_HASHTABLE(hashtblP, "return HASH_TABLE_BAD_PARAMETER_KEY\n");
return HASH_TABLE_BAD_PARAMETER_KEY;
}
hash = hashtblP->hashfunc(keyP, key_sizeP) % hashtblP->size;
pthread_mutex_lock(&hashtblP->lock_nodes[hash]);
node = hashtblP->nodes[hash];
while (node) {
if (node->key == keyP) {
if ((node->data) && (node->data != dataP)) {
hashtblP->freedatafunc(&node->data);
node->data = dataP;
node->key_size = key_sizeP;
// no waste of memory here because if node->key == keyP, it is a reuse
// of the same key
pthread_mutex_unlock(&hashtblP->lock_nodes[hash]);
PRINT_HASHTABLE(
hashtblP,
"%s(%s,key %p data %p) hash %lx return INSERT_OVERWRITTEN_DATA\n",
__FUNCTION__, bdata(hashtblP->name), keyP, dataP, hash);
return HASH_TABLE_INSERT_OVERWRITTEN_DATA;
}
node->data = dataP;
pthread_mutex_unlock(&hashtblP->lock_nodes[hash]);
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p data %p) hash %lx return ok\n",
__FUNCTION__, bdata(hashtblP->name), keyP, dataP, hash);
return HASH_TABLE_OK;
}
node = node->next;
}
if (!(node = calloc(1, sizeof(obj_hash_node_t)))) {
pthread_mutex_unlock(&hashtblP->lock_nodes[hash]);
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return SYSTEM_ERROR\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
return HASH_TABLE_SYSTEM_ERROR;
}
if (!(node->key = calloc(1, key_sizeP))) {
free_wrapper((void**)&node);
pthread_mutex_unlock(&hashtblP->lock_nodes[hash]);
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return SYSTEM_ERROR\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
return HASH_TABLE_SYSTEM_ERROR;
}
memcpy(node->key, keyP, key_sizeP);
node->data = dataP;
node->key_size = key_sizeP;
if (hashtblP->nodes[hash]) {
node->next = hashtblP->nodes[hash];
} else {
node->next = NULL;
}
hashtblP->nodes[hash] = node;
__sync_fetch_and_add(&hashtblP->num_elements, 1);
pthread_mutex_unlock(&hashtblP->lock_nodes[hash]);
PRINT_HASHTABLE(
hashtblP, "%s(%s,key %p klen %u data %p) hash %lx return OK\n",
__FUNCTION__, bdata(hashtblP->name), keyP, key_sizeP, dataP, hash);
return HASH_TABLE_OK;
}
//------------------------------------------------------------------------------
/*
To remove an element from the hash table, we just search for it in the linked
list for that hash value, and remove it if it is found. If it was not found,
it is an error and -1 is returned.
*/
hashtable_rc_t obj_hashtable_free(obj_hash_table_t* const hashtblP,
const void* const keyP, const int key_sizeP) {
obj_hash_node_t *node, *prevnode = NULL;
hash_size_t hash;
if (hashtblP == NULL) {
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
}
if (keyP == NULL) {
PRINT_HASHTABLE(hashtblP, "return HASH_TABLE_BAD_PARAMETER_KEY\n");
return HASH_TABLE_BAD_PARAMETER_KEY;
}
hash = hashtblP->hashfunc(keyP, key_sizeP) % hashtblP->size;
node = hashtblP->nodes[hash];
while (node) {
if ((node->key == keyP) || ((node->key_size == key_sizeP) &&
(memcmp(node->key, keyP, key_sizeP) == 0))) {
if (prevnode) {
prevnode->next = node->next;
} else {
hashtblP->nodes[hash] = node->next;
}
hashtblP->freekeyfunc(&node->key);
hashtblP->freedatafunc(&node->data);
free_wrapper((void**)&node);
hashtblP->num_elements -= 1;
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return OK\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
return HASH_TABLE_OK;
}
prevnode = node;
node = node->next;
}
return HASH_TABLE_KEY_NOT_EXISTS;
}
//------------------------------------------------------------------------------
/*
Searching for an element is easy. We just search through the linked list for
the corresponding hash value. NULL is returned if we didn't find it.
*/
hashtable_rc_t obj_hashtable_get(const obj_hash_table_t* const hashtblP,
const void* const keyP, const int key_sizeP,
void** dataP) {
obj_hash_node_t* node;
hash_size_t hash;
if (hashtblP == NULL) {
*dataP = NULL;
return HASH_TABLE_BAD_PARAMETER_HASHTABLE;
}
if (keyP == NULL) {
PRINT_HASHTABLE(hashtblP, "return HASH_TABLE_BAD_PARAMETER_KEY\n");
return HASH_TABLE_BAD_PARAMETER_KEY;
}
hash = hashtblP->hashfunc(keyP, key_sizeP) % hashtblP->size;
node = hashtblP->nodes[hash];
while (node) {
if (node->key == keyP) {
*dataP = node->data;
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p data %p) hash %lx return OK\n",
__FUNCTION__, bdata(hashtblP->name), keyP, *dataP, hash);
return HASH_TABLE_OK;
} else if (node->key_size == key_sizeP) {
if (memcmp(node->key, keyP, key_sizeP) == 0) {
*dataP = node->data;
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p data %p) hash %lx return OK\n",
__FUNCTION__, bdata(hashtblP->name), keyP, *dataP,
hash);
return HASH_TABLE_OK;
}
}
node = node->next;
}
*dataP = NULL;
PRINT_HASHTABLE(hashtblP, "%s(%s,key %p) hash %lx return KEY_NOT_EXISTS\n",
__FUNCTION__, bdata(hashtblP->name), keyP, hash);
return HASH_TABLE_KEY_NOT_EXISTS;
}
|
5e9ac6ed502d8f3c45e8ca7cb9c25dbd596f2b6d
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/regress/lib/libm/fpaccuracy/log10.c
|
27b8b0f5095f0efafe6c82ecbd9c6a7f080a2317
|
[] |
no_license
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 89,822
|
c
|
log10.c
|
/* $OpenBSD: log10.c,v 1.1 2009/04/09 01:24:43 martynas Exp $ */
/*
* Copyright (c) 2009 Gaston H. Gonnet <gonnet@inf.ethz.ch>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* This program was generated automatically by a program written
by Gaston H. Gonnet on enigma on 2002-09-01 17:39:14.
Do not edit, rerun the original maple program. */
#include "header.h"
#define DBL_MAX_EXP 1024
#define N 1285
#define F log10
#define Fs "log10"
#define Fn fpaccuracy_log10
/* 6 candidate values discarded */
static struct input_point { double arg_m, val, eps;
int arg_e, val_e; } input_points[N] = {
4503599627370496.,-5412282753821250.,.048455703392481968379,-1074,44,
4503599627370497.,-5412282753821250.,.050152166212416545642,-1074,44,
4503599627370503.,-5412282753821250.,.060330943132024001312,-1074,44,
4503599627370694.,-5412282753821250.,.384355341739520919942,-1074,44,
4503599627370761.,-5412282753821250.,.498018350675131766554,-1074,44,
4503599627370762.,-5412282753821250.,.499714813495066243994,-1074,44,
4503599627371941.,-5412282753821248.,.499844478197553116672,-1074,44,
4503599627373120.,-5412282753821246.,.499974142899516374226,-1074,44,
7737125245472280.,-5629499534215059.,.499997690394823586707,-86,49,
7737125245524560.,-5629499534213406.,-.499973174421081144688,-86,49,
7737125245533516.,-5629499534213123.,-.498590984747027807841,-86,49,
7737125245533611.,-5629499534213120.,-.496678154465282635773,-86,49,
7737125245533626.,-5629499534213120.,-.022691918105010451659,-86,49,
7737125245533627.,-5629499534213120.,.008907164319007661276,-86,49,
7737125245533641.,-5629499534213120.,.451294318255260813535,-86,49,
7737125245533643.,-5629499534213119.,-.485507516896703087202,-86,49,
7737125245533959.,-5629499534213110.,.499802529092795395573,-86,49,
7737125245534497.,-5629499534213092.,-.499891126786781484167,-86,49,
7737125245537630.,-5629499534212993.,-.499965892369216147482,-86,49,
4835703278420175.,-5066549580793747.,.499997690394823586707,-82,49,
4835703278452850.,-5066549580792094.,-.499973174421081144688,-82,49,
4835703278457953.,-5066549580791836.,-.499784998631794137331,-82,49,
4835703278458131.,-5066549580791828.,.499633675729447604502,-82,49,
4835703278458487.,-5066549580791810.,.498471024450937294856,-82,49,
4835703278458507.,-5066549580791808.,-.490358337980479000607,-82,49,
4835703278458516.,-5066549580791808.,-.035331551074617697977,-82,49,
4835703278458517.,-5066549580791808.,.015226980803811283373,-82,49,
4835703278458526.,-5066549580791808.,.470253767709671645030,-82,49,
4835703278468337.,-5066549580791311.,-.499989973527756077437,-82,49,
6044629098072911.,-4503599627370505.,-.499888718716707181394,-79,49,
6044629098073145.,-4503599627370496.,-.035331551074617697977,-79,49,
6044629098073146.,-4503599627370496.,.005115274428125487939,-79,49,
6044629098073158.,-9007199254740991.,-.019045639077913605994,-79,50,
6044629098073183.,-9007199254740989.,.003295636059237325591,-79,50,
6044629098078103.,-9007199254740591.,.000058582887743742087,-79,50,
6044629098080699.,-9007199254740381.,-.000023407086960887479,-79,50,
6044629098128861.,-9007199254736485.,-.000003701241994044540,-79,50,
7555786372591301.,-7881299347898376.,-.499781536920988690500,-76,50,
7555786372591425.,-7881299347898368.,-.475131357176667455853,-76,50,
7555786372591432.,-7881299347898368.,-.022126911545943571248,-76,50,
7555786372591433.,-7881299347898368.,.042588009258445520864,-76,50,
7555786372591440.,-7881299347898368.,.495592454889168925831,-76,50,
7555786372591471.,-7881299347898365.,-.498245000174775325497,-76,50,
7555786372591950.,-7881299347898334.,-.499797934873540729386,-76,50,
7555786372599089.,-7881299347897872.,-.499978312589712437452,-76,50,
7555786372599738.,-7881299347897830.,-.499994710585555254579,-76,50,
4722366482868974.,-6755399441055814.,.499934112856986486930,-72,50,
4722366482869341.,-6755399441055775.,-.499464390801813226645,-72,50,
4722366482869640.,-6755399441055745.,.460153722018943383515,-72,50,
4722366482869645.,-6755399441055744.,-.022126911545943571248,-72,50,
4722366482869646.,-6755399441055744.,.081416961741078972020,-72,50,
4722366482869650.,-6755399441055744.,.495592454889168925831,-72,50,
4722366482869679.,-6755399441055741.,.498364780212810599243,-72,50,
4722366482869708.,-6755399441055737.,-.498862894463566167337,-72,50,
4722366482874025.,-6755399441055290.,-.499961914597477185179,-72,50,
4722366482882321.,-6755399441054431.,-.499989127009613205973,-72,50,
4722366482920556.,-6755399441050472.,-.499994024356360181084,-72,50,
5902958103580447.,-5629499534213668.,.499997470344511245692,-69,50,
5902958103587056.,-5629499534213120.,-.042835686203348082533,-69,50,
5902958103587057.,-5629499534213120.,.039999412426269957344,-69,50,
5902958103587062.,-5629499534213120.,.454174905574359946237,-69,50,
5902958103587075.,-5629499534213118.,-.468968812240607724480,-69,50,
5902958103587135.,-5629499534213113.,-.498862894463566167337,-69,50,
5902958103587304.,-5629499534213099.,-.499731226058503989972,-69,50,
5902958103588475.,-5629499534213002.,-.499830730789467501717,-69,50,
5902958103590817.,-5629499534212809.,.499970259690878375184,-69,50,
7378697629468074.,-4503599627371540.,.499993895110679960360,-66,50,
7378697629483798.,-4503599627370498.,.499266577915372118740,-66,50,
7378697629483813.,-4503599627370497.,.493287761470790634829,-66,50,
7378697629483820.,-4503599627370496.,-.042835686203348082533,-66,50,
7378697629483821.,-4503599627370496.,.023432392700346350491,-66,50,
7378697629483828.,-9007199254740991.,-.025382109947585739614,-66,51,
7378697629483964.,-9007199254740973.,-.000464648142884390813,-66,51,
7378697629493999.,-9007199254739643.,-.000121051925876916116,-66,51,
7378697629498013.,-9007199254739111.,.000016386054463395241,-66,51,
4611686018405948.,-6755399441060290.,-.499999881396781651474,-62,51,
4611686018423165.,-6755399441056639.,-.499953519535860433710,-62,51,
4611686018427387.,-6755399441055744.,-.191700298652607270838,-62,51,
4611686018427388.,-6755399441055744.,.020357553839214929209,-62,51,
4611686018427390.,-6755399441055744.,.444473258822859191356,-62,51,
4611686018427395.,-6755399441055742.,-.495237478718030957976,-62,51,
4611686018427428.,-6755399441055735.,-.497328346487934774727,-62,51,
4611686018427461.,-6755399441055728.,-.499419214257888666656,-62,51,
4611686018428904.,-6755399441055422.,-.499938068611204681465,-62,51,
8703077354446029.,-4778604949514421.,-.499924410695911607853,-60,51,
8703077354446118.,-4778604949514411.,-.499204753621229707789,-60,51,
8703077354446207.,-4778604949514401.,-.498485096546650077764,-60,51,
8703077354446216.,-4778604949514400.,-.487176367179563449489,-60,51,
8703077354446234.,-4778604949514398.,-.464558908445393330374,-60,51,
8703077354450185.,-4778604949513955.,.499973283603713783013,-60,51,
8703077354576636.,-4778604949499746.,.499988418055348390769,-60,51,
5764607523007435.,-4503599627375042.,-.499999881396781651474,-59,51,
5764607523033501.,-4503599627370621.,.499986570633305053287,-59,51,
5764607523033613.,-4503599627370601.,-.499629846097193166604,-59,51,
5764607523034173.,-4503599627370506.,-.497711929755221615186,-59,51,
5764607523034226.,-4503599627370498.,.493541015898094062534,-59,51,
5764607523034232.,-4503599627370496.,-.488581292141158428155,-59,51,
5764607523034234.,-4503599627370496.,-.149288728154242827150,-59,51,
5764607523034235.,-4503599627370496.,.020357553839214929209,-59,51,
7188956797842248.,-5863884328859106.,-.486078263848913873876,-57,52,
7188956797842259.,-5863884328859103.,-.493325109175397726308,-57,52,
7188956797842270.,-5863884328859101.,.499428045498113841974,-57,52,
7188956797843097.,-5863884328858875.,-.499948416788266697292,-57,52,
7188956797844615.,-5863884328858463.,.499986928064899297588,-57,52,
7188956797875111.,-5863884328850165.,-.499994462845281540084,-57,52,
9006440473861104.,-5423039079313661.,.499999293096660420404,-57,52,
9006440473864203.,-5423039079312988.,.495993261630438360331,-57,52,
9006440473864249.,-5423039079312978.,.485607886524645728788,-57,52,
9006440473864378.,-5423039079312950.,.499961943292911616798,-57,52,
7205759403788625.,-4503599627371627.,-.499985789012022190891,-56,52,
7205759403791226.,-4503599627370922.,.499981355242738476872,-56,52,
7205759403792777.,-4503599627370501.,.494194750253757098079,-56,52,
7205759403792788.,-4503599627370498.,.479969313338618012570,-56,52,
7205759403792793.,-4503599627370496.,-.162860430713719442150,-56,52,
7205759403792794.,-4503599627370496.,.108573620475812953899,-56,52,
7205759403793057.,-9007199254740849.,-.008541833356949207402,-56,53,
7205759403793827.,-9007199254740431.,-.000103001514678987376,-56,53,
7205759403819907.,-9007199254726273.,.000007016843243872622,-56,53,
7591484324333081.,-8803213731969180.,-.499990839498066895337,-56,53,
7591484324371714.,-8803213731949274.,.499987581325177102445,-56,53,
7591484324372401.,-8803213731948919.,-.499313918954688577040,-56,53,
7591484324373088.,-8803213731948565.,-.498615419266589951980,-56,53,
7591484324373121.,-8803213731948548.,-.494215054653557528522,-56,53,
7591484324373123.,-8803213731948547.,-.463645335586103393694,-56,53,
7591484324376032.,-8803213731947048.,-.499988952261457568850,-56,53,
8003388475031835.,-8596523747631344.,.499060200049214272601,-56,53,
8003388475031874.,-8596523747631324.,-.439101068557767407578,-56,53,
8003388475031880.,-8596523747631322.,.493489505502688704898,-56,53,
8003388475032369.,-8596523747631083.,.499621291422470750109,-56,53,
8003388475032725.,-8596523747630909.,.499995352328300395440,-56,53,
8715649185154930.,-8263024597387754.,-.499997002912364012912,-56,53,
8715649185197722.,-8263024597368548.,-.499962813691344868371,-56,53,
8715649185231047.,-8263024597353591.,-.499796040440802485875,-56,53,
8715649185231809.,-8263024597353249.,-.497271597562196059239,-56,53,
8715649185231936.,-8263024597353192.,-.496850857085335355295,-56,53,
8715649185231956.,-8263024597353184.,.479593354013307166486,-56,53,
8715649185233382.,-8263024597352543.,-.499934394706573438384,-56,53,
4823460372571543.,-7865906464255499.,.499995958813231860782,-55,53,
4823460372574564.,-7865906464253048.,-.499961744626319767649,-55,53,
4823460372575019.,-7865906464252679.,-.499624358153848799189,-55,53,
4823460372575183.,-7865906464252546.,-.497304948532745078971,-55,53,
4823460372595256.,-7865906464236268.,.499996903442179633331,-55,53,
6866204439023839.,-6484580262615162.,.499997114836160179721,-55,53,
6866204439034841.,-6484580262608893.,-.499944462840310066436,-55,53,
6866204439034899.,-6484580262608860.,-.456497508813590510070,-55,53,
6866204439034920.,-6484580262608848.,-.492490853045364324992,-55,53,
6866204439034927.,-6484580262608845.,.495511365544036271941,-55,53,
7429938090840994.,-6175917371978620.,-.499982465478932858752,-55,53,
7429938090843127.,-6175917371977498.,.499980339808713331215,-55,53,
7429938090848922.,-6175917371974446.,-.499183067050220400690,-55,53,
7429938090848960.,-6175917371974426.,-.492620204152230590405,-55,53,
7429938090849224.,-6175917371974287.,-.499657156653231424852,-55,53,
7429938090849526.,-6175917371974129.,.499868753737294797699,-55,53,
7429938090895848.,-6175917371949741.,.499998548443094730657,-55,53,
7477266621094255.,-6151078473125387.,-.496445016116083754874,-55,53,
7477266621094274.,-6151078473125378.,.443519078694789398049,-55,53,
7477266621094406.,-6151078473125308.,-.499888262619841770156,-55,53,
7477266621094989.,-6151078473125003.,-.499937353440711962086,-55,53,
7477266621095572.,-6151078473124698.,-.499986444285362899092,-55,53,
7477266621156852.,-6151078473092640.,.499999208754941614893,-55,53,
8992428863894944.,-5429294269744736.,.455206186628679357456,-55,53,
8992428863894951.,-5429294269744732.,-.499739028884614436641,-55,53,
8992428863895528.,-5429294269744482.,.499776778082875282170,-55,53,
8992428863899390.,-5429294269742801.,-.499997838434994658874,-55,53,
4684840655054737.,-5268535501554995.,-.499998009122869612881,-54,53,
4684840655106266.,-5268535501511970.,.499915124553567168198,-54,53,
4684840655107072.,-5268535501511297.,.498729962645544739605,-54,53,
4684840655107175.,-5268535501511210.,-.497699406688513925169,-54,53,
4684840655107187.,-5268535501511200.,-.477865935154740827005,-54,53,
4684840655107375.,-5268535501511044.,.499525118871020292242,-54,53,
4684840655111308.,-5268535501507760.,.499945412550676324780,-54,53,
4684840655118871.,-5268535501501445.,.499990836050792245689,-54,53,
5261029272885353.,-4814789783109430.,-.499997819326959411088,-54,53,
5261029272899320.,-4814789783099046.,.499894695829681241378,-54,53,
5261029272899476.,-4814789783098930.,.491874593459089583658,-54,53,
5261029272899515.,-4814789783098901.,.489869567865904264024,-54,53,
5261029272899523.,-4814789783098895.,.438176229282660192626,-54,53,
5261029272903808.,-4814789783095709.,.499931749332641219214,-54,53,
5357701474438019.,-4743562713662630.,-.499995217994721289525,-54,53,
5357701474446282.,-4743562713656598.,.499968975628592888534,-54,53,
5357701474447590.,-4743562713655643.,.499842285347932809349,-54,53,
5357701474447716.,-4743562713655551.,.495242925262713806393,-54,53,
6544763739207500.,-7921395658694251.,-.485104373659462942594,-54,54,
6544763739207505.,-7921395658694246.,.491852304398968271952,-54,54,
6544763739207546.,-7921395658694196.,-.497102935522068006310,-54,54,
6544763739207633.,-7921395658694092.,-.498056737306747339762,-54,54,
6544763739207807.,-7921395658693884.,-.499964340880253406350,-54,54,
6544763739220392.,-7921395658678841.,.499994317027041735060,-54,54,
6748349574614099.,-7681739340518685.,.499998599851669638480,-54,54,
6748349574652460.,-7681739340474212.,.499891538351515681332,-54,54,
6748349574653414.,-7681739340473106.,.499263237205588263107,-54,54,
6748349574653709.,-7681739340472763.,-.498834612761122398080,-54,54,
6748349574653772.,-7681739340472690.,-.461140255298323355949,-54,54,
6748349574653778.,-7681739340472684.,.494830635888574324723,-54,54,
6748349574658774.,-7681739340466892.,.499926028698806431849,-54,54,
6748349574671402.,-7681739340452252.,.499994988846817379714,-54,54,
6750030179296307.,-7679791210214333.,.499996695062685602127,-54,54,
6750030179306097.,-7679791210202986.,.499984553129260131480,-54,54,
6750030179323841.,-7679791210182419.,-.497177434318274380459,-54,54,
6750030179323885.,-7679791210182368.,-.499424680071205775553,-54,54,
6750030179324344.,-7679791210181837.,.499859733531801724080,-54,54,
6750030179325677.,-7679791210180292.,.499960219890572207215,-54,54,
6921931465590491.,-7483045507698244.,-.499997572992716302037,-54,54,
6921931465612133.,-7483045507673784.,.498156093027803913488,-54,54,
6921931465612179.,-7483045507673732.,.489927420394691434771,-54,54,
6921931465612609.,-7483045507673246.,.499963741416277119478,-54,54,
6921931465622574.,-7483045507661983.,.499991498029183715138,-54,54,
7262316160940307.,-7107483908079143.,.499993436920224356412,-54,54,
7262316160954929.,-7107483908063390.,-.499940060779457995754,-54,54,
7262316160955343.,-7107483908062945.,.494317053514168563894,-54,54,
7262316160955356.,-7107483908062931.,.498967639228291017823,-54,54,
7262316160972346.,-7107483908044627.,-.499997668125442907402,-54,54,
7667186625744855.,-6683048777589059.,-.499451588486088858642,-54,54,
7667186625744904.,-6683048777589010.,.499871268611034310027,-54,54,
7667186625747846.,-6683048777586007.,-.499968618102341134013,-54,54,
7667186625759663.,-6683048777573950.,.499994680525965663514,-54,54,
7667186625784768.,-6683048777548332.,-.499998728699227341686,-54,54,
7756304500084488.,-6592637826653493.,.499989126296996139053,-54,54,
7756304500084834.,-6592637826653144.,.499907594753607965034,-54,54,
7756304500086564.,-6592637826651399.,.499499936803139700953,-54,54,
7756304500086679.,-6592637826651283.,.496582664729052286243,-54,54,
7756304500086680.,-6592637826651281.,-.494747050680295146943,-54,54,
7756304500086707.,-6592637826651254.,-.260649366732725000033,-54,54,
7756304500086910.,-6592637826651050.,.499418405166340569340,-54,54,
7756304500133506.,-6592637826604050.,.499999048640355197408,-54,54,
8671512143463121.,-5720020612094756.,-.499998118845112635302,-54,54,
8671512143471118.,-5720020612087541.,-.499979312917251182816,-54,54,
8671512143472652.,-5720020612086158.,.495272511793382115008,-54,54,
8671512143472672.,-5720020612086139.,-.460460841210703645953,-54,54,
8671512143472744.,-5720020612086075.,.498899087974243022951,-54,54,
8671512143473061.,-5720020612085788.,-.499474557148448398625,-54,54,
4889567999034235.,-4779567241590217.,-.499904507127373119962,-53,54,
4889567999034295.,-4779567241590121.,-.496897259623119968046,-53,54,
4889567999035555.,-4779567241588105.,-.433745062305934501972,-53,54,
4889567999035885.,-4779567241587577.,-.417205201189665263125,-53,54,
4889567999035890.,-4779567241587569.,-.416954597233632214871,-53,54,
4889567999038223.,-4779567241583837.,.499977207758920730269,-53,54,
4889567999046204.,-4779567241571067.,.499991225857367773552,-53,54,
4889567999054185.,-4779567241558296.,-.499994776888024584044,-53,54,
4930099044600809.,-4714982848320760.,.499992314945183857408,-53,54,
4930099044602259.,-4714982848318459.,.499019963170791755233,-53,54,
4930099044602305.,-4714982848318386.,.496230495448253065310,-53,54,
4930099044602334.,-4714982848318339.,-.483788951594567021866,-53,54,
4930099044602610.,-4714982848317902.,.499474242053321498193,-53,54,
4930099044602961.,-4714982848317345.,.499928520896195413212,-53,54,
4930099044616224.,-4714982848296297.,-.499999997357077413899,-53,54,
5026050879176558.,-4564180059130816.,.499924216713166528767,-53,54,
5026050879177088.,-4564180059129991.,.498247839024059232653,-53,54,
5026050879177167.,-4564180059129868.,.469696077059176113692,-53,54,
5026050879177185.,-4564180059129840.,.488507068003615915347,-53,54,
5026050879177194.,-4564180059129826.,.497912563475798186836,-53,54,
5026050879179535.,-4564180059126182.,.499941995999307108009,-53,54,
5026050879188466.,-4564180059112280.,.499995317389031988651,-53,54,
5035712052437124.,-4549155906172842.,.499992716797632789805,-53,54,
5035712052438784.,-4549155906170263.,.499602855283075559486,-53,54,
5035712052438840.,-4549155906170175.,-.498000658132239261846,-53,54,
5035712052440043.,-4549155906168307.,.499909580230127460780,-53,54,
5035712052473010.,-4549155906117089.,.499998207865966565787,-53,54,
5280619103515292.,-8355255567088503.,.499971094595302565387,-53,55,
5280619103516946.,-8355255567083601.,-.499656359670307012200,-53,55,
5280619103516973.,-8355255567083521.,-.495418113773229348515,-53,55,
5280619103517651.,-8355255567081513.,.499897838619279997436,-53,55,
5280619103528741.,-8355255567048652.,.499977318276230148718,-53,55,
5280619103569088.,-8355255566929099.,.499995380349395616846,-53,55,
5388947655791161.,-8037513185667781.,-.499998602033934571558,-53,55,
5388947655826010.,-8037513185566596.,.499992967484477082741,-53,55,
5388947655827980.,-8037513185560875.,-.495990196710006515700,-53,55,
5388947655827990.,-8037513185560846.,-.460436811762013123532,-53,55,
5388947655828063.,-8037513185560635.,.499102898356706350122,-53,55,
5388947655828457.,-8037513185559491.,.499906265249267215720,-53,55,
5828367993164858.,-6810984871513336.,-.498558710669152104825,-53,55,
5828367993164896.,-6810984871513234.,-.481991701630903562257,-53,55,
5828367993164912.,-6810984871513192.,.472352302174475784829,-53,55,
5828367993165581.,-6810984871511395.,-.499139038818642633942,-53,55,
5828367993166545.,-6810984871508807.,-.499912810059173506076,-53,55,
5828367993192500.,-6810984871439127.,-.499999311789197981908,-53,55,
5842346135973055.,-6773503427170073.,.499998402877040689138,-53,55,
5842346135980237.,-6773503427150838.,.499968772397473243494,-53,55,
5842346135984650.,-6773503427139019.,.499532843194074213806,-53,55,
5842346135984675.,-6773503427138952.,.455116142912562709682,-53,55,
5842346135984678.,-6773503427138944.,.489786138878762075727,-53,55,
5842346135986496.,-6773503427134075.,.499803693636767393997,-53,55,
6083309738848262.,-6141102707175156.,-.499955101029685251840,-53,55,
6083309738850681.,-6141102707168934.,-.499886763440716314987,-53,55,
6083309738852053.,-6141102707165406.,.472454599317509816782,-53,55,
6083309738852067.,-6141102707165370.,.482376449953797692069,-53,55,
6083309738852088.,-6141102707165316.,.497259225908074119118,-53,55,
6083309738852095.,-6141102707165297.,-.497779848773875174768,-53,55,
6083309738852899.,-6141102707163229.,-.499410712381327993527,-53,55,
6083309738860558.,-6141102707143530.,.499978845595265000459,-53,55,
6083309738948848.,-6141102706916436.,.499990643101085952093,-53,55,
6466710109355003.,-5184773661991221.,.499997231590886577146,-53,55,
6466710109365879.,-5184773661964904.,-.499927402541216808932,-53,55,
6466710109371043.,-5184773661952409.,-.481134737884715490351,-53,55,
6466710109371062.,-5184773661952364.,.492017287780144033123,-53,55,
6466710109371093.,-5184773661952288.,-.499155722977480409208,-53,55,
6466710109371317.,-5184773661951746.,-.499889736204549730320,-53,55,
6683043781680113.,-4669889240306415.,.499834107383468395986,-53,55,
6683043781680781.,-4669889240304851.,.497962564549155460171,-53,55,
6683043781680790.,-4669889240304829.,-.430206363424230427615,-53,55,
6683043781688633.,-4669889240286467.,.499915615203282524334,-53,55,
6683043781697153.,-4669889240266519.,.499997097592025684687,-53,55,
7533119765568612.,-5592742815521734.,-.499984024582481893146,-53,56,
7533119765574798.,-5592742815496037.,.487426386606482294495,-53,56,
7533119765574824.,-5592742815495929.,.497072793075190245064,-53,56,
7533119765574837.,-5592742815495874.,-.498104003690595574861,-53,56,
7533119765575038.,-5592742815495040.,.499547061688086489218,-53,56,
7533119765576283.,-5592742815489868.,.499923063164131370881,-53,56,
7533119765576698.,-5592742815488143.,-.499951603200470866825,-53,56,
7533119765656313.,-5592742815157406.,.499994681845003019677,-53,56,
7593583889909180.,-5342564395175533.,.498783490811309725856,-53,56,
7593583889909279.,-5342564395175125.,.491554287317651628195,-53,56,
7593583889909337.,-5342564395174885.,-.482377973317467523964,-53,56,
7593583889909989.,-5342564395172198.,-.499685455065457865632,-53,56,
7593583889910410.,-5342564395170464.,.499875204603519760686,-53,56,
7593583889912482.,-5342564395161924.,-.499911763938025555323,-53,56,
7593583889939872.,-5342564395049046.,-.499991649106626073447,-53,56,
7593583889944437.,-5342564395030234.,.499994997114569959490,-53,56,
7618936725631545.,-5238255864266180.,-.499999752733673216015,-53,56,
7618936725668054.,-5238255864116223.,.499880213221338840099,-53,56,
7618936725668687.,-5238255864113622.,-.499738407198950046377,-53,56,
7618936725669069.,-5238255864112053.,-.463173340953622650631,-53,56,
7618936725669078.,-5238255864112016.,-.496343273948791245372,-53,56,
7618936725669199.,-5238255864111519.,-.497850150888075765874,-53,56,
7618936725673360.,-5238255864094429.,.499917489397087141452,-53,56,
7618936725683972.,-5238255864050841.,.499991996215078862293,-53,56,
8259236168421722.,-5425920327421732.,-.499965315173584569374,-53,57,
8259236168422549.,-5425920327415466.,.499952317369309593741,-53,57,
8259236168422767.,-5425920327413813.,-.497651015390156779019,-53,57,
8259236168422940.,-5425920327412503.,.495076615003638551814,-53,57,
8259236168434236.,-5425920327326902.,.499997439548379045028,-53,57,
8460168363155807.,-7842968831806098.,.499996607676184453232,-53,58,
8460168363166725.,-7842968831644554.,-.499990251811821826547,-53,58,
8460168363172662.,-7842968831556711.,.499925214376339073473,-53,58,
8460168363172863.,-7842968831553736.,-.499067037215589771132,-53,58,
8460168363173010.,-7842968831551561.,-.483404654096211505061,-53,58,
8460168363173015.,-7842968831551488.,.496719916757524532596,-53,58,
8791115980768044.,-6079217015698469.,-.499990105523048878861,-53,59,
8791115980768818.,-6079217015676427.,-.499564505065165778010,-53,59,
8791115980769023.,-6079217015670590.,.497964238917087898578,-53,59,
8791115980769069.,-6079217015669280.,.487653615596843702138,-53,59,
8791115980769090.,-6079217015668681.,-.473575147225546704397,-53,59,
8791115980769205.,-6079217015665406.,-.499351705563969218952,-53,59,
8791115980791515.,-6079217015030062.,.499995166440597692028,-53,59,
8837821264139149.,-4752662974862797.,.499997641958770331597,-53,59,
8837821264166358.,-4752662974092032.,-.499898267362223980114,-53,59,
8837821264166990.,-4752662974074129.,-.495448819825037644680,-53,59,
8837821264167106.,-4752662974070844.,.499038736862350832348,-53,59,
8837821264167451.,-4752662974061071.,.499885349169089852937,-53,59,
8837821264171075.,-4752662973958411.,-.499917215912688597824,-53,59,
8837821264189943.,-4752662973423927.,-.499993723288346435938,-53,59,
9006099743106022.,-7824031469365511.,.499995358302944939043,-53,67,
9006099743109138.,-7824031447190966.,.499969893275081168993,-53,67,
9006099743112254.,-7824031425016421.,.499936756126744518746,-53,67,
9006099743112935.,-7824031420170186.,-.499750583309762590411,-53,67,
9006099743113215.,-7824031418177609.,.356471843358418391857,-53,67,
9006099743113216.,-7824031418170492.,-.294041648085928412785,-53,67,
9006099743113221.,-7824031418134911.,.453390894680485014583,-53,67,
9006099743113224.,-7824031418113561.,-.498149579669148968533,-53,67,
9006099743113327.,-7824031417380578.,.498960796679879791798,-53,67,
9006099743182849.,-7824030922637729.,.498092910049324241690,-53,67,
9007144712050371.,-6209578279819947.,.499789463270636884003,-53,71,
9007144712055836.,-6209577657638538.,-.499810397331985640993,-53,71,
9007144712056048.,-6209577633502682.,.498550675308658490224,-53,71,
9007144712056137.,-6209577623370175.,-.497420553122232491861,-53,71,
9007144712056158.,-6209577620979359.,-.473998048586901227517,-53,71,
9007144712056161.,-6209577620637814.,-.327794834108314773211,-53,71,
9007144712056162.,-6209577620523966.,.054272904025934472794,-53,71,
9007144712056171.,-6209577619499331.,.492882546665387314658,-53,71,
9007144712057074.,-6209577516694241.,-.499955179835599145792,-53,71,
9007198645421183.,-8879316057025228.,.488976101032133937188,-53,78,
9007198645422961.,-8879290147110188.,.496890506156041498424,-53,78,
9007198645424739.,-8879264237195148.,.499690354495466566776,-53,78,
9007198645424872.,-8879262299051896.,-.476683762544252050988,-53,78,
9007198645424957.,-8879261060388916.,-.499193488593766897874,-53,78,
9007198658399535.,-8690188949355324.,-.273479579316638407615,-53,78,
9007198658422453.,-8689854976671393.,.448191520205094458837,-53,78,
9007198658430258.,-8689741238264984.,.499682488696668225141,-53,78,
9007198658430429.,-8689738746366521.,-.496577132464507597391,-53,78,
9007198658430445.,-8689738513206431.,-.484533669402742252970,-53,78,
9007198658430453.,-8689738396626386.,-.478512093187690076280,-53,78,
9007198658430592.,-8689736371048104.,-.498903735453057021534,-53,78,
9007198658431089.,-8689729128512809.,.499871888413553418201,-53,78,
9007198744458217.,-7436098327752221.,.498571871304860100483,-53,78,
9007198744459518.,-7436079368922582.,-.474349030493905306786,-53,78,
9007198744459520.,-7436079339777572.,.498788106764276404377,-53,78,
9007198744460190.,-7436069576198896.,.499364872639595020707,-53,78,
9007198744462498.,-7436035942856233.,.492806624861152209567,-53,78,
9007198744508919.,-7435359472579042.,-.474586709313371459410,-53,78,
9007198751706499.,-7330472698581509.,.383554472076394818038,-53,78,
9007198751718177.,-7330302520862574.,.499994486412583256768,-53,78,
9007198751718455.,-7330298469706051.,-.498723489267267429405,-53,78,
9007198751718495.,-7330297886805833.,.494256440385815572579,-53,78,
9007198751723162.,-7330229876922782.,.482419362073197886964,-53,78,
9007198756991593.,-7253455637354040.,.498453069446295337939,-53,78,
9007198756992127.,-7253447855636121.,.498824277292136126379,-53,78,
9007198756992957.,-7253435760456583.,-.479042654902141245876,-53,78,
9007198756992972.,-7253435541869001.,-.484677009357773335061,-53,78,
9007198756993002.,-7253435104693837.,-.495946810333446784922,-53,78,
9007198756993017.,-7253434886106256.,.498417743146511854405,-53,78,
9007198756996740.,-7253380632668405.,.488442290824550816838,-53,78,
9007198772918826.,-7021355947603821.,-.480252666667493618508,-53,78,
9007198772918860.,-7021355452138637.,.497597030305159272176,-53,78,
9007198772918944.,-7021354228048179.,-.498311736530184965240,-53,78,
9007198772919398.,-7021347612130710.,.499793296430528505626,-53,78,
9007198772942559.,-7021010098332202.,.044375743568381422585,-53,78,
9007198772949873.,-7020903515027410.,-.279747560858765316617,-53,78,
9007198805307567.,-6549370844018165.,.055313900315177349459,-53,78,
9007198805328400.,-6549067255013415.,.494494351939928798727,-53,78,
9007198805331018.,-6549029104194308.,-.490283871478516598387,-53,78,
9007198805331036.,-6549028841889212.,.495267506212130270184,-53,78,
9007198805331170.,-6549026889173490.,.498800174822020439150,-53,78,
9007198805331237.,-6549025912815628.,-.499444384822102481813,-53,78,
9007198805332345.,-6549009766479659.,.498681981739495320294,-53,78,
9007198859763360.,-5755813509509940.,.474289071461962856507,-53,78,
9007198859768993.,-5755731422587585.,.470160882143171040236,-53,78,
9007198859769033.,-5755730839687373.,.470658105122175767768,-53,78,
9007198859770453.,-5755710146729847.,.486632433557115132911,-53,78,
9007198859771373.,-5755696740024971.,.495240519787049416952,-53,78,
9007198859771393.,-5755696448574865.,.495412444088673026457,-53,78,
9007198859795472.,-5755345557219746.,-.067008867393373899672,-53,78,
9007198895054592.,-5241531845153156.,.437224332548842635125,-53,78,
9007198895062879.,-5241411082802208.,.499816295600353961334,-53,78,
9007198895063373.,-5241403883984618.,.497866399480120405282,-53,78,
9007198895063402.,-5241403461381965.,-.457725924291447492313,-53,78,
9007198895063406.,-5241403403091944.,-.486083592970601954018,-53,78,
9007198895063443.,-5241402863909250.,-.498393255409564484235,-53,78,
9007198918835676.,-4894981874338206.,.497526100719643506643,-53,78,
9007198918835720.,-4894981233147977.,.493327278659943449544,-53,78,
9007198918835735.,-4894981014560398.,-.439923035678364547040,-53,78,
9007198918835901.,-4894978595524535.,.498749180336166348135,-53,78,
9007198918836126.,-4894975316710864.,.499890355124937188419,-53,78,
9007198974136351.,-8178225005129931.,.464264823854537486610,-53,79,
9007198974136538.,-8178219555013018.,.466947473921372225234,-53,79,
9007198974139904.,-8178121452908584.,.495886386557888595174,-53,79,
9007198974141026.,-8178088752207106.,.497385832426270305761,-53,79,
9007198974141039.,-8178088373321973.,.486684146801320404704,-53,79,
9007198974141052.,-8178087994436840.,.475981914335255635238,-53,79,
9007198974155225.,-8177674922206851.,.175099850753152467432,-53,79,
9007199052041097.,-5907690395816518.,.480141670050942328398,-53,79,
9007199052042543.,-5907648252132090.,.492952949076740255796,-53,79,
9007199052044618.,-5907587776236385.,-.420261956138390944768,-53,79,
9007199052044622.,-5907587659656346.,.491217187402047542631,-53,79,
9007199052044667.,-5907586348130897.,.495353984821810623229,-53,79,
9007199052044712.,-5907585036605448.,.499484229855547352100,-53,79,
9007199067960722.,-5443712766757416.,.453167351595547561160,-53,79,
9007199068058786.,-5440854690504012.,.375773777101853970091,-53,79,
9007199068083302.,-5440140171440666.,.494439647193403742554,-53,79,
9007199068085112.,-5440087418972700.,.499693517719227940704,-53,79,
9007199068085139.,-5440086632057431.,-.499203382138079082393,-53,79,
9007199068085152.,-5440086253172302.,-.461636064104121122485,-53,79,
9007199120523059.,-7823565875218210.,.499944109198228105537,-53,80,
9007199120523258.,-7823554275504326.,-.496390004191888276675,-53,80,
9007199120523260.,-7823554158924287.,-.471228833739625325275,-53,80,
9007199120523263.,-7823553984054229.,.066512873402577052041,-53,80,
9007199120523264.,-7823553925764209.,-.420906570493006702129,-53,80,
9007199120523377.,-7823547338992004.,-.499345413575703276695,-53,80,
9007199120527868.,-7823285558514374.,.431371321382871710738,-53,80,
9007199120534386.,-7822905624167191.,.099744248845087994523,-53,80,
9007199179190063.,-8807730156900675.,.008801035587392305283,-53,81,
9007199179193036.,-8807383564446911.,.286898529734615951774,-53,81,
9007199179198775.,-8806714511607304.,.495122361632260792212,-53,81,
9007199179198839.,-8806707050484854.,-.498511918581960490061,-53,81,
9007199179198982.,-8806690379539383.,.499894923924102541808,-53,81,
9007199179205707.,-8805906378782046.,.189008269619763059020,-53,81,
9007199180925940.,-8605361549835388.,.103509486735156140358,-53,81,
9007199180930381.,-8604843817885549.,-.217026500206633258551,-53,81,
9007199180957027.,-8601737426186523.,.499134547174372652142,-53,81,
9007199180957381.,-8601696156852984.,-.491057398743272552379,-53,81,
9007199180957418.,-8601691843391570.,.498574678747195623698,-53,81,
9007199206467276.,-5627751626390361.,-.247168203290902843922,-53,81,
9007199206479378.,-5626340774771542.,.378681235847054444103,-53,81,
9007199206483656.,-5625842045369351.,-.498086512997405791491,-53,81,
9007199206483702.,-5625836682687608.,.480445982953361798447,-53,81,
9007199206483713.,-5625835400307190.,-.481213347379641256854,-53,81,
9007199206483759.,-5625830037625447.,.497285212066292872644,-53,81,
9007199206484125.,-5625787369331571.,.499145727109257905462,-53,81,
9007199206484777.,-5625711359146852.,.492700244052596899731,-53,81,
9007199206527134.,-5620773378481001.,.295381697626909376312,-53,81,
9007199242897716.,-5522758234398352.,-.224592677437703704608,-53,83,
9007199242954392.,-5496329073590350.,.409588282031820529547,-53,83,
9007199242956258.,-5495458920190894.,.487096629793995516625,-53,83,
9007199242956321.,-5495429542021459.,.496213929287489361397,-53,83,
9007199242956342.,-5495419749298314.,.499207366270414912228,-53,83,
9007199242956674.,-5495264931008593.,.495879399953863081602,-53,83,
9007199242957649.,-5494810268862575.,.450106820037018054424,-53,83,
9007199254731348.,-4605124114865813.,-.145772999677475806726,-53,93,
9007199254740480.,-7823553867474413.,.443369586828641146432,-53,98,
9007199254740896.,-5867665400605674.,.082405543942148722412,-53,100,
9007199254740911.,-4950842681761033.,-.245565669857734801577,-53,100,
9007199254740960.,-7823553867474204.,-.095279099602088074758,-53,102,
9007199254740986.,-5867665400605645.,.397283072411868402017,-53,104,
9007199254740989.,-5867665400605644.,.374445656694185665153,-53,105,
9007199254740990.,-7823553867474191.,-.066444642504500458090,-53,106,
9007199254740991.,-7823553867474191.,.367849839398751465994,-53,107,
4503599627370496.,0.,0.000000000000000000000,-52,0,
4503599627370497.,7823553867474189.,.329266714891493147485,-52,106,
4503599627370498.,7823553867474188.,.460677751084989877914,-52,105,
4503599627370501.,4889721167171366.,.159319287290926007578,-52,103,
4503599627370517.,5134207225529925.,.347101131687219028803,-52,101,
4503599627370569.,8923741130087676.,-.129173805935221925801,-52,100,
4503599627371103.,4637594919488783.,-.363903055218774661621,-52,96,
4503599627376043.,5297516272320875.,-.093732541999954987325,-52,93,
4503599627377359.,6554327416068659.,.194304609982645307903,-52,93,
4503599627380487.,4770820720815914.,-.203243814524009051195,-52,92,
4503599640661305.,6197772026084563.,.292320417507903403360,-52,82,
4503599640675471.,6204377917297944.,.188366648463872860176,-52,82,
4503599640746301.,6237407373364537.,-.012265486547626541726,-52,82,
4503599640748662.,6238508355233414.,.467984959082928242446,-52,82,
4503599640749446.,6238873950229264.,-.466734418171525730360,-52,82,
4503599640749459.,6238880012391184.,.499372856591623469776,-52,82,
4503599643257923.,7408627315212669.,.305619186400531623914,-52,82,
4503599643293407.,7425174219326738.,.493120694483711711501,-52,82,
4503599643301028.,7428728045170857.,.470485043989035839256,-52,82,
4503599643301038.,7428732708372332.,.494716146649291550921,-52,82,
4503599643301040.,7428733641012627.,.499561124654872039338,-52,82,
4503599643302278.,7429310945355235.,.419126375291282371367,-52,82,
4503599653608297.,6117607620048888.,.053531155501245695470,-52,81,
4503599653612281.,6118536529780586.,.499475196830780005731,-52,81,
4503599653612327.,6118547255143954.,.498821392299383528543,-52,81,
4503599653612442.,6118574068552374.,.496707602273000411729,-52,81,
4503599653612451.,6118576166993033.,.453035025617581750653,-52,81,
4503599659568391.,7507263572553034.,.367194320486930533210,-52,81,
4503599659575269.,7508867247534501.,.374854396033801290298,-52,81,
4503599659577281.,7509336365601193.,.499716508043262589789,-52,81,
4503599659577456.,7509377168613952.,.496693430979719280874,-52,81,
4503599659577467.,7509379733374754.,.490736160588153472399,-52,81,
4503599659595400.,7513560992962215.,.176194232126079078966,-52,81,
4503599680919697.,6242767812207479.,-.178741587914745593882,-52,80,
4503599680946526.,6245895537990679.,.172103260695306707622,-52,80,
4503599680948049.,6246073089385357.,-.458626011391993733633,-52,80,
4503599680955664.,6246960846358742.,.487078836370742113964,-52,80,
4503599680956602.,6247070198432418.,-.499612449200961812047,-52,80,
4503599680956632.,6247073695833495.,-.473976307660099540649,-52,80,
4503599680956652.,6247076027434213.,-.456898489616710899712,-52,80,
4503599681425018.,6301678152526112.,.495542102793254443598,-52,80,
4503599681425602.,6301746235267072.,-.490829641829103147925,-52,80,
4503599681425638.,6301750432148364.,-.497127746362894058652,-52,80,
4503599681425656.,6301752530589009.,.499710620789908113384,-52,80,
4503599681430113.,6302272127808965.,.236484192732237868552,-52,80,
4503599681435208.,6302866103091817.,.305451799989846779863,-52,80,
4503599681487434.,6308954612046093.,.014847182414120060943,-52,80,
4503599694413439.,7815868736660571.,.255255780824825569414,-52,80,
4503599694471868.,7822680391557825.,-.226503933184695169513,-52,80,
4503599694478885.,7823498433667285.,.497509151718098429675,-52,80,
4503599694479259.,7823542034600582.,-.498538927709639328024,-52,80,
4503599694479357.,7823553459444065.,.480507537290829887613,-52,80,
4503599694479360.,7823553809184172.,.132923405311658340987,-52,80,
4503599694479361.,7823553925764208.,-.316271357120000608475,-52,80,
4503599694479377.,7823555791044776.,.496608923481869360193,-52,80,
4503599694480499.,7823686593844664.,.483312533056480351993,-52,80,
4503599694483914.,7824084714666070.,.231610780582962242116,-52,80,
4503599718151123.,5291604387010888.,.479043482826849940676,-52,79,
4503599718152897.,5291707793501878.,.499061633418519656010,-52,79,
4503599718152929.,5291709658782438.,-.493059502989965758743,-52,79,
4503599718153155.,5291722832326385.,.499707631380092418718,-52,79,
4503599718207503.,5294890778195771.,.220865249406687200396,-52,79,
4503599720390462.,5422135496407493.,-.322400911862363230903,-52,79,
4503599720401708.,5422791025943623.,-.499897347659605708336,-52,79,
4503599720401733.,5422792483194058.,.497351047886377737341,-52,79,
4503599720404611.,5422960241864250.,.446518103309417499185,-52,79,
4503599750515393.,7178118243904410.,.396343262702798522674,-52,79,
4503599750519267.,7178344059430462.,.499618055972174381665,-52,79,
4503599750519347.,7178348722631827.,-.494101184023967883690,-52,79,
4503599750519387.,7178351054232509.,-.490991867182326307762,-52,79,
4503599750520565.,7178419719872593.,.491292191588843462209,-52,79,
4503599750522502.,7178532627635619.,.437545493683364886430,-52,79,
4503599750552875.,7180303070323474.,.246030057445962608170,-52,79,
4503599772429744.,8455506134229064.,.306787468962762549165,-52,79,
4503599772445449.,8456421578942380.,.468844975752141331968,-52,79,
4503599772458071.,8457157315534004.,-.464701863757746977255,-52,79,
4503599772458084.,8457158073304221.,.494927911425524261391,-52,79,
4503599772458131.,8457160812935010.,-.497198074056832242460,-52,79,
4503599772458875.,8457204180707483.,.495977827237223806742,-52,79,
4503599772461154.,8457337023655693.,.438554150309828007469,-52,79,
4503599775920912.,8659006375404829.,-.229779121272955018205,-52,79,
4503599775954317.,8660953553413397.,-.225745695279038899256,-52,79,
4503599776085972.,8668627725564671.,.217155476646089337361,-52,79,
4503599776092522.,8669009525174182.,-.499677554814705019158,-52,79,
4503599776092579.,8669012847705134.,.488135748542505121212,-52,79,
4503599776092586.,8669013255735252.,-.478276043255922609122,-52,79,
4503599776092611.,8669014712985669.,.498819523127798792270,-52,79,
4503599804231484.,5154615042743870.,-.499678148420653525938,-52,78,
4503599804231591.,5154618161259744.,.486509236995549339142,-52,78,
4503599804231608.,5154618656724884.,-.497000522722217723709,-52,78,
4503599804232211.,5154636231164814.,.498472990192697292209,-52,78,
4503599804244339.,5154989701823990.,-.025836432441129022597,-52,78,
4503599804248887.,5155122253321181.,-.467859347449476670865,-52,78,
4503599804285998.,5156203853719645.,-.077845992465943211658,-52,78,
4503599814625422.,5457546450400118.,-.499640956905134006109,-52,78,
4503599814625504.,5457548840290783.,-.465143153347595382250,-52,78,
4503599814625522.,5457549364900929.,-.481966533006621300121,-52,78,
4503599814625540.,5457549889511075.,-.498792009428906917688,-52,78,
4503599814626611.,5457581103814760.,.496318231673047463463,-52,78,
4503599814631367.,5457719717473332.,.388666151039387029940,-52,78,
4503599814685344.,5459292877576084.,-.087801314494787894122,-52,78,
4503599827004805.,5818343667838230.,.418379713024136042369,-52,78,
4503599827008934.,5818464007576386.,.497452686591453898285,-52,78,
4503599827009267.,5818473712864060.,.499506407079290651684,-52,78,
4503599827009832.,5818490179793597.,.468316194491033176368,-52,78,
4503599827009833.,5818490208938605.,.498347654718072609996,-52,78,
4503599827027348.,5819000683754251.,-.493329774295981005673,-52,78,
4503599831827665.,5958905961190841.,.483584825063132170036,-52,78,
4503599831829909.,5958971362588791.,-.106805427108142418233,-52,78,
4503599831830101.,5958976958430327.,-.329956492857667599352,-52,78,
4503599831830245.,5958981155311479.,-.497476350492006233877,-52,78,
4503599831830247.,5958981213601495.,-.499803960019130002617,-52,78,
4503599831830248.,5958981242746502.,.499032225510070873756,-52,78,
4503599831833691.,5959081589009042.,.453650526097361058121,-52,78,
4503599831856935.,5959759035574965.,.135744013647713050028,-52,78,
4503599831872431.,5960210666618912.,-.351993831822616704369,-52,78,
4503599838493341.,6153177141384835.,.089862629607575556901,-52,78,
4503599838545775.,6154705330731976.,.208206225448305652923,-52,78,
4503599838550676.,6154848170415965.,.431722851666609511523,-52,78,
4503599838555264.,6154981887712464.,.486424104890607164545,-52,78,
4503599838555286.,6154982528902640.,-.496640893654977315375,-52,78,
4503599838555398.,6154985793143530.,.498616006222757198806,-52,78,
4503599838555577.,6154991010099954.,.499795540517668910700,-52,78,
4503599840025107.,6197820473633538.,.361269069531011686481,-52,78,
4503599840031652.,6198011227710544.,-.495252095594530040885,-52,78,
4503599840031689.,6198012306075837.,.497895523136481810526,-52,78,
4503599840031818.,6198016065781863.,-.499037474790232913014,-52,78,
4503599840032113.,6198024663559206.,.499819547060559399135,-52,78,
4503599840032408.,6198033261336550.,.498113387366238792391,-52,78,
4503599840077818.,6199356736147361.,-.395447718130028925156,-52,78,
4503599864052596.,6898101829588176.,.418634032237617745808,-52,78,
4503599864069173.,6898584966382315.,.490586676841451779060,-52,78,
4503599864070641.,6898627751253752.,-.499476223138286767136,-52,78,
4503599864070865.,6898634279735497.,-.496461513262748771271,-52,78,
4503599864070879.,6898634687765606.,-.433783875400200348552,-52,78,
4503599864071008.,6898638447471611.,-.499171044896219450917,-52,78,
4503599865858060.,6950722091922752.,.267922937876161960682,-52,78,
4503599865866469.,6950967172293163.,-.499151525645421466552,-52,78,
4503599865866505.,6950968221513443.,-.470597224074234575760,-52,78,
4503599865866532.,6950969008428653.,-.449187001899275872659,-52,78,
4503599865866889.,6950979413196430.,-.499873201714335505064,-52,78,
4503599865867589.,6950999814701874.,.496387180210626908896,-52,78,
4503599878044787.,7305904344653177.,-.499928878449995591449,-52,78,
4503599878044807.,7305904927553330.,.495253614822917446122,-52,78,
4503599878048937.,7306025296435130.,.444979412596952601846,-52,78,
4503599878053087.,7306146248217084.,.278432443696141774067,-52,78,
4503599895527260.,7815431153860045.,.480941214565219084136,-52,78,
4503599895529679.,7815501655633397.,.499456303032908264932,-52,78,
4503599895530112.,7815514275421682.,.499188016097897172055,-52,78,
4503599895530545.,7815526895209967.,.497706395728708659086,-52,78,
4503599895536682.,7815705758121526.,.341622585190125819129,-52,78,
4503599895546104.,7815980362383007.,-.372196757322060783360,-52,78,
4503599929444085.,8803937272076917.,-.480606622868275677670,-52,78,
4503599929444104.,8803937825832056.,.494844733904719250130,-52,78,
4503599929444262.,8803942430743221.,-.498860790107786674866,-52,78,
4503599929444548.,8803950766215327.,.499463892430537127950,-52,78,
4503599929446422.,8804005383959133.,.482381689127811289649,-52,78,
4503599943605736.,4608339347076846.,-.493642899512998996072,-52,77,
4503599943605863.,4608341197784807.,.499443120530010203986,-52,77,
4503599943621109.,4608563370175268.,.117018754456355270751,-52,77,
4503599943758323.,4610562921689380.,-.170127351750161373365,-52,77,
4503599943773569.,4610785094079833.,-.073735453629040554833,-52,77,
4503626898712911.,6209540018823364.,.217836019594716144405,-52,71,
4503626898712912.,6209540019051058.,.224373426011519134932,-52,71,
4503626898712924.,6209540021783386.,.302822299069637294465,-52,71,
4503626898712953.,6209540028386512.,.492407045570072993133,-52,71,
4503626898712954.,6209540028614206.,.498944449863443361542,-52,71,
4503626898713413.,6209540133125755.,.499607683120873012033,-52,71,
4503626898713719.,6209540202800122.,-.499956078925870450651,-52,71,
4503626898718155.,6209541212850734.,.499300242207755991729,-52,71,
4504149383144373.,7823075825172407.,.497474909022526227862,-52,67,
4504149383172906.,7823076231174873.,.499798351133309136482,-52,67,
4504149383174669.,7823076256260996.,.499822497409476982955,-52,67,
4504149383183484.,7823076381691611.,.499795941818615638885,-52,67,
4504149383183809.,7823076386316110.,-.499642514392393463558,-52,67,
4504149383184370.,7823076394298705.,-.489443219308658974156,-52,67,
4504149383184379.,7823076394426768.,-.467889228025475106204,-52,67,
4504149383184384.,7823076394497914.,-.344803677423164971822,-52,67,
4504149383184385.,7823076394512143.,-.120186567312180355710,-52,67,
4504149383184410.,7823076394867873.,.495241184435715547534,-52,67,
4504149383184459.,7823076395565106.,-.498520427865923721086,-52,67,
6005646624948160.,9007199254568222.,-.499998935518059296384,-52,56,
6005646624980238.,9007199254735373.,.499865747246457241540,-52,56,
6005646624981201.,9007199254740391.,.498988798768019956208,-52,56,
6005646624981315.,9007199254740986.,-.469962366525682262003,-52,56,
6005646624981316.,9007199254740991.,-.259163692537080416944,-52,56,
6005646624981317.,4503599627370498.,-.024182509274239719767,-52,55,
6005646624981329.,4503599627370529.,.240609534657332306341,-52,55,
6005646624981386.,4503599627370678.,-.251628256668553686406,-52,55,
6005646624981590.,4503599627371209.,.249836490153568209670,-52,55,
6005646624984683.,4503599627379268.,-.250014188917133656126,-52,55,
6005646624994925.,4503599627405952.,.249995268996513564534,-52,55,
8008658488351403.,9007199254622759.,-.000013027686031685165,-52,55,
8008658488409725.,9007199254736707.,-.000027553098171820155,-52,55,
8008658488411845.,9007199254740849.,.000589166056742351671,-52,55,
8008658488411888.,9007199254740933.,.012865825915048782012,-52,55,
8008658488411918.,4503599627370496.,-.186958949882734839667,-52,54,
8008658488411919.,4503599627370497.,-.210072011977412038028,-52,54,
8008658488411929.,4503599627370507.,-.441202632924190730477,-52,54,
8008658488411932.,4503599627370509.,.489458180791773283200,-52,54,
8008658488412494.,4503599627371058.,.499917283562999206995,-52,54,
9007199254643340.,5422874305113771.,.499998431711740291838,-52,54,
9007199254717314.,5422874305178025.,-.499992513232114170068,-52,54,
9007199254740988.,5422874305198587.,.475136668967818721204,-52,54,
9007199254740991.,5422874305198590.,.080903560387330410356,-52,54,
4503599627370497.,5422874305198593.,-.313329548193158768386,-51,54,
4503599627370570.,5422874305198720.,-.499340832444681032833,-51,54,
4503599627370882.,5422874305199262.,-.499827417214080179824,-51,54,
4503599627371038.,5422874305199532.,.499929290387139522745,-51,54,
4503599627375113.,5422874305206611.,.499984309337333435191,-51,54,
7120816245950054.,9007199254699105.,.000003842006123563559,-51,54,
7120816245983128.,9007199254735443.,-.000014848634465499221,-51,54,
7120816245988083.,9007199254740887.,-.002013188506237046437,-51,54,
7120816245988154.,9007199254740965.,.004819933135074049332,-51,54,
7120816245988174.,9007199254740987.,-.021424257952020977658,-51,54,
7120816245988178.,9007199254740991.,.373326903830552610909,-51,54,
7120816245988179.,4503599627370496.,.236007347138097811160,-51,53,
7120816245988387.,4503599627370610.,.499537553483294148139,-51,53,
7120816245988691.,4503599627370778.,-.499918298787422723476,-51,53,
5812361472613257.,6420807498743686.,-.499998651183340918059,-50,53,
5812361472643105.,6420807498763774.,-.499885783131745331259,-50,53,
5812361472645307.,6420807498765255.,.467959580493779376778,-50,53,
5812361472645313.,6420807498765260.,-.493980895355419425075,-50,53,
5812361472645417.,6420807498765329.,.499050856591139027355,-50,53,
5812361472645680.,6420807498765507.,-.499340001472671402696,-50,53,
5812361472646836.,6420807498766285.,-.499871681878532787620,-50,53,
5995926477584710.,6542437866569278.,-.499966893015783323427,-50,53,
5995926477585271.,6542437866569643.,.499661026104887569065,-50,53,
5995926477585458.,6542437866569765.,.499536999137501374495,-50,53,
5995926477585461.,6542437866569767.,.456754260736924061581,-50,53,
5995926477592774.,6542437866574539.,-.499967716647761251196,-50,53,
5995926477754054.,6542437866679759.,-.499985675160749332741,-50,53,
6025316007234861.,6561564926584206.,-.499744260274169276842,-50,53,
6025316007235166.,6561564926584404.,-.486567298736218955502,-50,53,
6025316007235186.,6561564926584416.,.497903321692148913159,-50,53,
6025316007236600.,6561564926585334.,.499976185868516901258,-50,53,
6025316007247225.,6561564926592232.,.499993280726757914482,-50,53,
6084210162701752.,6599614741596823.,-.499999322908825762015,-50,53,
6084210162707849.,6599614741600743.,-.499978417606829813478,-50,53,
6084210162770561.,6599614741641063.,-.499763619641722114244,-50,53,
6084210162778400.,6599614741646103.,-.499736799117382093367,-50,53,
6084210162778428.,6599614741646121.,-.497440492077779326202,-50,53,
6084210162778442.,6599614741646130.,-.496292338558009010597,-50,53,
6369701198561097.,6778991790400979.,.478610063847577445284,-50,53,
6369701198561110.,6778991790400987.,.462202787171836346640,-50,53,
6369701198561141.,6778991790401007.,-.499999180285765873078,-50,53,
6469155038028473.,6839596724335558.,.499995856451383785083,-50,53,
6469155038059362.,6839596724354236.,.499981267349716072505,-50,53,
6469155038060131.,6839596724354701.,.499883781054785572182,-50,53,
6469155038060857.,6839596724355140.,.498491355711316791181,-50,53,
6469155038060862.,6839596724355144.,-.478102256033643757784,-50,53,
6469155038060900.,6839596724355166.,.499786294704579703912,-50,53,
6469155038069402.,6839596724360308.,-.499991119836768070967,-50,53,
6482505237454335.,6847661021817050.,-.492843897849569780841,-50,53,
6482505237454360.,6847661021817065.,-.406944270897500310042,-50,53,
6482505237454393.,6847661021817085.,-.493556763320857692702,-50,53,
6482505237454683.,6847661021817260.,-.497121090681994414403,-50,53,
6482505237454915.,6847661021817400.,-.499972552576540386634,-50,53,
6482505237595195.,6847661021902050.,-.499986722438639480118,-50,53,
6527239159284927.,6874562367129761.,.499996160117837815828,-50,53,
6527239159286357.,6874562367130618.,.499545086750162291425,-50,53,
6527239159286644.,6874562367130790.,.498755255918782711392,-50,53,
6527239159286654.,6874562367130796.,.491759094565636624216,-50,53,
6527239159286659.,6874562367130799.,.488261013889060137554,-50,53,
6527239159287500.,6874562367131303.,.499883844056232432832,-50,53,
6527239159302651.,6874562367140383.,.499999766182546182315,-50,53,
6551699081962055.,6889193810617853.,-.499996464984337213327,-50,53,
6551699081994673.,6889193810637328.,-.499934937749341691332,-50,53,
6551699081997465.,6889193810638994.,.499886376773371380995,-50,53,
6551699081998078.,6889193810639360.,.499488979043028819631,-50,53,
6551699081998284.,6889193810639483.,.494461468541947206324,-50,53,
6551699081998289.,6889193810639486.,.479776334791872881965,-50,53,
6551699081998418.,6889193810639564.,-.499100115960832331853,-50,53,
6551699082012378.,6889193810647899.,-.499993555215517586116,-50,53,
6698297894212183.,6975757642269906.,-.499996420652874177395,-50,53,
6698297894350583.,6975757642350731.,-.499948061922667033684,-50,53,
6698297894367191.,6975757642360430.,-.499942371099268137650,-50,53,
6698297894367441.,6975757642360575.,.498973899351995970187,-50,53,
6698297894367477.,6975757642360597.,-.477182157703470830172,-50,53,
6698297894367494.,6975757642360606.,.450744148686963903621,-50,53,
7036523586229524.,7168454868046317.,.480569739780153041870,-50,53,
7036523586229533.,7168454868046322.,.483891617721691846042,-50,53,
7036523586229569.,7168454868046342.,.497179129487783068206,-50,53,
7036523586229578.,7168454868046348.,-.499498992570710124883,-50,53,
7036523586231384.,7168454868047352.,-.499575485771163344552,-50,53,
7036523586240414.,7168454868052372.,-.499957955638741282540,-50,53,
7036523586241317.,7168454868052874.,-.499996202979819328306,-50,53,
7060691919437311.,7181867619090072.,.499998572880472454484,-50,53,
7060691919441078.,7181867619092159.,.499952333508268013348,-50,53,
7060691919442605.,7181867619093005.,.491173302789902804204,-50,53,
7060691919442632.,7181867619093020.,.449760706960230569513,-50,53,
7060691919442670.,7181867619093042.,-.497412576059405036236,-50,53,
7060691919442744.,7181867619093083.,-.499802653519020588019,-50,53,
7099291104809557.,7203194166831670.,-.499996875593144425835,-50,53,
7099291104850765.,7203194166854376.,-.499988541721734312096,-50,53,
7099291104852647.,7203194166855412.,.499914767214889416265,-50,53,
7099291104853088.,7203194166855655.,.495109963371228632105,-50,53,
7099291104853569.,7203194166855921.,-.469314323831471160911,-50,53,
7099291104853578.,7203194166855925.,.489771292416124230564,-50,53,
7214758118824651.,7266305728423966.,-.499978786344920719209,-50,53,
7214758118827353.,7266305728425431.,-.499891343699216338961,-50,53,
7214758118828775.,7266305728426201.,.495713520418769623044,-50,53,
7214758118828786.,7266305728426207.,.459814542573801690193,-50,53,
7214758118828941.,7266305728426291.,.499419854757377646376,-50,53,
7214758118834902.,7266305728429523.,.499982859363588109663,-50,53,
7214758118881310.,7266305728454686.,-.499995772845054327327,-50,53,
7236286776332599.,7277960991938464.,.499838288153574449216,-50,53,
7236286776333326.,7277960991938857.,.499994131619806712661,-50,53,
7243607294770927.,7281916302311482.,-.499822384319538905332,-50,53,
7243607294772838.,7281916302312514.,-.499409307397470854268,-50,53,
7243607294773238.,7281916302312730.,-.486763974742851622715,-50,53,
7243607294773249.,7281916302312735.,.453583771904981879421,-50,53,
7243607294773275.,7281916302312749.,.494405718527097933638,-50,53,
7243607294773425.,7281916302312830.,.499147718269091071798,-50,53,
7243607294777247.,7281916302314894.,.499973871129183373227,-50,53,
7243607294835451.,7281916302346326.,.499996081157256726724,-50,53,
7273994527114592.,7298292043927157.,.496229325490227890768,-50,53,
7273994527114698.,7298292043927215.,-.499554706174492091959,-50,53,
7273994527114923.,7298292043927335.,.499960320949528514105,-50,53,
7273994527121091.,7298292043930652.,.499998929718383672581,-50,53,
7311312768865097.,7318309579777677.,-.499990105825614476816,-50,53,
7311312768882025.,7318309579786734.,-.499964581858885530314,-50,53,
7311312768882496.,7318309579786985.,.499504464497006057012,-50,53,
7311312768883124.,7318309579787321.,.498796526279608639500,-50,53,
7311312768883167.,7318309579787345.,-.494882520446523644537,-50,53,
7311312768887720.,7318309579789780.,.499984926599911341747,-50,53,
7548454164495009.,7443173315221837.,.470469733977897935552,-50,53,
7548454164495011.,7443173315221839.,-.493085757387057009462,-50,53,
7548454164495038.,7443173315221852.,.498915109186024355291,-50,53,
7548454164495285.,7443173315221980.,.499811925611519625240,-50,53,
7548454164500910.,7443173315224895.,.499992460483431320818,-50,53,
7548454164528788.,7443173315239342.,.499998286406554977605,-50,53,
7571434122739820.,7455063950669427.,-.499868504890634838008,-50,53,
7571434122741322.,7455063950670203.,-.492462348338955630932,-50,53,
7571434122741324.,7455063950670204.,-.459163538543383586162,-50,53,
7571434122741622.,7455063950670358.,-.497640879006199094291,-50,53,
7571434122741742.,7455063950670420.,-.499712291274816043563,-50,53,
7571434122744655.,7455063950671925.,-.499995824396932350845,-50,53,
7938013874342320.,7640015128802027.,-.499999679576606551048,-50,53,
7938013874372280.,7640015128816791.,-.499987869041446524153,-50,53,
7938013874373459.,7640015128817371.,.499879083244254626457,-50,53,
7938013874374638.,7640015128817952.,.499746035443662296861,-50,53,
7938013874374916.,7640015128818089.,.495473781581586172758,-50,53,
7938013874374930.,7640015128818096.,.394539207645959045162,-50,53,
7938013874375054.,7640015128818158.,-.499452732927269525535,-50,53,
7969971748295294.,7655732045490204.,-.499997609139892919474,-50,53,
7969971748333506.,7655732045508959.,-.499991043833569054855,-50,53,
7969971748344066.,7655732045514142.,-.499884566191840455235,-50,53,
7969971748344828.,7655732045514516.,-.499308701309478637849,-50,53,
7969971748345209.,7655732045514703.,-.499020768881706893947,-50,53,
7969971748345319.,7655732045514756.,.490563673549844997563,-50,53,
7969971748345325.,7655732045514759.,.435450097682453669868,-50,53,
7969971748345372.,7655732045514783.,-.496272913278855098643,-50,53,
7969971748347332.,7655732045515744.,.499958969915654186756,-50,53,
8345810168411799.,7835981596899523.,.499989091392562993266,-50,53,
8345810168412614.,7835981596899905.,.499835321092917952419,-50,53,
8345810168414916.,7835981596900984.,.473634119382493890460,-50,53,
8345810168414931.,7835981596900992.,-.495693864122242417666,-50,53,
8345810168415027.,7835981596901037.,-.499392958552854017029,-50,53,
8345810168415059.,7835981596901051.,.499374009970160431527,-50,53,
8345810168418287.,7835981596902564.,.499991959433742438106,-50,53,
8345810168437751.,7835981596911688.,-.499999450627087877338,-50,53,
8515808456091080.,7914861083868146.,.499299868899378678818,-50,53,
8515808456091117.,7914861083868163.,.495425051206344032949,-50,53,
8515808456091154.,7914861083868180.,.491550233513235541287,-50,53,
8515808456091326.,7914861083868260.,-.499435405493535638573,-50,53,
8515808456094426.,7914861083869684.,-.499757969261236635025,-50,53,
8515808456096751.,7914861083870752.,-.499999892427197270120,-50,53,
8579801239786836.,7944146575151226.,-.499998485469808853963,-50,53,
8579801239792407.,7944146575153765.,.478340031811930532432,-50,53,
8579801239792418.,7944146575153770.,.493554844894143844079,-50,53,
8579801239792554.,7944146575153832.,.499847079364613602995,-50,53,
8666221177833593.,7983350786031725.,-.463207492147540594579,-50,53,
8666221177833604.,7983350786031730.,-.498004621354359542247,-50,53,
8666221177833748.,7983350786031795.,-.498985221880570673734,-50,53,
8666221177833892.,7983350786031860.,-.499965822407861844445,-50,53,
8666221177844094.,7983350786036465.,-.499994204180438190274,-50,53,
8666221177881827.,7983350786053496.,.499998796213548625323,-50,53,
8746614672447068.,8019471686161309.,.496727185277263333661,-50,53,
8746614672447106.,8019471686161326.,.491590803800165970185,-50,53,
8746614672447229.,8019471686161382.,-.498719062560418622939,-50,53,
8746614672447627.,8019471686161560.,-.499884321195904246785,-50,53,
8746614672449380.,8019471686162344.,-.499991603674231704415,-50,53,
8746614672468265.,8019471686170789.,.499993537757195362996,-50,53,
8848436869419801.,8064746934932899.,.499960149877544437459,-50,53,
8848436869420932.,8064746934933400.,-.499895491690547513863,-50,53,
8848436869422063.,8064746934933900.,-.499751133322549076749,-50,53,
8848436869422486.,8064746934934087.,-.497044622649612675191,-50,53,
8848436869422504.,8064746934934094.,.460517356527760786873,-50,53,
8848436869422581.,8064746934934129.,-.498800843658102139687,-50,53,
8848436869440867.,8064746934942212.,.499996438879720783044,-50,53,
8957999189153692.,8112885570022487.,-.499970597007360276251,-50,53,
8957999189156472.,8112885570023700.,.469761500593918154299,-50,53,
8957999189156495.,8112885570023711.,-.486604025218865640529,-50,53,
8957999189156511.,8112885570023718.,-.499727869262556533097,-50,53,
8957999189156740.,8112885570023817.,.499937112860750078739,-50,53,
8957999189165655.,8112885570027710.,.499995257726577892432,-50,53,
4630540339090841.,8243045443032028.,-.499999942429704626026,-49,53,
4630540339110516.,8243045443048649.,-.499957812364002446261,-49,53,
4630540339111798.,8243045443049732.,-.495024955310592052917,-49,53,
4630540339111914.,8243045443049829.,.499181137824533868912,-49,53,
4630540339112249.,8243045443050112.,.499690113675124465408,-49,53,
4630540339116385.,8243045443053607.,-.499996084674243743674,-49,53,
4751802502288025.,8344166656761645.,-.499996096479904023151,-49,53,
4751802502327707.,8344166656794311.,.499991626989057910349,-49,53,
4751802502332074.,8344166656797906.,.499965058952615195925,-49,53,
4751802502333590.,8344166656799155.,-.499128204275450635926,-49,53,
4751802502333788.,8344166656799317.,.498351699310484113886,-49,53,
4751802502333873.,8344166656799387.,.472017314484180495285,-49,53,
4751802502333969.,8344166656799467.,-.498901520144679320646,-49,53,
4918372782520586.,8478941925147298.,.499998191710081149494,-49,53,
4918372782548466.,8478941925169473.,-.430297317640235671228,-49,53,
4918372782548481.,8478941925169484.,.499797573551174956502,-49,53,
4918372782549468.,8478941925170270.,-.499958586133968185691,-49,53,
4918372782565690.,8478941925183171.,.499996383784467312697,-49,53,
4961703275449724.,8513253464551320.,.499998274563258444836,-49,53,
4961703275494907.,8513253464586943.,-.495342404421033861872,-49,53,
4961703275494959.,8513253464586984.,-.498856064951563839847,-49,53,
4961703275495545.,8513253464587446.,-.499990777883008548103,-49,53,
5155187794682824.,8662896387896959.,.499956211987053520190,-49,53,
5155187794694864.,8662896387906095.,.499682685064281540292,-49,53,
5155187794695432.,8662896387906527.,-.499665767563441439384,-49,53,
5155187794695461.,8662896387906549.,-.494350811800990198306,-49,53,
5155187794695469.,8662896387906555.,-.423919099866542674884,-49,53,
5155187794710482.,8662896387917946.,.499992292519352749720,-49,53,
5155187794739645.,8662896387940075.,.499994058502385966925,-49,53,
5357710127493616.,8813629367116971.,-.499953351973252725624,-49,53,
5357710127494861.,8813629367117880.,-.499248459336149949407,-49,53,
5357710127495150.,8813629367118091.,-.494265556577503461350,-49,53,
5357710127495276.,8813629367118183.,-.499013495170722223254,-49,53,
5357710127497829.,8813629367120047.,-.499977679989822584568,-49,53,
5357710127502042.,8813629367123122.,.499997989574815275997,-49,53,
5363132893508262.,8817586640398684.,-.499982804808859385657,-49,53,
5363132893510287.,8817586640400161.,-.499795021951500457286,-49,53,
5363132893510590.,8817586640400382.,-.496803961157105981604,-49,53,
5363132893510675.,8817586640400444.,-.499265214731878214097,-49,53,
5363132893534672.,8817586640417946.,.499997074985395076139,-49,53,
5365726582682598.,8819477975392048.,-.492680921524555350862,-49,53,
5365726582682620.,8819477975392064.,-.454015660427590473645,-49,53,
5365726582682646.,8819477975392083.,-.499229442767625854896,-49,53,
5365726582682956.,8819477975392309.,-.499855309136662172331,-49,53,
5365726582689370.,8819477975396985.,-.499901463327787486651,-49,53,
5365726582702198.,8819477975406337.,-.499993788478613577567,-49,53,
5483096108824229.,8904121504334032.,-.499866936537612779638,-49,53,
5483096108824892.,8904121504334505.,-.499201693104971938593,-49,53,
5483096108825391.,8904121504334860.,.499790699727422999884,-49,53,
5483096108830203.,8904121504338294.,-.499905906525413469213,-49,53,
5483096108845138.,8904121504348948.,.499996648189428420324,-49,53,
5494838942542058.,8912490175378092.,-.499983687892976624376,-49,53,
5494838942547268.,8912490175381801.,-.499949679232786145078,-49,53,
5494838942548705.,8912490175382824.,-.499364483988832991153,-49,53,
5494838942549125.,8912490175383122.,.498718871564303915436,-49,53,
5494838942549139.,8912490175383132.,.465321650082348215198,-49,53,
5494838942549184.,8912490175383165.,-.499169418966967095203,-49,53,
5494838942598410.,8912490175418209.,-.499999909896077141481,-49,53,
5525992699346453.,8934605905993223.,.499997085753000088629,-49,53,
5525992699365206.,8934605906006498.,.499952645431489903988,-49,53,
5525992699367818.,8934605906008348.,-.499893573581465393994,-49,53,
5525992699368845.,8934605906009074.,.499784042210437924833,-49,53,
5525992699369016.,8934605906009196.,-.451584144462454084094,-49,53,
5525992699369023.,8934605906009201.,-.496376994209377423720,-49,53,
5629499534200817.,9007199254732443.,-.000017378473290768449,-49,53,
5629499534209279.,9007199254738323.,-.000167985534959634543,-49,53,
5629499534212730.,9007199254740721.,.000243292361472396405,-49,53,
5629499534213061.,9007199254740951.,.002600908332812633003,-49,53,
5629499534213119.,9007199254740991.,.305128828954797014041,-49,53,
5629499534213121.,4503599627370496.,.347435585522601431262,-49,52,
5629499534213127.,4503599627370498.,.432049098658208722781,-49,52,
5629499534213133.,4503599627370501.,-.483337388206186207511,-49,52,
5629499534213179.,4503599627370516.,.498699545833378846768,-49,52,
5629499534278866.,4503599627393339.,-.499994364431173399931,-49,52,
7036874417733527.,9007199254731855.,-.000002328924195760724,-46,52,
7036874417763144.,9007199254740087.,-.000213169481662788707,-46,52,
7036874417765425.,9007199254740721.,.000243292352085247115,-46,52,
7036874417765756.,9007199254740813.,.001186338747535917156,-46,52,
7036874417766382.,9007199254740987.,-.003072431525467453355,-46,52,
7036874417766396.,9007199254740991.,-.111793873672324994778,-46,52,
7036874417766399.,4503599627370496.,-.138974234209040594723,-46,51,
7036874417766401.,4503599627370496.,.138974234209040574974,-46,51,
5426391276979793.,5605160498150127.,-.498340601022449469493,-44,51,
5426391276979843.,5605160498150136.,-.487340624085926626462,-44,51,
5426391276979965.,5605160498150157.,.499499319638840652757,-44,51,
5426391276981785.,5605160498150485.,.499898480064381349738,-44,51,
5426391276982240.,5605160498150567.,.499998270153577362946,-44,51,
5426971710372686.,5605265098261756.,-.499995159269396128002,-44,51,
5426971710374878.,5605265098262150.,.499992695888269462995,-44,51,
5426971710392414.,5605265098265310.,.499895531406015505645,-44,51,
5426971710398990.,5605265098266495.,.499859092092696707541,-44,51,
5426971710399495.,5605265098266587.,-.498775093163330092653,-44,51,
5426971710399595.,5605265098266605.,-.478702654601171523610,-44,51,
5426971710399606.,5605265098266607.,-.496494686359354352457,-44,51,
5426971710399889.,5605265098266658.,-.499689685230348477842,-44,51,
5562950707695949.,5629466663649870.,-.499992677834406003674,-44,51,
5562950707701791.,5629466663650896.,.499977646599375236278,-44,51,
5562950707703179.,5629466663651141.,-.495236525022027671955,-44,51,
5562950707703361.,5629466663651172.,.499627322786789358961,-44,51,
5562950707730216.,5629466663655894.,-.499995584807771566324,-44,51,
5565768841101520.,5629961954659738.,.499995915148297356780,-44,51,
5565768841142577.,5629961954666952.,.499990930485746362889,-44,51,
5565768841150357.,5629961954668320.,-.499985663686003037211,-44,51,
5565768841151205.,5629961954668468.,.499502748556137564909,-44,51,
5565768841151347.,5629961954668493.,.449888779849182675164,-44,51,
5565768841151353.,5629961954668495.,-.495869556856759012964,-44,51,
5565768841151666.,5629961954668550.,-.499596121684959789282,-44,51,
5637442019520522.,5642475033041692.,-.499988104056062189373,-44,51,
5637442019534455.,5642475033044108.,.499948612241512954136,-44,51,
5637442019535925.,5642475033044364.,-.494675160951368987031,-44,51,
5637442019535948.,5642475033044367.,.495204875249846704233,-44,51,
5637442019536046.,5642475033044384.,.495563290367887639654,-44,51,
5637442019537124.,5642475033044571.,.499505856646832927219,-44,51,
5637442019556787.,5642475033047982.,.499990711914620092072,-44,51,
5666178554261246.,5647447384828970.,.493900820937909819429,-44,51,
5666178554261252.,5647447384828972.,-.470539613754557560322,-44,51,
5666178554261275.,5647447384828975.,.499105386590973992140,-44,51,
5666178554261472.,5647447384829009.,.499977780854214606822,-44,51,
5666178554262625.,5647447384829209.,-.499992419243012516859,-44,51,
5666178554295865.,5647447384834945.,.499999366266772070189,-44,51,
5772925638472642.,5665699815103011.,.499976426207636749393,-44,51,
5772925638472677.,5665699815103017.,.429040875278780921587,-44,51,
5772925638472701.,5665699815103021.,.494685068927544721117,-44,51,
5772925638485682.,5665699815105220.,.499988306225752238638,-44,51,
5772925638498722.,5665699815107430.,-.499999818745865720760,-44,51,
5835612929829491.,5676261914827400.,-.499940383616529986143,-44,51,
5835612929829855.,5676261914827460.,.499941762519159813409,-44,51,
5835612929832039.,5676261914827826.,.499234639253395590300,-44,51,
5835612929832224.,5676261914827858.,-.498078006267625464197,-44,51,
5835612929846605.,5676261914830268.,-.499986956506738929422,-44,51,
5835612929855162.,5676261914831701.,.499989753894056605952,-44,51,
5896103646765295.,5686346896283055.,-.499988594963912116988,-44,51,
5896103646768406.,5686346896283570.,.499168218082976745227,-44,51,
5896103646768509.,5686346896283588.,-.416963845006273034175,-44,51,
5896103646768551.,5686346896283595.,-.450726433838868311599,-44,51,
5896103646768611.,5686346896283605.,-.498958703599804788521,-44,51,
5896103646769027.,5686346896283673.,.499964226054917119100,-44,51,
5896103646829360.,5686346896293681.,-.499994684010982430550,-44,51,
6004329071212296.,5704134711264240.,.499999279214967165140,-44,51,
6004329071266424.,5704134711273057.,-.499938218518973451630,-44,51,
6004329071334084.,5704134711284077.,-.499860202447742877921,-44,51,
6004329071334612.,5704134711284162.,.497184449628024934896,-44,51,
6004329071334618.,5704134711284163.,.474423593401569749708,-44,51,
6004329071334655.,5704134711284170.,-.499268353328258804318,-44,51,
6029337333097935.,5708199427683352.,.499997333119733481644,-44,51,
6029337333126129.,5708199427687926.,-.499987221635238118721,-44,51,
6029337333126203.,5708199427687938.,-.497362509208663365536,-44,51,
6304262280168312.,5751804833829838.,.484042964997938768291,-44,51,
6304262280168325.,5751804833829841.,-.499341217059581001974,-44,51,
6304262280168686.,5751804833829897.,-.499471195735444947730,-44,51,
6304262280170130.,5751804833830121.,-.499991110470967850076,-44,51,
6304262280185537.,5751804833832511.,-.499998264863347672255,-44,51,
6305910042749690.,5752060408437772.,-.499996142464717951625,-44,51,
6305910042755719.,5752060408438706.,.499986952989959180465,-44,51,
6305910042773806.,5752060408441511.,.499936233990341371607,-44,51,
6305910042774367.,5752060408441599.,-.498074959446134451764,-44,51,
6305910042774380.,5752060408441601.,-.481986092270957378546,-44,51,
6535180284037603.,5786985377295174.,.499999466718162729372,-44,51,
6535180284090970.,5786985377303161.,-.499976486585385709521,-44,51,
6535180284094612.,5786985377303705.,.499968937575769327705,-44,51,
6535180284100165.,5786985377304536.,.467760518640522753592,-44,51,
6535180284100172.,5786985377304538.,-.484738213384512564873,-44,51,
6535180284100212.,5786985377304544.,-.499016682099021623149,-44,51,
6535180284100633.,5786985377304607.,-.499297565321451502001,-44,51,
6535180284101475.,5786985377304733.,-.499859331778486692026,-44,51,
6535815775749321.,5787080469582329.,.499999010697835993179,-44,51,
6535815775753224.,5787080469582913.,.499988308931599446951,-44,51,
6535815775780545.,5787080469587001.,.499913386803002716199,-44,51,
6535815775784448.,5787080469587585.,.499902682246783053645,-44,51,
6535815775784575.,5787080469587605.,-.497279321212480585060,-44,51,
6535815775784582.,5787080469587606.,-.449879904080324751074,-44,51,
6544022097454393.,5788307598866346.,-.499907312651883802975,-44,51,
6544022097454480.,5788307598866359.,-.498553246033192102004,-44,51,
6544022097454654.,5788307598866385.,-.495845112796327242536,-44,51,
6544022097454674.,5788307598866387.,.492971914012463496479,-44,51,
6544022097454681.,5788307598866389.,-.460942126604461902890,-44,51,
6544022097457344.,5788307598866787.,-.499955007095981204009,-44,51,
6544022097460295.,5788307598867227.,.499997298261054270140,-44,51,
6616319171093301.,5799052490062837.,-.499998583830160993619,-44,51,
6616319171106460.,5799052490064782.,-.495860335412426693306,-44,51,
6616319171106487.,5799052490064785.,.494952927955226532891,-44,51,
6616319171106690.,5799052490064815.,.499956352533727412329,-44,51,
6616319171117684.,5799052490066440.,.499994034981559277314,-44,51,
6702751591225878.,5811745158329061.,-.498502666117754705328,-44,51,
6702751591226159.,5811745158329101.,.499932954672734735671,-44,51,
6702751591232540.,5811745158330032.,.499995930238937189200,-44,51,
6729307497419250.,5815612060490681.,-.499997137115532599777,-44,51,
6729307497431285.,5815612060492430.,-.499991730215634605747,-44,51,
6729307497436666.,5815612060493211.,.499927595280805231476,-44,51,
6729307497437230.,5815612060493293.,.463866361195165086584,-44,51,
6729307497437244.,5815612060493295.,.498432217086568911241,-44,51,
6743769751750153.,5817711548736150.,-.499998910928946841671,-44,51,
6743769751754987.,5817711548736850.,.499975649698349432580,-44,51,
6743769751757504.,5817711548737216.,-.498589520318766945594,-44,51,
6743769751757518.,5817711548737218.,-.468386863338710747149,-44,51,
6743769751758166.,5817711548737312.,-.499006740266436084745,-44,51,
6743769751759821.,5817711548737551.,.499950209823162080940,-44,51,
6754791752038960.,5819308593579163.,.499998832151120058504,-44,51,
6754791752061422.,5819308593582416.,-.499913269737703409460,-44,51,
6754791752062092.,5819308593582513.,-.498753137603265932559,-44,51,
6754791752062147.,5819308593582520.,.464028664287939667130,-44,51,
6754791752062161.,5819308593582522.,.490918577496599831104,-44,51,
6754791752062168.,5819308593582524.,-.495636465899071662261,-44,51,
6754791752062389.,5819308593582556.,-.499731407391525944724,-44,51,
6754791752066554.,5819308593583159.,-.499982228022010212333,-44,51,
6794379564739824.,5825023302236630.,-.499999796082499045253,-44,51,
6794379564754678.,5825023302238768.,-.499980073445761594537,-44,51,
6794379564776959.,5825023302241975.,-.499950498254659913897,-44,51,
6794379564778154.,5825023302242147.,-.498467829804744926751,-44,51,
6794379564778161.,5825023302242148.,-.490927763964541660129,-44,51,
6794379564778168.,5825023302242149.,-.483387698124339431539,-44,51,
6794379564778286.,5825023302242166.,-.499140873961086669650,-44,51,
6794379564778418.,5825023302242185.,-.499813918117797528101,-44,51,
6990987887109277.,5852920275443047.,.499998554010371221300,-44,51,
6990987887144141.,5852920275447924.,.499974084730539433143,-44,51,
6990987887145199.,5852920275448072.,.499801244501231032857,-44,51,
6990987887147844.,5852920275448442.,.499369143829968988382,-44,51,
6990987887148180.,5852920275448490.,-.498795387683093174277,-44,51,
6990987887148194.,5852920275448491.,.459614423503813545586,-44,51,
6990987887155586.,5852920275449525.,.499994729642849122197,-44,51,
7006147211081140.,5855038563100257.,-.499890760416634248708,-44,51,
7006147211081620.,5855038563100324.,-.499695373999862028990,-44,51,
7006147211081706.,5855038563100336.,-.495493700600675226535,-44,51,
7006147211081720.,5855038563100337.,.458678664836387748668,-44,51,
7006147211085897.,5855038563100920.,.499962266848578131494,-44,51,
7006147211091134.,5855038563101652.,-.499989320011259620499,-44,51,
7006147211132070.,5855038563107366.,-.499992806415676991695,-44,51,
7054682820221209.,5861789986378716.,.499721125112962770043,-44,51,
7054682820221411.,5861789986378745.,-.498348782794506364455,-44,51,
7054682820221512.,5861789986378759.,-.497383736748541603791,-44,51,
7054682820221548.,5861789986378763.,.493059249960862725673,-44,51,
7054682820223301.,5861789986379006.,.499908019418544775084,-44,51,
7054682820224347.,5861789986379152.,-.499998533460913035335,-44,51,
7138546116893913.,5873346846652852.,.499975431928656019084,-44,51,
7138546116895497.,5873346846653069.,.499857535896670737670,-44,51,
7138546116897081.,5873346846653286.,.499739639816534501198,-44,51,
7138546116897373.,5873346846653327.,-.497756841031777217300,-44,51,
7138546116897519.,5873346846653347.,-.496505081456546685268,-44,51,
7138546116901906.,5873346846653948.,-.499988168931361700325,-44,51,
7138546116927469.,5873346846657450.,-.499996875871697107238,-44,51,
7223985620312852.,5884982128905322.,.499981147093985028947,-44,51,
7223985620314093.,5884982128905490.,.499871717096311354959,-44,51,
7223985620314551.,5884982128905553.,-.498557065295294380412,-44,51,
7223985620314647.,5884982128905565.,.497405460665792120140,-44,51,
7223985620314654.,5884982128905566.,.445027728183781255179,-44,51,
7223985620321768.,5884982128906530.,-.499999254723066305182,-44,51,
7322656671993204.,5898249282110012.,.496920860181360681566,-44,51,
7322656671993219.,5898249282110015.,-.499822103664137804838,-44,51,
7322656671993526.,5898249282110056.,-.499828097036241608561,-44,51,
7322656672000587.,5898249282110999.,-.499965945069048645426,-44,51,
7322656672002429.,5898249282111244.,.499998094425021616851,-44,51,
7371229009390497.,5904714721042824.,-.499997120438890337181,-44,51,
7371229009394017.,5904714721043290.,.499969547597061485625,-44,51,
7371229009395223.,5904714721043451.,-.499473690621457873715,-44,51,
7371229009395321.,5904714721043464.,-.497770073164411297853,-44,51,
7371229009395351.,5904714721043467.,.482343279118323505146,-44,51,
7371229009395374.,5904714721043471.,-.466236484131590782589,-44,51,
7413149621275409.,5910260592336724.,.498724620494993036383,-44,51,
7413149621275439.,5910260592336728.,.456330834030527652324,-44,51,
7413149621275447.,5910260592336730.,-.488307509026665821664,-44,51,
7413149621275644.,5910260592336755.,.499973293189585547103,-44,51,
7413149621279654.,5910260592337285.,-.499996164386062757071,-44,51,
7461059150899351.,5916560491843206.,.499989618412495482582,-44,51,
7461059150902212.,5916560491843582.,-.499840128592786783892,-44,51,
7461059150902227.,5916560491843583.,.466256534739557374301,-44,51,
7461059150902235.,5916560491843585.,-.485158578149860690884,-44,51,
7461059150946485.,5916560491849384.,.499998235054100081561,-44,51,
7761862923838164.,5955213729277231.,.499989555800237344203,-44,51,
7761862923839767.,5955213729277433.,.467561204153223358870,-44,51,
7761862923839783.,5955213729277435.,.483457115802200750442,-44,51,
7761862923839799.,5955213729277437.,.499353027451173986525,-44,51,
7761862923839926.,5955213729277454.,-.499473173835248350176,-44,51,
7761862923867983.,5955213729280989.,-.499998609333126846705,-44,51,
7819356134936071.,5962430803784780.,.473157403102710360012,-44,51,
7819356134936199.,5962430803784796.,.481746821393661719639,-44,51,
7819356134936463.,5962430803784829.,.499462496617921276729,-44,51,
7819356134936471.,5962430803784830.,.499999335261063255174,-44,51,
7880037969507938.,5969990808372563.,-.499994661829980522605,-44,51,
7880037969510170.,5969990808372840.,-.499866303147570491157,-44,51,
7880037969510589.,5969990808372891.,.499709764176984551128,-44,51,
7880037969511145.,5969990808372961.,-.498466146489688546990,-44,51,
7880037969511266.,5969990808372976.,-.481882127049088006323,-44,51,
7880037969511274.,5969990808372977.,-.489050125763767171524,-44,51,
7880037969511282.,5969990808372978.,-.496218124478447344672,-44,51,
8016984453625142.,5986840421332387.,.499999093022386921388,-44,51,
8016984453660040.,5986840421336644.,.499380310829109443650,-44,51,
8016984453660081.,5986840421336650.,-.499273634109003088045,-44,51,
8016984453660286.,5986840421336675.,-.492543358799949410460,-44,51,
8016984453660327.,5986840421336680.,-.491197303738215407731,-44,51,
8016984453663024.,5986840421337008.,.499785879168937120217,-44,51,
8016984453664516.,5986840421337190.,.499988663288044267258,-44,51,
8049376796585031.,5990783809313562.,-.499997617104082235271,-44,51,
8049376796610909.,5990783809316706.,-.499969750584135334983,-44,51,
8049376796641100.,5990783809320374.,-.499937252419167261765,-44,51,
8049376796641314.,5990783809320399.,.499599263533427856613,-44,51,
8049376796642170.,5990783809320503.,.497745327336896116975,-44,51,
8198893031065787.,6008782361548741.,.499975545692301524791,-44,51,
8198893031068168.,6008782361549025.,.499926634697337589242,-44,51,
8198893031068713.,6008782361549091.,-.493784686814579288380,-44,51,
8198893031068738.,6008782361549093.,.488155160822385090172,-44,51,
8198893031068889.,6008782361549111.,.499071840549456622639,-44,51,
8198893031068998.,6008782361549125.,-.499670423753724376737,-44,51,
8198893031085665.,6008782361551112.,.499987196770975933175,-44,51,
8198893031105543.,6008782361553483.,.499998842101223321856,-44,51,
8347450336544563.,6026343300644223.,.498841949256834019547,-44,51,
8347450336544640.,6026343300644233.,-.480235141531828983932,-44,51,
8347450336544657.,6026343300644235.,-.488602810926739821886,-44,51,
8347450336544674.,6026343300644237.,-.496970480321654715899,-44,51,
8347450336547909.,6026343300644615.,.498946549454539360737,-44,51,
8347450336578262.,6026343300648171.,.499895415498719697924,-44,51,
8347450336581608.,6026343300648564.,-.499999985886095490183,-44,51,
8638779724394281.,6059891867216395.,-.491670744572102408173,-44,51,
8638779724394290.,6059891867216396.,-.472834938855851483251,-44,51,
8638779724394546.,6059891867216425.,-.492616465149603000902,-44,51,
8638779724396454.,6059891867216641.,-.499425653334772749015,-44,51,
8638779724396613.,6059891867216659.,-.499993085685690255947,-44,51,
8704521642366309.,6067305938638189.,-.499683864400677488330,-44,51,
8704521642366371.,6067305938638195.,.465953647236539529847,-44,51,
8704521642366389.,6067305938638197.,.488235505453786790493,-44,51,
8704521642366398.,6067305938638198.,.499376434562408852620,-44,51,
8704521642367386.,6067305938638310.,-.499819347741881686344,-44,51,
8704521642368463.,6067305938638431.,-.499954831098057052153,-44,51,
8704521642390813.,6067305938640942.,-.499980881840587086158,-44,51,
8704521642405713.,6067305938642616.,-.499998252584119045966,-44,51,
8796093022207186.,6755399441055653.,.499978683068583661624,-43,51,
8796093022207996.,6755399441055744.,-.444717549468929972632,-43,51,
8796093022207999.,6755399441055744.,-.111179387367232474199,-43,51,
8796093022208001.,6755399441055744.,.111179387367232461559,-43,51,
8796093022208256.,6755399441055772.,.461923166011097601451,-43,51,
8796093022208796.,6755399441055832.,.498792344313040094595,-43,51,
8796093022208814.,6755399441055835.,-.499978683076958631871,-43,51,
8796093022231597.,6755399441058368.,-.499996298934445626810,-43,51,
5497558138867998.,9007199254738857.,-.000011492769040960767,-39,51,
5497558138870033.,9007199254739219.,.000073775663175568155,-39,51,
5497558138879792.,9007199254740955.,-.000500115815665266611,-39,51,
5497558138879983.,9007199254740989.,-.024079336388727801953,-39,51,
5497558138879994.,9007199254740991.,-.067322118725432274070,-39,51,
5497558138879999.,4503599627370496.,-.088943509893785982392,-39,50,
5497558138880001.,4503599627370496.,.088943509893785966214,-39,50,
5497558138880028.,4503599627370498.,.490418277026000938420,-39,50,
5497558138880208.,4503599627370515.,-.499749942092867323278,-39,50,
5497558138892002.,4503599627371564.,-.499994255945993312339,-39,50,
6871947673398053.,5629499534198751.,-.499994227456292802785,-36,50,
6871947673572082.,5629499534211134.,-.499927375808645442839,-36,50,
6871947673599993.,5629499534213120.,-.498083655405201709779,-36,50,
6871947673599999.,5629499534213120.,-.071154807915028784620,-36,50,
6871947673600001.,5629499534213120.,.071154807915028774265,-36,50,
6871947673600260.,5629499534213139.,-.499749942092867323278,-36,50,
6871947673602087.,5629499534213269.,-.499915881357486928024,-36,50,
8589934591997848.,6755399441055621.,.499882693471108593767,-33,50,
8589934591999675.,6755399441055725.,.499749942092167366694,-33,50,
8589934591999956.,6755399441055741.,.495350761390980548879,-33,50,
8589934591999991.,6755399441055743.,.487685383011792519629,-33,50,
8589934591999999.,6755399441055744.,-.056923846332023026867,-33,50,
8589934592000001.,6755399441055744.,.056923846332023020240,-33,50,
8589934592000009.,6755399441055745.,-.487685383011793056401,-33,50,
8589934592000202.,6755399441055755.,.498616959068515557751,-33,50,
8589934592003979.,6755399441055970.,.499984555067151448452,-33,50,
8589934592063989.,6755399441059387.,-.499997073745783497788,-33,50,
5368709119999731.,7881299347898343.,.499976538696676873676,-29,50,
5368709119999797.,7881299347898350.,-.488865288641427597985,-29,50,
5368709119999995.,7881299347898368.,-.455390770656184400489,-29,50,
5368709119999999.,7881299347898368.,-.091078154131236846169,-29,50,
5368709120000001.,7881299347898368.,.091078154131236829204,-29,50,
5368709120021240.,7881299347900302.,.499993743643741629993,-29,50,
6710886399990187.,9007199254740277.,.000058807615574757185,-26,50,
6710886399998257.,9007199254740865.,.000621879386860931376,-26,50,
6710886399999602.,9007199254740963.,.000715724613330955918,-26,50,
6710886399999959.,9007199254740989.,.012636544495422598279,-26,50,
6710886399999986.,9007199254740991.,-.020075326269853646107,-26,50,
6710886399999987.,9007199254740991.,.052787197035135970616,-26,50,
6710886399999999.,4503599627370496.,-.036431261652494737789,-26,49,
6710886400000001.,4503599627370496.,.036431261652494732360,-26,49,
6710886400000151.,4503599627370502.,-.498879490473356893430,-26,49,
6710886400011158.,4503599627370903.,-.499982481801684049209,-26,49,
6710886400032129.,4503599627371667.,-.499994369798596240527,-26,49,
8388607999981146.,5066549580791258.,.499994242473891526059,-23,49,
8388607999999999.,5066549580791808.,-.029145009321995789797,-23,49,
8388608000000001.,5066549580791808.,.029145009321995786322,-23,49,
8388608000000015.,5066549580791808.,.437175139829936430029,-23,49,
8388608000000017.,5066549580791808.,.495465158473927894969,-23,49,
8388608000000223.,5066549580791814.,.499337078804974349168,-23,49,
8388608000000772.,5066549580791830.,.499947196579713051754,-23,49,
5242879999987144.,5629499534212520.,.498816249540423279253,-19,49,
5242879999999925.,5629499534213117.,-.497401118639519582513,-19,49,
5242879999999990.,5629499534213120.,-.466320149151933053671,-19,49,
5242879999999999.,5629499534213120.,-.046632014915193265343,-19,49,
5242880000000001.,5629499534213120.,.046632014915193256448,-19,49,
5242880000000011.,5629499534213121.,-.487047835932874668259,-19,49,
5242880000000311.,5629499534213135.,-.497443361375325996809,-19,49,
5242880000023471.,5629499534214215.,-.499977927948868432152,-19,49,
5242880000023664.,5629499534214224.,-.499999049357025279420,-19,49,
9007199254740990.,5422874305198591.,-.052203938626100463765,971,44 };
#include "trailer.h"
|
c4539058faeb548b0369c5a4c239b5c83b333c57
|
0dd85c72c457ac317ecdde7dc40518f7be1a2602
|
/sdk/protocol/boathwbcs/protos/common/contract.pb-c.h
|
3106ef166ae091456c045d3a03a83bc17f582664
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
aitos-io/BoAT-X-Framework
|
00072acd6e570b8dda5c3e211103717110303915
|
92c09bd1ed269903b542b7b39a02137bb0b4f9be
|
refs/heads/master
| 2023-07-08T11:20:52.441231
| 2023-03-08T01:43:57
| 2023-03-08T01:43:57
| 249,309,472
| 2,165
| 141
|
Apache-2.0
| 2023-06-27T03:22:02
| 2020-03-23T01:39:16
|
C
|
UTF-8
|
C
| false
| true
| 4,067
|
h
|
contract.pb-c.h
|
/* Generated by the protocol buffer compiler. DO NOT EDIT! */
/* Generated from: common/contract.proto */
#ifndef PROTOBUF_C_common_2fcontract_2eproto__INCLUDED
#define PROTOBUF_C_common_2fcontract_2eproto__INCLUDED
#include <protobuf-c/protobuf-c.h>
PROTOBUF_C__BEGIN_DECLS
#if PROTOBUF_C_VERSION_NUMBER < 1003000
# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers.
#elif 1004000 < PROTOBUF_C_MIN_COMPILER_VERSION
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif
#include "transaction.pb-c-hwbcs.h"
typedef struct Common__Invocation Common__Invocation;
typedef struct Common__ContractInvocation Common__ContractInvocation;
/* --- enums --- */
/* --- messages --- */
struct Common__Invocation
{
ProtobufCMessage base;
Common__TxHeader *header;
Common__ContractInvocation *parameters;
};
#define COMMON__INVOCATION__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&common__invocation__descriptor) \
, NULL, NULL }
struct Common__ContractInvocation
{
ProtobufCMessage base;
char *contract_name;
char *func_name;
size_t n_args;
ProtobufCBinaryData *args;
ProtobufCBinaryData encryptedkey;
protobuf_c_boolean is_compressed;
};
#define COMMON__CONTRACT_INVOCATION__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&common__contract_invocation__descriptor) \
, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, {0,NULL}, 0 }
/* Common__Invocation methods */
void common__invocation__init
(Common__Invocation *message);
size_t common__invocation__get_packed_size
(const Common__Invocation *message);
size_t common__invocation__pack
(const Common__Invocation *message,
uint8_t *out);
size_t common__invocation__pack_to_buffer
(const Common__Invocation *message,
ProtobufCBuffer *buffer);
Common__Invocation *
common__invocation__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void common__invocation__free_unpacked
(Common__Invocation *message,
ProtobufCAllocator *allocator);
/* Common__ContractInvocation methods */
void common__contract_invocation__init
(Common__ContractInvocation *message);
size_t common__contract_invocation__get_packed_size
(const Common__ContractInvocation *message);
size_t common__contract_invocation__pack
(const Common__ContractInvocation *message,
uint8_t *out);
size_t common__contract_invocation__pack_to_buffer
(const Common__ContractInvocation *message,
ProtobufCBuffer *buffer);
Common__ContractInvocation *
common__contract_invocation__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void common__contract_invocation__free_unpacked
(Common__ContractInvocation *message,
ProtobufCAllocator *allocator);
/* --- per-message closures --- */
typedef void (*Common__Invocation_Closure)
(const Common__Invocation *message,
void *closure_data);
typedef void (*Common__ContractInvocation_Closure)
(const Common__ContractInvocation *message,
void *closure_data);
/* --- services --- */
/* --- descriptors --- */
extern const ProtobufCMessageDescriptor common__invocation__descriptor;
extern const ProtobufCMessageDescriptor common__contract_invocation__descriptor;
PROTOBUF_C__END_DECLS
#endif /* PROTOBUF_C_common_2fcontract_2eproto__INCLUDED */
|
59c47e85d196ebcb400cf3f9f9791d5c51a654de
|
28d0f8c01599f8f6c711bdde0b59f9c2cd221203
|
/sys/arch/mac68k/obio/iwmreg.h
|
551393a4a746bc5f3d6724f562842136fab9b798
|
[] |
no_license
|
NetBSD/src
|
1a9cbc22ed778be638b37869ed4fb5c8dd616166
|
23ee83f7c0aea0777bd89d8ebd7f0cde9880d13c
|
refs/heads/trunk
| 2023-08-31T13:24:58.105962
| 2023-08-27T15:50:47
| 2023-08-27T15:50:47
| 88,439,547
| 656
| 348
| null | 2023-07-20T20:07:24
| 2017-04-16T20:03:43
| null |
UTF-8
|
C
| false
| false
| 9,211
|
h
|
iwmreg.h
|
/* $NetBSD: iwmreg.h,v 1.8 2007/03/04 06:00:09 christos Exp $ */
/*
* Copyright (c) 1996-99 Hauke Fath. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MAC68K_IWMREG_H
#define _MAC68K_IWMREG_H
/*
* iwmreg.h -- Interface declarations for iwm.
*/
#ifndef _LOCORE
/*
* Configuration
*/
/* Virtual Drive flags register */
enum {
IWM_DS_DISK = 0x01,
IWM_NO_DISK = 0x02,
IWM_MOTOR_OFF = 0x04,
IWM_WRITABLE = 0x08,
IWM_DD_DISK = 0x10,
IWM_NO_DRIVE = 0x80000000
};
/*
* Access
*/
enum {
noErr = 0, /* All went well */
noDriveErr = -64, /* Drive not installed */
offLinErr = -65, /* R/W requested for an offline drive */
noNybErr = -66, /* Disk is probably blank */
noAdrMkErr = -67, /* Can't find an address mark */
dataVerErr = -68, /* Read verify compare failed */
badCkSmErr = -69, /* Bad address mark checksum */
badBtSlpErr = -70, /* Bad address mark (no lead-out) */
noDtaMkErr = -71, /* Could not find a data mark */
badDCkSum = -72, /* Bad data mark checksum */
badDBtSlp = -73, /* One of the data mark bit slip */
/* nibbles was incorrect. */
wrUnderRun = -74, /* Could not write fast enough to */
/* keep up with the IWM */
cantStepErr = -75, /* Step handshake failed during seek */
tk0BadErr = -76, /* Track 00 sensor does not change */
/* during head calibration */
initIWMErr = -77, /* Unable to initialize IWM */
twoSideErr = -78, /* Tried to access a double-sided disk */
/* on a single-sided drive (400K drive) */
spAdjErr = -79, /* Can't adjust drive speed (400K drive) */
seekErr = -80, /* Wrong track number read in a sector's */
/* address field */
sectNFErr = -81, /* Sector number never found on a track */
fmt1Err = -82, /* Can't find sector 0 after track format */
fmt2Err = -83, /* Can't get enough sync */
verErr = -84 /* Track failed to verify */
};
#define IWM_TAG_SIZE 20 /* That's what "SonyEqu.a" says */
/* Buffer for sector header data */
struct sectorHdr {
u_int8_t side;
u_int8_t track;
u_int8_t sector;
u_int8_t Tags[IWM_TAG_SIZE];
};
typedef struct sectorHdr sectorHdr_t;
/*
* Cylinder cache data structure
* Cyl buffer is allocated in fdopen() and deallocated in fdclose().
*
* The "valid" flag is overloaded as "dirty" flag when writing
* to disk.
*/
struct cylCacheSlot {
unsigned char *secbuf; /* ptr to one sector buffer */
int32_t valid; /* content valid for cur. cylinder? */
};
typedef struct cylCacheSlot cylCacheSlot_t;
#else /* _LOCORE */
/*
* Assembler equates for IWM, kept here to ensure consistency.
* Modelled after <sys/disklabel.h>
*/
/*
* Offsets into data structures
*/
/* sectorHdr_t */
.equ o_side, 0
.equ o_track, 1
.equ o_sector, 2
.equ o_Tags, 3
/* cylCacheSlot_t */
.equ o_secbuf, 0
.equ o_valid, 4
/*
* Parameter (a6) offsets from <mac68k/obio/iwm_fdvar.h>
*
* int iwmReadSector(sectorHdr_t *hdr, cylCacheSlot_t *r_slots, void *buf)
* int iwmWriteSector(sectorHdr_t *hdr, cylCacheSlot_t *w_slots)
*/
.equ o_hdr, 8
.equ o_rslots, 12
.equ o_wslots, 12
.equ o_buf, 16
/*
* Offsets from IWM base address
* Lines are set by any memory access to corresponding address (IM III-34/-44).
* The SWIM has actual registers at these addresses, so writing to them
* in IWM mode is a no-no.
*/
.equ ph0L, 0x0000 /* CA0 off (0) */
.equ ph0H, 0x0200 /* CA0 on (1) */
.equ ph1L, 0x0400 /* CA1 off (0) */
.equ ph1H, 0x0600 /* CA1 on (1) */
.equ ph2L, 0x0800 /* CA2 off (0) */
.equ ph2H, 0x0A00 /* CA2 on (1) */
.equ ph3L, 0x0C00 /* LSTRB off (low) */
.equ ph3H, 0x0E00 /* LSTRB on (high) */
.equ mtrOff, 0x1000 /* disk enable off */
.equ mtrOn, 0x1200 /* disk enable on */
.equ intDrive, 0x1400 /* select internal drive */
.equ extDrive, 0x1600 /* select external drive */
.equ q6L, 0x1800 /* Q6 off */
.equ q6H, 0x1A00 /* Q6 on */
.equ q7L, 0x1C00 /* Q7 off */
.equ q7H, 0x1E00 /* Q7 on */
/*
* VIA Disk SEL line
*/
.equ vBufA, 0x1E00 /* Offset from vBase to register A */
/* (IM III-43) */
.equ vHeadSel, 5 /* Multi-purpose line (SEL) */
.equ vHeadSelMask, 0x0020 /* Corresponding bit mask */
/*
* Disk registers
* bit 0 - CA2, bit 1 - SEL, bit 2 - CA0, bit 3 - CA1 IM III name
*/
/* Status */
.equ stepDirection, 0x0000 /* Direction of next head step */
/* 0 = in, 1 = out (DIRTN) */
.equ rdDataFrom0, 0x0001 /* Set up drive to read data from */
/* head 0 (RDDATA0) */
.equ diskInserted, 0x0002 /* Disk inserted */
/* 0 = yes, 1 = no (CSTIN) */
.equ rdDataFrom1, 0x0003 /* Set up drive to read data from */
/* head 1 (RDDATA1) */
.equ stillStepping, 0x0004 /* Drive is still stepping */
/* 0 = yes, 1 = no (STEP) */
.equ writeProtected, 0x0006 /* Disk is locked */
/* 0 = yes, 1 = no (WRTPRT) */
.equ drvMotorState, 0x0008 /* Drive motor is on */
/* 0 = yes, 1 = no (MOTORON) */
.equ singleSided, 0x0009 /* Drive is single-sided */
/* 0 = yes, 1 = no (SIDES) */
.equ atTrack00, 0x000A /* Head is at track 00 */
/* 0 = yes, 1 = no (TK0) */
.equ headLoaded, 0x000B /* Head loaded, drive is ready */
/* 0 = yes, 1 = no () */
.equ drvInstalled, 0x000D /* Disk drive installed */
/* 0 = yes, 1 = no () */
.equ tachPulse, 0x000E /* Tachometer pulse (60 /rev.) */
/* 0 = yes, 1 = no (TACH) */
.equ diskIsHD, 0x000F /* HD disk detected */
/* 0 = yes, 1 = no (DRVIN) */
/* Commands */
.equ stepInCmd, 0x0000 /* Head step direction in (DIRTN) */
.equ stepOutCmd, 0x0001 /* Head step direction out (DIRTN+1) */
.equ doStepCmd, 0x0004 /* Step head (STEP) */
.equ motorOnCmd, 0x0008 /* Switch drive motor on (MOTORON) */
.equ motorOffCmd, 0x0009 /* Switch drive motor off (MOTOROFF) */
.equ ejectDiskCmd, 0x000D /* Eject disk from drive (EJECT) */
/*
* Low level disk errors
* For simplicity, they are given the MacOS names and numbers.
*/
.equ noErr, 0 /* All went well */
.equ noDriveErr, -64 /* Drive not installed */
.equ offLinErr, -65 /* R/W requested for an offline drive */
.equ noNybErr, -66 /* Disk is probably blank */
.equ noAdrMkErr, -67 /* Can't find an address mark */
.equ dataVerErr, -68 /* Read verify compare failed */
.equ badCkSmErr, -69 /* Bad address mark checksum */
.equ badBtSlpErr, -70 /* Bad address mark (no lead-out) */
.equ noDtaMkErr, -71 /* Could not find a data mark */
.equ badDCkSum, -72 /* Bad data mark checksum */
.equ badDBtSlp, -73 /* One of the data mark bit slip */
/* nibbles was incorrect. */
.equ wrUnderRun, -74 /* Could not write fast enough to */
/* keep up with the IWM */
.equ cantStepErr, -75 /* Step handshake failed during seek */
.equ tk0BadErr, -76 /* Track 00 sensor does not change */
/* during head calibration */
.equ initIWMErr, -77 /* Unable to initialize IWM */
.equ twoSideErr, -78 /* Tried to access a double-sided disk */
/* on a single-sided drive (400K drive) */
.equ spAdjErr, -79 /* Can't adjust drive speed (400K drive) */
.equ seekErr, -80 /* Wrong track number read in a */
/* sector's address field */
.equ sectNFErr, -81 /* Sector number never found on a track */
.equ fmt1Err, -82 /* Can't find sector 0 after */
/* track format */
.equ fmt2Err, -83 /* Can't get enough sync */
.equ verErr, -84 /* Track failed to verify */
/*
* Misc constants
*/
.equ iwmMode, 0x17 /* SWIM switch */
.equ maxGCRSectors, 12 /* Max. sectors per track for GCR */
#endif /* _LOCORE */
#endif /* _MAC68K_IWMREG_H */
|
4758f9657d7be04a7451dc34863373c1430c2a28
|
8fe1d3a1ab8de1d763579f7c585cfa65d1b32855
|
/Introducao/slides/RC-2/rotate.c
|
2def8b12c8305e5f2a1b89e9cd68aba37b7ff264
|
[] |
no_license
|
edsomjr/TEP
|
1920655075227e335e85741e2bbc2845177cf76e
|
f5885e1089ea9371777805b742ae22b4d67c8c48
|
refs/heads/master
| 2023-07-19T14:25:11.132962
| 2023-07-07T22:04:28
| 2023-07-07T22:04:28
| 63,184,807
| 389
| 178
| null | 2023-09-13T16:05:58
| 2016-07-12T18:57:19
|
TeX
|
UTF-8
|
C
| false
| false
| 355
|
c
|
rotate.c
|
#include <stdio.h>
union word32 {
unsigned int value;
unsigned char byte[4];
};
int main()
{
union word32 word, rotate;
register unsigned int i;
word.value = 0x12345678;
for (i = 0; i < 4; i++)
rotate.byte[i] = word.byte[(i+1) % 4];
printf("word: %08x, rotate: %08x\n", word.value, rotate.value);
return 0;
}
|
231e5c5f9148d64c4d4afc4773641f2ec90cb5ee
|
a1e9afa011a36f234d931450fcd9fcb7a06c0c81
|
/libgpu/include/thread_work.h
|
75cc9fca0e6d21e6e9f1f400998b10bce07da33f
|
[
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
IntelligentSoftwareSystems/Galois
|
feba91d648f2610d64a85532b46511088265f38f
|
b67f94206a8c47fd414446621f6633a31c49fd98
|
refs/heads/master
| 2023-09-02T19:16:15.788567
| 2023-08-28T23:34:50
| 2023-08-28T23:34:50
| 137,784,875
| 288
| 130
|
NOASSERTION
| 2023-08-28T21:16:42
| 2018-06-18T17:33:03
|
C++
|
UTF-8
|
C
| false
| false
| 2,438
|
h
|
thread_work.h
|
/*
thread_work.h
Copyright (C) 20XX--20XX, The University of Texas at Austin
Author: Vishwesh Jatala <vishwesh.jatala@austin.utexas.edu>
*/
struct ThreadWork {
PipeContextT<Worklist2> thread_work_wl;
PipeContextT<Worklist2> thread_src_wl;
Shared<int> thread_prefix_work_wl;
bool initialized = false;
void init_thread_work(int size) {
if (!initialized) {
thread_work_wl = PipeContextT<Worklist2>(size);
thread_src_wl = PipeContextT<Worklist2>(size);
thread_prefix_work_wl.alloc(size);
thread_prefix_work_wl.zero_gpu();
initialized = true;
}
}
void compute_prefix_sum() {
cub::CachingDeviceAllocator g_allocator(
true); // Caching allocator for device memory
// Determine temporary device storage requirements for inclusive prefix sum
void* d_temp_storage = NULL;
size_t temp_storage_bytes = 0;
cub::DeviceScan::InclusiveSum(
d_temp_storage, temp_storage_bytes, thread_work_wl.in_wl().dwl,
thread_prefix_work_wl.gpu_wr_ptr(), thread_work_wl.in_wl().nitems());
// Allocate temporary storage for inclusive prefix sum
CubDebugExit(
g_allocator.DeviceAllocate(&d_temp_storage, temp_storage_bytes));
// Run inclusive prefix sum
cub::DeviceScan::InclusiveSum(
d_temp_storage, temp_storage_bytes, thread_work_wl.in_wl().dwl,
thread_prefix_work_wl.gpu_wr_ptr(), thread_work_wl.in_wl().nitems());
}
void reset_thread_work() {
thread_prefix_work_wl.zero_gpu();
thread_work_wl.in_wl().reset();
thread_src_wl.in_wl().reset();
}
};
__device__ unsigned compute_src_and_offset(unsigned first, unsigned last,
unsigned index,
int* thread_prefix_work_wl,
unsigned num_items,
unsigned int& offset) {
unsigned middle = (first + last) / 2;
if (index <= thread_prefix_work_wl[first]) {
if (first == 0) {
offset = index - 1;
return first;
} else {
offset = index - thread_prefix_work_wl[first - 1] - 1;
return first;
}
}
while (first + 1 != last) {
middle = (first + last) / 2;
if (index > thread_prefix_work_wl[middle]) {
first = middle;
} else {
last = middle;
}
}
offset = index - thread_prefix_work_wl[first] - 1;
return last;
}
|
45571666d0946c6bba98bd2238dd20295bec6d7d
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/acm32/acm32f0x0-nucleo/libraries/HAL_Driver/Inc/HAL_RTC.h
|
77855b96b7fe9848c0f52b9768c7e8b14415fd3c
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 25,423
|
h
|
HAL_RTC.h
|
/*
******************************************************************************
* @file HAL_RTC.h
* @version V1.0.0
* @date 2020
* @brief Header file of RTC HAL module.
******************************************************************************
*/
#ifndef __HAL_RTC_H__
#define __HAL_RTC_H__
#include "ACM32Fxx_HAL.h"
/************************************************************************************/
/* Registers Bits Definition */
/************************************************************************************/
/**************** Bit definition for RTC IE Register ***********************/
#define RTC_IE_STP2RIE (BIT16)
#define RTC_IE_STP2FIE (BIT15)
#define RTC_IE_STP1RIE (BIT14)
#define RTC_IE_STP1FIE (BIT13)
#define RTC_IE_ADJ32 (BIT12)
#define RTC_IE_ALM (BIT11)
#define RTC_IE_1KHZ (BIT10)
#define RTC_IE_256HZ (BIT9)
#define RTC_IE_64HZ (BIT8)
#define RTC_IE_16HZ (BIT7)
#define RTC_IE_8HZ (BIT6)
#define RTC_IE_4HZ (BIT5)
#define RTC_IE_2HZ (BIT4)
#define RTC_IE_SEC (BIT3)
#define RTC_IE_MIN (BIT2)
#define RTC_IE_HOUR (BIT1)
#define RTC_IE_DATE (BIT0)
/**************** Bit definition for RTC SR Register ***********************/
#define RTC_SR_STP2RIE (BIT16)
#define RTC_SR_STP2FIE (BIT15)
#define RTC_SR_STP1RIE (BIT14)
#define RTC_SR_STP1FIE (BIT13)
#define RTC_SR_ADJ32 (BIT12)
#define RTC_SR_ALM (BIT11)
#define RTC_SR_1KHZ (BIT10)
#define RTC_SR_256HZ (BIT9)
#define RTC_SR_64HZ (BIT8)
#define RTC_SR_16HZ (BIT7)
#define RTC_SR_8HZ (BIT6)
#define RTC_SR_4HZ (BIT5)
#define RTC_SR_2HZ (BIT4)
#define RTC_SR_SEC (BIT3)
#define RTC_SR_MIN (BIT2)
#define RTC_SR_HOUR (BIT1)
#define RTC_SR_DATE (BIT0)
/**************** Bit definition for RTC CR Register ***********************/
#define RTC_CR_TAMPFLTCLK (BIT22)
#define RTC_CR_TS2EDGE (BIT21)
#define RTC_CR_TAMP2FLT (BIT19|BIT20)
#define RTC_CR_TAMP2FLTEN (BIT18)
#define RTC_CR_TAMP2FCLR (BIT17)
#define RTC_CR_TAMP2RCLR (BIT16)
#define RTC_CR_TS1EDGE (BIT15)
#define RTC_CR_TAMP1FLT (BIT13|BIT14)
#define RTC_CR_TAMP1FLTEN (BIT12)
#define RTC_CR_ALM_MKSD (BIT11)
#define RTC_CR_ALM_MSKH (BIT10)
#define RTC_CR_ALM_MSKM (BIT9)
#define RTC_CR_TAMP1FCLR (BIT8)
#define RTC_CR_TAMP1RCLR (BIT7)
#define RTC_CR_TAMP2EN (BIT6)
#define RTC_CR_TAMP1EN (BIT5)
#define RTC_CR_ALM_EN (BIT4)
#define RTC_CR_FSEL (BIT0|BIT1|BIT2|BIT3)
/**************** Bit definition for RTC_PMU CR Register ***********************/
#define RPMU_CR_WU6FILEN BIT29
#define RPMU_CR_WU5FILEN BIT28
#define RPMU_CR_WU4FILEN BIT27
#define RPMU_CR_WU3FILEN BIT26
#define RPMU_CR_WU2FILEN BIT25
#define RPMU_CR_WU1FILEN BIT24
#define RPMU_CR_EWUP6 BIT21
#define RPMU_CR_EWUP5 BIT20
#define RPMU_CR_EWUP4 BIT19
#define RPMU_CR_EWUP3 BIT18
#define RPMU_CR_EWUP2 BIT17
#define RPMU_CR_EWUP1 BIT16
#define RPMU_CR_BORRST_EN BIT12
#define RPMU_CR_WK_TIME (BIT9|BIT10|BIT11)
#define RPMU_CR_STB_EN BIT8
#define RPMU_CR_BDRST BIT6
#define RPMU_CR_RTCEN BIT5
#define RPMU_CR_RTCSEL (BIT2|BIT3)
#define RPMU_CR_CWUF BIT1
#define RPMU_CR_CSBF BIT0
/**************** Bit definition for RTC_PMU ANACR Register ***********************/
#define RPMU_SR_BORWUF BIT13
#define RPMU_SR_IWDTWUF BIT12
#define RPMU_SR_RSTWUF BIT11
#define RPMU_SR_RTCWUF BIT10
#define RPMU_SR_WUP6F BIT6
#define RPMU_SR_WUP5F BIT5
#define RPMU_SR_WUP4F BIT4
#define RPMU_SR_WUP3F BIT3
#define RPMU_SR_WUP2F BIT2
#define RPMU_SR_WUP1F BIT1
#define RPMU_SR_SBF BIT0
/**************** Bit definition for RTC_PMU ANACR Register ***********************/
#define RPMU_ANACR_BOR_CFG (BIT24|BIT25)
#define RPMU_ANACR_BOR_EN BIT23
#define RPMU_ANACR_LPBGR_TRIM (BIT20|BIT21|BIT22)
#define RPMU_ANACR_RC32K_TRIM (BIT10|BIT11|BIT12|BIT13|BIT14|BIT15)
#define RPMU_ANACR_RC32K_RDY BIT9
#define RPMU_ANACR_RC32K_EN BIT8
#define RPMU_ANACR_XTLDRV_2 BIT5
#define RPMU_ANACR_XTLDRV_1 BIT4
#define RPMU_ANACR_XTLDRV_0 BIT3
#define RPMU_ANACR_XTLDRV (BIT3|BIT4|BIT5)
#define RPMU_ANACR_XTLBYO BIT2
#define RPMU_ANACR_XTLRDY BIT1
#define RPMU_ANACR_XTLEN BIT0
/** @defgroup ClockSource
* @{
*/
#define RTC_CLOCK_RC32K (0x00000000)
#define RTC_CLOCK_XTL (0x00000004)
/**
* @}
*/
/** @defgroup Clock_Compensation
* @{
*/
#define COMPENSATION_INCREASE (0x00000000)
#define COMPENSATION_DECREASE (0x00000400)
/**
* @}
*/
/** @defgroup RTC_Month_Date_Definitions RTC Month Date Definitions
* @{
*/
/* Coded in BCD format */
#define RTC_MONTH_JANUARY (0x01)
#define RTC_MONTH_FEBRUARY (0x02)
#define RTC_MONTH_MARCH (0x03)
#define RTC_MONTH_APRIL (0x04)
#define RTC_MONTH_MAY (0x05)
#define RTC_MONTH_JUNE (0x06)
#define RTC_MONTH_JULY (0x07)
#define RTC_MONTH_AUGUST (0x08)
#define RTC_MONTH_SEPTEMBER (0x09)
#define RTC_MONTH_OCTOBER (0x10)
#define RTC_MONTH_NOVEMBER (0x11)
#define RTC_MONTH_DECEMBER (0x12)
/**
* @}
*/
/** @defgroup RTC_WeekDay_Definitions RTC WeekDay Definitions
* @{
*/
#define RTC_WEEKDAY_MONDAY (0x01)
#define RTC_WEEKDAY_TUESDAY (0x02)
#define RTC_WEEKDAY_WEDNESDAY (0x03)
#define RTC_WEEKDAY_THURSDAY (0x04)
#define RTC_WEEKDAY_FRIDAY (0x05)
#define RTC_WEEKDAY_SATURDAY (0x06)
#define RTC_WEEKDAY_SUNDAY (0x07)
/**
* @}
*/
/** @defgroup RTC_Alarm_Mode Definitions
* @{
*/
#define RTC_ALARM_WEEK_MODE (0x00000000)
#define RTC_ALARM_DAY_MODE (0x80000000)
/**
* @}
*/
/** @defgroup RTC_AlarmInterrupt Definitions
* @{
*/
#define RTC_ALARM_INT_ENABLE (0x00000000)
#define RTC_ALARM_INT_DISABLE (0x00000001)
/**
* @}
*/
/** @defgroup RTC_DayMask Definitions
* @{
*/
#define RTC_ALARM_DAY_MASK_ENABLE RTC_CR_ALM_MKSD
#define RTC_ALARM_DAY_MASK_DISABLE (0x00000000)
/**
* @}
*/
/** @defgroup RTC_HourMask Definitions
* @{
*/
#define RTC_ALARM_HOUR_MASK_ENABLE RTC_CR_ALM_MSKH
#define RTC_ALARM_HOUR_MASK_DISABLE (0x00000000)
/**
* @}
*/
/** @defgroup RTC_MinMask Definitions
* @{
*/
#define RTC_ALARM_MIN_MASK_ENABLE RTC_CR_ALM_MSKM
#define RTC_ALARM_MIN_MASK_DISABLE (0x00000000)
/**
* @}
*/
/** @defgroup RTC_Alarm_WeekSelect Definitions
* @{
*/
#define RTC_ALARM_WEEK_SUNDAY (0x01000000)
#define RTC_ALARM_WEEK_MONDAY (0x02000000)
#define RTC_ALARM_WEEK_TUESDAY (0x04000000)
#define RTC_ALARM_WEEK_WEDNESDAY (0x08000000)
#define RTC_ALARM_WEEK_THURSDAY (0x10000000)
#define RTC_ALARM_WEEK_FRIDAY (0x20000000)
#define RTC_ALARM_WEEK_SATURDAY (0x40000000)
/**
* @}
*/
/** @defgroup RTC_Temper_edge Definitions
* @{
*/
#define RTC_TEMP_EDGE_RISING (0x00000000)
#define RTC_TEMP_EDGE_FALLING (0x00000001)
/**
* @}
*/
/** @defgroup RTC_TemperInterrupt Definitions
* @{
*/
#define RTC_TEMP_INT_DISABLE (0x00000000)
#define RTC_TEMP_INT_ENABLE (0x00000001)
/**
* @}
*/
/** @defgroup RTC_ClearBackup Definitions
* @{
*/
#define RTC_TEMP_CLEAR_DISABLE (0x00000000)
#define RTC_TEMP_CLEAR_ENABLE (0x00000001)
/**
* @}
*/
/** @defgroup RTC_TemperFilter Definitions
* @{
*/
#define RTC_TEMP_FILTER_DISABLE (0x00000000)
#define RTC_TEMP_FILTER_512_RTCCLK (0x00000001)
#define RTC_TEMP_FILTER_1_RTCCLK (0x00000002)
#define RTC_TEMP_FILTER_2_RTCCLK (0x00000003)
#define RTC_TEMP_FILTER_4_RTCCLK (0x00000004)
#define RTC_TEMP_FILTER_8_RTCCLK (0x00000005)
/**
* @}
*/
/**
* @brief RTC Temper index definition
*/
typedef enum
{
RTC_TEMPER_1,
RTC_TEMPER_2,
}enum_Temper_t;
/**
* @}
*/
/**
* @brief RTC wakeup source form standby
*/
typedef enum
{
RTC_WAKEUP_RTC_INT = 0,
RTC_WAKEUP_WKUP1 = 0x00010000, // PA0
RTC_WAKEUP_WKUP2 = 0x00020000, // PC13
RTC_WAKEUP_WKUP3 = 0x00040000, // PA2
RTC_WAKEUP_WKUP4 = 0x00080000, // PC5
RTC_WAKEUP_WKUP5 = 0x00100000, // PB5
RTC_WAKEUP_WKUP6 = 0x00200000, // PB15
RTC_WAKEUP_STAMP2 = (RTC_IE_STP2RIE | RTC_IE_STP2FIE),
RTC_WAKEUP_STAMP1 = (RTC_IE_STP1RIE | RTC_IE_STP1FIE),
RTC_WAKEUP_32S = RTC_IE_ADJ32,
RTC_WAKEUP_ALARM = RTC_IE_ALM,
RTC_WAKEUP_SEC = RTC_IE_SEC,
RTC_WAKEUP_MIN = RTC_IE_MIN,
RTC_WAKEUP_HOUR = RTC_IE_HOUR,
RTC_WAKEUP_DATE = RTC_IE_DATE,
}enum_WKUP_t;
#define STANDBY_WAKEUP_RISING 0
#define STANDBY_WAKEUP_FALLING 1
/**
* @}
*/
/**
* @brief Check RTC wakeup source form standby
*/
#define RTC_WAKEUP_SOURCE_BORWUF (0x00002000)
#define RTC_WAKEUP_SOURCE_IWDTWUF (0x00001000)
#define RTC_WAKEUP_SOURCE_RSTWUF (0x00000800)
#define RTC_WAKEUP_SOURCE_RTCWUF (0x00000400)
#define RTC_WAKEUP_SOURCE_WKUP6 (0x00000040)
#define RTC_WAKEUP_SOURCE_WKUP5 (0x00000020)
#define RTC_WAKEUP_SOURCE_WKUP4 (0x00000010)
#define RTC_WAKEUP_SOURCE_WKUP3 (0x00000008)
#define RTC_WAKEUP_SOURCE_WKUP2 (0x00000004)
#define RTC_WAKEUP_SOURCE_WKUP1 (0x00000002)
/**
* @}
*/
/**
* @brief RTC Configuration Structure definition
*/
typedef struct
{
uint32_t u32_ClockSource; /*!< The RTC Clock Source to be configured.
This parameter can be a value of @ref ClockSource */
uint32_t u32_Compensation; /*!< The RTC Clock Compensation to be configured.
This parameter can be a value of @ref Clock_Compensation */
uint32_t u32_CompensationValue; /*!< The RTC Clock Compensation Value to be configured.
This parameter must be a number between Min_Data = 0x000 and Max_Data = 0x1FF */
}RTC_ConfigTypeDef;
/**
* @brief RTC Date structure definition
*/
typedef struct
{
uint8_t u8_Year; /*!< Specifies the RTC Date Year.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x99 */
uint8_t u8_Month; /*!< Specifies the RTC Date Month (in BCD format).
This parameter can be a value of @ref RTC_Month_Date_Definitions */
uint8_t u8_Date; /*!< Specifies the RTC Date.
This parameter must be a number between Min_Data = 0x01 and Max_Data = 0x31 */
uint8_t u8_WeekDay; /*!< Specifies the RTC Date WeekDay.
This parameter can be a value of @ref RTC_WeekDay_Definitions */
}RTC_DateTypeDef;
/* Attention: Year、Month、Date、Week use BCD code */
/**
* @brief RTC Time structure definition
*/
typedef struct
{
uint8_t u8_Hours; /*!< Specifies the RTC Time Hour.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x23 */
uint8_t u8_Minutes; /*!< Specifies the RTC Time Minutes.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x59 */
uint8_t u8_Seconds; /*!< Specifies the RTC Time Seconds.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x59 */
}RTC_TimeTypeDef;
/* Attention: Hour、Minute、Second use BCD code */
/**
* @brief RTC Time structure definition
*/
typedef struct
{
uint32_t u32_AlarmMode; /*!< Specifies the RTC alarm Mode.
This parameter can be a value of @ref RTC_Alarm_Mode */
uint32_t u32_AlarmInterrupt; /*!< Specifies the RTC alarm interrupt Enable or Disable.
This parameter can be a value of @ref RTC_AlarmInterrupt */
uint32_t u32_DayMask; /*!< Specifies the RTC alarm Day/Week Mask.
This parameter can be a value of @ref RTC_DayMask */
uint32_t u32_HourMask; /*!< Specifies the RTC alarm Hour Mask.
This parameter can be a value of @ref RTC_HourMask */
uint32_t u32_MinMask; /*!< Specifies the RTC alarm Min Mask.
This parameter can be a value of @ref RTC_MinMask */
uint32_t u32_AlarmWeek; /*!< Specifies the RTC alarm week select(Select WeekMode this parameter is valid).
This parameter can be a value of @ref RTC_Alarm_WeekSelect */
uint32_t u32_AlarmDay; /*!< Specifies the RTC alarm day select(Select DayMode this parameter is valid).
This parameter must be a number between Min_Data = 0x01 and Max_Data = 0x31 */
uint32_t u32_Hours; /*!< Specifies the RTC alarm Hour.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x23 */
uint32_t u32_Minutes; /*!< Specifies the RTC alarm Minutes.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x59 */
uint32_t u32_Seconds; /*!< Specifies the RTC alarm Seconds.
This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x59 */
}RTC_AlarmTypeDef;
/**
* @brief RTC Temper structure definition
*/
typedef struct
{
uint32_t u32_TemperEdge; /*!< Specifies the RTC Temper edge select.
This parameter can be a value of @ref RTC_Temper_edge */
uint32_t u32_InterruptEN; /*!< Specifies the RTC Temper interrupt enable.
This parameter can be a value of @ref RTC_TemperInterrupt */
uint32_t u32_ClearBackup; /*!< Specifies the RTC Temper clear backup register.
This parameter can be a value of @ref RTC_ClearBackup */
uint32_t u32_Filter; /*!< Specifies the RTC Temper Filter select.
This parameter can be a value of @ref RTC_TemperFilter */
}RTC_TemperTypeDef;
/** @brief PC13 function select
* @param __FUNC__: PC13 function select.
* This parameter can be 0: GPIO,1:RTC Fout,2:RTC tamper 3:PC13 Value
*/
#define __HAL_RTC_PC13_SEL(__FUNC__) (PMU->IOSEL |= (PMU->IOSEL & ~(0x3)) | (__FUNC__))
/** @brief PC14 function select
* @param __FUNC__: PC14 function select.
* This parameter can be 0: GPIO,1:PC14 Value
*/
#define __HAL_RTC_PC14_SEL(__FUNC__) (PMU->IOSEL |= (PMU->IOSEL & ~(0x3 << 3)) | (__FUNC__ << 3))
/** @brief PC15 function select
* @param __FUNC__: PC15 function select.
* This parameter can be 0: GPIO,1:PC15 Value
*/
#define __HAL_RTC_PC15_SEL(__FUNC__) (PMU->IOSEL |= (PMU->IOSEL & ~(0x3 << 5)) | (__FUNC__ << 5))
/** @brief PC13 Value set
* @param __FUNC__: PC13 Value set.
* This parameter can be 0: set,1:claer
*/
#define __HAL_RTC_PC13_VALUE(__VALUE__) (PMU->IOSEL |= (PMU->IOSEL & ~(1 << 8)) | (__VALUE__ << 8))
/** @brief PC14 Value set
* @param __FUNC__: PC14 Value set.
* This parameter can be 0: set,1:claer
*/
#define __HAL_RTC_PC14_VALUE(__VALUE__) (PMU->IOSEL |= (PMU->IOSEL & ~(1 << 9)) | (__VALUE__ << 9))
/** @brief PC15 Value set
* @param __FUNC__: PC15 Value set.
* This parameter can be 0: set,1:claer
*/
#define __HAL_RTC_PC15_VALUE(__VALUE__) (PMU->IOSEL |= (PMU->IOSEL & ~(1 << 10)) | (__VALUE__ << 10))
/* @brief PC13、PC14、PC15 pull up or pull down */
#define __HAL_RTC_PC13_PULL_UP_ENABLE() (PMU->IOCR |= BIT0)
#define __HAL_RTC_PC13_PULL_UP_DISABLE() (PMU->IOCR &= ~BIT0)
#define __HAL_RTC_PC13_PULL_DOWN_ENABLE() (PMU->IOCR |= BIT1)
#define __HAL_RTC_PC13_PULL_DOWN_DISABLE() (PMU->IOCR &= ~BIT1)
#define __HAL_RTC_PC14_PULL_UP_ENABLE() (PMU->IOCR |= BIT8)
#define __HAL_RTC_PC14_PULL_UP_DISABLE() (PMU->IOCR &= ~BIT8)
#define __HAL_RTC_PC14_PULL_DOWN_ENABLE() (PMU->IOCR |= BIT9)
#define __HAL_RTC_PC14_PULL_DOWN_DISABLE() (PMU->IOCR &= ~BIT9)
#define __HAL_RTC_PC15_PULL_UP_ENABLE() (PMU->IOCR |= BIT16)
#define __HAL_RTC_PC15_PULL_UP_DISABLE() (PMU->IOCR &= ~BIT16)
#define __HAL_RTC_PC15_PULL_DOWN_ENABLE() (PMU->IOCR |= BIT17)
#define __HAL_RTC_PC15_PULL_DOWN_DISABLE() (PMU->IOCR &= ~BIT17)
/* @brief PC13、PC14、PC15 digit or analog */
#define __HAL_RTC_PC13_ANALOG() (PMU->IOCR |= BIT6)
#define __HAL_RTC_PC13_DIGIT() (PMU->IOCR &= ~BIT6)
#define __HAL_RTC_PC14_ANALOG() (PMU->IOCR |= BIT14)
#define __HAL_RTC_PC14_DIGIT() (PMU->IOCR &= ~BIT14)
#define __HAL_RTC_PC15_ANALOG() (PMU->IOCR |= BIT22)
#define __HAL_RTC_PC15_DIGIT() (PMU->IOCR &= ~BIT22)
/** @defgroup RTC Private Macros
* @{
*/
#define IS_RTC_CLOCKSRC(__CLOCKSRC__) (((__CLOCKSRC__) == RTC_CLOCK_RC32K) || \
((__CLOCKSRC__) == RTC_CLOCK_XTL))
#define IS_RTC_COMPENSATION(__COMPENSATION__) (((__COMPENSATION__) == COMPENSATION_INCREASE) || \
((__COMPENSATION__) == COMPENSATION_DECREASE))
#define IS_RTC_YEAR(__YEAR__) ((__YEAR__) <= 0x99)
#define IS_RTC_MONTH(__MONTH__) (((__MONTH__) == RTC_MONTH_JANUARY) || \
((__MONTH__) == RTC_MONTH_FEBRUARY) || \
((__MONTH__) == RTC_MONTH_MARCH) || \
((__MONTH__) == RTC_MONTH_APRIL) || \
((__MONTH__) == RTC_MONTH_MAY) || \
((__MONTH__) == RTC_MONTH_JUNE) || \
((__MONTH__) == RTC_MONTH_JULY) || \
((__MONTH__) == RTC_MONTH_AUGUST) || \
((__MONTH__) == RTC_MONTH_SEPTEMBER) || \
((__MONTH__) == RTC_MONTH_OCTOBER) || \
((__MONTH__) == RTC_MONTH_NOVEMBER) || \
((__MONTH__) == RTC_MONTH_DECEMBER))
#define IS_RTC_DAY(__DAY__) ((__DAY__) >= 0x01 && (__DAY__) <= 0x31)
#define IS_RTC_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_WEEKDAY_MONDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_TUESDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_WEDNESDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_THURSDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_FRIDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_SATURDAY) || \
((__WEEKDAY__) == RTC_WEEKDAY_SUNDAY))
#define IS_RTC_HOUR(__HOUR__) ((__HOUR__) <= 0x23)
#define IS_RTC_MIN(__MIN__) ((__MIN__) <= 0x59)
#define IS_RTC_SEC(__SEC__) ((__SEC__) <= 0x60)
#define IS_RTC_ALARM_MODE(__MODE__) (((__MODE__) == RTC_ALARM_WEEK_MODE) || \
((__MODE__) == RTC_ALARM_DAY_MODE))
#define IS_RTC_ALARM_INT(__INT__) (((__INT__) == RTC_ALARM_INT_ENABLE) || \
((__INT__) == RTC_ALARM_INT_DISABLE))
#define IS_RTC_ALARM_DAY_MASK(__MASKD__) (((__MASKD__) == RTC_ALARM_DAY_MASK_ENABLE) || \
((__MASKD__) == RTC_ALARM_DAY_MASK_DISABLE))
#define IS_RTC_ALARM_HOUR_MASK(__MASKH__) (((__MASKH__) == RTC_ALARM_HOUR_MASK_ENABLE) || \
((__MASKH__) == RTC_ALARM_HOUR_MASK_DISABLE))
#define IS_RTC_ALARM_MIN_MASK(__MASKM__) (((__MASKM__) == RTC_ALARM_MIN_MASK_ENABLE) || \
((__MASKM__) == RTC_ALARM_MIN_MASK_DISABLE))
#define IS_RTC_ALARM_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) == RTC_ALARM_WEEK_SUNDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_MONDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_TUESDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_WEDNESDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_THURSDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_FRIDAY) || \
((__WEEKDAY__) == RTC_ALARM_WEEK_SATURDAY) || \
((__WEEKDAY__) >= 0x01000000 && (__WEEKDAY__) <= 0x7F000000))
#define IS_RTC_TEMP_EDGE(__EDGE__) (((__EDGE__) == RTC_TEMP_EDGE_RISING) || \
((__EDGE__) == RTC_TEMP_EDGE_FALLING))
#define IS_RTC_TEMP_INT(__INT__) (((__INT__) == RTC_TEMP_INT_ENABLE) || \
((__INT__) == RTC_TEMP_INT_DISABLE))
#define IS_RTC_TEMP_CLEAR_BACKUP(__CLEAR__) (((__CLEAR__) == RTC_TEMP_CLEAR_DISABLE) || \
((__CLEAR__) == RTC_TEMP_CLEAR_ENABLE))
#define IS_RTC_TEMP_FILTER(__FILTER__) (((__FILTER__) == RTC_TEMP_FILTER_DISABLE) || \
((__FILTER__) == RTC_TEMP_FILTER_512_RTCCLK) || \
((__FILTER__) == RTC_TEMP_FILTER_1_RTCCLK) || \
((__FILTER__) == RTC_TEMP_FILTER_2_RTCCLK) || \
((__FILTER__) == RTC_TEMP_FILTER_4_RTCCLK) || \
((__FILTER__) == RTC_TEMP_FILTER_8_RTCCLK))
/**
* @}
*/
/* RTC stamp1 interrupt enable、disable */
#define __HAL_RTC_ENABLE_STAMP1_IT (RTC->IE |= (RTC_IE_STP1RIE | RTC_IE_STP1FIE))
#define __HAL_RTC_DISABLE_STAMP1_IT (RTC->IE &= ~(RTC_IE_STP1RIE | RTC_IE_STP1FIE))
/* RTC stamp2 interrupt enable、disable */
#define __HAL_RTC_ENABLE_STAMP2_IT (RTC->IE |= (RTC_IE_STP2RIE | RTC_IE_STP2FIE))
#define __HAL_RTC_DISABLE_STAMP2_IT (RTC->IE &= ~(RTC_IE_STP2RIE | RTC_IE_STP2FIE))
/* RTC 32S interrupt enable、disable */
#define __HAL_RTC_ENABLE_32S_IT (RTC->IE |= RTC_IE_ADJ32)
#define __HAL_RTC_DISABLE_32S_IT (RTC->IE &= ~RTC_IE_ADJ32)
/* RTC alarm interrupt enable、disable */
#define __HAL_RTC_ENABLE_ALM_IT (RTC->IE |= RTC_IE_ALM)
#define __HAL_RTC_DISABLE_ALM_IT (RTC->IE &= RTC_IE_ALM)
/* RTC sec interrupt enable、disable */
#define __HAL_RTC_ENABLE_SEC_IT (RTC->IE |= RTC_IE_SEC)
#define __HAL_RTC_DISABLE_SEC_IT (RTC->IE &= ~RTC_IE_SEC)
/* RTC Minutes interrupt enable、disable */
#define __HAL_RTC_ENABLE_MIN_IT (RTC->IE |= RTC_IE_MIN)
#define __HAL_RTC_DISABLE_MIN_IT (RTC->IE &= ~RTC_IE_MIN)
/* RTC Hour interrupt enable、disable */
#define __HAL_RTC_ENABLE_HOUR_IT (RTC->IE |= RTC_IE_HOUR)
#define __HAL_RTC_DISABLE_HOUR_IT (RTC->IE &= ~RTC_IE_HOUR)
/* RTC Date interrupt enable、disable */
#define __HAL_RTC_ENABLE_DATE_IT (RTC->IE |= RTC_IE_DATE)
#define __HAL_RTC_DISABLE_DATE_IT (RTC->IE &= ~RTC_IE_DATE)
/* HAL_RTC_Config */
HAL_StatusTypeDef HAL_RTC_Config(RTC_ConfigTypeDef *hrtc);
/* HAL_RTC_SetTime */
void HAL_RTC_SetTime(RTC_TimeTypeDef *fp_Time);
/* HAL_RTC_GetTime */
void HAL_RTC_GetTime(RTC_TimeTypeDef *fp_Time);
/* HAL_RTC_SetDate */
void HAL_RTC_SetDate(RTC_DateTypeDef *fp_Date);
/* HAL_RTC_GetDate */
void HAL_RTC_GetDate(RTC_DateTypeDef *fp_Date);
/* HAL_RTC_AlarmConfig */
void HAL_RTC_AlarmConfig(RTC_AlarmTypeDef *fp_Alarm);
/* HAL_RTC_AlarmEnable */
void HAL_RTC_AlarmEnable(void);
/* HAL_RTC_AlarmDisable */
void HAL_RTC_AlarmDisable(void);
/* HAL_RTC_Tamper */
void HAL_RTC_Tamper(enum_Temper_t fe_Temper, RTC_TemperTypeDef *fp_Temper);
/* HAL_RTC_TamperEnable */
void HAL_RTC_TamperEnable(enum_Temper_t fe_Temper);
/* HAL_RTC_TamperDisable */
void HAL_RTC_TamperDisable(enum_Temper_t fe_Temper);
/* HAL_RTC_Standby_Wakeup */
void HAL_RTC_Standby_Wakeup(enum_WKUP_t fe_Wakeup, uint32_t fu32_Edge);
/* HAL_RTC_Get_StandbyStatus */
bool HAL_RTC_Get_StandbyStatus(void);
/* HAL_RTC_Get_StandbyWakeupSource */
uint32_t HAL_RTC_Get_StandbyWakeupSource(void);
#endif
|
f75404cec25ef58f54347ba39fe1582e7b25fe76
|
95ae7dfa9ee578f1b24a65986ff78bf77ceca0c5
|
/Engine/lib/curl/tests/libtest/lib1556.c
|
b59a0db60a699b47e0ad73e2c23977c730e1013a
|
[
"MIT",
"LicenseRef-scancode-unknown",
"curl"
] |
permissive
|
TorqueGameEngines/Torque3D
|
4e1f6a05cc0928980c8c7c20bcdd680eaa6dcee8
|
a445a4364664e299196bd551d213844486080145
|
refs/heads/development
| 2023-09-03T12:40:40.658487
| 2023-08-24T14:44:43
| 2023-08-24T14:44:43
| 267,440,108
| 1,192
| 178
|
MIT
| 2023-09-13T14:28:16
| 2020-05-27T22:35:54
|
C++
|
UTF-8
|
C
| false
| false
| 2,250
|
c
|
lib1556.c
|
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "test.h"
#include "testutil.h"
#include "warnless.h"
#include "memdebug.h"
struct headerinfo {
size_t largest;
};
static size_t header(void *ptr, size_t size, size_t nmemb, void *stream)
{
size_t headersize = size * nmemb;
struct headerinfo *info = (struct headerinfo *)stream;
(void)ptr;
if(headersize > info->largest)
/* remember the longest header */
info->largest = headersize;
return nmemb * size;
}
int test(char *URL)
{
CURLcode code;
CURL *curl = NULL;
int res = 0;
struct headerinfo info = {0};
global_init(CURL_GLOBAL_ALL);
easy_init(curl);
easy_setopt(curl, CURLOPT_HEADERFUNCTION, header);
easy_setopt(curl, CURLOPT_HEADERDATA, &info);
easy_setopt(curl, CURLOPT_VERBOSE, 1L);
easy_setopt(curl, CURLOPT_URL, URL);
code = curl_easy_perform(curl);
if(CURLE_OK != code) {
fprintf(stderr, "%s:%d curl_easy_perform() failed, "
"with code %d (%s)\n",
__FILE__, __LINE__, (int)code, curl_easy_strerror(code));
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
}
printf("Max = %ld\n", (long)info.largest);
test_cleanup:
curl_easy_cleanup(curl);
curl_global_cleanup();
return res;
}
|
8efb4263397681ba226942a7d538b03661f1d036
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/net/wireless/mac80211_hwsim.h
|
afaad5a443b6b56a4c82acc214bc1862190df7c4
|
[
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"Linux-syscall-note",
"GPL-2.0-only"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 4,193
|
h
|
mac80211_hwsim.h
|
/*
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef __MAC80211_HWSIM_H
#define __MAC80211_HWSIM_H
/**
* enum hwsim_tx_control_flags - flags to describe transmission info/status
*
* These flags are used to give the wmediumd extra information in order to
* modify its behavior for each frame
*
* @HWSIM_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
* @HWSIM_TX_CTL_NO_ACK: tell the wmediumd not to wait for an ack
* @HWSIM_TX_STAT_ACK: Frame was acknowledged
*
*/
enum hwsim_tx_control_flags {
HWSIM_TX_CTL_REQ_TX_STATUS = BIT(0),
HWSIM_TX_CTL_NO_ACK = BIT(1),
HWSIM_TX_STAT_ACK = BIT(2),
};
/**
* DOC: Frame transmission/registration support
*
* Frame transmission and registration support exists to allow userspace
* entities such as wmediumd to receive and process all broadcasted
* frames from a mac80211_hwsim radio device.
*
* This allow user space applications to decide if the frame should be
* dropped or not and implement a wireless medium simulator at user space.
*
* Registration is done by sending a register message to the driver and
* will be automatically unregistered if the user application doesn't
* responds to sent frames.
* Once registered the user application has to take responsibility of
* broadcasting the frames to all listening mac80211_hwsim radio
* interfaces.
*
* For more technical details, see the corresponding command descriptions
* below.
*/
/**
* enum hwsim_commands - supported hwsim commands
*
* @HWSIM_CMD_UNSPEC: unspecified command to catch errors
*
* @HWSIM_CMD_REGISTER: request to register and received all broadcasted
* frames by any mac80211_hwsim radio device.
* @HWSIM_CMD_FRAME: send/receive a broadcasted frame from/to kernel/user
* space, uses:
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_ADDR_RECEIVER,
* %HWSIM_ATTR_FRAME, %HWSIM_ATTR_FLAGS, %HWSIM_ATTR_RX_RATE,
* %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
* @HWSIM_CMD_TX_INFO_FRAME: Transmission info report from user space to
* kernel, uses:
* %HWSIM_ATTR_ADDR_TRANSMITTER, %HWSIM_ATTR_FLAGS,
* %HWSIM_ATTR_TX_INFO, %HWSIM_ATTR_SIGNAL, %HWSIM_ATTR_COOKIE
* @__HWSIM_CMD_MAX: enum limit
*/
enum {
HWSIM_CMD_UNSPEC,
HWSIM_CMD_REGISTER,
HWSIM_CMD_FRAME,
HWSIM_CMD_TX_INFO_FRAME,
__HWSIM_CMD_MAX,
};
#define HWSIM_CMD_MAX (_HWSIM_CMD_MAX - 1)
/**
* enum hwsim_attrs - hwsim netlink attributes
*
* @HWSIM_ATTR_UNSPEC: unspecified attribute to catch errors
*
* @HWSIM_ATTR_ADDR_RECEIVER: MAC address of the radio device that
* the frame is broadcasted to
* @HWSIM_ATTR_ADDR_TRANSMITTER: MAC address of the radio device that
* the frame was broadcasted from
* @HWSIM_ATTR_FRAME: Data array
* @HWSIM_ATTR_FLAGS: mac80211 transmission flags, used to process
properly the frame at user space
* @HWSIM_ATTR_RX_RATE: estimated rx rate index for this frame at user
space
* @HWSIM_ATTR_SIGNAL: estimated RX signal for this frame at user
space
* @HWSIM_ATTR_TX_INFO: ieee80211_tx_rate array
* @HWSIM_ATTR_COOKIE: sk_buff cookie to identify the frame
* @__HWSIM_ATTR_MAX: enum limit
*/
enum {
HWSIM_ATTR_UNSPEC,
HWSIM_ATTR_ADDR_RECEIVER,
HWSIM_ATTR_ADDR_TRANSMITTER,
HWSIM_ATTR_FRAME,
HWSIM_ATTR_FLAGS,
HWSIM_ATTR_RX_RATE,
HWSIM_ATTR_SIGNAL,
HWSIM_ATTR_TX_INFO,
HWSIM_ATTR_COOKIE,
__HWSIM_ATTR_MAX,
};
#define HWSIM_ATTR_MAX (__HWSIM_ATTR_MAX - 1)
/**
* struct hwsim_tx_rate - rate selection/status
*
* @idx: rate index to attempt to send with
* @count: number of tries in this rate before going to the next rate
*
* A value of -1 for @idx indicates an invalid rate and, if used
* in an array of retry rates, that no more rates should be tried.
*
* When used for transmit status reporting, the driver should
* always report the rate and number of retries used.
*
*/
struct hwsim_tx_rate {
s8 idx;
u8 count;
} __packed;
#endif /* __MAC80211_HWSIM_H */
|
1f7bf1c81f43988b71e3452151dd775752166182
|
2247493654c160426c1655281aa7f1dca2bc98dd
|
/src/kernel/ContinuityVofAdvElemKernel.C
|
55bfb0bd84f5b4cded2d4f87516d02d78922f6ad
|
[
"BSD-2-Clause"
] |
permissive
|
NaluCFD/Nalu
|
12999b0e3b76dbeab8fc184f38b65a13b1180bce
|
3286651e494894ac5948c41bf985f987d20c2370
|
refs/heads/master
| 2023-08-10T02:48:04.179859
| 2023-08-02T19:02:46
| 2023-08-02T19:02:46
| 69,712,764
| 138
| 185
|
NOASSERTION
| 2023-09-14T16:42:19
| 2016-10-01T01:25:20
|
C
|
UTF-8
|
C
| false
| false
| 7,716
|
c
|
ContinuityVofAdvElemKernel.C
|
/*------------------------------------------------------------------------*/
/* Copyright 2014 Sandia Corporation. */
/* This software is released under the license detailed */
/* in the file, LICENSE, which is located in the top-level Nalu */
/* directory structure */
/*------------------------------------------------------------------------*/
#include "kernel/ContinuityVofAdvElemKernel.h"
#include "AlgTraits.h"
#include "master_element/MasterElement.h"
#include "TimeIntegrator.h"
#include "SolutionOptions.h"
// template and scratch space
#include "BuildTemplates.h"
#include "ScratchViews.h"
// stk_mesh/base/fem
#include <stk_mesh/base/Entity.hpp>
#include <stk_mesh/base/MetaData.hpp>
#include <stk_mesh/base/BulkData.hpp>
#include <stk_mesh/base/Field.hpp>
namespace sierra {
namespace nalu {
template<typename AlgTraits>
ContinuityVofAdvElemKernel<AlgTraits>::ContinuityVofAdvElemKernel(
const stk::mesh::BulkData& bulkData,
const SolutionOptions& solnOpts,
ElemDataRequests& dataPreReqs)
: Kernel(),
meshMotion_(solnOpts.does_mesh_move()),
shiftMdot_(solnOpts.cvfemShiftMdot_),
shiftPoisson_(solnOpts.get_shifted_grad_op("pressure")),
reducedSensitivities_(solnOpts.cvfemReducedSensPoisson_),
n_(solnOpts.localVofN_),
m_(solnOpts.localVofM_),
c_(solnOpts.localVofC_),
lrscv_(sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_)->adjacentNodes())
{
// Save of required fields
const stk::mesh::MetaData& metaData = bulkData.mesh_meta_data();
std::string velocity_name = meshMotion_ ? "velocity_rtm" : "velocity";
velocityRTM_ = metaData.get_field<double>(stk::topology::NODE_RANK, velocity_name);
Gpdx_ = metaData.get_field<double>(stk::topology::NODE_RANK, "dpdx");
pressure_ = metaData.get_field<double>(stk::topology::NODE_RANK, "pressure");
ScalarFieldType *density = metaData.get_field<double>(stk::topology::NODE_RANK, "density");
densityNp1_ = &(density->field_of_state(stk::mesh::StateNP1));
interfaceCurvature_ = metaData.get_field<double>(stk::topology::NODE_RANK, "interface_curvature");
surfaceTension_ = metaData.get_field<double>(stk::topology::NODE_RANK, "surface_tension");
vof_ = metaData.get_field<double>(stk::topology::NODE_RANK, "volume_of_fluid");
coordinates_ = metaData.get_field<double>(stk::topology::NODE_RANK, solnOpts.get_coordinates_name());
for (int i = 0; i < AlgTraits::nDim_; ++i)
gravity_(i) = solnOpts.gravity_[i];
if(solnOpts.buoyancyPressureStab_)
buoyancyWeight_ = 1.0;
else
buoyancyWeight_ = 0.0;
MasterElement *meSCS = sierra::nalu::MasterElementRepo::get_surface_master_element(AlgTraits::topo_);
dataPreReqs.add_cvfem_surface_me(meSCS);
// fields and data
dataPreReqs.add_coordinates_field(*coordinates_, AlgTraits::nDim_, CURRENT_COORDINATES);
dataPreReqs.add_gathered_nodal_field(*velocityRTM_, AlgTraits::nDim_);
dataPreReqs.add_gathered_nodal_field(*densityNp1_, 1);
dataPreReqs.add_gathered_nodal_field(*pressure_, 1);
dataPreReqs.add_gathered_nodal_field(*interfaceCurvature_, 1);
dataPreReqs.add_gathered_nodal_field(*surfaceTension_, 1);
dataPreReqs.add_gathered_nodal_field(*vof_, 1);
dataPreReqs.add_gathered_nodal_field(*Gpdx_, AlgTraits::nDim_);
dataPreReqs.add_master_element_call(SCS_AREAV, CURRENT_COORDINATES);
// manage dndx
if ( !shiftPoisson_ || !reducedSensitivities_ )
dataPreReqs.add_master_element_call(SCS_GRAD_OP, CURRENT_COORDINATES);
if ( shiftPoisson_ || reducedSensitivities_ )
dataPreReqs.add_master_element_call(SCS_SHIFTED_GRAD_OP, CURRENT_COORDINATES);
if ( shiftMdot_ )
get_scs_shape_fn_data<AlgTraits>([&](double* ptr){meSCS->shifted_shape_fcn(ptr);}, v_shape_function_);
else
get_scs_shape_fn_data<AlgTraits>([&](double* ptr){meSCS->shape_fcn(ptr);}, v_shape_function_);
}
template<typename AlgTraits>
ContinuityVofAdvElemKernel<AlgTraits>::~ContinuityVofAdvElemKernel()
{}
template<typename AlgTraits>
void
ContinuityVofAdvElemKernel<AlgTraits>::setup(const TimeIntegrator& timeIntegrator)
{
const double dt = timeIntegrator.get_time_step();
const double gamma1 = timeIntegrator.get_gamma1();
projTimeScale_ = dt/gamma1;
}
template<typename AlgTraits>
void
ContinuityVofAdvElemKernel<AlgTraits>::execute(
SharedMemView<DoubleType **>& lhs,
SharedMemView<DoubleType *>& rhs,
ScratchViews<DoubleType>& scratchViews)
{
// Work arrays (fixed size)
NALU_ALIGNED DoubleType w_uIp [AlgTraits::nDim_];
NALU_ALIGNED DoubleType w_GpdxIp [AlgTraits::nDim_];
NALU_ALIGNED DoubleType w_dpdxIp [AlgTraits::nDim_];
SharedMemView<DoubleType*>& v_densityNp1 = scratchViews.get_scratch_view_1D(*densityNp1_);
SharedMemView<DoubleType*>& v_pressure = scratchViews.get_scratch_view_1D(*pressure_);
SharedMemView<DoubleType*>& v_kappa = scratchViews.get_scratch_view_1D(*interfaceCurvature_);
SharedMemView<DoubleType*>& v_sigma = scratchViews.get_scratch_view_1D(*surfaceTension_);
SharedMemView<DoubleType*>& v_vof = scratchViews.get_scratch_view_1D(*vof_);
SharedMemView<DoubleType**>& v_velocity = scratchViews.get_scratch_view_2D(*velocityRTM_);
SharedMemView<DoubleType**>& v_Gpdx = scratchViews.get_scratch_view_2D(*Gpdx_);
SharedMemView<DoubleType**>& v_scs_areav = scratchViews.get_me_views(CURRENT_COORDINATES).scs_areav;
SharedMemView<DoubleType***>& v_dndx = shiftPoisson_ ?
scratchViews.get_me_views(CURRENT_COORDINATES).dndx_shifted : scratchViews.get_me_views(CURRENT_COORDINATES).dndx;
SharedMemView<DoubleType***>& v_dndx_lhs = (shiftPoisson_ || reducedSensitivities_)?
scratchViews.get_me_views(CURRENT_COORDINATES).dndx_shifted : scratchViews.get_me_views(CURRENT_COORDINATES).dndx;
for (int ip = 0; ip < AlgTraits::numScsIp_; ++ip) {
const int il = lrscv_[2*ip];
const int ir = lrscv_[2*ip+1];
// need density at ip first for proper LHS scaling
DoubleType rhoIp = 0.0;
DoubleType dvofdaIp = 0.0;
DoubleType sigmaKappaIp = 0.0;
DoubleType vofIp = 0.0;
for (int ic = 0; ic < AlgTraits::nodesPerElement_; ++ic) {
rhoIp += v_shape_function_(ip, ic)*v_densityNp1(ic);
vofIp += v_shape_function_(ip, ic)*v_vof(ic);
}
for (int j = 0; j < AlgTraits::nDim_; ++j) {
w_uIp[j] = 0.0;
w_GpdxIp[j] = 0.0;
w_dpdxIp[j] = 0.0;
}
for (int ic = 0; ic < AlgTraits::nodesPerElement_; ++ic) {
const DoubleType r = v_shape_function_(ip, ic);
sigmaKappaIp += r*v_sigma(ic)*v_kappa(ic);
const DoubleType pressureIc = v_pressure(ic);
const DoubleType vofIc = v_vof(ic);
DoubleType lhsfac = 0.0;
for (int j = 0; j < AlgTraits::nDim_; ++j) {
w_GpdxIp[j] += r*v_Gpdx(ic, j);
w_uIp[j] += r*v_velocity(ic, j);
w_dpdxIp[j] += v_dndx(ip,ic,j)*pressureIc;
dvofdaIp += v_dndx(ip,ic,j)*vofIc*v_scs_areav(ip,j);
lhsfac += -v_dndx_lhs(ip, ic, j)*v_scs_areav(ip,j);
}
lhs(il,ic) += lhsfac/rhoIp;
lhs(ir,ic) -= lhsfac/rhoIp;
}
// correct for localized approach
sigmaKappaIp *= c_*stk::math::pow(vofIp,n_)*stk::math::pow(1.0-vofIp,m_);
// assemble flow rate
DoubleType vdot = projTimeScale_*sigmaKappaIp*dvofdaIp/rhoIp;
for (int j = 0; j < AlgTraits::nDim_; ++j) {
// balanced force approach
vdot += (w_uIp[j] - projTimeScale_*((w_dpdxIp[j]-buoyancyWeight_*rhoIp*gravity_(j))/rhoIp - w_GpdxIp[j]))*v_scs_areav(ip,j);
}
// residuals
rhs(il) -= vdot/projTimeScale_;
rhs(ir) += vdot/projTimeScale_;
}
}
INSTANTIATE_KERNEL(ContinuityVofAdvElemKernel);
} // nalu
} // sierra
|
376169c5a4366e8c345c6715f804632d631c425d
|
8838eb997879add5759b6dfb23f9a646464e53ca
|
/platform/lego_nxt/pnet/node/direct_comm/executer_embox.c
|
17e37072abc52b8cdc3daea61004fe03385bb777
|
[
"BSD-2-Clause"
] |
permissive
|
embox/embox
|
d6aacec876978522f01cdc4b8de37a668c6f4c80
|
98e3c06e33f3fdac10a29c069c20775568e0a6d1
|
refs/heads/master
| 2023-09-04T03:02:20.165042
| 2023-09-02T14:55:31
| 2023-09-02T14:55:31
| 33,078,138
| 1,087
| 325
|
BSD-2-Clause
| 2023-09-14T16:58:34
| 2015-03-29T15:27:48
|
C
|
UTF-8
|
C
| false
| false
| 2,062
|
c
|
executer_embox.c
|
/**
* @file
* @brief
*
* @date 26.11.2011
* @author Anton Kozlov
*/
#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <embox/unit.h>
#include <drivers/nxt/motor.h>
#include <drivers/nxt/sensor.h>
#include <drivers/nxt/direct_comm.h>
#include <drivers/bluetooth/bluetooth.h>
#include <pnet/core/core.h>
#include <pnet/core/node.h>
#include <pnet/core/repo.h>
#include <pnet/pack/pack_alone.h>
#include <pnet/node/direct_comm.h>
#include "device_config.h"
#define DEVICE_CONFIG_DATA 0
#define EXECUTE_COMMAND 1
#define REQUEST_SENSOR_DATA 2
EMBOX_UNIT_INIT(node_dc_init);
static struct lego_dc_msg_full dc_out_msg;
static void handle_command(struct lego_dc_msg *msg, int *addit_len, uint8_t addit_msg[]) {
switch (msg->command) {
case DC_EX_SET_M_OUTPUT_STATE:
nxt_motor_set_power(NXT_MOTOR_A, msg->tail[0]);
nxt_motor_set_power(NXT_MOTOR_B, msg->tail[1]);
nxt_motor_set_power(NXT_MOTOR_C, msg->tail[2]);
break;
}
}
static void send_config(char *msg) {
int length;
char buff[256];
struct DeviceConfigurationMessage message;
buff[0] = DEVICE_CONFIG_DATA;
strcpy(message._id, "LEGO_NXT");
message._id_len = 8;
message._type = _LEGO_NXT;
message._commands[0] = DC_EX_SET_M_OUTPUT_STATE;
message._commands_len = 1;
message._sensors[0] = 0x00;
message._sensors_len = 1;
length = DeviceConfigurationMessage_write_delimited_to(&message, buff, 1);
bluetooth_write((uint8_t *)buff, length);
}
static int dc_rx_hnd(struct pnet_pack *pack) {
struct lego_dc_msg *lego_msg;
int addit_len = 0;
char *msg;
msg = pnet_pack_get_data(pack);
switch (msg[0]) {
case DEVICE_CONFIG_DATA:
send_config(msg);
break;
case EXECUTE_COMMAND:
lego_msg = (struct lego_dc_msg *) (msg);
handle_command(lego_msg, &addit_len, dc_out_msg.body.tail + 1);
break;
case REQUEST_SENSOR_DATA:
break;
}
return NET_HND_STOP_FREE;
}
static int node_dc_init(void) {
return 0;
}
PNET_NODE_DEF(PNET_NODE_DIRECT_COMM_EXECUTER, {
.rx_hnd = dc_rx_hnd,
.tx_hnd = NULL
});
|
07c25af53be2de38b9e4e551d55baffdf93f17a9
|
0337c1df871a431c6a8b03ad871d396826d7e210
|
/src/3rdparty/win32_include/libavcodec/codec_par.h
|
f51d27c5908449354badf3e00cf5e3002a4f97ac
|
[
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown"
] |
permissive
|
clangen/musikcube
|
be1ad8c1567c9e3cfbf71e1f595ede9aa0152a97
|
64485978ea2e4483499996a8e2304ce5566573d9
|
refs/heads/master
| 2023-08-28T00:52:06.905519
| 2023-08-02T02:47:41
| 2023-08-02T02:47:41
| 32,483,164
| 4,049
| 370
|
BSD-3-Clause
| 2023-09-08T05:05:44
| 2015-03-18T20:41:57
|
C++
|
UTF-8
|
C
| false
| false
| 7,631
|
h
|
codec_par.h
|
/*
* Codec parameters public API
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_CODEC_PAR_H
#define AVCODEC_CODEC_PAR_H
#include <stdint.h>
#include "libavutil/avutil.h"
#include "libavutil/channel_layout.h"
#include "libavutil/rational.h"
#include "libavutil/pixfmt.h"
#include "codec_id.h"
/**
* @addtogroup lavc_core
* @{
*/
enum AVFieldOrder {
AV_FIELD_UNKNOWN,
AV_FIELD_PROGRESSIVE,
AV_FIELD_TT, ///< Top coded_first, top displayed first
AV_FIELD_BB, ///< Bottom coded first, bottom displayed first
AV_FIELD_TB, ///< Top coded first, bottom displayed first
AV_FIELD_BT, ///< Bottom coded first, top displayed first
};
/**
* This struct describes the properties of an encoded stream.
*
* sizeof(AVCodecParameters) is not a part of the public ABI, this struct must
* be allocated with avcodec_parameters_alloc() and freed with
* avcodec_parameters_free().
*/
typedef struct AVCodecParameters {
/**
* General type of the encoded data.
*/
enum AVMediaType codec_type;
/**
* Specific type of the encoded data (the codec used).
*/
enum AVCodecID codec_id;
/**
* Additional information about the codec (corresponds to the AVI FOURCC).
*/
uint32_t codec_tag;
/**
* Extra binary data needed for initializing the decoder, codec-dependent.
*
* Must be allocated with av_malloc() and will be freed by
* avcodec_parameters_free(). The allocated size of extradata must be at
* least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding
* bytes zeroed.
*/
uint8_t *extradata;
/**
* Size of the extradata content in bytes.
*/
int extradata_size;
/**
* - video: the pixel format, the value corresponds to enum AVPixelFormat.
* - audio: the sample format, the value corresponds to enum AVSampleFormat.
*/
int format;
/**
* The average bitrate of the encoded data (in bits per second).
*/
int64_t bit_rate;
/**
* The number of bits per sample in the codedwords.
*
* This is basically the bitrate per sample. It is mandatory for a bunch of
* formats to actually decode them. It's the number of bits for one sample in
* the actual coded bitstream.
*
* This could be for example 4 for ADPCM
* For PCM formats this matches bits_per_raw_sample
* Can be 0
*/
int bits_per_coded_sample;
/**
* This is the number of valid bits in each output sample. If the
* sample format has more bits, the least significant bits are additional
* padding bits, which are always 0. Use right shifts to reduce the sample
* to its actual size. For example, audio formats with 24 bit samples will
* have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32.
* To get the original sample use "(int32_t)sample >> 8"."
*
* For ADPCM this might be 12 or 16 or similar
* Can be 0
*/
int bits_per_raw_sample;
/**
* Codec-specific bitstream restrictions that the stream conforms to.
*/
int profile;
int level;
/**
* Video only. The dimensions of the video frame in pixels.
*/
int width;
int height;
/**
* Video only. The aspect ratio (width / height) which a single pixel
* should have when displayed.
*
* When the aspect ratio is unknown / undefined, the numerator should be
* set to 0 (the denominator may have any value).
*/
AVRational sample_aspect_ratio;
/**
* Video only. The order of the fields in interlaced video.
*/
enum AVFieldOrder field_order;
/**
* Video only. Additional colorspace characteristics.
*/
enum AVColorRange color_range;
enum AVColorPrimaries color_primaries;
enum AVColorTransferCharacteristic color_trc;
enum AVColorSpace color_space;
enum AVChromaLocation chroma_location;
/**
* Video only. Number of delayed frames.
*/
int video_delay;
#if FF_API_OLD_CHANNEL_LAYOUT
/**
* Audio only. The channel layout bitmask. May be 0 if the channel layout is
* unknown or unspecified, otherwise the number of bits set must be equal to
* the channels field.
* @deprecated use ch_layout
*/
attribute_deprecated
uint64_t channel_layout;
/**
* Audio only. The number of audio channels.
* @deprecated use ch_layout.nb_channels
*/
attribute_deprecated
int channels;
#endif
/**
* Audio only. The number of audio samples per second.
*/
int sample_rate;
/**
* Audio only. The number of bytes per coded audio frame, required by some
* formats.
*
* Corresponds to nBlockAlign in WAVEFORMATEX.
*/
int block_align;
/**
* Audio only. Audio frame size, if known. Required by some formats to be static.
*/
int frame_size;
/**
* Audio only. The amount of padding (in samples) inserted by the encoder at
* the beginning of the audio. I.e. this number of leading decoded samples
* must be discarded by the caller to get the original audio without leading
* padding.
*/
int initial_padding;
/**
* Audio only. The amount of padding (in samples) appended by the encoder to
* the end of the audio. I.e. this number of decoded samples must be
* discarded by the caller from the end of the stream to get the original
* audio without any trailing padding.
*/
int trailing_padding;
/**
* Audio only. Number of samples to skip after a discontinuity.
*/
int seek_preroll;
/**
* Audio only. The channel layout and number of channels.
*/
AVChannelLayout ch_layout;
} AVCodecParameters;
/**
* Allocate a new AVCodecParameters and set its fields to default values
* (unknown/invalid/0). The returned struct must be freed with
* avcodec_parameters_free().
*/
AVCodecParameters *avcodec_parameters_alloc(void);
/**
* Free an AVCodecParameters instance and everything associated with it and
* write NULL to the supplied pointer.
*/
void avcodec_parameters_free(AVCodecParameters **par);
/**
* Copy the contents of src to dst. Any allocated fields in dst are freed and
* replaced with newly allocated duplicates of the corresponding fields in src.
*
* @return >= 0 on success, a negative AVERROR code on failure.
*/
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src);
/**
* This function is the same as av_get_audio_frame_duration(), except it works
* with AVCodecParameters instead of an AVCodecContext.
*/
int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
/**
* @}
*/
#endif // AVCODEC_CODEC_PAR_H
|
fe820c9f1b5ab16e7dfc9d1440d7774fdc1e5c5c
|
f9e7d65cb784c01a0200145ba8d289afe41d4a56
|
/baseboard/intelrvp/usb_mux.c
|
644ae1735cf6ecff46e2c44d23b7668291a18bf2
|
[
"BSD-3-Clause"
] |
permissive
|
FrameworkComputer/EmbeddedController
|
ad7086769e87d0a4179eae96a7c9ff5e383ff54e
|
f6d6b927eed71550d3475411cfc3e59abe5cef2a
|
refs/heads/hx20-hx30
| 2023-08-08T20:45:10.621169
| 2023-05-26T07:03:59
| 2023-05-26T07:03:59
| 447,021,040
| 846
| 48
|
BSD-3-Clause
| 2023-05-26T07:04:59
| 2022-01-12T00:11:14
|
C
|
UTF-8
|
C
| false
| false
| 2,142
|
c
|
usb_mux.c
|
/* Copyright 2019 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Intel BASEBOARD-RVP USB MUX specific configuration */
#include "common.h"
#include "anx7440.h"
#include "bb_retimer.h"
#include "timer.h"
#include "usb_mux.h"
#ifdef CONFIG_USBC_RETIMER_INTEL_BB
struct usb_mux usbc0_retimer = {
.usb_port = TYPE_C_PORT_0,
.driver = &bb_usb_retimer,
.i2c_port = I2C_PORT0_BB_RETIMER,
.i2c_addr_flags = I2C_PORT0_BB_RETIMER_ADDR,
};
#ifdef HAS_TASK_PD_C1
struct usb_mux usbc1_retimer = {
.usb_port = TYPE_C_PORT_1,
.driver = &bb_usb_retimer,
.i2c_port = I2C_PORT1_BB_RETIMER,
.i2c_addr_flags = I2C_PORT1_BB_RETIMER_ADDR,
};
#endif /* HAS_TASK_PD_C1 */
#endif
/* USB muxes Configuration */
#ifdef CONFIG_USB_MUX_VIRTUAL
const struct usb_mux usb_muxes[] = {
[TYPE_C_PORT_0] = {
.usb_port = TYPE_C_PORT_0,
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
#ifdef CONFIG_USBC_RETIMER_INTEL_BB
.next_mux = &usbc0_retimer,
#endif
},
#ifdef HAS_TASK_PD_C1
[TYPE_C_PORT_1] = {
.usb_port = TYPE_C_PORT_1,
.driver = &virtual_usb_mux_driver,
.hpd_update = &virtual_hpd_update,
#ifdef CONFIG_USBC_RETIMER_INTEL_BB
.next_mux = &usbc1_retimer,
#endif
},
#endif /* HAS_TASK_PD_C1 */
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT);
#endif /* CONFIG_USB_MUX_VIRTUAL */
#ifdef CONFIG_USB_MUX_ANX7440
const struct usb_mux usb_muxes[] = {
[TYPE_C_PORT_0] = {
.usb_port = TYPE_C_PORT_0,
.i2c_port = I2C_PORT_USB_MUX,
.i2c_addr_flags = I2C_ADDR_USB_MUX0_FLAGS,
.driver = &anx7440_usb_mux_driver,
#ifdef CONFIG_USBC_RETIMER_INTEL_BB
.next_mux = &usbc0_retimer,
#endif
},
#ifdef HAS_TASK_PD_C1
[TYPE_C_PORT_1] = {
.usb_port = TYPE_C_PORT_1,
.i2c_port = I2C_PORT_USB_MUX,
.i2c_addr_flags = I2C_ADDR_USB_MUX1_FLAGS,
.driver = &anx7440_usb_mux_driver,
#ifdef CONFIG_USBC_RETIMER_INTEL_BB
.next_mux = &usbc1_retimer,
#endif
},
#endif /* HAS_TASK_PD_C1 */
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT);
#endif /* CONFIG_USB_MUX_ANX7440 */
|
d5dc6a89c21b68791b8f6061d12df0343bd3d1b8
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/imxrt/libraries/MIMXRT1064/MIMXRT1064/drivers/fsl_pit.h
|
667ce8df269fc86bdf6b5390e0f8508c60b443f6
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 9,360
|
h
|
fsl_pit.h
|
/*
* Copyright (c) 2015, Freescale Semiconductor, Inc.
* Copyright 2016-2017 NXP
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FSL_PIT_H_
#define _FSL_PIT_H_
#include "fsl_common.h"
/*!
* @addtogroup pit
* @{
*/
/*******************************************************************************
* Definitions
******************************************************************************/
/*! @name Driver version */
/*@{*/
/*! @brief PIT Driver Version 2.0.1 */
#define FSL_PIT_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
/*@}*/
/*!
* @brief List of PIT channels
* @note Actual number of available channels is SoC dependent
*/
typedef enum _pit_chnl
{
kPIT_Chnl_0 = 0U, /*!< PIT channel number 0*/
kPIT_Chnl_1, /*!< PIT channel number 1 */
kPIT_Chnl_2, /*!< PIT channel number 2 */
kPIT_Chnl_3, /*!< PIT channel number 3 */
} pit_chnl_t;
/*! @brief List of PIT interrupts */
typedef enum _pit_interrupt_enable
{
kPIT_TimerInterruptEnable = PIT_TCTRL_TIE_MASK, /*!< Timer interrupt enable*/
} pit_interrupt_enable_t;
/*! @brief List of PIT status flags */
typedef enum _pit_status_flags
{
kPIT_TimerFlag = PIT_TFLG_TIF_MASK, /*!< Timer flag */
} pit_status_flags_t;
/*!
* @brief PIT configuration structure
*
* This structure holds the configuration settings for the PIT peripheral. To initialize this
* structure to reasonable defaults, call the PIT_GetDefaultConfig() function and pass a
* pointer to your config structure instance.
*
* The configuration structure can be made constant so it resides in flash.
*/
typedef struct _pit_config
{
bool enableRunInDebug; /*!< true: Timers run in debug mode; false: Timers stop in debug mode */
} pit_config_t;
/*******************************************************************************
* API
******************************************************************************/
#if defined(__cplusplus)
extern "C" {
#endif
/*!
* @name Initialization and deinitialization
* @{
*/
/*!
* @brief Ungates the PIT clock, enables the PIT module, and configures the peripheral for basic operations.
*
* @note This API should be called at the beginning of the application using the PIT driver.
*
* @param base PIT peripheral base address
* @param config Pointer to the user's PIT config structure
*/
void PIT_Init(PIT_Type *base, const pit_config_t *config);
/*!
* @brief Gates the PIT clock and disables the PIT module.
*
* @param base PIT peripheral base address
*/
void PIT_Deinit(PIT_Type *base);
/*!
* @brief Fills in the PIT configuration structure with the default settings.
*
* The default values are as follows.
* @code
* config->enableRunInDebug = false;
* @endcode
* @param config Pointer to the configuration structure.
*/
static inline void PIT_GetDefaultConfig(pit_config_t *config)
{
assert(config);
/* Timers are stopped in Debug mode */
config->enableRunInDebug = false;
}
#if defined(FSL_FEATURE_PIT_HAS_CHAIN_MODE) && FSL_FEATURE_PIT_HAS_CHAIN_MODE
/*!
* @brief Enables or disables chaining a timer with the previous timer.
*
* When a timer has a chain mode enabled, it only counts after the previous
* timer has expired. If the timer n-1 has counted down to 0, counter n
* decrements the value by one. Each timer is 32-bits, which allows the developers
* to chain timers together and form a longer timer (64-bits and larger). The first timer
* (timer 0) can't be chained to any other timer.
*
* @param base PIT peripheral base address
* @param channel Timer channel number which is chained with the previous timer
* @param enable Enable or disable chain.
* true: Current timer is chained with the previous timer.
* false: Timer doesn't chain with other timers.
*/
static inline void PIT_SetTimerChainMode(PIT_Type *base, pit_chnl_t channel, bool enable)
{
if (enable)
{
base->CHANNEL[channel].TCTRL |= PIT_TCTRL_CHN_MASK;
}
else
{
base->CHANNEL[channel].TCTRL &= ~PIT_TCTRL_CHN_MASK;
}
}
#endif /* FSL_FEATURE_PIT_HAS_CHAIN_MODE */
/*! @}*/
/*!
* @name Interrupt Interface
* @{
*/
/*!
* @brief Enables the selected PIT interrupts.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
* @param mask The interrupts to enable. This is a logical OR of members of the
* enumeration ::pit_interrupt_enable_t
*/
static inline void PIT_EnableInterrupts(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
{
base->CHANNEL[channel].TCTRL |= mask;
}
/*!
* @brief Disables the selected PIT interrupts.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
* @param mask The interrupts to disable. This is a logical OR of members of the
* enumeration ::pit_interrupt_enable_t
*/
static inline void PIT_DisableInterrupts(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
{
base->CHANNEL[channel].TCTRL &= ~mask;
}
/*!
* @brief Gets the enabled PIT interrupts.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
*
* @return The enabled interrupts. This is the logical OR of members of the
* enumeration ::pit_interrupt_enable_t
*/
static inline uint32_t PIT_GetEnabledInterrupts(PIT_Type *base, pit_chnl_t channel)
{
return (base->CHANNEL[channel].TCTRL & PIT_TCTRL_TIE_MASK);
}
/*! @}*/
/*!
* @name Status Interface
* @{
*/
/*!
* @brief Gets the PIT status flags.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
*
* @return The status flags. This is the logical OR of members of the
* enumeration ::pit_status_flags_t
*/
static inline uint32_t PIT_GetStatusFlags(PIT_Type *base, pit_chnl_t channel)
{
return (base->CHANNEL[channel].TFLG & PIT_TFLG_TIF_MASK);
}
/*!
* @brief Clears the PIT status flags.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
* @param mask The status flags to clear. This is a logical OR of members of the
* enumeration ::pit_status_flags_t
*/
static inline void PIT_ClearStatusFlags(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
{
base->CHANNEL[channel].TFLG = mask;
}
/*! @}*/
/*!
* @name Read and Write the timer period
* @{
*/
/*!
* @brief Sets the timer period in units of count.
*
* Timers begin counting from the value set by this function until it reaches 0,
* then it generates an interrupt and load this register value again.
* Writing a new value to this register does not restart the timer. Instead, the value
* is loaded after the timer expires.
*
* @note Users can call the utility macros provided in fsl_common.h to convert to ticks.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
* @param count Timer period in units of ticks
*/
static inline void PIT_SetTimerPeriod(PIT_Type *base, pit_chnl_t channel, uint32_t count)
{
base->CHANNEL[channel].LDVAL = count;
}
/*!
* @brief Reads the current timer counting value.
*
* This function returns the real-time timer counting value, in a range from 0 to a
* timer period.
*
* @note Users can call the utility macros provided in fsl_common.h to convert ticks to usec or msec.
*
* @param base PIT peripheral base address
* @param channel Timer channel number
*
* @return Current timer counting value in ticks
*/
static inline uint32_t PIT_GetCurrentTimerCount(PIT_Type *base, pit_chnl_t channel)
{
return base->CHANNEL[channel].CVAL;
}
/*! @}*/
/*!
* @name Timer Start and Stop
* @{
*/
/*!
* @brief Starts the timer counting.
*
* After calling this function, timers load period value, count down to 0 and
* then load the respective start value again. Each time a timer reaches 0,
* it generates a trigger pulse and sets the timeout interrupt flag.
*
* @param base PIT peripheral base address
* @param channel Timer channel number.
*/
static inline void PIT_StartTimer(PIT_Type *base, pit_chnl_t channel)
{
base->CHANNEL[channel].TCTRL |= PIT_TCTRL_TEN_MASK;
}
/*!
* @brief Stops the timer counting.
*
* This function stops every timer counting. Timers reload their periods
* respectively after the next time they call the PIT_DRV_StartTimer.
*
* @param base PIT peripheral base address
* @param channel Timer channel number.
*/
static inline void PIT_StopTimer(PIT_Type *base, pit_chnl_t channel)
{
base->CHANNEL[channel].TCTRL &= ~PIT_TCTRL_TEN_MASK;
}
/*! @}*/
#if defined(FSL_FEATURE_PIT_HAS_LIFETIME_TIMER) && FSL_FEATURE_PIT_HAS_LIFETIME_TIMER
/*!
* @brief Reads the current lifetime counter value.
*
* The lifetime timer is a 64-bit timer which chains timer 0 and timer 1 together.
* Timer 0 and 1 are chained by calling the PIT_SetTimerChainMode before using this timer.
* The period of lifetime timer is equal to the "period of timer 0 * period of timer 1".
* For the 64-bit value, the higher 32-bit has the value of timer 1, and the lower 32-bit
* has the value of timer 0.
*
* @param base PIT peripheral base address
*
* @return Current lifetime timer value
*/
uint64_t PIT_GetLifetimeTimerCount(PIT_Type *base);
#endif /* FSL_FEATURE_PIT_HAS_LIFETIME_TIMER */
#if defined(__cplusplus)
}
#endif
/*! @}*/
#endif /* _FSL_PIT_H_ */
|
4ef50174f0aee54d5015437127bbf643a4f3a31d
|
7664f318ed04bd0680f3d82321c18896e3ef6ad5
|
/src/code/z_skin_awb.c
|
e16556ca6a3958d9e28b2cbc366ab2e3c4d4d773
|
[] |
no_license
|
zeldaret/oot
|
9c80ce17f2d8fd61514b375f92ee4739b5ce9d4e
|
2875ab4fcf5c5f81d76353d1ee0024c9ea8d0b23
|
refs/heads/master
| 2023-08-29T05:29:31.356427
| 2023-08-28T22:48:52
| 2023-08-28T22:48:52
| 247,875,738
| 4,401
| 802
| null | 2023-09-14T13:34:38
| 2020-03-17T04:02:19
|
C
|
UTF-8
|
C
| false
| false
| 7,044
|
c
|
z_skin_awb.c
|
#include "global.h"
#include "overlays/actors/ovl_En_fHG/z_en_fhg.h"
/**
* Initialises the Vtx buffers used for limb at index `limbIndex`
*/
void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) {
s32 i;
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
SkinAnimatedLimbData* animatedLimbData =
SEGMENTED_TO_VIRTUAL(((SkinLimb*)SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]))->segment);
SkinLimbModif* limbModifications = SEGMENTED_TO_VIRTUAL(animatedLimbData->limbModifications);
SkinLimbModif* modifEntry;
SkinVertex* skinVtxEntry;
for (i = 0; i < ARRAY_COUNT(skin->vtxTable->buf); i++) {
Vtx* vtxBuf = skin->vtxTable[limbIndex].buf[i];
for (modifEntry = limbModifications; modifEntry < limbModifications + animatedLimbData->limbModifCount;
modifEntry++) {
SkinVertex* skinVertices = SEGMENTED_TO_VIRTUAL(modifEntry->skinVertices);
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount]; skinVtxEntry++) {
Vtx* vtx = &vtxBuf[skinVtxEntry->index];
vtx->n.flag = 0;
vtx->n.tc[0] = skinVtxEntry->s;
vtx->n.tc[1] = skinVtxEntry->t;
vtx->n.a = skinVtxEntry->alpha;
}
}
}
}
/**
* Initializes a skin skeleton to looping animation, dynamically allocating the frame tables,
* and dynamically allocating and initializing the Vtx and SkinLimbVtx buffers for its animated limbs
*/
void Skin_Init(PlayState* play, Skin* skin, SkeletonHeader* skeletonHeader, AnimationHeader* animationHeader) {
s32 limbCount;
s32 i;
SkinLimb** skeleton;
SkeletonHeader* virtSkelHeader = SEGMENTED_TO_VIRTUAL(skeletonHeader);
skin->limbCount = virtSkelHeader->limbCount;
skin->skeletonHeader = virtSkelHeader;
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
limbCount = skin->skeletonHeader->limbCount;
skin->vtxTable = ZeldaArena_MallocDebug(limbCount * sizeof(SkinLimbVtx), "../z_skin_awb.c", 212);
ASSERT(skin->vtxTable != NULL, "pskin_awb->avb_tbl != NULL", "../z_skin_awb.c", 214);
for (i = 0; i < limbCount; i++) {
SkinLimbVtx* vtxEntry = &skin->vtxTable[i];
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
if ((limb->segmentType != SKIN_LIMB_TYPE_ANIMATED) || (limb->segment == NULL)) {
vtxEntry->index = 0;
vtxEntry->buf[0] = NULL;
vtxEntry->buf[1] = NULL;
} else {
SkinAnimatedLimbData* animatedLimbData = SEGMENTED_TO_VIRTUAL(((void)0, limb->segment));
vtxEntry->index = 0;
vtxEntry->buf[0] =
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 235);
ASSERT(vtxEntry->buf[0] != NULL, "psavb->buf[0] != NULL", "../z_skin_awb.c", 237);
vtxEntry->buf[1] =
ZeldaArena_MallocDebug(animatedLimbData->totalVtxCount * sizeof(Vtx), "../z_skin_awb.c", 240);
ASSERT(vtxEntry->buf[1] != NULL, "psavb->buf[1] != NULL", "../z_skin_awb.c", 242);
Skin_InitAnimatedLimb(play, skin, i);
}
}
SkelAnime_InitSkin(play, &skin->skelAnime, skeletonHeader, animationHeader);
}
/**
* Frees the dynamically allocated Vtx and SkinLimbVtx buffers and tables
*/
void Skin_Free(PlayState* play, Skin* skin) {
if (skin->vtxTable != NULL) {
s32 i;
for (i = 0; i < skin->limbCount; i++) {
if (skin->vtxTable[i].buf[0] != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[0], "../z_skin_awb.c", 276);
skin->vtxTable[i].buf[0] = NULL;
}
if (skin->vtxTable[i].buf[1] != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable[i].buf[1], "../z_skin_awb.c", 280);
skin->vtxTable[i].buf[1] = NULL;
}
}
if (skin->vtxTable != NULL) {
ZeldaArena_FreeDebug(skin->vtxTable, "../z_skin_awb.c", 286);
}
SkelAnime_Free(&skin->skelAnime, play);
}
}
s32 func_800A698C(Skin* skin, SkinLimb** skeleton, MtxF* limbMatrices, u8 parentIndex, u8 limbIndex) {
s32 pad;
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[limbIndex]);
MtxF* mtx;
s32 ret;
MtxF sp28;
if (parentIndex == LIMB_DONE) {
SkinMatrix_GetClear(&mtx);
} else {
mtx = &limbMatrices[(s32)parentIndex];
}
SkinMatrix_MtxFMtxFMult(mtx, &limbMatrices[limbIndex], &sp28);
SkinMatrix_MtxFCopy(&sp28, &limbMatrices[limbIndex]);
if (limb->child != LIMB_DONE) {
ret = func_800A698C(skin, skeleton, limbMatrices, limbIndex, limb->child);
if (ret) {
return ret;
}
}
if (limb->sibling != LIMB_DONE) {
ret = func_800A698C(skin, skeleton, limbMatrices, parentIndex, limb->sibling);
if (ret) {
return ret;
}
}
return false;
}
/**
* Recursively applies matrix transformations to each limb
*/
s32 Skin_ApplyAnimTransformations(Skin* skin, MtxF* limbMatrices, Actor* actor, s32 setTranslation) {
s32 i;
s32 pad;
f32 yRot;
f32 xRot;
f32 zRot;
s32 ret;
f32 yTransl;
f32 xTransl;
f32 zTransl;
SkinLimb** skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
Vec3s* jointRot = &skin->skelAnime.jointTable[0];
jointRot++;
xRot = jointRot->x;
yRot = jointRot->y;
zRot = jointRot->z;
if (setTranslation) {
jointRot--; // access joint table entry 0 for translation data
xTransl = jointRot->x;
yTransl = jointRot->y;
zTransl = jointRot->z;
jointRot++;
if (setTranslation == SKIN_TRANSFORM_IS_FHG) {
EnfHG* horse = (EnfHG*)actor;
yRot += horse->turnRot;
}
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, xTransl, yTransl, zTransl);
} else {
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[0], xRot, yRot, zRot, 0.0f, 0.0f, 0.0f);
}
jointRot++;
for (i = 1; i < skin->skeletonHeader->limbCount; i++) {
SkinLimb* limb = SEGMENTED_TO_VIRTUAL(skeleton[i]);
xTransl = limb->jointPos.x;
yTransl = limb->jointPos.y;
zTransl = limb->jointPos.z;
xRot = jointRot->x;
yRot = jointRot->y;
zRot = jointRot->z;
jointRot++;
SkinMatrix_SetTranslateRotateZYX(&limbMatrices[i], xRot, yRot, zRot, xTransl, yTransl, zTransl);
}
SkinMatrix_SetTranslateRotateYXZScale(
&skin->mtx, actor->scale.x, actor->scale.y, actor->scale.z, actor->shape.rot.x, actor->shape.rot.y,
actor->shape.rot.z, actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
actor->world.pos.z);
ret = func_800A698C(skin, SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment), limbMatrices, LIMB_DONE, 0);
if (!ret) {
return ret;
}
return false;
}
|
dcc22c2270ab92611972bfa2dbf441b422244197
|
f79dec3c4033ca3cbb55d8a51a748cc7b8b6fbab
|
/net/md-whois/patches/patch-mkpasswd.c
|
3edf65ba40f6986c37a09e587ddb556455c44c74
|
[] |
no_license
|
jsonn/pkgsrc
|
fb34c4a6a2d350e8e415f3c4955d4989fcd86881
|
c1514b5f4a3726d90e30aa16b0c209adbc276d17
|
refs/heads/trunk
| 2021-01-24T09:10:01.038867
| 2017-07-07T15:49:43
| 2017-07-07T15:49:43
| 2,095,004
| 106
| 47
| null | 2016-09-19T09:26:01
| 2011-07-23T23:49:04
|
Makefile
|
UTF-8
|
C
| false
| false
| 288
|
c
|
patch-mkpasswd.c
|
$NetBSD: patch-mkpasswd.c,v 1.1 2017/02/17 17:10:37 joerg Exp $
--- mkpasswd.c.orig 2017-02-17 12:01:45.221231875 +0000
+++ mkpasswd.c
@@ -30,6 +30,7 @@
#endif
#include <fcntl.h>
#include <string.h>
+#include <strings.h>
#include <time.h>
#include <sys/types.h>
#ifdef HAVE_XCRYPT
|
2d63008f86009d172aaab28c970eee94d86efcb4
|
4b15f318ba3332ee946cb0b2838c93e7935b9b89
|
/src/ocf_space.c
|
f24e12b9e2f445ea0b76375d9737be104f1b8613
|
[
"BSD-3-Clause"
] |
permissive
|
Open-CAS/ocf
|
c4f8a5c9c1b254a905fda75be2c19bd7c8ebd450
|
016d7a8ee2822d672c308264e79bae4081e7930e
|
refs/heads/master
| 2023-05-28T08:40:51.328181
| 2023-05-11T08:11:57
| 2023-05-11T08:11:57
| 152,160,836
| 168
| 94
|
BSD-3-Clause
| 2023-09-14T08:01:50
| 2018-10-08T23:46:10
|
C
|
UTF-8
|
C
| false
| false
| 4,139
|
c
|
ocf_space.c
|
/*
* Copyright(c) 2012-2021 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "ocf_space.h"
#include "utils/utils_user_part.h"
#include "engine/engine_common.h"
static uint32_t ocf_evict_calculate(ocf_cache_t cache,
struct ocf_user_part *user_part, uint32_t to_evict)
{
uint32_t curr_part_size = ocf_part_get_occupancy(&user_part->part);
uint32_t min_part_size = ocf_user_part_get_min_size(cache, user_part);
if (curr_part_size <= min_part_size) {
/*
* Cannot evict from this partition because current size
* is less than minimum size
*/
return 0;
}
if (to_evict > (curr_part_size - min_part_size))
to_evict = curr_part_size - min_part_size;
return to_evict;
}
static inline uint32_t ocf_evict_part_do(struct ocf_request *req,
struct ocf_user_part *user_part)
{
uint32_t unmapped = ocf_engine_unmapped_count(req);
uint32_t to_evict = 0;
to_evict = ocf_evict_calculate(req->cache, user_part, unmapped);
if (to_evict < unmapped) {
/* cannot evict enough cachelines to map request,
so no purpose in evicting anything */
return 0;
}
return ocf_lru_req_clines(req, &user_part->part, to_evict);
}
static inline uint32_t ocf_evict_user_partitions(ocf_cache_t cache,
struct ocf_request *req, uint32_t evict_cline_no,
bool overflown_only, int16_t max_priority)
{
uint32_t to_evict = 0, evicted = 0;
struct ocf_user_part *user_part;
ocf_part_id_t part_id;
unsigned overflow_size;
/* For each partition from the lowest priority to highest one */
for_each_user_part(cache, user_part, part_id) {
/*
* Check stop and continue conditions
*/
if (max_priority > user_part->config->priority) {
/*
* iterate partition have higher priority,
* do not evict
*/
break;
}
if (!overflown_only && !user_part->config->flags.eviction) {
/* If partition is overflown it should be evcited
* even if its pinned
*/
break;
}
if (overflown_only) {
overflow_size = ocf_user_part_overflow_size(cache, user_part);
if (overflow_size == 0)
continue;
}
to_evict = ocf_evict_calculate(cache, user_part,
evict_cline_no - evicted);
if (to_evict == 0) {
/* No cache lines to evict for this partition */
continue;
}
if (overflown_only)
to_evict = OCF_MIN(to_evict, overflow_size);
evicted += ocf_lru_req_clines(req, &user_part->part, to_evict);
if (evicted >= evict_cline_no) {
/* Evicted requested number of cache line, stop
*/
goto out;
}
}
out:
return evicted;
}
static inline uint32_t ocf_remap_do(struct ocf_request *req)
{
ocf_cache_t cache = req->cache;
ocf_part_id_t target_part_id = req->part_id;
struct ocf_user_part *target_part = &cache->user_parts[target_part_id];
uint32_t remap_cline_no = ocf_engine_unmapped_count(req);
uint32_t remapped = 0;
/* First attempt to map from freelist */
if (ocf_lru_num_free(cache) > 0)
remapped = ocf_lru_req_clines(req, &cache->free, remap_cline_no);
if (remapped >= remap_cline_no)
return remapped;
/* Attempt to evict overflown partitions in order to
* achieve configured maximum size. Ignoring partitions
* priority in this case, as overflown partitions should
* free its cachelines regardless of destination partition
* priority. */
remapped += ocf_evict_user_partitions(cache, req, remap_cline_no - remapped,
true, OCF_IO_CLASS_PRIO_PINNED);
if (remapped >= remap_cline_no)
return remapped;
/* Not enough cachelines in overflown partitions. Go through
* partitions with priority <= target partition and attempt
* to evict from those. */
remap_cline_no -= remapped;
remapped += ocf_evict_user_partitions(cache, req, remap_cline_no,
false, target_part->config->priority);
return remapped;
}
int ocf_space_managment_remap_do(struct ocf_request *req)
{
uint32_t needed = ocf_engine_unmapped_count(req);
uint32_t remapped;
struct ocf_user_part *req_part = &req->cache->user_parts[req->part_id];
if (ocf_req_part_evict(req)) {
remapped = ocf_evict_part_do(req, req_part);
} else {
remapped = ocf_remap_do(req);
}
if (needed <= remapped)
return LOOKUP_REMAPPED;
return LOOKUP_MISS;
}
|
9c0808088e4d0bba23e128f8a76cfc192b0e4822
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/gd32/arm/libraries/GD32F30x_Firmware_Library/GD32F30x_usbd_library/device/Include/usb_ch9_std.h
|
7ba1d3d08e06c44bd34a3d098e044ee68ff273eb
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 12,469
|
h
|
usb_ch9_std.h
|
/*!
\file usb_ch9_std.h
\brief USB 2.0 standard defines
\version 2020-08-01, V3.0.0, firmware for GD32F30x
*/
/*
Copyright (c) 2020, GigaDevice Semiconductor Inc.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef __USB_CH9_STD_H
#define __USB_CH9_STD_H
#include "usbd_conf.h"
#define USB_DEV_QUALIFIER_DESC_LEN 0x0AU /*!< USB device qualifier descriptor length */
#define USB_DEV_DESC_LEN 0x12U /*!< USB device descriptor length */
#define USB_CFG_DESC_LEN 0x09U /*!< USB configuration descriptor length */
#define USB_ITF_DESC_LEN 0x09U /*!< USB interface descriptor length */
#define USB_EP_DESC_LEN 0x07U /*!< USB endpoint descriptor length */
#define USB_BOS_DESC_LEN 0x0CU /*!< USB BOS descriptor length */
#define USB_OTG_DESC_LEN 0x03U /*!< USB device OTG descriptor length */
#define USB_SETUP_PACKET_LEN 0x08U /*!< USB SETUP packet length */
#define USB_DEVICE_CAPABITY 0x10U /*!< USB device capabity */
/* bit 7 of bmRequestType: data phase transfer direction */
#define USB_TRX_MASK 0x80U /*!< USB transfer direction mask */
#define USB_TRX_OUT 0x00U /*!< USB transfer OUT direction */
#define USB_TRX_IN 0x80U /*!< USB transfer IN direction */
/* bit 6..5 of bmRequestType: request type */
#define USB_REQTYPE_STRD 0x00U /*!< USB standard request */
#define USB_REQTYPE_CLASS 0x20U /*!< USB class request */
#define USB_REQTYPE_VENDOR 0x40U /*!< USB vendor request */
#define USB_REQTYPE_MASK 0x60U /*!< USB request mask */
#define USBD_BUS_POWERED 0x00U /*!< USB bus power supply */
#define USBD_SELF_POWERED 0x01U /*!< USB self power supply */
#define USB_STATUS_REMOTE_WAKEUP 2U /*!< USB is in remote wakeup status */
#define USB_STATUS_SELF_POWERED 1U /*!< USB is in self powered status */
/* bit 4..0 of bmRequestType: recipient type */
enum _usb_recp_type {
USB_RECPTYPE_DEV = 0x0U, /*!< USB device request type */
USB_RECPTYPE_ITF = 0x1U, /*!< USB interface request type */
USB_RECPTYPE_EP = 0x2U, /*!< USB endpoint request type */
USB_RECPTYPE_MASK = 0x3U /*!< USB request type mask */
};
/* bRequest value */
enum _usb_request {
USB_GET_STATUS = 0x0U, /*!< USB get status request */
USB_CLEAR_FEATURE = 0x1U, /*!< USB clear feature request */
USB_RESERVED2 = 0x2U, /*!< USB reserved2 */
USB_SET_FEATURE = 0x3U, /*!< USB set feature request */
USB_RESERVED4 = 0x4U, /*!< USB reserved4 */
USB_SET_ADDRESS = 0x5U, /*!< USB set address request */
USB_GET_DESCRIPTOR = 0x6U, /*!< USB get descriptor request */
USB_SET_DESCRIPTOR = 0x7U, /*!< USB set descriptor request */
USB_GET_CONFIGURATION = 0x8U, /*!< USB get configuration request */
USB_SET_CONFIGURATION = 0x9U, /*!< USB set configuration request */
USB_GET_INTERFACE = 0xAU, /*!< USB get interface request */
USB_SET_INTERFACE = 0xBU, /*!< USB set interface request */
USB_SYNCH_FRAME = 0xCU /*!< USB synchronized frame request */
};
/* descriptor types of USB specifications */
enum _usb_desctype {
USB_DESCTYPE_DEV = 0x1U, /*!< USB device descriptor type */
USB_DESCTYPE_CONFIG = 0x2U, /*!< USB configuration descriptor type */
USB_DESCTYPE_STR = 0x3U, /*!< USB string descriptor type */
USB_DESCTYPE_ITF = 0x4U, /*!< USB interface descriptor type */
USB_DESCTYPE_EP = 0x5U, /*!< USB endpoint descriptor type */
USB_DESCTYPE_DEV_QUALIFIER = 0x6U, /*!< USB device qualifier descriptor type */
USB_DESCTYPE_OTHER_SPD_CONFIG = 0x7U, /*!< USB other speed configuration descriptor type */
USB_DESCTYPE_ITF_POWER = 0x8U, /*!< USB interface power descriptor type */
USB_DESCTYPE_BOS = 0xFU /*!< USB BOS descriptor type */
};
/* USB endpoint descriptor bmAttributes bit definitions */
/* bits 1..0 : transfer type */
enum _usbx_type {
USB_EP_ATTR_CTL = 0x0U, /*!< USB endpoint control attributes*/
USB_EP_ATTR_ISO = 0x1U, /*!< USB endpoint isochronous attributes*/
USB_EP_ATTR_BULK = 0x2U, /*!< USB endpoint bulk attributes*/
USB_EP_ATTR_INT = 0x3U /*!< USB endpoint interrupt attributes*/
};
/* bits 3..2 : Sync type (only if ISOCHRONOUS) */
#define USB_EP_ATTR_NOSYNC 0x00U /*!< USB endpoint no SYNC attributes*/
#define USB_EP_ATTR_ASYNC 0x04U /*!< USB endpoint ASYNC attributes*/
#define USB_EP_ATTR_ADAPTIVE 0x08U /*!< USB endpoint adaptive attributes*/
#define USB_EP_ATTR_SYNC 0x0CU /*!< USB endpoint SYNC attributes*/
#define USB_EP_ATTR_SYNCTYPE 0x0CU /*!< USB endpoint SYNC type attributes*/
/* bits 5..4 : usage type (only if ISOCHRONOUS) */
#define USB_EP_ATTR_DATA 0x00U /*!< USB endpoint data attributes*/
#define USB_EP_ATTR_FEEDBACK 0x10U /*!< USB endpoint feedback attributes*/
#define USB_EP_ATTR_IMPLICIT_FEEDBACK_DATA 0x20U /*!< USB endpoint implicit feedback attributes*/
#define USB_EP_ATTR_USAGETYPE 0x30U /*!< USB endpoint usage type attributes*/
#pragma pack(1)
/* USB standard device request structure */
typedef struct _usb_req {
uint8_t bmRequestType; /*!< type of request */
uint8_t bRequest; /*!< request of setup packet */
uint16_t wValue; /*!< value of setup packet */
uint16_t wIndex; /*!< index of setup packet */
uint16_t wLength; /*!< length of setup packet */
} usb_req;
/* USB setup packet definition */
typedef union _usb_setup {
uint8_t data[8]; /*!< USB setup data */
usb_req req; /*!< USB setup request */
} usb_setup;
/* USB descriptor definition */
typedef struct _usb_desc_header {
uint8_t bLength; /*!< size of the descriptor */
uint8_t bDescriptorType; /*!< type of the descriptor */
} usb_desc_header;
typedef struct _usb_desc_dev {
usb_desc_header header; /*!< descriptor header, including type and size */
uint16_t bcdUSB; /*!< BCD of the supported USB specification */
uint8_t bDeviceClass; /*!< USB device class */
uint8_t bDeviceSubClass; /*!< USB device subclass */
uint8_t bDeviceProtocol; /*!< USB device protocol */
uint8_t bMaxPacketSize0; /*!< size of the control (address 0) endpoint's bank in bytes */
uint16_t idVendor; /*!< vendor ID for the USB product */
uint16_t idProduct; /*!< unique product ID for the USB product */
uint16_t bcdDevice; /*!< product release (version) number */
uint8_t iManufacturer; /*!< string index for the manufacturer's name */
uint8_t iProduct; /*!< string index for the product name/details */
uint8_t iSerialNumber; /*!< string index for the product's globally unique hexadecimal serial number */
uint8_t bNumberConfigurations; /*!< total number of configurations supported by the device */
} usb_desc_dev;
typedef struct _usb_desc_config {
usb_desc_header header; /*!< descriptor header, including type and size */
uint16_t wTotalLength; /*!< size of the configuration descriptor header, and all sub descriptors inside the configuration */
uint8_t bNumInterfaces; /*!< total number of interfaces in the configuration */
uint8_t bConfigurationValue; /*!< configuration index of the current configuration */
uint8_t iConfiguration; /*!< index of a string descriptor describing the configuration */
uint8_t bmAttributes; /*!< configuration attributes */
uint8_t bMaxPower; /*!< maximum power consumption of the device while in the current configuration */
} usb_desc_config;
typedef struct _usb_desc_itf {
usb_desc_header header; /*!< descriptor header, including type and size */
uint8_t bInterfaceNumber; /*!< index of the interface in the current configuration */
uint8_t bAlternateSetting; /*!< alternate setting for the interface number */
uint8_t bNumEndpoints; /*!< total number of endpoints in the interface */
uint8_t bInterfaceClass; /*!< interface class ID */
uint8_t bInterfaceSubClass; /*!< interface subclass ID */
uint8_t bInterfaceProtocol; /*!< interface protocol ID */
uint8_t iInterface; /*!< index of the string descriptor describing the interface */
} usb_desc_itf;
typedef struct _usb_desc_ep {
usb_desc_header header; /*!< descriptor header, including type and size */
uint8_t bEndpointAddress; /*!< logical address of the endpoint */
uint8_t bmAttributes; /*!< endpoint attribute */
uint16_t wMaxPacketSize; /*!< size of the endpoint bank, in bytes */
uint8_t bInterval; /*!< polling interval in milliseconds for the endpoint if it is an INTERRUPT or ISOCHRONOUS type */
} usb_desc_ep;
typedef struct _usb_desc_LANGID {
usb_desc_header header; /*!< descriptor header, including type and size. */
uint16_t wLANGID; /*!< LANGID code */
} usb_desc_LANGID;
typedef struct _usb_desc_str {
usb_desc_header header; /*!< descriptor header, including type and size. */
uint16_t unicode_string[64]; /*!< unicode string data */
} usb_desc_str;
#pragma pack()
/* compute string descriptor length */
#define USB_STRING_LEN(unicode_chars) (sizeof(usb_desc_header) + ((unicode_chars) << 1))
#endif /* __USB_CH9_STD_H */
|
d55ff8afd98095bf8c658ca22ae0b2e9d1c70c4d
|
c72be999abf8848a7d09264ba9ee7bae30f4524a
|
/xme/xme/wp/marshal/src/marshalerInternalTypes.c
|
4359c2c0abeab6b2b54caa2b0def43dea2212f08
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ipa-rmb/autopnp
|
8399be67c1a3de61e01619dc8677c52728ffd836
|
f25517a093c772a1481bcff3e9da055d4c627954
|
refs/heads/indigo_dev
| 2022-05-05T01:57:05.858437
| 2022-04-29T07:31:42
| 2022-04-29T07:31:42
| 3,398,225
| 144
| 101
| null | 2019-07-08T06:11:13
| 2012-02-09T15:30:28
|
C
|
UTF-8
|
C
| false
| false
| 1,301
|
c
|
marshalerInternalTypes.c
|
/*
* Copyright (c) 2011-2013, fortiss GmbH.
* Licensed under the Apache License, Version 2.0.
*
* Use, modification and distribution are subject to the terms specified
* in the accompanying license file LICENSE.txt located at the root directory
* of this software distribution. A copy is available at
* http://chromosome.fortiss.org/.
*
* This file is part of CHROMOSOME.
*
* $Id: marshalerInternalTypes.c 4834 2013-08-28 09:36:55Z wiesmueller $
*/
/**
* \file
*
* \brief Internal data types for marshaler waypoint. Only made visible so
* that the marshaler code generated by XMT can access it.
* Do not use this otherwise.
*/
/******************************************************************************/
/*** Includes ***/
/******************************************************************************/
#include "xme/wp/marshal/include/marshalerInternalTypes.h"
/******************************************************************************/
/*** Global Variables ***/
/******************************************************************************/
xme_wp_marshal_marshaler_configurationTable_t xme_wp_marshal_marshaler_configurationTable;
|
2fbe315d477ba9bf93e5fb8abdbcfff4162fa211
|
e9454d56c6fdd3389b7590aa0cbe96eef716d8f4
|
/SimTKmath/Integrators/src/CPodes/sundials/src/cpodes/cpodes_root.c
|
1a0a4cf3d629ca7bb513d431275b45c304d728f8
|
[
"Apache-2.0"
] |
permissive
|
simbody/simbody
|
b2ca134c6d91e5fe4da93fc22aaf86cdbdeff658
|
0d671660c4e97f26566da040eaa57089fab81192
|
refs/heads/master
| 2023-09-01T09:33:29.968397
| 2023-08-31T16:51:49
| 2023-08-31T16:51:49
| 12,146,969
| 2,186
| 539
|
Apache-2.0
| 2023-09-05T17:15:38
| 2013-08-16T00:21:53
|
C++
|
UTF-8
|
C
| false
| false
| 23,033
|
c
|
cpodes_root.c
|
/*
* -----------------------------------------------------------------
* $Revision:$
* $Date:$
* -----------------------------------------------------------------
* Programmer: Radu Serban @ LLNL
* -----------------------------------------------------------------
* Copyright (c) 2006, The Regents of the University of California.
* Produced at the Lawrence Livermore National Laboratory.
* All rights reserved.
* For details, see the LICENSE file.
* -----------------------------------------------------------------
* This is the implementation for the event detection for CPODES.
* -----------------------------------------------------------------
*/
/*
* =================================================================
* Import Header Files
* =================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "cpodes_private.h"
#include <sundials/sundials_math.h>
/*
* =================================================================
* Private Function Prototypes
* =================================================================
*/
static booleantype cpRootAlloc(CPodeMem cp_mem, int nrt);
static int cpRootfind(CPodeMem cp_mem, realtype ttol);
/*
* =================================================================
* EXPORTED FUNCTIONS
* =================================================================
*/
/*
* CPodeRootInit
*
* CPodeRootInit initializes a rootfinding problem to be solved
* during the integration of the ODE system. It loads the root
* function pointer and the number of root functions, and allocates
* workspace memory. The return value is CP_SUCCESS = 0 if no errors
* occurred, or a negative value otherwise.
*/
int CPodeRootInit(void *cpode_mem, int nrtfn, CPRootFn gfun, void *g_data)
{
CPodeMem cp_mem;
booleantype allocOK;
int i;
/* Check cpode_mem pointer */
if (cpode_mem == NULL) {
cpProcessError(NULL, CP_MEM_NULL, "CPODES", "CPodeRootInit", MSGCP_NO_MEM);
return(CP_MEM_NULL);
}
cp_mem = (CPodeMem) cpode_mem;
/* If called with nrtfn <= 0, then disable rootfinding and return */
if (nrtfn <= 0) {
cp_mem->cp_doRootfinding = FALSE;
return(CP_SUCCESS);
}
/* Check for legal input parameters */
if (gfun == NULL) {
cpProcessError(cp_mem, CP_ILL_INPUT, "CPODES", "CPodeRootInit", MSGCP_NULL_G);
return(CP_ILL_INPUT);
}
/* If rerunning CPodeRootInit() with a different number of root
* functions (changing number of gfun components), then free
* currently held memory resources */
if ( (cp_mem->cp_rootMallocDone) && (nrtfn != cp_mem->cp_nrtfn) ) {
cpRootFree(cp_mem);
cp_mem->cp_rootMallocDone = FALSE;
}
/* Allocate necessary memory and return */
if (!cp_mem->cp_rootMallocDone) {
allocOK = cpRootAlloc(cp_mem, nrtfn);
if (!allocOK) {
cpProcessError(cp_mem, CP_MEM_FAIL, "CPODES", "CPodeRootInit", MSGCP_MEM_FAIL);
return(CP_MEM_FAIL);
}
cp_mem->cp_rootMallocDone = TRUE;
}
/* Set variable values in CPODES memory block */
cp_mem->cp_nrtfn = nrtfn;
cp_mem->cp_gfun = gfun;
cp_mem->cp_g_data = g_data;
/* Set default values for rootdir (both directions)
* and for gactive (all active) */
for(i=0; i<nrtfn; i++) {
cp_mem->cp_rootdir[i] = 0;
cp_mem->cp_gactive[i] = TRUE;
}
/* Rootfinding is now enabled */
cp_mem->cp_doRootfinding = TRUE;
return(CP_SUCCESS);
}
/*
* =================================================================
* Readibility Constants
* =================================================================
*/
#define uround (cp_mem->cp_uround)
#define tn (cp_mem->cp_tn)
#define h (cp_mem->cp_h)
#define zn (cp_mem->cp_zn)
#define y (cp_mem->cp_y)
#define yp (cp_mem->cp_yp)
#define lrw (cp_mem->cp_lrw)
#define liw (cp_mem->cp_liw)
#define taskc (cp_mem->cp_taskc)
#define toutc (cp_mem->cp_toutc)
#define nrtfn (cp_mem->cp_nrtfn)
#define gfun (cp_mem->cp_gfun)
#define g_data (cp_mem->cp_g_data)
#define nge (cp_mem->cp_nge)
#define gactive (cp_mem->cp_gactive)
#define iroots (cp_mem->cp_iroots)
#define rootdir (cp_mem->cp_rootdir)
#define irfnd (cp_mem->cp_irfnd)
#define tlo (cp_mem->cp_tlo)
#define thi (cp_mem->cp_thi)
#define glo (cp_mem->cp_glo)
#define ghi (cp_mem->cp_ghi)
#define trout (cp_mem->cp_trout)
#define grout (cp_mem->cp_grout)
/*
* =================================================================
* INTERNAL FUNCTIONS
* =================================================================
*/
/*
* -----------------------------------------------------------------
* Root finding functions
* cpRcheck1 |
* cpRcheck2 |-> interface functions to CPode
* cpRcheck3 |
* cpRootfind
* -----------------------------------------------------------------
* Memory allocation/deallocation for rootfinding
* cpRootAlloc
* cpRootFree
* -----------------------------------------------------------------
*/
/*
* cpRcheck1
*
* This routine completes the initialization of rootfinding memory
* information (it is called only once, at the very first step),
* and checks whether g has any components that are zero BOTH at AND
* very near the initial time of the IVP. Those components of g are
* made inactive and will be later reactivated only when they move
* away from zero.
*
* sherm 111125:
* thi (output only) set to tn
* ghi (output only) set to g(thi)
* where we may have advanced time by smallh to see whether g's that were zero
* at tn and deactivated can be reactivated at tn+smallh.
*
* The return value will be
* CV_RTFUNC_FAIL < 0 if the g function failed
* CP_SUCCESS = 0 otherwise.
*/
int cpRcheck1(CPodeMem cp_mem)
{
int i, retval;
realtype ttol, smallh, hratio;
booleantype zroot;
for (i = 0; i < nrtfn; i++) iroots[i] = 0;
thi = tlo = tn;
ttol = (ABS(tn) + ABS(h))*uround*FUZZ_FACTOR;
/*
* Evaluate g at initial t and check for zero values.
* Note that cpRcheck1 is called at the first step
* before scaling zn[1] and therefore, y'(t0)=zn[1].
*/
retval = gfun(tlo, zn[0], zn[1], glo, g_data);
nge = 1;
if (retval != 0) return(CP_RTFUNC_FAIL);
/* Assume we won't find a root at the start. */
for (i = 0; i < nrtfn; i++) ghi[i] = glo[i];
zroot = FALSE;
for (i = 0; i < nrtfn; i++) {
if (ABS(glo[i]) == ZERO) {
zroot = TRUE;
gactive[i] = FALSE;
}
}
if (!zroot) return(CP_SUCCESS);
/*
* Some g_i is zero at t0; look at g at t0+(small increment).
* At the initial time and at order 1, we have:
* y(t0+smallh) = zn[0] + (smallh/h) * zn[1]
* y'(t0+smallh) = zn[1]
*/
hratio = MAX(ttol/ABS(h), PT1);
smallh = hratio*h;
thi += smallh;
N_VLinearSum(ONE, zn[0], hratio, zn[1], y);
retval = gfun(thi, y, zn[1], ghi, g_data);
nge++;
if (retval != 0) return(CP_RTFUNC_FAIL);
/*
* We check now only the components of g which were exactly
* zero at t0 to see if we can 'activate' them.
*/
for (i = 0; i < nrtfn; i++) {
if (!gactive[i] && ABS(ghi[i]) != ZERO) {
gactive[i] = TRUE;
}
}
return(CP_SUCCESS);
}
/*
* cpRcheck2
*
* This routine is called at the beginning of a step to find the beginning tlo
* of the next root search interval, which is usually the end (thi) of the
* previous search interval. But it first checks for exact zeros of any active
* g at thi. It then checks for a close pair of zeros (a condition that
* would trigger making inactive the corresponding components
* of g), and for a new root at a nearby point.
* The endpoint thi of the previous search interval is thus adjusted
* if necessary to assure that all active g_i are nonzero there,
* before returning to do a root search in the interval.
*
* On entry, thi = tretlast is the last value of tret returned by
* CPode. This may be the previous tn, the previous tout value, or
* the last root location.
*
* This routine returns an int equal to:
* CP_RTFUNC_FAIL < 0 if gfun failed
* RTFOUND > 0 if a new zero of g was found near tlo, or
* CP_SUCCESS = 0 otherwise.
*/
int cpRcheck2(CPodeMem cp_mem)
{
int i, retval;
realtype ttol, smallh, hratio;
booleantype zroot;
/* Move tlo up to end of previous search interval in case we find a root
here. */
tlo = thi;
/* Evaluate g(tlo) */
(void) cpGetSolution(cp_mem, tlo, y, yp);
retval = gfun(tlo, y, yp, glo, g_data);
nge++;
if (retval != 0) return(CP_RTFUNC_FAIL);
/* Assume we won't find a root at the start. */
for (i = 0; i < nrtfn; i++) ghi[i] = glo[i];
/* Check if any active g function is exactly ZERO at tlo.
* If not, simply return CP_SUCCESS. */
zroot = FALSE;
for (i = 0; i < nrtfn; i++) iroots[i] = 0;
for (i = 0; i < nrtfn; i++) {
if (!gactive[i]) continue;
if (ABS(glo[i]) == ZERO) {
zroot = TRUE;
iroots[i] = 1;
}
}
/* If no root then tlo==thi, glo==ghi. */
if (!zroot) return(CP_SUCCESS);
/* One or more g_i has a zero at tlo.
* Evaluate g(thi=tlo+smallh). */
ttol = (ABS(tn) + ABS(h))*uround*FUZZ_FACTOR;
smallh = (h > ZERO) ? ttol : -ttol;
thi = tlo+smallh;
if ( (thi - tn)*h >= ZERO) {
hratio = smallh/h;
N_VLinearSum(ONE, y, hratio, zn[1], y);
} else {
(void) cpGetSolution(cp_mem, thi, y, yp);
}
retval = gfun(thi, y, yp, ghi, g_data);
nge++;
if (retval != 0) return(CP_RTFUNC_FAIL);
/* Check if any active function is ZERO at thi+smallh.
* Make inactive those that were also ZERO at thi.
* Report a root for those that only became ZERO at tlo+smallh. */
zroot = FALSE;
for (i = 0; i < nrtfn; i++) {
if (ABS(ghi[i]) == ZERO) {
if (!gactive[i]) continue;
if (iroots[i] == 1) { iroots[i] = 0; gactive[i] = FALSE; }
else { iroots[i] = 1; zroot = TRUE; }
}
}
if (zroot) return(RTFOUND);
return(CP_SUCCESS);
}
/*
* cpRcheck3
*
* This routine interfaces to cpRootfind to look for a root of g
* between tlo and either tn or tout, whichever comes first.
* Only roots beyond tlo in the direction of integration are sought.
*
* On entry, both thi and ghi=g(thi) should have been evaluated. We start by
* setting tlo=thi and glo=ghi, shiting the search interval to start at the
* end of the previous one.
* On return, if there is a root it is in (tlo,thi] which will have been
* adjusted to a very narrow bracket around the zero crossing. If there is no
* root then thi and ghi are at the end of the search interval, where they can
* serve as the start for the next one.
*
* This routine returns an int equal to:
* CP_RTFUNC_FAIL < 0 if the g function failed,
* RTFOUND > 0 if a root of g was found, or
* CP_SUCCESS = 0 otherwise.
*/
int cpRcheck3(CPodeMem cp_mem)
{
int i, retval, ier;
realtype ttol;
/* Move start of search interval to end of previous one. */
tlo = thi;
for (i = 0; i < nrtfn; ++i) glo[i] = ghi[i];
/* Set thi = tn or tout, whichever comes first. */
switch (taskc) {
case CP_ONE_STEP:
thi = tn;
break;
case CP_NORMAL:
thi = ( (toutc - tn)*h >= ZERO) ? tn : toutc;
break;
}
/* Get y and y' at thi. */
(void) cpGetSolution(cp_mem, thi, y, yp);
/* Set ghi = g(thi) */
retval = gfun(thi, y, yp, ghi, g_data);
nge++;
if (retval != 0) return(CP_RTFUNC_FAIL);
/* Call cpRootfind to search (tlo,thi) for roots, and to modify tlo,thi
to create a very narrow bracket around the first root. */
ttol = (ABS(tn) + ABS(h))*uround*FUZZ_FACTOR;
ier = cpRootfind(cp_mem, ttol);
/* If the root function g failed, return now */
if (ier == CP_RTFUNC_FAIL) return(CP_RTFUNC_FAIL);
/* If any of the inactive components moved away from zero,
* activate them now. */
for(i=0; i<nrtfn; i++) {
if(!gactive[i] && grout[i] != ZERO) gactive[i] = TRUE;
}
/* If no root found, return CP_SUCCESS. */
if (ier == CP_SUCCESS) return(CP_SUCCESS);
/* If a root was found, interpolate to get y(trout) and return. */
(void) cpGetSolution(cp_mem, trout, y, yp);
return(RTFOUND);
}
/*
* cpRootFind
*
* This routine solves for a root of g(t) between tlo and thi, if
* one exists. Only roots of odd multiplicity (i.e. with a change
* of sign in one of the g_i), or exact zeros, are found.
* Here the sign of tlo - thi is arbitrary, but if multiple roots
* are found, the one closest to tlo is returned.
*
* The method used is the Illinois algorithm, a modified secant method.
* Reference: Kathie L. Hiebert and Lawrence F. Shampine, Implicitly
* Defined Output Points for Solutions of ODEs, Sandia National
* Laboratory Report SAND80-0180, February 1980.
*
* This routine uses the following parameters for communication:
*
* nrtfn = number of functions g_i, or number of components of
* the vector-valued function g(t). Input only.
*
* gfun = user-defined function for g(t). Its form is
* (void) gfun(t, y, gt, g_data)
*
* gactive = array specifying whether a component of g should
* or should not be monitored. gactive[i] is initially
* set to TRUE for all i=0,...,nrtfn-1, but it may be
* reset to FALSE if at the first step g[i] is 0.0
* both at the I.C. and at a small perturbation of them.
* gactive[i] is then set back on TRUE only after the
* corresponding g function moves away from 0.0.
*
* rootdir = array specifying the direction of zero-crossings.
* If rootdir[i] > 0, search for roots of g_i only if
* g_i is increasing; if rootdir[i] < 0, search for
* roots of g_i only if g_i is decreasing; otherwise
* always search for roots of g_i.
*
* nge = cumulative counter for gfun calls.
*
* ttol = a convergence tolerance for trout. Input only.
* When a root at trout is found, it is located in time only to
* within a tolerance of ttol. Typically, ttol should
* be set to a value on the order of
* 100 * UROUND * max (ABS(tlo), ABS(thi))
* where UROUND is the unit roundoff of the machine.
*
* tlo, thi = endpoints of the interval in which roots are sought.
* On input, they must be distinct, but tlo - thi may
* be of either sign. The direction of integration is
* assumed to be from tlo to thi. On return, tlo and thi
* are the endpoints of the final relevant interval (tlo,thi];
* that is, the root has not yet occurred at tlo but has
* definitely occurred by thi. The reported root time trout is
* always the same as thi.
*
* glo, ghi = arrays of length nrtfn containing the vectors g(tlo)
* and g(thi) respectively. Input and output. On input,
* none of the active glo[i] should be zero.
*
* trout = root location (same as thi), if a root was found, or the original
* value of thi if not. Output only. trout is the endpoint thi of
* the final interval (tlo,thi] bracketing the root, with |thi-tlo|
* at most ttol.
*
* grout = array of length nrtfn containing g(trout) (==ghi) on return.
*
* iroots = int array of length nrtfn with root information.
* Output only. If a root was found, iroots indicates
* which components g_i have a root at trout. For
* i = 0, ..., nrtfn-1, iroots[i] = 1 if g_i has a root
* and g_i is increasing, iroots[i] = -1 if g_i has a
* root and g_i is decreasing, and iroots[i] = 0 if g_i
* has no roots or g_i varies in the direction opposite
* to that indicated by rootdir[i].
*
* This routine returns an int equal to:
* CP_RTFUNC_FAIL < 0 if gfun faild
* RTFOUND > 0 if a root of g was found, or
* CP_SUCCESS = 0 otherwise.
*/
static int cpRootfind(CPodeMem cp_mem, realtype ttol)
{
realtype alpha, tmid, my_tmid, tmid_saved, thi_saved, fracint, fracsub;
int i, retval, side, sideprev;
booleantype zroot;
/* alpha is a bias weight in the secant method.
* On the first two passes, set alpha = 1. Thereafter, reset alpha
* according to the side (low vs high) of the subinterval in which
* the sign change was found in the previous two passes.
* If the sides were opposite, set alpha = 1.
* If the sides were the same, then double alpha (if high side),
* or halve alpha (if low side).
* The next guess tmid is the secant method value if alpha = 1, but
* is closer to tlo if alpha < 1, and closer to thi if alpha > 1.
*/
alpha = ONE;
/* First, for each active g function, check whether an event occurred in
* (tlo,thi). Since glo != 0 for an active component, this means we check for
* a sign change or for ghi = 0 (taking into account rootdir). For each
* component that triggers an event, we estimate a "proposal" mid point (by
* bisection if ghi=0 or with secant method otherwise) and select the one
* closest to tlo. */
zroot = FALSE;
tmid = thi;
for (i = 0; i < nrtfn; i++) {
if(!gactive[i]) continue;
if ( (glo[i]*ghi[i] <= ZERO) && (rootdir[i]*glo[i] <= ZERO) ) {
zroot = TRUE;
if (ghi[i] == ZERO) {
my_tmid = thi - HALF * (thi-tlo);
} else {
my_tmid = thi - (thi - tlo)*ghi[i]/(ghi[i] - alpha*glo[i]);
}
/* Pick my_tmid if it is closer to tlo than the current tmid. */
if ( (my_tmid-tmid)*h < ZERO ) tmid = my_tmid;
}
}
/* If no event was detected, set trout to thi and return CP_SUCCESS */
if (!zroot) {
trout = thi;
for (i = 0; i < nrtfn; i++) grout[i] = ghi[i];
return(CP_SUCCESS);
}
/* An event was detected. Loop to locate nearest root. */
side = 0;
loop {
sideprev = side;
/* If tmid is too close to tlo or thi, adjust it inward,
* by a fractional distance that is between 0.1 and 0.5. */
if (ABS(tmid - tlo) < HALF*ttol) {
fracint = ABS(thi - tlo)/ttol;
fracsub = (fracint > FIVE) ? PT1 : HALF/fracint;
tmid = tlo + fracsub*(thi - tlo);
}
if (ABS(thi - tmid) < HALF*ttol) {
fracint = ABS(thi - tlo)/ttol;
fracsub = (fracint > FIVE) ? PT1 : HALF/fracint;
tmid = thi - fracsub*(thi - tlo);
}
/* Get solution at tmid and evaluate g(tmid). */
(void) cpGetSolution(cp_mem, tmid, y, yp);
retval = gfun(tmid, y, yp, grout, g_data);
nge++;
if (retval != 0) return(CP_RTFUNC_FAIL);
/* Check (tlo, tmid) to see if an event occurred in the "low" side
* First make temporary copies of thi and tmid in case the event
* turns out to be on the "high" side. */
tmid_saved = tmid;
thi_saved = thi;
thi = tmid;
zroot = FALSE;
for (i = 0; i < nrtfn; i++) {
if(!gactive[i]) continue;
if ( (glo[i]*grout[i] <= ZERO) && (rootdir[i]*glo[i] <= ZERO) ) {
zroot = TRUE;
if (grout[i] == ZERO) {
my_tmid = thi - HALF * (thi-tlo);
} else {
my_tmid = thi - (thi - tlo)*grout[i]/(grout[i] - alpha*glo[i]);
}
if ( (my_tmid-tmid)*h < ZERO ) tmid = my_tmid;
}
}
/* If we detected an event in the "low" side:
- accept current value of thi
- set ghi <- grout
- test for convergence and break from loop if converged
- set side=1 (low); if previous side was also 1, scale alpha by 1/2
- continue looping to refine root location */
if (zroot) {
for (i = 0; i < nrtfn; i++) ghi[i] = grout[i];
if (ABS(thi - tlo) <= ttol) break;
side = 1;
if (sideprev == 1) alpha = alpha*HALF;
else alpha = ONE;
continue;
}
/* No event detected in "low" side; event must be in "high" side.
- restore previously saved values for thi and set tlo = tmid_saved
- set glo <- grout
- test for convergence and break from loop if converged
- set side=2 (high); if previous side was also 2, scale alpha by 2
- continue looping to refine root location */
thi = thi_saved;
tlo = tmid_saved;
for (i = 0; i < nrtfn; i++) glo[i] = grout[i];
if (ABS(thi - tlo) <= ttol) break;
tmid = thi;
for (i = 0; i < nrtfn; i++) {
if(!gactive[i]) continue;
if ( (glo[i]*ghi[i] <= ZERO) && (rootdir[i]*glo[i] <= ZERO) ) {
if (ghi[i] == ZERO) {
my_tmid = thi - HALF * (thi-tlo);
} else {
my_tmid = thi - (thi - tlo)*ghi[i]/(ghi[i] - alpha*glo[i]);
}
if ( (my_tmid-tmid)*h < ZERO ) tmid = my_tmid;
}
}
side = 2;
if (sideprev == 2) alpha = alpha*TWO;
else alpha = ONE;
} /* End of root-search loop */
/* Root has been isolated to (tlo,thi] and |thi-tlo| <= ttol. We'll declare
that the root was found at trout=thi.
- Reset trout and grout
- Set iroots
- Return RTFOUND. */
trout = thi;
for (i = 0; i < nrtfn; i++) {
grout[i] = ghi[i];
iroots[i] = 0;
if(!gactive[i]) continue;
if ( (glo[i]*ghi[i] <= ZERO) && (rootdir[i]*glo[i] <= ZERO) )
iroots[i] = glo[i] > 0 ? -1:1;
}
return(RTFOUND);
}
/*
* cpRootAlloc allocates memory for the rootfinding algorithm.
*/
static booleantype cpRootAlloc(CPodeMem cp_mem, int nrt)
{
glo = NULL;
glo = (realtype *) malloc(nrt*sizeof(realtype));
ghi = NULL;
ghi = (realtype *) malloc(nrt*sizeof(realtype));
if (ghi == NULL) {
free(glo); glo = NULL;
return(FALSE);
}
grout = NULL;
grout = (realtype *) malloc(nrt*sizeof(realtype));
if (grout == NULL) {
free(glo); glo = NULL;
free(ghi); ghi = NULL;
return(FALSE);
}
iroots = NULL;
iroots = (int *) malloc(nrt*sizeof(int));
if (iroots == NULL) {
free(glo); glo = NULL;
free(ghi); ghi = NULL;
free(grout); grout = NULL;
return(FALSE);
}
rootdir = NULL;
rootdir = (int *) malloc(nrt*sizeof(int));
if (rootdir == NULL) {
free(glo); glo = NULL;
free(ghi); ghi = NULL;
free(grout); grout = NULL;
free(iroots); iroots = NULL;
}
gactive = NULL;
gactive = (booleantype *) malloc(nrt*sizeof(booleantype));
if (gactive == NULL) {
free(glo); glo = NULL;
free(ghi); ghi = NULL;
free(grout); grout = NULL;
free(iroots); iroots = NULL;
free(rootdir); rootdir = NULL;
}
lrw += 3*nrt;
liw += 3*nrt;
return(TRUE);
}
/*
* cpRootFree frees the memory allocated in cpRootAlloc.
*/
void cpRootFree(CPodeMem cp_mem)
{
free(glo); glo = NULL;
free(ghi); ghi = NULL;
free(grout); grout = NULL;
free(gactive); gactive = NULL;
free(iroots); iroots = NULL;
free(rootdir); rootdir = NULL;
lrw -= 3 * nrtfn;
liw -= 3 * nrtfn;
}
|
47976043b06c5118b1304aee67efcc0067b8a5f4
|
b732361d6b3405c3e79ac0a7d8361cf5b329b015
|
/ext/phalcon/mvc/view/engine/engineinterface.zep.h
|
ccbb985440f0e23ba261393b469affa676d9f5c2
|
[
"BSD-3-Clause"
] |
permissive
|
phalcon/cphalcon
|
4a5b26f47b5c2a4107541d7fd73c595c0d90ed73
|
fc183e11e8b96c43daf7d893244846206dc2aa73
|
refs/heads/master
| 2023-03-07T22:09:48.814291
| 2023-02-28T16:45:15
| 2023-02-28T16:45:15
| 2,854,337
| 8,135
| 2,343
|
BSD-3-Clause
| 2023-09-12T12:41:13
| 2011-11-26T05:52:50
|
PHP
|
UTF-8
|
C
| false
| true
| 1,176
|
h
|
engineinterface.zep.h
|
extern zend_class_entry *phalcon_mvc_view_engine_engineinterface_ce;
ZEPHIR_INIT_CLASS(Phalcon_Mvc_View_Engine_EngineInterface);
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_view_engine_engineinterface_getcontent, 0, 0, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_mvc_view_engine_engineinterface_partial, 0, 1, IS_VOID, 0)
ZEND_ARG_TYPE_INFO(0, partialPath, IS_STRING, 0)
ZEND_ARG_INFO(0, params)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_mvc_view_engine_engineinterface_render, 0, 0, 2)
ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
ZEND_ARG_INFO(0, params)
ZEND_ARG_TYPE_INFO(0, mustClean, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(phalcon_mvc_view_engine_engineinterface_method_entry) {
PHP_ABSTRACT_ME(Phalcon_Mvc_View_Engine_EngineInterface, getContent, arginfo_phalcon_mvc_view_engine_engineinterface_getcontent)
PHP_ABSTRACT_ME(Phalcon_Mvc_View_Engine_EngineInterface, partial, arginfo_phalcon_mvc_view_engine_engineinterface_partial)
PHP_ABSTRACT_ME(Phalcon_Mvc_View_Engine_EngineInterface, render, arginfo_phalcon_mvc_view_engine_engineinterface_render)
PHP_FE_END
};
|
c59f710929c798759ac9e68f6363319020eb0a23
|
011e552512f45ca313615e428924d001a427e8e6
|
/hal/armv7a/zynq7000/zynq.h
|
182a96a53210e01bcab16faf104fbd400b37b172
|
[
"BSD-2-Clause",
"BSD-3-Clause"
] |
permissive
|
phoenix-rtos/phoenix-rtos-kernel
|
3d4c1d0e7703ea5ce50c2642d35fbb79c1f2afd6
|
e15898bac82e168f7e6aaea60d413790a282f389
|
refs/heads/master
| 2023-09-01T15:04:26.226958
| 2023-09-01T09:21:17
| 2023-09-01T09:45:00
| 125,823,596
| 115
| 39
|
BSD-3-Clause
| 2023-09-14T13:34:22
| 2018-03-19T08:14:43
|
C
|
UTF-8
|
C
| false
| false
| 494
|
h
|
zynq.h
|
/*
* Phoenix-RTOS
*
* Operating system kernel
*
* HAL internal functions for zynq7000
*
* Copyright 2022 Phoenix Systems
* Author: Maciej Purski
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/
#ifndef _HAL_ZYNQ_H_
#define _HAL_ZYNQ_H_
#include "../../cpu.h"
extern int _zynq_setMIO(unsigned int pin, char disableRcvr, char pullup, char ioType, char speed, char l0, char l1, char l2, char l3, char triEnable);
extern int _zynq_setAmbaClk(u32 dev, u32 state);
#endif
|
5219a134b54d3e3919f0bba6773d5db4baef6ab1
|
a3cf3ed7895b6168fe0864770f944d0a25d5ad74
|
/src/libfsm/print/irdot.c
|
206a42e5efaedc695d2ea759886b3e75f2511e00
|
[
"BSD-2-Clause"
] |
permissive
|
katef/libfsm
|
32269415d8ab61778bef9bfdb3c14c61117216d4
|
479d103357f4e1a8596437895bbc6ddf237a1da0
|
refs/heads/main
| 2023-08-12T06:21:35.611111
| 2023-06-03T22:17:25
| 2023-06-15T20:40:54
| 80,573,145
| 918
| 66
|
BSD-2-Clause
| 2023-09-12T13:31:36
| 2017-01-31T23:31:36
|
C
|
UTF-8
|
C
| false
| false
| 7,290
|
c
|
irdot.c
|
/*
* Copyright 2018 Katherine Flavel
*
* See LICENCE for the full copyright terms.
*/
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <ctype.h>
#include <print/esc.h>
#include <adt/set.h>
#include <fsm/fsm.h>
#include <fsm/pred.h>
#include <fsm/print.h>
#include <fsm/walk.h>
#include <fsm/options.h>
#include "libfsm/internal.h"
#include "ir.h"
static unsigned int
ir_indexof(const struct ir *ir, const struct ir_state *cs)
{
assert(ir != NULL);
assert(cs != NULL);
return cs - &ir->states[0];
}
static const char *
strategy_name(enum ir_strategy strategy)
{
switch (strategy) {
case IR_NONE: return "NONE";
case IR_SAME: return "SAME";
case IR_COMPLETE: return "COMPLETE";
case IR_PARTIAL: return "PARTIAL";
case IR_DOMINANT: return "DOMINANT";
case IR_ERROR: return "ERROR";
case IR_TABLE: return "TABLE";
default:
return "?";
}
}
static void
print_endpoint(FILE *f, const struct fsm_options *opt, unsigned char c)
{
assert(f != NULL);
assert(opt != NULL);
dot_escputc_html(f, opt, c);
}
static void
print_state(FILE *f, unsigned to, unsigned self)
{
assert(f != NULL);
if (to == self) {
fprintf(f, "(self)");
} else {
fprintf(f, "S%u", to);
}
}
static void
print_errorrows(FILE *f, const struct fsm_options *opt,
const struct ir_error *error)
{
size_t k;
assert(f != NULL);
assert(opt != NULL);
assert(error != NULL);
assert(error->ranges != NULL);
for (k = 0; k < error->n; k++) {
fprintf(f, "\t\t <TR>");
if (error->ranges[k].start == error->ranges[k].end) {
fprintf(f, "<TD COLSPAN='2' ALIGN='LEFT'>");
print_endpoint(f, opt, error->ranges[k].start);
fprintf(f, "</TD>");
} else {
fprintf(f, "<TD ALIGN='LEFT'>");
print_endpoint(f, opt, error->ranges[k].start);
fprintf(f, "</TD>");
fprintf(f, "<TD ALIGN='LEFT'>");
print_endpoint(f, opt, error->ranges[k].end);
fprintf(f, "</TD>");
}
if (k + 1 < error->n) {
fprintf(f, "<TD ALIGN='LEFT'>↴</TD>");
} else {
fprintf(f, "<TD ALIGN='LEFT'>(error)</TD>");
}
fprintf(f, "</TR>\n");
}
}
static void
print_grouprows(FILE *f, const struct fsm_options *opt,
unsigned self,
const struct ir_group *groups, size_t n)
{
size_t j, k;
assert(f != NULL);
assert(opt != NULL);
assert(groups != NULL);
for (j = 0; j < n; j++) {
assert(groups[j].ranges != NULL);
for (k = 0; k < groups[j].n; k++) {
fprintf(f, "\t\t <TR>");
if (groups[j].ranges[k].start == groups[j].ranges[k].end) {
fprintf(f, "<TD COLSPAN='2' ALIGN='LEFT'>");
print_endpoint(f, opt, groups[j].ranges[k].start);
fprintf(f, "</TD>");
} else {
fprintf(f, "<TD ALIGN='LEFT'>");
print_endpoint(f, opt, groups[j].ranges[k].start);
fprintf(f, "</TD>");
fprintf(f, "<TD ALIGN='LEFT'>");
print_endpoint(f, opt, groups[j].ranges[k].end);
fprintf(f, "</TD>");
}
if (k + 1 < groups[j].n) {
fprintf(f, "<TD ALIGN='LEFT'>↴</TD>");
} else {
fprintf(f, "<TD ALIGN='LEFT' PORT='group%u'>",
(unsigned) j);
print_state(f, groups[j].to, self);
fprintf(f, "</TD>");
}
fprintf(f, "</TR>\n");
}
}
}
static void
print_grouplinks(FILE *f, unsigned self,
const struct ir_group *groups, size_t n)
{
unsigned j;
assert(f != NULL);
assert(groups != NULL);
for (j = 0; j < n; j++) {
if (groups[j].to == self) {
/* no edge drawn */
} else {
fprintf(f, "\tcs%u:group%u -> cs%u;\n",
self, j,
groups[j].to);
}
}
}
static void
print_cs(FILE *f, const struct fsm_options *opt,
const struct ir *ir, const struct ir_state *cs)
{
assert(f != NULL);
assert(opt != NULL);
assert(ir != NULL);
assert(cs != NULL);
if (cs->isend) {
fprintf(f, "\tcs%u [ peripheries = 2 ];\n", ir_indexof(ir, cs));
}
fprintf(f, "\tcs%u [ label =\n", ir_indexof(ir, cs));
fprintf(f, "\t\t<<TABLE BORDER='0' CELLPADDING='2' CELLSPACING='0'>\n");
fprintf(f, "\t\t <TR><TD COLSPAN='2' ALIGN='LEFT'>S%u</TD><TD ALIGN='LEFT'>%s</TD></TR>\n",
ir_indexof(ir, cs), strategy_name(cs->strategy));
if (cs->example != NULL) {
fprintf(f, "\t\t <TR><TD COLSPAN='2' ALIGN='LEFT'>example</TD><TD ALIGN='LEFT'>");
escputs(f, opt, dot_escputc_html, cs->example);
fprintf(f, "</TD></TR>\n");
}
/* TODO: leaf callback for dot output */
switch (cs->strategy) {
case IR_NONE:
break;
case IR_SAME:
fprintf(f, "\t\t <TR><TD COLSPAN='2' ALIGN='LEFT'>to</TD><TD ALIGN='LEFT'>");
print_state(f, cs->u.same.to, ir_indexof(ir, cs));
fprintf(f, "</TD></TR>\n");
break;
case IR_COMPLETE:
print_grouprows(f, opt, ir_indexof(ir, cs), cs->u.complete.groups, cs->u.complete.n);
break;
case IR_PARTIAL:
print_grouprows(f, opt, ir_indexof(ir, cs), cs->u.partial.groups, cs->u.partial.n);
break;
case IR_DOMINANT:
fprintf(f, "\t\t <TR><TD COLSPAN='2' ALIGN='LEFT'>mode</TD><TD ALIGN='LEFT' PORT='mode'>");
print_state(f, cs->u.dominant.mode, ir_indexof(ir, cs));
fprintf(f, "</TD></TR>\n");
print_grouprows(f, opt, ir_indexof(ir, cs), cs->u.dominant.groups, cs->u.dominant.n);
break;
case IR_ERROR:
fprintf(f, "\t\t <TR><TD COLSPAN='2' ALIGN='LEFT'>mode</TD><TD ALIGN='LEFT' PORT='mode'>");
print_state(f, cs->u.error.mode, ir_indexof(ir, cs));
fprintf(f, "</TD></TR>\n");
print_errorrows(f, opt, &cs->u.error.error);
print_grouprows(f, opt, ir_indexof(ir, cs), cs->u.error.groups, cs->u.error.n);
break;
case IR_TABLE:
assert(!"unreached");
break;
default:
;
}
fprintf(f, "\t\t</TABLE>> ];\n");
switch (cs->strategy) {
case IR_NONE:
break;
case IR_SAME:
if (cs->u.same.to == ir_indexof(ir, cs)) {
/* no edge drawn */
} else {
fprintf(f, "\tcs%u -> cs%u;\n",
ir_indexof(ir, cs), cs->u.same.to);
}
break;
case IR_COMPLETE:
print_grouplinks(f, ir_indexof(ir, cs), cs->u.complete.groups, cs->u.complete.n);
break;
case IR_PARTIAL:
print_grouplinks(f, ir_indexof(ir, cs), cs->u.partial.groups, cs->u.partial.n);
break;
case IR_DOMINANT:
if (cs->u.dominant.mode == ir_indexof(ir, cs)) {
/* no edge drawn */
} else {
fprintf(f, "\tcs%u:mode -> cs%u;\n",
ir_indexof(ir, cs), cs->u.dominant.mode);
}
print_grouplinks(f, ir_indexof(ir, cs), cs->u.dominant.groups, cs->u.dominant.n);
break;
case IR_ERROR:
if (cs->u.error.mode == ir_indexof(ir, cs)) {
/* no edge drawn */
} else {
fprintf(f, "\tcs%u:mode -> cs%u;\n",
ir_indexof(ir, cs), cs->u.error.mode);
}
print_grouplinks(f, ir_indexof(ir, cs), cs->u.error.groups, cs->u.error.n);
break;
case IR_TABLE:
assert(!"unreached");
break;
default:
;
}
}
int
fsm_print_ir(FILE *f, const struct fsm *fsm)
{
struct ir *ir;
size_t i;
assert(f != NULL);
assert(fsm != NULL);
ir = make_ir(fsm);
if (ir == NULL) {
return -1;
}
fprintf(f, "digraph G {\n");
fprintf(f, "\tnode [ shape = box, style = rounded ];\n");
fprintf(f, "\trankdir = LR;\n");
fprintf(f, "\troot = start;\n");
fprintf(f, "\n");
fprintf(f, "\tstart [ shape = none, label = \"\" ];\n");
if (ir->n > 0) {
fprintf(f, "\tstart -> cs%u;\n", ir->start);
fprintf(f, "\n");
}
for (i = 0; i < ir->n; i++) {
print_cs(f, fsm->opt, ir, &ir->states[i]);
}
fprintf(f, "}\n");
free_ir(fsm, ir);
if (ferror(f)) {
return -1;
}
return 0;
}
|
6199f151ff35c294de2e931e76a0c618df1d25be
|
fa1ad2e2ac7e376fc7cb3b3a6e1bb88eed3e80be
|
/govern/data-security/krb-1.2.1/src/lib/krb5/krb/fast.h
|
ad7f934bcd23a8cf965e71fdab2fa2dea91e9c30
|
[
"BSD-4-Clause",
"LicenseRef-scancode-generic-export-compliance",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-mit-old-style",
"BSD-4-Clause-UC",
"LicenseRef-scancode-rsa-1990",
"BSD-3-Clause",
"MIT-CMU",
"LicenseRef-scancode-mit-no-advert-export-control",
"CC-BY-SA-3.0",
"LicenseRef-scancode-mit-modification-obligations",
"LicenseRef-scancode-proprietary-license",
"GPL-2.0-or-later",
"LicenseRef-scancode-michigan-disclaimer",
"ISC",
"LicenseRef-scancode-nrl-permission",
"FreeBSD-DOC",
"LicenseRef-scancode-rsa-md4",
"RSA-MD",
"OLDAP-2.8",
"FSFULLRWD",
"BSD-2-Clause",
"LicenseRef-scancode-brian-gladman",
"MIT",
"Apache-2.0"
] |
permissive
|
alldatacenter/alldata
|
7bc7713c9f1d56ad6b8e59ea03206d1073b7e047
|
8d5f9a2d49ab8f9e85ccf058cb02c2fda287afc6
|
refs/heads/master
| 2023-08-05T07:32:25.442740
| 2023-08-03T13:17:24
| 2023-08-03T13:17:24
| 213,321,771
| 774
| 250
|
Apache-2.0
| 2023-09-06T17:35:32
| 2019-10-07T07:36:18
| null |
UTF-8
|
C
| false
| false
| 4,548
|
h
|
fast.h
|
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* lib/krb5/krb/fast.h */
/*
* Copyright (C) 2009 by the Massachusetts Institute of Technology.
* All rights reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
#ifndef KRB_FAST_H
#define KRB_FAST_H
#include <k5-int.h>
struct krb5int_fast_request_state {
krb5_kdc_req fast_outer_request;
krb5_keyblock *armor_key; /*non-null means fast is in use*/
krb5_fast_armor *armor;
krb5_ui_4 fast_state_flags;
krb5_ui_4 fast_options;
krb5_int32 nonce;
};
#define KRB5INT_FAST_DO_FAST (1l<<0) /* Perform FAST */
#define KRB5INT_FAST_ARMOR_AVAIL (1l<<1)
krb5_error_code
krb5int_fast_prep_req_body(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_kdc_req *request,
krb5_data **encoded_req_body);
typedef krb5_error_code (*kdc_req_encoder_proc)(const krb5_kdc_req *,
krb5_data **);
krb5_error_code
krb5int_fast_prep_req(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_kdc_req *request,
const krb5_data *to_be_checksummed,
kdc_req_encoder_proc encoder,
krb5_data **encoded_request);
krb5_error_code
krb5int_fast_process_error(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_error **err_replyptr,
krb5_pa_data ***out_padata,
krb5_boolean *retry);
krb5_error_code
krb5int_fast_process_response(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_kdc_rep *resp,
krb5_keyblock **strengthen_key);
krb5_error_code
krb5int_fast_make_state(krb5_context context,
struct krb5int_fast_request_state **state);
void
krb5int_fast_free_state(krb5_context context,
struct krb5int_fast_request_state *state);
krb5_error_code
krb5int_fast_as_armor(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_get_init_creds_opt *opt, krb5_kdc_req *request);
krb5_error_code
krb5int_fast_reply_key(krb5_context context,
const krb5_keyblock *strengthen_key,
const krb5_keyblock *existing_key, krb5_keyblock *output_key);
krb5_error_code
krb5int_fast_verify_nego(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_kdc_rep *rep, krb5_data *request,
krb5_keyblock *decrypting_key,
krb5_boolean *fast_avail);
krb5_boolean
k5_upgrade_to_fast_p(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_pa_data **padata);
krb5_error_code
krb5int_fast_tgs_armor(krb5_context context,
struct krb5int_fast_request_state *state,
krb5_keyblock *subkey,
krb5_keyblock *session_key,
krb5_ccache ccache,
krb5_data *target_realm);
#endif
|
62083448452245a0d20d190ee67a743371da0a00
|
b56e852bbbd2f03c0bf8f3c0100e33f2c4c9d587
|
/source/checkForUpdates.c
|
3fb32c2596682adf886e7e5e2b4234ff976eeba2
|
[
"MIT",
"curl"
] |
permissive
|
16BitWonder/NX-Update-Checker
|
67385404f310b3e0dcd687d687ff21a559073ec6
|
a4f89c28d9e90aef45a2bf772ac9b71466a4c9c2
|
refs/heads/master
| 2023-04-27T01:59:16.535407
| 2021-08-19T16:38:43
| 2021-08-19T16:38:43
| 239,370,904
| 113
| 9
|
MIT
| 2020-06-09T20:46:04
| 2020-02-09T20:39:45
|
C
|
UTF-8
|
C
| false
| false
| 10,235
|
c
|
checkForUpdates.c
|
#include "main.h"
extern bool logging;
extern FILE *logFile;
Entry *ignoreList;
void printNewUpdates(FILE*, Entry*, Entry*);
void printNewDLC(FILE*, Entry*, Entry*);
void printMissDLC(FILE*, Entry*, Entry*);
void initIgnoreList();
bool isIgnored(char*);
void checkForUpdates(FILE *out, Entry *localEntries, Entry *extEntries) {
u64 rawTime;
TimeCalendarTime timeCal;
TimeCalendarAdditionalInfo timeInfo;
timeGetCurrentTime(TimeType_UserSystemClock, &rawTime);
timeToCalendarTimeWithMyRule(rawTime, &timeCal, &timeInfo);
fprintf(out, "Generated: %04i/%02i/%02i - %02i:%02i:%02i (%s)\n\n\n", timeCal.year, timeCal.month, timeCal.day, timeCal.hour, timeCal.minute, timeCal.second, timeInfo.timezoneName);
if (logging) {
fprintf(logFile, "[checkForUpdates] Begin initIgnoreList\n");
fflush(logFile);
}
initIgnoreList();
if (logging) {
fprintf(logFile, "[checkForUpdates] ignoreList initialized\n");
fflush(logFile);
}
if (logging) {
fprintf(logFile, "[checkForUpdates] Begin printing new updates\n");
fflush(logFile);
}
printNewUpdates(out, localEntries, extEntries);
if (logging) {
fprintf(logFile, "[checkForUpdates] Finished printing new updates\n");
fprintf(logFile, "[checkForUpdates] Begin printing new DLC binaries\n");
fflush(logFile);
}
printNewDLC(out, localEntries, extEntries);
if (logging) {
fprintf(logFile, "[checkForUpdates] Finished printing new DLC binaries\n");
fprintf(logFile, "[checkForUpdates] Begin printing missing DLC\n");
fflush(logFile);
}
printMissDLC(out, localEntries, extEntries);
if (logging) {
fprintf(logFile, "[checkForUpdates] Finished printing missing DLC\n");
fflush(logFile);
}
freeList(ignoreList);
if (logging) {
fprintf(logFile, "[checkForUpdates] Freed ignoreList\n");
fflush(logFile);
}
return;
}
void printNewUpdates(FILE *out, Entry *localEntries, Entry *extEntries) {
Entry *tmpLocal = localEntries->next;
Entry *tmpExt;
fprintf(out, "New Updates Available:\n\n");
printf("New Updates Available:\n\n");
while (tmpLocal != NULL) {
tmpExt = extEntries->next;
if ((tmpLocal->Data.TID[13] == '8') && logging) {
fprintf(logFile, "[printNewUpdates] Looking for newer update of %s [%s][%s][v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.displayVersion, tmpLocal->Data.version);
fflush(logFile);
}
while (tmpExt != NULL) {
if (strcmp(tmpExt->Data.TID, tmpLocal->Data.TID) == 0) {
if ((tmpLocal->Data.TID[13] == '8') && (tmpExt->Data.version > tmpLocal->Data.version)) {
if (logging) {
fprintf(logFile, "[printNewUpdates] Found newer update, checking if it's ignored\n");
fflush(logFile);
}
if (!isIgnored(tmpLocal->Data.TID)) {
if (logging) {
fprintf(logFile, "[printNewUpdates] Not ignored, printing out\n");
fflush(logFile);
}
fprintf(out, "%s [%s][%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.displayVersion, tmpLocal->Data.version, tmpExt->Data.version);
printf("%s [%s][%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.displayVersion, tmpLocal->Data.version, tmpExt->Data.version);
if (logging) {
fprintf(logFile, "[printNewUpdates] Printed %s [%s][%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.displayVersion, tmpLocal->Data.version, tmpExt->Data.version);
fflush(logFile);
}
consoleUpdate(NULL);
} else {
if (logging) {
fprintf(logFile, "[printNewUpdates] Ignoring %s\n", tmpLocal->Data.TID);
fflush(logFile);
}
}
}
tmpExt = NULL;
} else {
tmpExt = tmpExt->next;
}
}
tmpLocal = tmpLocal->next;
}
fprintf(out, "\n\n");
printf("\n\n");
return;
}
void printNewDLC(FILE *out, Entry *localEntries, Entry *extEntries) {
Entry *tmpLocal = localEntries->next;
Entry *tmpExt;
fprintf(out, "New DLC Binaries Available:\n\n");
printf("New DLC Binaries Available:\n\n");
while (tmpLocal != NULL) {
tmpExt = extEntries->next;
if ((tmpLocal->Data.TID[13] != '8') && logging) {
fprintf(logFile, "[printNewDLC] Looking for newer DLC of %s [%s][v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.version);
fflush(logFile);
}
while (tmpExt != NULL) {
if (strcmp(tmpExt->Data.TID, tmpLocal->Data.TID) == 0) {
if ((tmpLocal->Data.TID[13] != '8') && (tmpExt->Data.version > tmpLocal->Data.version)) {
if (logging) {
fprintf(logFile, "[printNewDLC] Found newer DLC, checking if it's ignored\n");
fflush(logFile);
}
if (!isIgnored(tmpLocal->Data.TID)) {
if (logging) {
fprintf(logFile, "[printNewDLC] Not ignored, printing out\n");
fflush(logFile);
}
fprintf(out, "%s [%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.version, tmpExt->Data.version);
printf("%s [%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.version, tmpExt->Data.version);
if (logging) {
fprintf(logFile, "[printNewDLC] Printed %s [%s][v%d] -> [v%d]\n", tmpLocal->Data.name, tmpLocal->Data.TID, tmpLocal->Data.version, tmpExt->Data.version);
fflush(logFile);
}
consoleUpdate(NULL);
} else {
if (logging) {
fprintf(logFile, "[printNewDLC] Ignoring %s\n", tmpLocal->Data.TID);
fflush(logFile);
}
}
}
tmpExt = NULL;
} else {
tmpExt = tmpExt->next;
}
}
tmpLocal = tmpLocal->next;
}
fprintf(out, "\n\n");
printf("\n\n");
return;
}
void printMissDLC(FILE *out, Entry *localEntries, Entry *extEntries) {
Entry *localTraverse = localEntries->next;
Entry *tmpLocal;
Entry *tmpExt;
Entry *dlcList = calloc(1, sizeof(Entry));
Entry *dlcListHead = dlcList;
char dlcRange[17];
fprintf(out, "Available DLC Not Installed:\n\n");
printf("Available DLC Not Installed:\n\n");
while (localTraverse != NULL) {
// Find title TID
while ((localTraverse != NULL) && (localTraverse->Data.TID[13] != '8')) {
localTraverse = localTraverse->next;
}
if ((localTraverse != NULL) && logging) {
fprintf(logFile, "[printMissDLC] Looking for missing DLC for %s\n", localTraverse->Data.TID);
fflush(logFile);
} else if (logging) {
fprintf(logFile, "[printMissDLC] Reached the end of the local title list\n");
fflush(logFile);
}
if (localTraverse != NULL) {
// Shift TID into DLC range
strcpy(dlcRange, localTraverse->Data.TID);
dlcRange[12] = dlcRange[12] + 1;
if (dlcRange[12] == ':'){
dlcRange[12] = 'A';
}
// Iterate through external list looking for DLC
tmpExt = extEntries->next;
while (tmpExt != NULL) {
strcpy(dlcRange+13, (tmpExt->Data.TID)+13);
if (strcmp(dlcRange, tmpExt->Data.TID) == 0) {
Entry *newDLC = calloc(1, sizeof(Entry));
strcpy(newDLC->Data.TID, tmpExt->Data.TID);
newDLC->Data.version = tmpExt->Data.version;
newDLC->prev = dlcList;
dlcList->next = newDLC;
dlcList = dlcList->next;
}
tmpExt = tmpExt->next;
}
// Check if any of this title's DLC are not installed
dlcList = dlcListHead->next;
while (dlcList != NULL) {
bool foundDLC = false;
tmpLocal = localEntries->next;
// If local titles don't include this DLC, print it
while (!foundDLC && (tmpLocal != NULL)) {
if (strcmp(dlcList->Data.TID, tmpLocal->Data.TID) == 0) {
foundDLC = true;
}
tmpLocal = tmpLocal->next;
}
if (!foundDLC && !isIgnored(dlcList->Data.TID)) {
fprintf(out, "%s [%s][v%d]\n", localTraverse->Data.name, dlcList->Data.TID, dlcList->Data.version);
printf("%s [%s][v%d]\n", localTraverse->Data.name, dlcList->Data.TID, dlcList->Data.version);
if (logging) {
fprintf(logFile, "[printMissDLC] Printed %s [%s][v%d]\n", localTraverse->Data.name, dlcList->Data.TID, dlcList->Data.version);
fflush(logFile);
}
consoleUpdate(NULL);
} else if (isIgnored(dlcList->Data.TID)) {
if (logging) {
fprintf(logFile, "[printMissDLC] Ignoring %s\n", dlcList->Data.TID);
fflush(logFile);
}
}
dlcList = dlcList->next;
}
freeList(dlcListHead);
dlcListHead = calloc(1, sizeof(Entry));
dlcList = dlcListHead;
localTraverse = localTraverse->next;
}
}
return;
}
void initIgnoreList() {
// Have an empty entry at head of list
ignoreList = calloc(1, sizeof(Entry));
if(access("ignore.txt", F_OK ) == -1 ) {
if (logging) {
fprintf(logFile, "[initIgnoreList] ignore.txt does not exist\n");
fflush(logFile);
}
return;
}
Entry *tmpIgnore = ignoreList;
char *memVerList;
FILE *ignoreListTxt = fopen("ignore.txt", "r");
if (logging) {
fprintf(logFile, "[initIgnoreList] ignore.txt opened\n");
fflush(logFile);
}
fseek(ignoreListTxt, 0, SEEK_END);
long fileSize = ftell(ignoreListTxt);
memVerList = calloc(fileSize, sizeof(char));
rewind(ignoreListTxt);
fread(memVerList, 1, fileSize, ignoreListTxt);
if (logging) {
fprintf(logFile, "[initIgnoreList] Read ignore.txt into memory\n");
fflush(logFile);
}
// Close our input file
if (fclose(ignoreListTxt) != 0) {
perror("ignore.txt");
consoleUpdate(NULL);
}
if (logging) {
fprintf(logFile, "[initIgnoreList] ignore.txt closed\n");
fflush(logFile);
}
// Build ignore list
char titleID[17];
titleID[16] = 0;
long fileIndex = 0;
int tidIndex = 0;
while (fileIndex < fileSize) {
titleID[tidIndex] = *(memVerList+fileIndex);
if (tidIndex == 15) {
tidIndex = -1;
// Navigate to the next entry/EOF
while ((fileIndex < fileSize) && (*(memVerList+fileIndex) != '\n')){
fileIndex++;
}
Entry *newIgnore = calloc(1, sizeof(Entry));
strcpy(newIgnore->Data.TID, titleID);
tmpIgnore->next = newIgnore;
newIgnore->prev = tmpIgnore;
tmpIgnore = tmpIgnore->next;
if (logging) {
fprintf(logFile, "[initIgnoreList] Parsed %s into ignore list\n", titleID);
fflush(logFile);
}
}
fileIndex++;
tidIndex++;
}
return;
}
bool isIgnored(char *titleID) {
Entry *tmpEntry = ignoreList->next;
while (tmpEntry != NULL) {
if (strcmp(titleID, tmpEntry->Data.TID) == 0) {
return true;
}
tmpEntry = tmpEntry->next;
}
return false;
}
|
2a9b3bc3cdf69ad450c96721b6898c0a2c168722
|
2bdfcadcaef9d66ec96b893f3ea39edff8d985ca
|
/IR_rec_trans/Src/IRremote.c
|
786abdc2becfa2530df54f4b651f6406fbb056f0
|
[] |
no_license
|
stDstm/Example_STM32F103
|
39948c703e025a52f31defe37acfc82a4a7b4a7d
|
f8eb4225eb53a309f16ef0b6042c48c65648a616
|
refs/heads/master
| 2022-12-10T11:05:19.068088
| 2022-11-30T21:31:47
| 2022-11-30T21:31:47
| 154,344,724
| 152
| 137
| null | null | null | null |
UTF-8
|
C
| false
| false
| 5,382
|
c
|
IRremote.c
|
#include "IRremote.h"
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if(htim == &htim4)
{
uint8_t irdata = RECIV_PIN; // пин для приёма
irparams.timer++; // One more 50uS tick
if(irparams.rawlen >= RAWBUF) irparams.rcvstate = STATE_OVERFLOW ; // Buffer overflow
switch(irparams.rcvstate)
{
case STATE_IDLE: // In the middle of a gap
if(irdata == MARK)
{
if(irparams.timer < GAP_TICKS) // Not big enough to be a gap.
{
irparams.timer = 0;
}
else
{
// Gap just ended; Record duration; Start recording transmission
irparams.overflow = false;
irparams.rawlen = 0;
irparams.rawbuf[irparams.rawlen++] = irparams.timer;
irparams.timer = 0;
irparams.rcvstate = STATE_MARK;
}
}
break;
case STATE_MARK: // Timing Mark
if(irdata == SPACE) // Mark ended; Record time
{
irparams.rawbuf[irparams.rawlen++] = irparams.timer;
irparams.timer = 0;
irparams.rcvstate = STATE_SPACE;
}
break;
case STATE_SPACE: // Timing Space
if(irdata == MARK) // Space just ended; Record time
{
irparams.rawbuf[irparams.rawlen++] = irparams.timer;
irparams.timer = 0;
irparams.rcvstate = STATE_MARK;
}
else if(irparams.timer > GAP_TICKS) // Space
{
irparams.rcvstate = STATE_STOP;
}
break;
case STATE_STOP: // Waiting; Measuring Gap
if(irdata == MARK) irparams.timer = 0 ; // Reset gap timer
break;
case STATE_OVERFLOW: // Flag up a read overflow; Stop the State Machine
irparams.overflow = true;
irparams.rcvstate = STATE_STOP;
break;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////
int MATCH(int measured, int desired)
{
return ((measured >= TICKS_LOW(desired)) && (measured <= TICKS_HIGH(desired)));
}
int MATCH_MARK(int measured_ticks, int desired_us)
{
return ((measured_ticks >= TICKS_LOW(desired_us + MARK_EXCESS)) && (measured_ticks <= TICKS_HIGH(desired_us + MARK_EXCESS)));
}
int MATCH_SPACE(int measured_ticks, int desired_us)
{
return ((measured_ticks >= TICKS_LOW(desired_us - MARK_EXCESS)) && (measured_ticks <= TICKS_HIGH(desired_us - MARK_EXCESS)));
}
//////////////////////////////////////////irRecv.c//////////////////////////////////////////////////
int16_t my_decode(decode_results *results)
{
results->rawbuf = irparams.rawbuf;
results->rawlen = irparams.rawlen;
results->overflow = irparams.overflow;
if(irparams.rcvstate != STATE_STOP) return false;
#if DECODE_NEC
if(decodeNEC(results)) return true;
#endif
#if DECODE_SONY
if(decodeSony(results)) return true;
#endif
#if DECODE_SANYO
if(decodeSanyo(results)) return true;
#endif
#if DECODE_MITSUBISHI
if(decodeMitsubishi(results)) return true;
#endif
#if DECODE_RC5
if(decodeRC5(results)) return true;
#endif
#if DECODE_RC6
if(decodeRC6(results)) return true;
#endif
#if DECODE_PANASONIC
if(decodePanasonic(results)) return true;
#endif
#if DECODE_LG
if(decodeLG(results)) return true;
#endif
#if DECODE_JVC
if(decodeJVC(results)) return true;
#endif
#if DECODE_SAMSUNG
if(decodeSAMSUNG(results)) return true;
#endif
#if DECODE_WHYNTER
if(decodeWhynter(results)) return true;
#endif
#if DECODE_AIWA_RC_T501
if(decodeAiwaRCT501(results)) return true;
#endif
#if DECODE_DENON
if(decodeDenon(results)) return true;
#endif
if(decodeHash(results)) return true;
my_resume();
return false;
}
void my_enableIRIn() // initialization
{
DWT_Init(); // старт счётчика микросекунд
HAL_TIM_Base_DeInit(&htim4);
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
TIM_MasterConfigTypeDef sMasterConfig = {0};
htim4.Instance = TIM4;
htim4.Init.Prescaler = MYPRESCALER;
htim4.Init.CounterMode = TIM_COUNTERMODE_UP;
htim4.Init.Period = MYPERIOD;
htim4.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim4.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
HAL_TIM_Base_Init(&htim4);
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
HAL_TIM_ConfigClockSource(&htim4, &sClockSourceConfig);
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
HAL_TIMEx_MasterConfigSynchronization(&htim4, &sMasterConfig);
irparams.rcvstate = STATE_IDLE;
irparams.rawlen = 0;
HAL_TIM_Base_Start_IT(&htim4);
}
uint8_t my_isIdle() // Return if receiving new IR signals
{
return (irparams.rcvstate == STATE_IDLE || irparams.rcvstate == STATE_STOP) ? true : false;
}
void my_resume() // Restart the ISR state machine
{
irparams.rcvstate = STATE_IDLE;
irparams.rawlen = 0;
}
int compare(unsigned int oldval, unsigned int newval)
{
if(newval < oldval * .8) return 0;
else if(oldval < newval * .8) return 2;
else return 1;
}
#define FNV_PRIME_32 16777619
#define FNV_BASIS_32 2166136261
int32_t decodeHash(decode_results *results)
{
int32_t hash = FNV_BASIS_32;
// Require at least 6 samples to prevent triggering on noise
if(results->rawlen < 6) return false;
for(int16_t i = 1; (i + 2) < results->rawlen; i++)
{
int16_t value = compare(results->rawbuf[i], results->rawbuf[i+2]);
hash = (hash * FNV_PRIME_32) ^ value; // Add value into the hash
}
results->value = hash;
results->bits = 32;
results->decode_type = UNKNOWN;
return true;
}
|
6fae7667eeaa258a319d71802e04113bc0122072
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/net/inet/ipv4_build_header.c
|
001cba22bfff4624f94f39466bb7e74ae782768b
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 3,661
|
c
|
ipv4_build_header.c
|
/****************************************************************************
* net/inet/ipv4_build_header.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/net/ip.h>
#include <nuttx/net/netconfig.h>
#include "inet.h"
#include "utils/utils.h"
/****************************************************************************
* Private Data
****************************************************************************/
#ifdef CONFIG_NET_IPv4
/* Increasing number used for the IP ID field. */
static uint16_t g_ipid;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: ipv4_build_header
*
* Description:
* build IPv4 header
*
* Input Parameters:
* ipv4 Pointer to IPv4 header's buffer
* total_len total length of the IPv4 packet
* prot the next level protocol used in IPv4 packet
* src_ip Source IPv4 address
* dst_ip Destination IPv4 address
* ttl Time to live(IPv4)
* opt IPv4 options
*
* Returned Value:
* length of IPv4 header
*
****************************************************************************/
uint16_t ipv4_build_header(FAR struct ipv4_hdr_s *ipv4, uint16_t total_len,
uint16_t prot, FAR const in_addr_t *src_ip,
FAR const in_addr_t *dst_ip, uint8_t ttl,
uint8_t tos, FAR struct ipv4_opt_s *opt)
{
/* Initialize the IP header. */
ipv4->vhl = 0x45; /* orginal initial value like this */
ipv4->tos = tos;
ipv4->len[0] = (total_len >> 8);
ipv4->len[1] = (total_len & 0xff);
++g_ipid;
ipv4->ipid[0] = g_ipid >> 8;
ipv4->ipid[1] = g_ipid & 0xff;
ipv4->ipoffset[0] = IP_FLAG_DONTFRAG >> 8;
ipv4->ipoffset[1] = IP_FLAG_DONTFRAG & 0xff;
ipv4->ttl = ttl;
ipv4->proto = prot;
/* It's possible to use its own src_ip to initialize its dest_ip */
net_ipv4addr_hdrcopy(ipv4->destipaddr, dst_ip);
net_ipv4addr_hdrcopy(ipv4->srcipaddr, src_ip);
/* if ip has options, build it now */
if (opt != NULL)
{
ipv4->vhl += opt->len >> 2;
memcpy(ipv4 + 1, opt->data, opt->len);
}
/* Calculate IP checksum. */
ipv4->ipchksum = 0;
ipv4->ipchksum = ~ipv4_chksum(ipv4);
ninfo("IPv4 Packet: ipid:%d, length: %d\n", g_ipid, total_len);
return (ipv4->vhl & IPv4_HLMASK) << 2;
}
#endif /* CONFIG_NET_IPv4 */
|
b1402fc857bbad043d031903831870f0383a2dfa
|
3059b388ef9bf2b7d81265f2a418bf3e360fb235
|
/Gep/Include/ps2/gpfifo.h
|
40d200cb574627f9765c946c48ebfb9300779527
|
[
"MIT"
] |
permissive
|
iaddis/SNESticle
|
4486e560e3c8ee0d1d8993955f1394e0edc4b38f
|
9590ebf3bf768424ebd6cb018f322e724a7aade3
|
refs/heads/main
| 2023-09-03T13:19:59.494801
| 2022-01-13T07:59:38
| 2022-01-13T07:59:38
| 447,509,804
| 341
| 51
| null | null | null | null |
UTF-8
|
C
| false
| false
| 824
|
h
|
gpfifo.h
|
#ifndef _GPFIFO_H
#define _GPFIFO_H
void GPFifoFlush();
void GPFifoPause();
void GPFifoResume();
void GPFifoSync();
Uint64 *GPFifoOpen(Uint32 nMinQwords);
void GPFifoClose(Uint64 *pPtr);
void GPFifoInit(Uint128 *pMem, Int32 nBytes);
void GPFifoShutdown();
void GPFifoRect(unsigned x1, unsigned y1, unsigned c1, unsigned x2, unsigned y2, unsigned c2, unsigned z, unsigned abe);
void GPFifoEnableZBuf(void);
void GPFifoDisableZBuf(void);
void GPFifoTexRect(u32 x1, u32 y1, u32 u1, u32 v1, u32 x2, u32 y2, u32 u2, u32 v2, u32 z, u32 colour, unsigned abe);
void GPFifoSetTex(u32 tbp, u32 tbw, u32 texwidthlog2, u32 texheightlog2, u32 tpsm, u32 cbp, u32 cbw, u32 cpsm, int filter);
void GPFifoUploadTexture(int TBP, int TBW, int xofs, int yofs, int pxlfmt, void *tex, int wpxls, int hpxls);
#endif
|
69d85bafbe1c0d391867c65bcd7480457c10117f
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_ssd1306.c
|
fee650ba5a0c36890d57d6a59f9fbb29b2ed573e
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 3,557
|
c
|
s32k1xx_ssd1306.c
|
/****************************************************************************
* boards/arm/s32k1xx/rddrone-bms772/src/s32k1xx_ssd1306.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
/* Copyright 2022 NXP */
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/board.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/lcd/lcd.h>
#include <nuttx/lcd/ssd1306.h>
#include "s32k1xx_lpi2c.h"
#if defined(CONFIG_I2C) && defined(CONFIG_S32K1XX_LPI2C0) && \
defined(CONFIG_LCD_SSD1306_I2C)
/****************************************************************************
* Private Data
****************************************************************************/
static struct lcd_dev_s *s32k1xx_ssd1306_dev;
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_lcd_initialize
****************************************************************************/
int board_lcd_initialize(void)
{
struct i2c_master_s *lpi2c0;
int ret = OK;
/* Initialize LPI2C0 */
lpi2c0 = s32k1xx_i2cbus_initialize(0);
if (lpi2c0 == NULL)
{
i2cerr("ERROR: Failed to initialize LPI2C0\n");
return -ENODEV;
}
/* Initialize SSD1306 on LPI2C0 */
lcdinfo("Initialize SSD1306 on LPI2C0\n");
s32k1xx_ssd1306_dev = ssd1306_initialize(lpi2c0, NULL, 0);
if (s32k1xx_ssd1306_dev == NULL)
{
lcderr("ERROR: Failed to initialize SSD1306 on LPI2C0\n");
s32k1xx_i2cbus_uninitialize(lpi2c0);
return -ENODEV;
}
lcdinfo("Successfully initialized SSD1306 on LPI2C0\n");
return ret;
}
/****************************************************************************
* Name: board_lcd_getdev
****************************************************************************/
struct lcd_dev_s *board_lcd_getdev(int devno)
{
/* Only one display device with devno 0 is supported */
if (devno == 0)
{
return s32k1xx_ssd1306_dev;
}
return NULL;
}
/****************************************************************************
* Name: board_lcd_uninitialize
****************************************************************************/
void board_lcd_uninitialize(void)
{
/* Turn off the power to uninitialize */
s32k1xx_ssd1306_dev->setpower(s32k1xx_ssd1306_dev, 0);
}
#endif /* CONFIG_I2C && CONFIG_S32K1XX_LPI2C0 && CONFIG_LCD_SSD1306_I2C */
|
e33f02f4cea51b5005531d44d91512e289665e21
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/drivers/dma/dmaengine.c
|
93f7992bee5c1c933e49b7f93ee41c81265698c8
|
[
"Linux-syscall-note",
"GPL-2.0-only",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
OLIMEX/DIY-LAPTOP
|
ae82f4ee79c641d9aee444db9a75f3f6709afa92
|
a3fafd1309135650bab27f5eafc0c32bc3ca74ee
|
refs/heads/rel3
| 2023-08-04T01:54:19.483792
| 2023-04-03T07:18:12
| 2023-04-03T07:18:12
| 80,094,055
| 507
| 92
|
Apache-2.0
| 2023-04-03T07:05:59
| 2017-01-26T07:25:50
|
C
|
UTF-8
|
C
| false
| false
| 29,862
|
c
|
dmaengine.c
|
/*
* Copyright(c) 2004 - 2006 Intel Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* The full GNU General Public License is included in this distribution in the
* file called COPYING.
*/
/*
* This code implements the DMA subsystem. It provides a HW-neutral interface
* for other kernel code to use asynchronous memory copy capabilities,
* if present, and allows different HW DMA drivers to register as providing
* this capability.
*
* Due to the fact we are accelerating what is already a relatively fast
* operation, the code goes to great lengths to avoid additional overhead,
* such as locking.
*
* LOCKING:
*
* The subsystem keeps a global list of dma_device structs it is protected by a
* mutex, dma_list_mutex.
*
* A subsystem can get access to a channel by calling dmaengine_get() followed
* by dma_find_channel(), or if it has need for an exclusive channel it can call
* dma_request_channel(). Once a channel is allocated a reference is taken
* against its corresponding driver to disable removal.
*
* Each device has a channels list, which runs unlocked but is never modified
* once the device is registered, it's just setup by the driver.
*
* See Documentation/dmaengine.txt for more details
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/dma-mapping.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/hardirq.h>
#include <linux/spinlock.h>
#include <linux/percpu.h>
#include <linux/rcupdate.h>
#include <linux/mutex.h>
#include <linux/jiffies.h>
#include <linux/rculist.h>
#include <linux/idr.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/acpi_dma.h>
#include <linux/of_dma.h>
static DEFINE_MUTEX(dma_list_mutex);
static DEFINE_IDR(dma_idr);
static LIST_HEAD(dma_device_list);
static long dmaengine_ref_count;
/* --- sysfs implementation --- */
/**
* dev_to_dma_chan - convert a device pointer to the its sysfs container object
* @dev - device node
*
* Must be called under dma_list_mutex
*/
static struct dma_chan *dev_to_dma_chan(struct device *dev)
{
struct dma_chan_dev *chan_dev;
chan_dev = container_of(dev, typeof(*chan_dev), device);
return chan_dev->chan;
}
static ssize_t show_memcpy_count(struct device *dev, struct device_attribute *attr, char *buf)
{
struct dma_chan *chan;
unsigned long count = 0;
int i;
int err;
mutex_lock(&dma_list_mutex);
chan = dev_to_dma_chan(dev);
if (chan) {
for_each_possible_cpu(i)
count += per_cpu_ptr(chan->local, i)->memcpy_count;
err = sprintf(buf, "%lu\n", count);
} else
err = -ENODEV;
mutex_unlock(&dma_list_mutex);
return err;
}
static ssize_t show_bytes_transferred(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct dma_chan *chan;
unsigned long count = 0;
int i;
int err;
mutex_lock(&dma_list_mutex);
chan = dev_to_dma_chan(dev);
if (chan) {
for_each_possible_cpu(i)
count += per_cpu_ptr(chan->local, i)->bytes_transferred;
err = sprintf(buf, "%lu\n", count);
} else
err = -ENODEV;
mutex_unlock(&dma_list_mutex);
return err;
}
static ssize_t show_in_use(struct device *dev, struct device_attribute *attr, char *buf)
{
struct dma_chan *chan;
int err;
mutex_lock(&dma_list_mutex);
chan = dev_to_dma_chan(dev);
if (chan)
err = sprintf(buf, "%d\n", chan->client_count);
else
err = -ENODEV;
mutex_unlock(&dma_list_mutex);
return err;
}
static struct device_attribute dma_attrs[] = {
__ATTR(memcpy_count, S_IRUGO, show_memcpy_count, NULL),
__ATTR(bytes_transferred, S_IRUGO, show_bytes_transferred, NULL),
__ATTR(in_use, S_IRUGO, show_in_use, NULL),
__ATTR_NULL
};
static void chan_dev_release(struct device *dev)
{
struct dma_chan_dev *chan_dev;
chan_dev = container_of(dev, typeof(*chan_dev), device);
if (atomic_dec_and_test(chan_dev->idr_ref)) {
mutex_lock(&dma_list_mutex);
idr_remove(&dma_idr, chan_dev->dev_id);
mutex_unlock(&dma_list_mutex);
kfree(chan_dev->idr_ref);
}
kfree(chan_dev);
}
static struct class dma_devclass = {
.name = "dma",
.dev_attrs = dma_attrs,
.dev_release = chan_dev_release,
};
/* --- client and device registration --- */
#define dma_device_satisfies_mask(device, mask) \
__dma_device_satisfies_mask((device), &(mask))
static int
__dma_device_satisfies_mask(struct dma_device *device,
const dma_cap_mask_t *want)
{
dma_cap_mask_t has;
bitmap_and(has.bits, want->bits, device->cap_mask.bits,
DMA_TX_TYPE_END);
return bitmap_equal(want->bits, has.bits, DMA_TX_TYPE_END);
}
static struct module *dma_chan_to_owner(struct dma_chan *chan)
{
return chan->device->dev->driver->owner;
}
/**
* balance_ref_count - catch up the channel reference count
* @chan - channel to balance ->client_count versus dmaengine_ref_count
*
* balance_ref_count must be called under dma_list_mutex
*/
static void balance_ref_count(struct dma_chan *chan)
{
struct module *owner = dma_chan_to_owner(chan);
while (chan->client_count < dmaengine_ref_count) {
__module_get(owner);
chan->client_count++;
}
}
/**
* dma_chan_get - try to grab a dma channel's parent driver module
* @chan - channel to grab
*
* Must be called under dma_list_mutex
*/
static int dma_chan_get(struct dma_chan *chan)
{
int err = -ENODEV;
struct module *owner = dma_chan_to_owner(chan);
if (chan->client_count) {
__module_get(owner);
err = 0;
} else if (try_module_get(owner))
err = 0;
if (err == 0)
chan->client_count++;
/* allocate upon first client reference */
if (chan->client_count == 1 && err == 0) {
int desc_cnt = chan->device->device_alloc_chan_resources(chan);
if (desc_cnt < 0) {
err = desc_cnt;
chan->client_count = 0;
module_put(owner);
} else if (!dma_has_cap(DMA_PRIVATE, chan->device->cap_mask))
balance_ref_count(chan);
}
return err;
}
/**
* dma_chan_put - drop a reference to a dma channel's parent driver module
* @chan - channel to release
*
* Must be called under dma_list_mutex
*/
static void dma_chan_put(struct dma_chan *chan)
{
if (!chan->client_count)
return; /* this channel failed alloc_chan_resources */
chan->client_count--;
module_put(dma_chan_to_owner(chan));
if (chan->client_count == 0)
chan->device->device_free_chan_resources(chan);
}
enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)
{
enum dma_status status;
unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
dma_async_issue_pending(chan);
do {
status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
pr_err("%s: timeout!\n", __func__);
return DMA_ERROR;
}
if (status != DMA_IN_PROGRESS)
break;
cpu_relax();
} while (1);
return status;
}
EXPORT_SYMBOL(dma_sync_wait);
/**
* dma_cap_mask_all - enable iteration over all operation types
*/
static dma_cap_mask_t dma_cap_mask_all;
/**
* dma_chan_tbl_ent - tracks channel allocations per core/operation
* @chan - associated channel for this entry
*/
struct dma_chan_tbl_ent {
struct dma_chan *chan;
};
/**
* channel_table - percpu lookup table for memory-to-memory offload providers
*/
static struct dma_chan_tbl_ent __percpu *channel_table[DMA_TX_TYPE_END];
static int __init dma_channel_table_init(void)
{
enum dma_transaction_type cap;
int err = 0;
bitmap_fill(dma_cap_mask_all.bits, DMA_TX_TYPE_END);
/* 'interrupt', 'private', and 'slave' are channel capabilities,
* but are not associated with an operation so they do not need
* an entry in the channel_table
*/
clear_bit(DMA_INTERRUPT, dma_cap_mask_all.bits);
clear_bit(DMA_PRIVATE, dma_cap_mask_all.bits);
clear_bit(DMA_SLAVE, dma_cap_mask_all.bits);
for_each_dma_cap_mask(cap, dma_cap_mask_all) {
channel_table[cap] = alloc_percpu(struct dma_chan_tbl_ent);
if (!channel_table[cap]) {
err = -ENOMEM;
break;
}
}
if (err) {
pr_err("initialization failure\n");
for_each_dma_cap_mask(cap, dma_cap_mask_all)
if (channel_table[cap])
free_percpu(channel_table[cap]);
}
return err;
}
arch_initcall(dma_channel_table_init);
/**
* dma_find_channel - find a channel to carry out the operation
* @tx_type: transaction type
*/
struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type)
{
return this_cpu_read(channel_table[tx_type]->chan);
}
EXPORT_SYMBOL(dma_find_channel);
/*
* net_dma_find_channel - find a channel for net_dma
* net_dma has alignment requirements
*/
struct dma_chan *net_dma_find_channel(void)
{
struct dma_chan *chan = dma_find_channel(DMA_MEMCPY);
if (chan && !is_dma_copy_aligned(chan->device, 1, 1, 1))
return NULL;
return chan;
}
EXPORT_SYMBOL(net_dma_find_channel);
/**
* dma_issue_pending_all - flush all pending operations across all channels
*/
void dma_issue_pending_all(void)
{
struct dma_device *device;
struct dma_chan *chan;
rcu_read_lock();
list_for_each_entry_rcu(device, &dma_device_list, global_node) {
if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
continue;
list_for_each_entry(chan, &device->channels, device_node)
if (chan->client_count)
device->device_issue_pending(chan);
}
rcu_read_unlock();
}
EXPORT_SYMBOL(dma_issue_pending_all);
/**
* nth_chan - returns the nth channel of the given capability
* @cap: capability to match
* @n: nth channel desired
*
* Defaults to returning the channel with the desired capability and the
* lowest reference count when 'n' cannot be satisfied. Must be called
* under dma_list_mutex.
*/
static struct dma_chan *nth_chan(enum dma_transaction_type cap, int n)
{
struct dma_device *device;
struct dma_chan *chan;
struct dma_chan *ret = NULL;
struct dma_chan *min = NULL;
list_for_each_entry(device, &dma_device_list, global_node) {
if (!dma_has_cap(cap, device->cap_mask) ||
dma_has_cap(DMA_PRIVATE, device->cap_mask))
continue;
list_for_each_entry(chan, &device->channels, device_node) {
if (!chan->client_count)
continue;
if (!min)
min = chan;
else if (chan->table_count < min->table_count)
min = chan;
if (n-- == 0) {
ret = chan;
break; /* done */
}
}
if (ret)
break; /* done */
}
if (!ret)
ret = min;
if (ret)
ret->table_count++;
return ret;
}
/**
* dma_channel_rebalance - redistribute the available channels
*
* Optimize for cpu isolation (each cpu gets a dedicated channel for an
* operation type) in the SMP case, and operation isolation (avoid
* multi-tasking channels) in the non-SMP case. Must be called under
* dma_list_mutex.
*/
static void dma_channel_rebalance(void)
{
struct dma_chan *chan;
struct dma_device *device;
int cpu;
int cap;
int n;
/* undo the last distribution */
for_each_dma_cap_mask(cap, dma_cap_mask_all)
for_each_possible_cpu(cpu)
per_cpu_ptr(channel_table[cap], cpu)->chan = NULL;
list_for_each_entry(device, &dma_device_list, global_node) {
if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
continue;
list_for_each_entry(chan, &device->channels, device_node)
chan->table_count = 0;
}
/* don't populate the channel_table if no clients are available */
if (!dmaengine_ref_count)
return;
/* redistribute available channels */
n = 0;
for_each_dma_cap_mask(cap, dma_cap_mask_all)
for_each_online_cpu(cpu) {
if (num_possible_cpus() > 1)
chan = nth_chan(cap, n++);
else
chan = nth_chan(cap, -1);
per_cpu_ptr(channel_table[cap], cpu)->chan = chan;
}
}
static struct dma_chan *private_candidate(const dma_cap_mask_t *mask,
struct dma_device *dev,
dma_filter_fn fn, void *fn_param)
{
struct dma_chan *chan;
if (!__dma_device_satisfies_mask(dev, mask)) {
pr_debug("%s: wrong capabilities\n", __func__);
return NULL;
}
/* devices with multiple channels need special handling as we need to
* ensure that all channels are either private or public.
*/
if (dev->chancnt > 1 && !dma_has_cap(DMA_PRIVATE, dev->cap_mask))
list_for_each_entry(chan, &dev->channels, device_node) {
/* some channels are already publicly allocated */
if (chan->client_count)
return NULL;
}
list_for_each_entry(chan, &dev->channels, device_node) {
if (chan->client_count) {
pr_debug("%s: %s busy\n",
__func__, dma_chan_name(chan));
continue;
}
if (fn && !fn(chan, fn_param)) {
pr_debug("%s: %s filter said false\n",
__func__, dma_chan_name(chan));
continue;
}
return chan;
}
return NULL;
}
/**
* dma_request_channel - try to allocate an exclusive channel
* @mask: capabilities that the channel must satisfy
* @fn: optional callback to disposition available channels
* @fn_param: opaque parameter to pass to dma_filter_fn
*/
struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
dma_filter_fn fn, void *fn_param)
{
struct dma_device *device, *_d;
struct dma_chan *chan = NULL;
int err;
/* Find a channel */
mutex_lock(&dma_list_mutex);
list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
chan = private_candidate(mask, device, fn, fn_param);
if (chan) {
/* Found a suitable channel, try to grab, prep, and
* return it. We first set DMA_PRIVATE to disable
* balance_ref_count as this channel will not be
* published in the general-purpose allocator
*/
dma_cap_set(DMA_PRIVATE, device->cap_mask);
device->privatecnt++;
err = dma_chan_get(chan);
if (err == -ENODEV) {
pr_debug("%s: %s module removed\n",
__func__, dma_chan_name(chan));
list_del_rcu(&device->global_node);
} else if (err)
pr_debug("%s: failed to get %s: (%d)\n",
__func__, dma_chan_name(chan), err);
else
break;
if (--device->privatecnt == 0)
dma_cap_clear(DMA_PRIVATE, device->cap_mask);
chan = NULL;
}
}
mutex_unlock(&dma_list_mutex);
pr_debug("%s: %s (%s)\n",
__func__,
chan ? "success" : "fail",
chan ? dma_chan_name(chan) : NULL);
return chan;
}
EXPORT_SYMBOL_GPL(__dma_request_channel);
/**
* dma_request_slave_channel - try to allocate an exclusive slave channel
* @dev: pointer to client device structure
* @name: slave channel name
*/
struct dma_chan *dma_request_slave_channel(struct device *dev, const char *name)
{
/* If device-tree is present get slave info from here */
if (dev->of_node)
return of_dma_request_slave_channel(dev->of_node, name);
/* If device was enumerated by ACPI get slave info from here */
if (ACPI_HANDLE(dev))
return acpi_dma_request_slave_chan_by_name(dev, name);
return NULL;
}
EXPORT_SYMBOL_GPL(dma_request_slave_channel);
void dma_release_channel(struct dma_chan *chan)
{
mutex_lock(&dma_list_mutex);
WARN_ONCE(chan->client_count != 1,
"chan reference count %d != 1\n", chan->client_count);
dma_chan_put(chan);
/* drop PRIVATE cap enabled by __dma_request_channel() */
if (--chan->device->privatecnt == 0)
dma_cap_clear(DMA_PRIVATE, chan->device->cap_mask);
mutex_unlock(&dma_list_mutex);
}
EXPORT_SYMBOL_GPL(dma_release_channel);
/**
* dmaengine_get - register interest in dma_channels
*/
void dmaengine_get(void)
{
struct dma_device *device, *_d;
struct dma_chan *chan;
int err;
mutex_lock(&dma_list_mutex);
dmaengine_ref_count++;
/* try to grab channels */
list_for_each_entry_safe(device, _d, &dma_device_list, global_node) {
if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
continue;
list_for_each_entry(chan, &device->channels, device_node) {
err = dma_chan_get(chan);
if (err == -ENODEV) {
/* module removed before we could use it */
list_del_rcu(&device->global_node);
break;
} else if (err)
pr_debug("%s: failed to get %s: (%d)\n",
__func__, dma_chan_name(chan), err);
}
}
/* if this is the first reference and there were channels
* waiting we need to rebalance to get those channels
* incorporated into the channel table
*/
if (dmaengine_ref_count == 1)
dma_channel_rebalance();
mutex_unlock(&dma_list_mutex);
}
EXPORT_SYMBOL(dmaengine_get);
/**
* dmaengine_put - let dma drivers be removed when ref_count == 0
*/
void dmaengine_put(void)
{
struct dma_device *device;
struct dma_chan *chan;
mutex_lock(&dma_list_mutex);
dmaengine_ref_count--;
BUG_ON(dmaengine_ref_count < 0);
/* drop channel references */
list_for_each_entry(device, &dma_device_list, global_node) {
if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
continue;
list_for_each_entry(chan, &device->channels, device_node)
dma_chan_put(chan);
}
mutex_unlock(&dma_list_mutex);
}
EXPORT_SYMBOL(dmaengine_put);
static bool device_has_all_tx_types(struct dma_device *device)
{
/* A device that satisfies this test has channels that will never cause
* an async_tx channel switch event as all possible operation types can
* be handled.
*/
#ifdef CONFIG_ASYNC_TX_DMA
if (!dma_has_cap(DMA_INTERRUPT, device->cap_mask))
return false;
#endif
#if defined(CONFIG_ASYNC_MEMCPY) || defined(CONFIG_ASYNC_MEMCPY_MODULE)
if (!dma_has_cap(DMA_MEMCPY, device->cap_mask))
return false;
#endif
#if defined(CONFIG_ASYNC_MEMSET) || defined(CONFIG_ASYNC_MEMSET_MODULE)
if (!dma_has_cap(DMA_MEMSET, device->cap_mask))
return false;
#endif
#if defined(CONFIG_ASYNC_XOR) || defined(CONFIG_ASYNC_XOR_MODULE)
if (!dma_has_cap(DMA_XOR, device->cap_mask))
return false;
#ifndef CONFIG_ASYNC_TX_DISABLE_XOR_VAL_DMA
if (!dma_has_cap(DMA_XOR_VAL, device->cap_mask))
return false;
#endif
#endif
#if defined(CONFIG_ASYNC_PQ) || defined(CONFIG_ASYNC_PQ_MODULE)
if (!dma_has_cap(DMA_PQ, device->cap_mask))
return false;
#ifndef CONFIG_ASYNC_TX_DISABLE_PQ_VAL_DMA
if (!dma_has_cap(DMA_PQ_VAL, device->cap_mask))
return false;
#endif
#endif
return true;
}
static int get_dma_id(struct dma_device *device)
{
int rc;
mutex_lock(&dma_list_mutex);
rc = idr_alloc(&dma_idr, NULL, 0, 0, GFP_KERNEL);
if (rc >= 0)
device->dev_id = rc;
mutex_unlock(&dma_list_mutex);
return rc < 0 ? rc : 0;
}
/**
* dma_async_device_register - registers DMA devices found
* @device: &dma_device
*/
int dma_async_device_register(struct dma_device *device)
{
int chancnt = 0, rc;
struct dma_chan* chan;
atomic_t *idr_ref;
if (!device)
return -ENODEV;
/* validate device routines */
BUG_ON(dma_has_cap(DMA_MEMCPY, device->cap_mask) &&
!device->device_prep_dma_memcpy);
BUG_ON(dma_has_cap(DMA_XOR, device->cap_mask) &&
!device->device_prep_dma_xor);
BUG_ON(dma_has_cap(DMA_XOR_VAL, device->cap_mask) &&
!device->device_prep_dma_xor_val);
BUG_ON(dma_has_cap(DMA_PQ, device->cap_mask) &&
!device->device_prep_dma_pq);
BUG_ON(dma_has_cap(DMA_PQ_VAL, device->cap_mask) &&
!device->device_prep_dma_pq_val);
BUG_ON(dma_has_cap(DMA_MEMSET, device->cap_mask) &&
!device->device_prep_dma_memset);
BUG_ON(dma_has_cap(DMA_INTERRUPT, device->cap_mask) &&
!device->device_prep_dma_interrupt);
BUG_ON(dma_has_cap(DMA_SG, device->cap_mask) &&
!device->device_prep_dma_sg);
BUG_ON(dma_has_cap(DMA_CYCLIC, device->cap_mask) &&
!device->device_prep_dma_cyclic);
BUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
!device->device_control);
BUG_ON(dma_has_cap(DMA_INTERLEAVE, device->cap_mask) &&
!device->device_prep_interleaved_dma);
BUG_ON(!device->device_alloc_chan_resources);
BUG_ON(!device->device_free_chan_resources);
BUG_ON(!device->device_tx_status);
BUG_ON(!device->device_issue_pending);
BUG_ON(!device->dev);
/* note: this only matters in the
* CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=n case
*/
if (device_has_all_tx_types(device))
dma_cap_set(DMA_ASYNC_TX, device->cap_mask);
idr_ref = kmalloc(sizeof(*idr_ref), GFP_KERNEL);
if (!idr_ref)
return -ENOMEM;
rc = get_dma_id(device);
if (rc != 0) {
kfree(idr_ref);
return rc;
}
atomic_set(idr_ref, 0);
/* represent channels in sysfs. Probably want devs too */
list_for_each_entry(chan, &device->channels, device_node) {
rc = -ENOMEM;
chan->local = alloc_percpu(typeof(*chan->local));
if (chan->local == NULL)
goto err_out;
chan->dev = kzalloc(sizeof(*chan->dev), GFP_KERNEL);
if (chan->dev == NULL) {
free_percpu(chan->local);
chan->local = NULL;
goto err_out;
}
chan->chan_id = chancnt++;
chan->dev->device.class = &dma_devclass;
chan->dev->device.parent = device->dev;
chan->dev->chan = chan;
chan->dev->idr_ref = idr_ref;
chan->dev->dev_id = device->dev_id;
atomic_inc(idr_ref);
dev_set_name(&chan->dev->device, "dma%dchan%d",
device->dev_id, chan->chan_id);
rc = device_register(&chan->dev->device);
if (rc) {
free_percpu(chan->local);
chan->local = NULL;
kfree(chan->dev);
atomic_dec(idr_ref);
goto err_out;
}
chan->client_count = 0;
}
device->chancnt = chancnt;
mutex_lock(&dma_list_mutex);
/* take references on public channels */
if (dmaengine_ref_count && !dma_has_cap(DMA_PRIVATE, device->cap_mask))
list_for_each_entry(chan, &device->channels, device_node) {
/* if clients are already waiting for channels we need
* to take references on their behalf
*/
if (dma_chan_get(chan) == -ENODEV) {
/* note we can only get here for the first
* channel as the remaining channels are
* guaranteed to get a reference
*/
rc = -ENODEV;
mutex_unlock(&dma_list_mutex);
goto err_out;
}
}
list_add_tail_rcu(&device->global_node, &dma_device_list);
if (dma_has_cap(DMA_PRIVATE, device->cap_mask))
device->privatecnt++; /* Always private */
dma_channel_rebalance();
mutex_unlock(&dma_list_mutex);
return 0;
err_out:
/* if we never registered a channel just release the idr */
if (atomic_read(idr_ref) == 0) {
mutex_lock(&dma_list_mutex);
idr_remove(&dma_idr, device->dev_id);
mutex_unlock(&dma_list_mutex);
kfree(idr_ref);
return rc;
}
list_for_each_entry(chan, &device->channels, device_node) {
if (chan->local == NULL)
continue;
mutex_lock(&dma_list_mutex);
chan->dev->chan = NULL;
mutex_unlock(&dma_list_mutex);
device_unregister(&chan->dev->device);
free_percpu(chan->local);
}
return rc;
}
EXPORT_SYMBOL(dma_async_device_register);
/**
* dma_async_device_unregister - unregister a DMA device
* @device: &dma_device
*
* This routine is called by dma driver exit routines, dmaengine holds module
* references to prevent it being called while channels are in use.
*/
void dma_async_device_unregister(struct dma_device *device)
{
struct dma_chan *chan;
mutex_lock(&dma_list_mutex);
list_del_rcu(&device->global_node);
dma_channel_rebalance();
mutex_unlock(&dma_list_mutex);
list_for_each_entry(chan, &device->channels, device_node) {
WARN_ONCE(chan->client_count,
"%s called while %d clients hold a reference\n",
__func__, chan->client_count);
mutex_lock(&dma_list_mutex);
chan->dev->chan = NULL;
mutex_unlock(&dma_list_mutex);
device_unregister(&chan->dev->device);
free_percpu(chan->local);
}
}
EXPORT_SYMBOL(dma_async_device_unregister);
/**
* dma_async_memcpy_buf_to_buf - offloaded copy between virtual addresses
* @chan: DMA channel to offload copy to
* @dest: destination address (virtual)
* @src: source address (virtual)
* @len: length
*
* Both @dest and @src must be mappable to a bus address according to the
* DMA mapping API rules for streaming mappings.
* Both @dest and @src must stay memory resident (kernel memory or locked
* user space pages).
*/
dma_cookie_t
dma_async_memcpy_buf_to_buf(struct dma_chan *chan, void *dest,
void *src, size_t len)
{
struct dma_device *dev = chan->device;
struct dma_async_tx_descriptor *tx;
dma_addr_t dma_dest, dma_src;
dma_cookie_t cookie;
unsigned long flags;
dma_src = dma_map_single(dev->dev, src, len, DMA_TO_DEVICE);
dma_dest = dma_map_single(dev->dev, dest, len, DMA_FROM_DEVICE);
flags = DMA_CTRL_ACK |
DMA_COMPL_SRC_UNMAP_SINGLE |
DMA_COMPL_DEST_UNMAP_SINGLE;
tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
if (!tx) {
dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
dma_unmap_single(dev->dev, dma_dest, len, DMA_FROM_DEVICE);
return -ENOMEM;
}
tx->callback = NULL;
cookie = tx->tx_submit(tx);
preempt_disable();
__this_cpu_add(chan->local->bytes_transferred, len);
__this_cpu_inc(chan->local->memcpy_count);
preempt_enable();
return cookie;
}
EXPORT_SYMBOL(dma_async_memcpy_buf_to_buf);
/**
* dma_async_memcpy_buf_to_pg - offloaded copy from address to page
* @chan: DMA channel to offload copy to
* @page: destination page
* @offset: offset in page to copy to
* @kdata: source address (virtual)
* @len: length
*
* Both @page/@offset and @kdata must be mappable to a bus address according
* to the DMA mapping API rules for streaming mappings.
* Both @page/@offset and @kdata must stay memory resident (kernel memory or
* locked user space pages)
*/
dma_cookie_t
dma_async_memcpy_buf_to_pg(struct dma_chan *chan, struct page *page,
unsigned int offset, void *kdata, size_t len)
{
struct dma_device *dev = chan->device;
struct dma_async_tx_descriptor *tx;
dma_addr_t dma_dest, dma_src;
dma_cookie_t cookie;
unsigned long flags;
dma_src = dma_map_single(dev->dev, kdata, len, DMA_TO_DEVICE);
dma_dest = dma_map_page(dev->dev, page, offset, len, DMA_FROM_DEVICE);
flags = DMA_CTRL_ACK | DMA_COMPL_SRC_UNMAP_SINGLE;
tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
if (!tx) {
dma_unmap_single(dev->dev, dma_src, len, DMA_TO_DEVICE);
dma_unmap_page(dev->dev, dma_dest, len, DMA_FROM_DEVICE);
return -ENOMEM;
}
tx->callback = NULL;
cookie = tx->tx_submit(tx);
preempt_disable();
__this_cpu_add(chan->local->bytes_transferred, len);
__this_cpu_inc(chan->local->memcpy_count);
preempt_enable();
return cookie;
}
EXPORT_SYMBOL(dma_async_memcpy_buf_to_pg);
/**
* dma_async_memcpy_pg_to_pg - offloaded copy from page to page
* @chan: DMA channel to offload copy to
* @dest_pg: destination page
* @dest_off: offset in page to copy to
* @src_pg: source page
* @src_off: offset in page to copy from
* @len: length
*
* Both @dest_page/@dest_off and @src_page/@src_off must be mappable to a bus
* address according to the DMA mapping API rules for streaming mappings.
* Both @dest_page/@dest_off and @src_page/@src_off must stay memory resident
* (kernel memory or locked user space pages).
*/
dma_cookie_t
dma_async_memcpy_pg_to_pg(struct dma_chan *chan, struct page *dest_pg,
unsigned int dest_off, struct page *src_pg, unsigned int src_off,
size_t len)
{
struct dma_device *dev = chan->device;
struct dma_async_tx_descriptor *tx;
dma_addr_t dma_dest, dma_src;
dma_cookie_t cookie;
unsigned long flags;
dma_src = dma_map_page(dev->dev, src_pg, src_off, len, DMA_TO_DEVICE);
dma_dest = dma_map_page(dev->dev, dest_pg, dest_off, len,
DMA_FROM_DEVICE);
flags = DMA_CTRL_ACK;
tx = dev->device_prep_dma_memcpy(chan, dma_dest, dma_src, len, flags);
if (!tx) {
dma_unmap_page(dev->dev, dma_src, len, DMA_TO_DEVICE);
dma_unmap_page(dev->dev, dma_dest, len, DMA_FROM_DEVICE);
return -ENOMEM;
}
tx->callback = NULL;
cookie = tx->tx_submit(tx);
preempt_disable();
__this_cpu_add(chan->local->bytes_transferred, len);
__this_cpu_inc(chan->local->memcpy_count);
preempt_enable();
return cookie;
}
EXPORT_SYMBOL(dma_async_memcpy_pg_to_pg);
void dma_async_tx_descriptor_init(struct dma_async_tx_descriptor *tx,
struct dma_chan *chan)
{
tx->chan = chan;
#ifdef CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH
spin_lock_init(&tx->lock);
#endif
}
EXPORT_SYMBOL(dma_async_tx_descriptor_init);
/* dma_wait_for_async_tx - spin wait for a transaction to complete
* @tx: in-flight transaction to wait on
*/
enum dma_status
dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
{
unsigned long dma_sync_wait_timeout = jiffies + msecs_to_jiffies(5000);
if (!tx)
return DMA_SUCCESS;
while (tx->cookie == -EBUSY) {
if (time_after_eq(jiffies, dma_sync_wait_timeout)) {
pr_err("%s timeout waiting for descriptor submission\n",
__func__);
return DMA_ERROR;
}
cpu_relax();
}
return dma_sync_wait(tx->chan, tx->cookie);
}
EXPORT_SYMBOL_GPL(dma_wait_for_async_tx);
/* dma_run_dependencies - helper routine for dma drivers to process
* (start) dependent operations on their target channel
* @tx: transaction with dependencies
*/
void dma_run_dependencies(struct dma_async_tx_descriptor *tx)
{
struct dma_async_tx_descriptor *dep = txd_next(tx);
struct dma_async_tx_descriptor *dep_next;
struct dma_chan *chan;
if (!dep)
return;
/* we'll submit tx->next now, so clear the link */
txd_clear_next(tx);
chan = dep->chan;
/* keep submitting up until a channel switch is detected
* in that case we will be called again as a result of
* processing the interrupt from async_tx_channel_switch
*/
for (; dep; dep = dep_next) {
txd_lock(dep);
txd_clear_parent(dep);
dep_next = txd_next(dep);
if (dep_next && dep_next->chan == chan)
txd_clear_next(dep); /* ->next will be submitted */
else
dep_next = NULL; /* submit current dep and terminate */
txd_unlock(dep);
dep->tx_submit(dep);
}
chan->device->device_issue_pending(chan);
}
EXPORT_SYMBOL_GPL(dma_run_dependencies);
static int __init dma_bus_init(void)
{
return class_register(&dma_devclass);
}
arch_initcall(dma_bus_init);
|
1e621ac3f290907e0d22b7ab666e7b35f7262cd5
|
ea401c3e792a50364fe11f7cea0f35f99e8f4bde
|
/released_plugins/v3d_plugins/neurontracing_neutube/src_neutube/neurolabi/mex/tz_corr.c
|
fbc8d3cfae9673866ee4f8e136f899f23da0b01e
|
[
"BSD-2-Clause",
"MIT",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"GPL-2.0-only"
] |
permissive
|
Vaa3D/vaa3d_tools
|
edb696aa3b9b59acaf83d6d27c6ae0a14bf75fe9
|
e6974d5223ae70474efaa85e1253f5df1814fae8
|
refs/heads/master
| 2023-08-03T06:12:01.013752
| 2023-08-02T07:26:01
| 2023-08-02T07:26:01
| 50,527,925
| 107
| 86
|
MIT
| 2023-05-22T23:43:48
| 2016-01-27T18:19:17
|
C++
|
UTF-8
|
C
| false
| false
| 1,175
|
c
|
tz_corr.c
|
/*********************************
* tz_convolve.c
*
* Mex function of the convolution of 2 double arrays
*
* Created by T. Zhao, 17-Sep-2007
*
* Version: 1.0
*
*********************************/
#include <mex.h>
#include <string.h>
#include "../c/tz_darray.h"
#include "tz_mexutils.h"
void mexFunction(int nlhs,mxArray *plhs[],int nrhs,const mxArray *prhs[])
{
double *conv; //temporary array to store convolution
mwSize length; //length of the convolution
if(nlhs>1)
mexErrMsgTxt("Too many outputs.");
if(nrhs!=2)
mexErrMsgTxt("Exactly 2 argument is required");
if( !tz_mxIsDoubleVector(prhs[0]) ) {
mexErrMsgTxt("The first input must be a 1D double array.");
}
if( !tz_mxIsDoubleVector(prhs[0]) ) {
mexErrMsgTxt("The second input must be a 1D array.");
}
length = tz_mxGetL(prhs[0]) + tz_mxGetL(prhs[1]) - 1;
conv = (double *) fftw_malloc(sizeof(fftw_complex)*R2C_LENGTH(length));
darray_convolve(mxGetPr(prhs[0]),tz_mxGetL(prhs[0]),
mxGetPr(prhs[1]),tz_mxGetL(prhs[1]),1,conv);
plhs[0] = mxCreateDoubleMatrix(1,length,mxREAL);
memcpy(mxGetPr(plhs[0]),conv,sizeof(double)*length);
fftw_free(conv);
}
|
2ef65cbf7ab5a8d492d99f9cafb28c0d100348b9
|
9907672fcd81ab73ac63b2a83422a82bf31eadde
|
/codeeval/tyama_codeeval39.c
|
8748f783a1aec94082513e7857c5a49d73cd1e85
|
[
"0BSD"
] |
permissive
|
cielavenir/procon
|
bbe1974b9bddb51b76d58722a0686a5b477c4456
|
746e1a91f574f20647e8aaaac0d9e6173f741176
|
refs/heads/master
| 2023-06-21T23:11:24.562546
| 2023-06-11T13:15:15
| 2023-06-11T13:15:15
| 7,557,464
| 137
| 136
| null | 2020-10-20T09:35:52
| 2013-01-11T09:40:26
|
C++
|
UTF-8
|
C
| false
| false
| 320
|
c
|
tyama_codeeval39.c
|
a[200];
int seq(n){
int r=0;
for(;n;n/=10){
r+=(n%10)*(n%10);
}
return r;
}
int search(n){
if(n==1)return 2;
if(a[n])return a[n]==3?1:a[n];
a[n]=3;
return a[n]=search(seq(n));
}
main(){
int i=2;
for(a[1]=2;i<200;i++)if(!a[i])a[i]=search(i);
for(;~scanf("%d",&i);printf("%d\n",a[i]-1))for(;i>199;)i=seq(i);
}
|
ac7307e823e659eeb6867c4f0073b9575e194b4e
|
d9bde3779ade5dc45058447e7bd5c42b3971977a
|
/print-ahcp.c
|
d57edda9e090f280c214de3a45e057d962461a7a
|
[
"BSD-3-Clause"
] |
permissive
|
the-tcpdump-group/tcpdump
|
60e6d0e705ba9a6e6c29d5d9782aff214ca4d61b
|
d6734adaa3aba89bf73eec03837b41aa064c8fb5
|
refs/heads/master
| 2023-08-14T06:11:14.949694
| 2023-08-13T07:57:20
| 2023-08-13T07:59:12
| 9,435,882
| 2,394
| 894
|
NOASSERTION
| 2023-09-12T08:53:57
| 2013-04-14T21:46:15
|
C
|
UTF-8
|
C
| false
| false
| 10,138
|
c
|
print-ahcp.c
|
/*
* Copyright (c) 2013 The TCPDUMP project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/* \summary: Ad Hoc Configuration Protocol (AHCP) printer */
/* Based on draft-chroboczek-ahcp-00 and source code of ahcpd-0.53 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "netdissect-stdinc.h"
#define ND_LONGJMP_FROM_TCHECK
#include "netdissect.h"
#include "extract.h"
#include "addrtoname.h"
#define AHCP_MAGIC_NUMBER 43
#define AHCP_VERSION_1 1
#define AHCP1_HEADER_FIX_LEN 24
#define AHCP1_BODY_MIN_LEN 4
#define AHCP1_MSG_DISCOVER 0
#define AHCP1_MSG_OFFER 1
#define AHCP1_MSG_REQUEST 2
#define AHCP1_MSG_ACK 3
#define AHCP1_MSG_NACK 4
#define AHCP1_MSG_RELEASE 5
static const struct tok ahcp1_msg_str[] = {
{ AHCP1_MSG_DISCOVER, "Discover" },
{ AHCP1_MSG_OFFER, "Offer" },
{ AHCP1_MSG_REQUEST, "Request" },
{ AHCP1_MSG_ACK, "Ack" },
{ AHCP1_MSG_NACK, "Nack" },
{ AHCP1_MSG_RELEASE, "Release" },
{ 0, NULL }
};
#define AHCP1_OPT_PAD 0
#define AHCP1_OPT_MANDATORY 1
#define AHCP1_OPT_ORIGIN_TIME 2
#define AHCP1_OPT_EXPIRES 3
#define AHCP1_OPT_MY_IPV6_ADDRESS 4
#define AHCP1_OPT_MY_IPV4_ADDRESS 5
#define AHCP1_OPT_IPV6_PREFIX 6
#define AHCP1_OPT_IPV4_PREFIX 7
#define AHCP1_OPT_IPV6_ADDRESS 8
#define AHCP1_OPT_IPV4_ADDRESS 9
#define AHCP1_OPT_IPV6_PREFIX_DELEGATION 10
#define AHCP1_OPT_IPV4_PREFIX_DELEGATION 11
#define AHCP1_OPT_NAME_SERVER 12
#define AHCP1_OPT_NTP_SERVER 13
#define AHCP1_OPT_MAX 13
static const struct tok ahcp1_opt_str[] = {
{ AHCP1_OPT_PAD, "Pad" },
{ AHCP1_OPT_MANDATORY, "Mandatory" },
{ AHCP1_OPT_ORIGIN_TIME, "Origin Time" },
{ AHCP1_OPT_EXPIRES, "Expires" },
{ AHCP1_OPT_MY_IPV6_ADDRESS, "My-IPv6-Address" },
{ AHCP1_OPT_MY_IPV4_ADDRESS, "My-IPv4-Address" },
{ AHCP1_OPT_IPV6_PREFIX, "IPv6 Prefix" },
{ AHCP1_OPT_IPV4_PREFIX, "IPv4 Prefix" },
{ AHCP1_OPT_IPV6_ADDRESS, "IPv6 Address" },
{ AHCP1_OPT_IPV4_ADDRESS, "IPv4 Address" },
{ AHCP1_OPT_IPV6_PREFIX_DELEGATION, "IPv6 Prefix Delegation" },
{ AHCP1_OPT_IPV4_PREFIX_DELEGATION, "IPv4 Prefix Delegation" },
{ AHCP1_OPT_NAME_SERVER, "Name Server" },
{ AHCP1_OPT_NTP_SERVER, "NTP Server" },
{ 0, NULL }
};
static void
ahcp_time_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
time_t t;
char buf[sizeof("-yyyyyyyyyy-mm-dd hh:mm:ss UTC")];
if (len != 4)
goto invalid;
t = GET_BE_U_4(cp);
ND_PRINT(": %s",
nd_format_time(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S UTC",
gmtime(&t)));
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp_seconds_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
if (len != 4)
goto invalid;
ND_PRINT(": %us", GET_BE_U_4(cp));
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp_ipv6_addresses_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
const char *sep = ": ";
while (len) {
if (len < 16)
goto invalid;
ND_PRINT("%s%s", sep, GET_IP6ADDR_STRING(cp));
cp += 16;
len -= 16;
sep = ", ";
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp_ipv4_addresses_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
const char *sep = ": ";
while (len) {
if (len < 4)
goto invalid;
ND_PRINT("%s%s", sep, GET_IPADDR_STRING(cp));
cp += 4;
len -= 4;
sep = ", ";
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp_ipv6_prefixes_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
const char *sep = ": ";
while (len) {
if (len < 17)
goto invalid;
ND_PRINT("%s%s/%u", sep, GET_IP6ADDR_STRING(cp), GET_U_1(cp + 16));
cp += 17;
len -= 17;
sep = ", ";
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp_ipv4_prefixes_print(netdissect_options *ndo,
const u_char *cp, uint8_t len)
{
const char *sep = ": ";
while (len) {
if (len < 5)
goto invalid;
ND_PRINT("%s%s/%u", sep, GET_IPADDR_STRING(cp), GET_U_1(cp + 4));
cp += 5;
len -= 5;
sep = ", ";
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
(* const data_decoders[AHCP1_OPT_MAX + 1])(netdissect_options *, const u_char *, uint8_t) = {
/* [AHCP1_OPT_PAD] = */ NULL,
/* [AHCP1_OPT_MANDATORY] = */ NULL,
/* [AHCP1_OPT_ORIGIN_TIME] = */ ahcp_time_print,
/* [AHCP1_OPT_EXPIRES] = */ ahcp_seconds_print,
/* [AHCP1_OPT_MY_IPV6_ADDRESS] = */ ahcp_ipv6_addresses_print,
/* [AHCP1_OPT_MY_IPV4_ADDRESS] = */ ahcp_ipv4_addresses_print,
/* [AHCP1_OPT_IPV6_PREFIX] = */ ahcp_ipv6_prefixes_print,
/* [AHCP1_OPT_IPV4_PREFIX] = */ NULL,
/* [AHCP1_OPT_IPV6_ADDRESS] = */ ahcp_ipv6_addresses_print,
/* [AHCP1_OPT_IPV4_ADDRESS] = */ ahcp_ipv4_addresses_print,
/* [AHCP1_OPT_IPV6_PREFIX_DELEGATION] = */ ahcp_ipv6_prefixes_print,
/* [AHCP1_OPT_IPV4_PREFIX_DELEGATION] = */ ahcp_ipv4_prefixes_print,
/* [AHCP1_OPT_NAME_SERVER] = */ ahcp_ipv6_addresses_print,
/* [AHCP1_OPT_NTP_SERVER] = */ ahcp_ipv6_addresses_print,
};
static void
ahcp1_options_print(netdissect_options *ndo,
const u_char *cp, uint16_t len)
{
while (len) {
uint8_t option_no, option_len;
/* Option no */
option_no = GET_U_1(cp);
cp += 1;
len -= 1;
ND_PRINT("\n\t %s", tok2str(ahcp1_opt_str, "Unknown-%u", option_no));
if (option_no == AHCP1_OPT_PAD || option_no == AHCP1_OPT_MANDATORY)
continue;
/* Length */
if (!len)
goto invalid;
option_len = GET_U_1(cp);
cp += 1;
len -= 1;
if (option_len > len)
goto invalid;
/* Value */
if (option_no <= AHCP1_OPT_MAX && data_decoders[option_no] != NULL) {
data_decoders[option_no](ndo, cp, option_len);
} else {
ND_PRINT(" (Length %u)", option_len);
ND_TCHECK_LEN(cp, option_len);
}
cp += option_len;
len -= option_len;
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
static void
ahcp1_body_print(netdissect_options *ndo,
const u_char *cp, u_int len)
{
uint8_t type, mbz;
uint16_t body_len;
if (len < AHCP1_BODY_MIN_LEN)
goto invalid;
/* Type */
type = GET_U_1(cp);
cp += 1;
len -= 1;
/* MBZ */
mbz = GET_U_1(cp);
cp += 1;
len -= 1;
/* Length */
body_len = GET_BE_U_2(cp);
cp += 2;
len -= 2;
if (ndo->ndo_vflag) {
ND_PRINT("\n\t%s", tok2str(ahcp1_msg_str, "Unknown-%u", type));
if (mbz != 0)
ND_PRINT(", MBZ %u", mbz);
ND_PRINT(", Length %u", body_len);
}
if (body_len > len)
goto invalid;
/* Options */
/* Here use "body_len", not "len" (ignore any extra data). */
if (ndo->ndo_vflag >= 2)
ahcp1_options_print(ndo, cp, body_len);
else
ND_TCHECK_LEN(cp, body_len);
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
void
ahcp_print(netdissect_options *ndo,
const u_char *cp, u_int len)
{
uint8_t version;
ndo->ndo_protocol = "ahcp";
nd_print_protocol_caps(ndo);
if (len < 2)
goto invalid;
/* Magic */
if (GET_U_1(cp) != AHCP_MAGIC_NUMBER)
goto invalid;
cp += 1;
len -= 1;
/* Version */
version = GET_U_1(cp);
cp += 1;
len -= 1;
switch (version) {
case AHCP_VERSION_1: {
ND_PRINT(" Version 1");
if (len < AHCP1_HEADER_FIX_LEN - 2)
goto invalid;
if (!ndo->ndo_vflag) {
ND_TCHECK_LEN(cp, AHCP1_HEADER_FIX_LEN - 2);
cp += AHCP1_HEADER_FIX_LEN - 2;
len -= AHCP1_HEADER_FIX_LEN - 2;
} else {
/* Hopcount */
ND_PRINT("\n\tHopcount %u", GET_U_1(cp));
cp += 1;
len -= 1;
/* Original Hopcount */
ND_PRINT(", Original Hopcount %u", GET_U_1(cp));
cp += 1;
len -= 1;
/* Nonce */
ND_PRINT(", Nonce 0x%08x", GET_BE_U_4(cp));
cp += 4;
len -= 4;
/* Source Id */
ND_PRINT(", Source Id %s", GET_LINKADDR_STRING(cp, LINKADDR_OTHER, 8));
cp += 8;
len -= 8;
/* Destination Id */
ND_PRINT(", Destination Id %s", GET_LINKADDR_STRING(cp, LINKADDR_OTHER, 8));
cp += 8;
len -= 8;
}
/* Body */
ahcp1_body_print(ndo, cp, len);
break;
}
default:
ND_PRINT(" Version %u (unknown)", version);
ND_TCHECK_LEN(cp, len);
break;
}
return;
invalid:
nd_print_invalid(ndo);
ND_TCHECK_LEN(cp, len);
}
|
310b12395e1b40dc84625024aa89bb8b3f7b2609
|
53360319eaf69ff75f34e1c2c45cbcdfd12842c9
|
/thirdparty/inteldfp/LIBRARY/src/inteldfp/bid128_sinh.c
|
68c74d8b16003d47162eaa44169fee4df9f16575
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
bloomberg/bde
|
229de23237d9cc0937ec2d0b69ef7dfcb1fa2154
|
7cc8e30c7218eaffbc31f518bd40794cc79f7282
|
refs/heads/main
| 2023-09-01T08:52:24.600136
| 2023-08-31T17:43:40
| 2023-08-31T17:43:40
| 6,619,178
| 1,429
| 338
|
Apache-2.0
| 2023-05-20T13:33:26
| 2012-11-09T20:00:30
|
C++
|
UTF-8
|
C
| false
| false
| 7,432
|
c
|
bid128_sinh.c
|
/******************************************************************************
Copyright (c) 2007-2011, Intel Corp.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
#include "bid_trans.h"
// +10^-40, used in trivial path
static BID_UINT128 BID128_10PM40 =
{BID128_LH_INIT( 0x0000000000000001ull, 0x2ff0000000000000ull )};
// Constants +1, +1/2 and -1/2 used elsewhere
static BID_UINT128 BID128_1 =
{BID128_LH_INIT( 0x0000000000000001ull, 0x3040000000000000ull )};
static BID_UINT128 BID128_POSHALF =
{BID128_LH_INIT( 0x0000000000000005ull, 0x303e000000000000ull )};
static BID_UINT128 BID128_NEGHALF =
{BID128_LH_INIT( 0x0000000000000005ull, 0xb03e000000000000ull )};
static BID_UINT128 BID128_EXP_11000 =
{BID128_LH_INIT( 0xd43ede775707fd0aull, 0x5550558ada285f8bull )};
static BID_UINT128 BID128_SHIFTER =
{BID128_LH_INIT( 0xbe00000000000000ull, 0x3040363bf3b1ceeeull )};
// +Infinity
static BID_UINT128 BID128_INF =
{BID128_LH_INIT( 0x0000000000000000ull, 0x7800000000000000ull )};
BID_F128_CONST_DEF(c_1em40, 3f7a16c262777579, c58c46475896767b); // 1e-40
BID_F128_CONST_DEF(c_one, 3fff000000000000, 0000000000000000); // 1
BID_F128_CONST_DEF(c_half, 3ffe000000000000, 0000000000000000); // .5
BID_F128_CONST_DEF(c_minus_half, bffe000000000000, 0000000000000000); // .5
BID_F128_CONST_DEF(c_zero, 0000000000000000, 0000000000000000); // 0
BID_F128_CONST_DEF(c_11000, 400c57c000000000, 0000000000000000); // 11000
BID_F128_CONST_DEF(c_64, 4005000000000000, 0000000000000000); // 64
BID128_FUNCTION_ARG1 (bid128_sinh, x)
// Declare local variables
BID_UINT128 res;
BID_F128_TYPE xd, yd, abs_xd, rt;
// Check for NaN and just return the same NaN, quieted and canonized
if ((x.w[BID_HIGH_128W] & NAN_MASK64) == NAN_MASK64)
{
#ifdef BID_SET_STATUS_FLAGS
if (((x.w[BID_HIGH_128W] & SNAN_MASK64) == SNAN_MASK64))
__set_status_flags (pfpsf, BID_INVALID_EXCEPTION);
#endif
res.w[BID_HIGH_128W] = x.w[BID_HIGH_128W] & 0xfc003fffffffffffull;
res.w[BID_LOW_128W] = x.w[BID_LOW_128W];
if (((res.w[BID_HIGH_128W] & 0x00003fffffffffffull) >
0x0000314dc6448d93ull) ||
(((res.w[BID_HIGH_128W] & 0x00003fffffffffffull) ==
0x0000314dc6448d93ull) &&
res.w[BID_LOW_128W] >= 0x38c15b0a00000000ull))
{ res.w[BID_HIGH_128W] &= ~0x00003fffffffffffull;
res.w[BID_LOW_128W] = 0ull;
}
BID_RETURN(res);
}
// Deal with infinite inputs
if ((x.w[BID_HIGH_128W] & INFINITY_MASK64) == INFINITY_MASK64)
{ BIDECIMAL_CALL2_NORND_NOSTAT(bid128_copySign, res,BID128_INF, x);
BID_RETURN(res);
}
// Convert to binary
BIDECIMAL_CALL1(bid128_to_binary128,xd,x);
// If the input is really small, the result is about x + x^3/3, which
// we do weakly just to make sure all the directed roundings are OK.
__bid_f128_fabs(abs_xd, xd);
if (__bid_f128_le(abs_xd, c_1em40.v))
{ BIDECIMAL_CALL3(bid128_fma,res,x,BID128_10PM40,x);
BID_RETURN(res);
}
// Otherwise if the input is <= 1 in magnitude, the naive computation is
// well-conditioned and will neither overflow nor underflow
else if (__bid_f128_le(abs_xd, c_one.v))
{ __bid_f128_sinh(yd, xd);
BIDECIMAL_CALL1(binary128_to_bid128,res,yd);
BID_RETURN(res);
}
// Otherwise, unless the input is totally huge, just "using the formula"
// sinh(x) = (e^x - e^-x) / 2 is OK, but we need to to it directly in
// decimal so that we don't hit ill-conditioning. Also use an FMA to try
// to minimize the additional rounding errors, and take care to isolate
// which is the dominant part to control these errors better: it depends
// on the sign of the input.
else if (__bid_f128_le(abs_xd, c_64.v))
{ BID_UINT128 e, i;
if (__bid_f128_le(c_zero.v, xd))
{ BIDECIMAL_CALL1(bid128_exp,e,x);
BIDECIMAL_CALL2(bid128_div,i,BID128_1,e);
BIDECIMAL_CALL2(bid128_mul,i,BID128_NEGHALF,i);
BIDECIMAL_CALL3(bid128_fma,res,e,BID128_POSHALF,i);
}
else
{ x.w[BID_HIGH_128W] &= 0x7FFFFFFFFFFFFFFFull;
BIDECIMAL_CALL1(bid128_exp,e,x);
BIDECIMAL_CALL2(bid128_div,i,BID128_1,e);
BIDECIMAL_CALL2(bid128_mul,i,BID128_POSHALF,i);
BIDECIMAL_CALL3(bid128_fma,res,e,BID128_NEGHALF,i);
}
BID_RETURN (res);
}
// For huge arguments, it's effectively +/- exp |x| / 2.
// We need to copy and tweak the exp code rather than call it
// in order to avoid cases where e^x/2 < MAXNUM < e^x.
else
{ BID_UINT128 m, n, t;
BID_F128_TYPE rd, md, nd;
x.w[BID_HIGH_128W] &= 0x7FFFFFFFFFFFFFFFull;
BIDECIMAL_CALL2(bid128_add, t, x, BID128_SHIFTER);
BIDECIMAL_CALL2(bid128_sub, n, t, BID128_SHIFTER);
BIDECIMAL_CALL2(bid128_sub, m, x, n);
BIDECIMAL_CALL1(bid128_to_binary128, nd, n);
BIDECIMAL_CALL1(bid128_to_binary128, md, m);
if (__bid_f128_gt(nd, c_11000.v))
{
__bid_f128_sub(nd, nd, c_11000.v);
__bid_f128_exp(rd, nd);
__bid_f128_exp(rt, md);
__bid_f128_mul(rd, rd, rt);
if (__bid_f128_lt(xd, c_zero.v))
__bid_f128_mul(rd, c_minus_half.v, rd);
else
__bid_f128_mul(rd, c_half.v, rd);
BIDECIMAL_CALL1 (binary128_to_bid128, res, rd);
BIDECIMAL_CALL2 (bid128_mul, res, res, BID128_EXP_11000);
}
else
{
__bid_f128_exp(rd, nd);
__bid_f128_exp(rt, md);
__bid_f128_mul(rd, rd, rt);
if (__bid_f128_lt(xd, c_zero.v))
__bid_f128_mul(rd, c_minus_half.v, rd);
else
__bid_f128_mul(rd, c_half.v, rd);
BIDECIMAL_CALL1 (binary128_to_bid128, res, rd);
}
BID_RETURN (res);
}
}
|
b52bc0b1b9ff93e56f1a4c263e83e71d1298b5af
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/libcpu/risc-v/virt64/vector_encoding.h
|
5445843f064f55a201a55caa6555b9c1809c4412
|
[
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 1,301
|
h
|
vector_encoding.h
|
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-10-10 RT-Thread the first version,
* compatible to riscv-v-spec-1.0
*/
#ifndef __VECTOR_ENCODING_H__
#define __VECTOR_ENCODING_H__
/**
* assembler names used for vset{i}vli vtypei immediate
*/
#define VEC_IMM_SEW_8 e8
#define VEC_IMM_SEW_16 e16
#define VEC_IMM_SEW_32 e32
#define VEC_IMM_SEW_64 e64
/* group setting, encoding by multiplier */
#define VEC_IMM_LMUL_F8 mf8
#define VEC_IMM_LMUL_F4 mf4
#define VEC_IMM_LMUL_F2 mf2
#define VEC_IMM_LMUL_1 m1
#define VEC_IMM_LMUL_2 m2
#define VEC_IMM_LMUL_4 m4
#define VEC_IMM_LMUL_8 m8
/* TAIL & MASK agnostic bits */
#define VEC_IMM_TAIL_AGNOSTIC ta
#define VEC_IMM_MASK_AGNOSTIC ma
#define VEC_IMM_TAMA VEC_IMM_TAIL_AGNOSTIC, VEC_IMM_MASK_AGNOSTIC
#define VEC_IMM_TAMU VEC_IMM_TAIL_AGNOSTIC
#define VEC_IMM_TUMA VEC_IMM_MASK_AGNOSTIC
/**
* configuration setting instruction
*/
#define VEC_CONFIG_SETVLI(xVl, xAvl, vtype...) vsetvli xVl, xAvl, ##vtype
#define VEC_CONFIG_SET_VL_VTYPE(xVl, xVtype) vsetvl x0, xVl, xVtype
#endif /* __VECTOR_ENCODING_H__ */
|
5ec843b93eb27efe9a343c52b9d9137feeef2141
|
6432ea7a083ff6ba21ea17af9ee47b9c371760f7
|
/stage0/stdlib/Lean/Compiler/IR/EmitLLVM.c
|
961b062452b2bf504dd903f6bebef2a16148b95f
|
[
"Apache-2.0",
"LLVM-exception",
"NCSA",
"LGPL-3.0-only",
"LicenseRef-scancode-inner-net-2.0",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"Spencer-94",
"LGPL-2.1-or-later",
"HPND",
"LicenseRef-scancode-pcre",
"ISC",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"SunPro",
"CMU-Mach"
] |
permissive
|
leanprover/lean4
|
4bdf9790294964627eb9be79f5e8f6157780b4cc
|
f1f9dc0f2f531af3312398999d8b8303fa5f096b
|
refs/heads/master
| 2023-08-30T01:57:45.786981
| 2023-08-29T23:14:28
| 2023-08-29T23:14:28
| 129,571,436
| 2,827
| 311
|
Apache-2.0
| 2023-09-14T18:29:16
| 2018-04-15T02:49:20
|
Lean
|
UTF-8
|
C
| false
| false
| 1,169,037
|
c
|
EmitLLVM.c
|
// Lean compiler output
// Module: Lean.Compiler.IR.EmitLLVM
// Imports: Init Lean.Data.HashMap Lean.Runtime Lean.Compiler.NameMangling Lean.Compiler.ExportAttr Lean.Compiler.InitAttr Lean.Compiler.IR.CompilerM Lean.Compiler.IR.EmitUtil Lean.Compiler.IR.NormIds Lean.Compiler.IR.SimpCase Lean.Compiler.IR.Boxing Lean.Compiler.IR.ResetReuse Lean.Compiler.IR.LLVMBindings
#include <lean/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_EXPORT lean_object* lean_ir_emit_llvm(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callIODeclInitFn(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgVal___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Util_0__outOfBounds___rarg(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitJmp___closed__1;
lean_object* lean_llvm_function_type(size_t, size_t, lean_object*, uint8_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5;
lean_object* lean_format_pretty(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__1(size_t, lean_object*, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals_go___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_get_first_function(size_t, size_t, lean_object*);
uint8_t l_Array_anyMUnsafe_any___at_Lean_IR_ensureHasDefault___spec__1(lean_object*, size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitApp(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_LLVM_i16Type(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitTaskManager(size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_add_case(size_t, size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2(size_t, size_t, size_t, size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind___boxed(lean_object*);
lean_object* lean_llvm_append_basic_block_in_context(size_t, size_t, lean_object*, lean_object*);
extern lean_object* l_Lean_IR_instInhabitedAlt;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___closed__5;
LEAN_EXPORT lean_object* l_Lean_IR_LLVM_size__tType___boxed(lean_object*, lean_object*);
extern lean_object* l_UInt32_size;
uint32_t lean_string_utf8_get(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___closed__5;
static lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorRelease(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitNumLit___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5(size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnArgs___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1;
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitCtorSetArgs___spec__1(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkString(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals_go(size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions(size_t, size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternDeclAux___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_uint32_to_nat(uint32_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___rarg___boxed(lean_object*, lean_object*);
lean_object* lean_llvm_get_insert_block(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVars(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_System_FilePath_join(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgVal(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMainFn(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitApp___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4(size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDel___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___lambda__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_constIntUnsigned(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitJp___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_emitInitFn___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2;
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_ConstantInfo_type(lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1;
lean_object* lean_ir_find_env_decl(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__1(size_t, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getFunIdTy(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg(uint8_t, uint8_t, lean_object*);
uint64_t lean_uint64_of_nat(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitTailCall___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitReuse___closed__1;
lean_object* lean_llvm_build_sext_or_trunc(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1;
lean_object* lean_llvm_build_switch(size_t, size_t, size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg(uint8_t, uint8_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_const_int(size_t, size_t, uint64_t, uint8_t, lean_object*);
lean_object* lean_llvm_get_value_name2(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4(lean_object*, lean_object*);
lean_object* lean_llvm_set_tail_call(size_t, size_t, uint8_t, lean_object*);
lean_object* l_Lean_Name_toString(lean_object*, uint8_t);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2;
LEAN_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__1___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_getInitFnNameForCore_x3f(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitPartialApp(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDec(size_t, size_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_LLVM_size__tType(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_toCtorIdx(uint8_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtorSetArgs___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitApp___closed__3;
lean_object* lean_array_push(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1;
static lean_object* l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__3;
lean_object* l_LLVM_i8Type(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2(lean_object*, uint8_t, size_t, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitTailCall___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsError(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_mk_array(lean_object*, lean_object*);
uint8_t lean_usize_dec_eq(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_builtinInitAttr;
lean_object* l_LLVM_constInt64(size_t, uint64_t, uint8_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnreachable___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsOk(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_write_bitcode_to_file(size_t, size_t, lean_object*, lean_object*);
lean_object* l_Lean_getExternEntryFor(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toHexDigit___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildWhile_____boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_fget(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern uint64_t l_LLVM_Linkage_internal;
lean_object* lean_array_fset(lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_zext(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
static lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanDecRef(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_FnBody_isTerminal(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__6;
lean_object* lean_environment_find(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgSlot_____boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_RBNode_insert___at_Lean_NameSet_insert___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__4(lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_emitLLVM___closed__2;
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3(size_t, lean_object*, lean_object*);
uint8_t l_Lean_isClosedTermName(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__5;
static lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFnIfNeeded___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1(size_t, size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4(lean_object*, size_t, size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitCtor___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanBox___closed__2;
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitTailCall___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitBox___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_Context_jpMap___default;
lean_object* lean_llvm_build_call2(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_get_target_from_triple(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3;
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitialize___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_string_dec_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnBody___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_get_named_global(size_t, size_t, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitTag___closed__2;
uint8_t l___private_Init_Data_Option_Basic_0__beqOption____x40_Init_Data_Option_Basic___hyg_1116____at_Lean_IR_IRType_beq___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderGetInsertionFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_mul(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet___lambda__1(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_unreachable(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM(size_t, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_IR_instInhabitedParam;
static lean_object* l_Lean_IR_EmitLLVM_emitBlock___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion(lean_object*);
lean_object* lean_string_utf8_byte_size(lean_object*);
lean_object* lean_mk_module_initialization_function_name(lean_object*);
lean_object* lean_string_push(lean_object*, uint32_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFullApp(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Expr_appArg_x21(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnreachable(size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_hasInitAttr(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFns(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCStrToNatFn(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___spec__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___spec__1(size_t, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__5;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getFunIdTy___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1(size_t, lean_object*, lean_object*, size_t);
lean_object* l_Lean_IR_Decl_resultType(lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultShowError(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toLLVMType___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___rarg___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn(size_t, size_t, uint8_t, uint8_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitCtorSetArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanSetPanicMessages(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTag(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toLLVMType___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorRelease___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBTree_toList___at_Lean_IR_EmitLLVM_emitFnDecls___spec__3(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanClosureSetFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1;
lean_object* l_LLVM_constInt8(size_t, uint64_t, uint8_t, lean_object*);
lean_object* llvm_get_param(size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDecl(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_main___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_global_string(size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternCall(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions_go___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
size_t lean_usize_of_nat(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUSet(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_array_type(size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitFns___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1;
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2(size_t, lean_object*, lean_object*);
lean_object* l_LLVM_getOrAddFunction(size_t, size_t, lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsExclusive___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_IRType_isIrrelevant(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitTag___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJp(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1;
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitAllocCtor___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_dispose_pass_manager_builder(size_t, size_t, lean_object*);
lean_object* lean_st_ref_take(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1;
LEAN_EXPORT lean_object* l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_string_utf8_next(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__3;
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitProj(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addJpTostate(size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_usesModuleFrom(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFns___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_LLVM_constInt32(size_t, uint64_t, uint8_t, lean_object*);
lean_object* l_Lean_IR_Decl_params(lean_object*);
lean_object* l_Array_zip___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanMkString___closed__1;
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5;
lean_object* lean_llvm_initialize_target_info(lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2;
lean_object* lean_get_init_fn_name_for(lean_object*, lean_object*);
uint32_t l_Nat_digitChar(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4;
uint8_t l_LLVM_Value_isNull___rarg(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkString___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse__(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitialize(size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_get_undef(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultShowError___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__2;
lean_object* lean_nat_div(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1(size_t, lean_object*, lean_object*, size_t, size_t, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_create_context(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__1;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_closureMaxArgs;
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj___lambda__1(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern uint64_t l_LLVM_CodegenFileType_ObjectFile;
lean_object* lean_llvm_create_pass_manager(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__2(size_t, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_exportAttr;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion(lean_object*);
lean_object* lean_llvm_parse_bitcode(size_t, size_t, lean_object*);
lean_object* l_List_range(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_optimizeLLVMModule(size_t, size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___rarg___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsScalar(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_isExternC(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_create_builder_in_context(size_t, lean_object*);
lean_object* lean_llvm_build_cond_br(size_t, size_t, size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(size_t, lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtor___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___rarg(lean_object*);
lean_object* lean_uint64_to_nat(uint64_t);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitJmp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_Decl_name(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, size_t, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_set_linkage(size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_ret(size_t, size_t, size_t, lean_object*);
lean_object* lean_llvm_pass_manager_builder_populate_module_pass_manager(size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_optimizeLLVMModule___boxed(lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_target_machine_emit_to_file(size_t, size_t, size_t, lean_object*, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitIsShared___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_inbounds_gep2(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanClosureSetFn(size_t, size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitInitFn___closed__3;
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6;
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2;
lean_object* lean_st_ref_get(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___lambda__1(lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGetUsize(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_pop(lean_object*);
uint8_t l_Lean_IR_IRType_isObj(lean_object*);
static lean_object* l_Lean_IR_getLeanHBcPath___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3;
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1(size_t, size_t, lean_object*, size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVars___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_FnBody_body(lean_object*);
lean_object* lean_st_mk_ref(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDel(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitOffset___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrAddFunIdValue(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGet(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSetTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3(size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__5;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux(size_t, size_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_gep2(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___lambda__1(size_t, size_t, lean_object*, lean_object*, lean_object*);
uint64_t llvm_count_params(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitReset___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn(size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitJDecl___closed__1;
lean_object* l_LLVM_constFalse(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__6;
lean_object* l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatIRType(lean_object*);
lean_object* l_List_replicateTR___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitAllocCtor(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecl(size_t, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__6;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_br(size_t, size_t, size_t, lean_object*);
lean_object* l_Lean_Expr_constName_x3f(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__5;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callPureDeclInitFn(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName(size_t);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot_____boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanObjTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSimpleExternalCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_foldr___at_Lean_IR_EmitLLVM_hasMainFn___spec__1___boxed(lean_object*, lean_object*);
lean_object* lean_llvm_opaque_pointer_type_in_context(size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___boxed(lean_object*);
extern uint64_t l_LLVM_IntPredicate_NE;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_dispose_target_machine(size_t, size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3;
extern uint64_t l_LLVM_IntPredicate_UGT;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDel___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1;
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitTailCall___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_name_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_position_builder_at_end(lean_object*, size_t, size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDec___closed__2;
lean_object* l_Lean_Name_str___override(lean_object*, lean_object*);
lean_object* lean_llvm_build_not(size_t, size_t, size_t, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__2;
extern lean_object* l_Lean_IR_instInhabitedArg;
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__7;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitOffset(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_set_dll_storage_class(size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderAppendBasicBlock(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitPartialApp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1(size_t, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___closed__1;
LEAN_EXPORT lean_object* l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addVartoState___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callPureDeclInitFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Util_0__mkPanicMessageWithDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsVal___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___spec__1(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocClosureFn(size_t, size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSet(size_t, size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSet(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_quoteString___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(size_t, size_t, size_t, lean_object*, lean_object*, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_main(size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callModInitFn(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toLLVMType___closed__4;
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsError___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_getExternNameFor(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitJp___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJDecl(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__4;
static lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5(size_t, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Std_Format_defWidth;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsScalar___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderAppendBasicBlock___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___spec__3(size_t, lean_object*, size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_toCtorIdx___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCase(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__6;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4;
lean_object* lean_llvm_create_memory_buffer_with_contents_of_file(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitVDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___boxed(lean_object*);
size_t lean_hashmap_mk_idx(lean_object*, uint64_t);
static lean_object* l_Lean_IR_EmitLLVM_buildWhile_____closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___lambda__1(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanBox___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___boxed(lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2;
lean_object* lean_llvm_run_pass_manager(size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFullApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Array_append___rarg(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg___boxed(lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2;
static lean_object* l_Lean_IR_emitLLVM___closed__1;
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__2(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_buildWhile_____closed__1;
static lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4;
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_IR_EmitLLVM_IRType_isIntegerType(lean_object*);
lean_object* lean_llvm_set_initializer(size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4(size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization(size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_constIntUnsigned___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addVartoState(size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callIODeclInitFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUProj___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecls___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsVal(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnboxUint32___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildWhile__(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6(size_t, size_t, size_t, size_t, lean_object*, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1;
lean_object* lean_get_prefix(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDec___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitIsShared(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVar(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_toCtorIdx(uint8_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitNumLit(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_NameSet_empty;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toLLVMType(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnboxUint32(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_addVartoState___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_add(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
lean_object* l_LLVM_getOrAddGlobal(size_t, size_t, lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__2(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCase___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern uint64_t l_LLVM_DLLStorageClass_export;
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitPartialApp___spec__1(size_t, size_t, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDecl___closed__2;
LEAN_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__2(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDecl___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__3;
lean_object* l_Lean_Expr_getForallBody(lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
lean_object* lean_llvm_create_module(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_IRType_isIntegerType___boxed(lean_object*);
lean_object* lean_llvm_build_sub(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___lambda__1(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_instInhabitedConstantInfo;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1;
lean_object* lean_llvm_get_named_function(size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtorSetArgs(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_mod(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitInitFn___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_buildWhile_____closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitVDecl(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1;
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnbox(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgSlot__(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitBox___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1;
lean_object* l_LLVM_i32Type(size_t, lean_object*);
lean_object* l_LLVM_constIntUnsigned(size_t, uint64_t, uint8_t, lean_object*);
uint8_t lean_uint32_dec_eq(uint32_t, uint32_t);
lean_object* lean_llvm_clear_insertion_position(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVar___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_declareVar___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitDecl___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitTaskManager___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitArgSlot_____closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen__(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_getDecls(lean_object*);
lean_object* l_Lean_ParametricAttribute_getParam_x3f___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_isTailCallTo(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnArgs(size_t, size_t, uint8_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsExclusive(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____closed__3;
static lean_object* l_Lean_IR_EmitLLVM_emitApp___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___rarg___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2;
uint8_t l_Lean_IR_ExplicitBoxing_isBoxedName(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1;
static lean_object* l_Lean_IR_leanMainFn___closed__1;
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_double_type_in_context(size_t, lean_object*);
lean_object* lean_llvm_get_next_function(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callModInitFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_NameSet_contains(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtor(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitCase___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSet___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_store(size_t, size_t, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions_go(size_t, size_t, lean_object*, lean_object*);
lean_object* lean_panic_fn(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_AltCore_body(lean_object*);
lean_object* lean_nat_sub(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*);
lean_object* l_Lean_IR_mkVarJPMaps(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___boxed(lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1;
lean_object* lean_llvm_dispose_module(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_mul(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrAddFunIdValue___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot__(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_getLeanHBcPath(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___closed__4;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMainFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_pointer_type(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_Context_mainFn___default;
static lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSetTag(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_icmp(size_t, size_t, uint64_t, size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitSimpleExternalCall___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_alloca(size_t, size_t, size_t, lean_object*, lean_object*);
lean_object* l_Array_back___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule(size_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSimpleExternalCall(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager(size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternCall___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_reverse___rarg(lean_object*);
lean_object* lean_llvm_get_first_global(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInc___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Environment_imports(lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1;
lean_object* l_Lean_mkHashMapImp___rarg(lean_object*);
lean_object* lean_ir_decl_to_string(lean_object*);
lean_object* lean_llvm_create_pass_manager_builder(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlotStore___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecls(size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5(size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__1(lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInc(size_t, size_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitCase___closed__1;
size_t lean_usize_add(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_instInhabitedName;
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1(size_t, lean_object*, lean_object*);
lean_object* lean_array_uget(lean_object*, size_t);
static lean_object* l_Lean_IR_EmitLLVM_emitSSet___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_emitUSet___closed__1;
lean_object* l_LLVM_i1Type(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_Context_mainParams___default;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4;
lean_object* lean_llvm_get_basic_block_parent(size_t, size_t, lean_object*);
lean_object* lean_llvm_get_default_target_triple(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_quoteString(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2;
lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind(uint8_t);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnBody(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toHexDigit(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___boxed(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_List_redLength___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3(size_t, size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_void_type_in_context(size_t, lean_object*);
lean_object* lean_llvm_pass_manager_builder_set_opt_level(size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitPartialApp___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanDecRef___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* llvm_is_declaration(size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___rarg(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_string_append(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderGetInsertionFn(size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4;
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__5;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitJmp___spec__1(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitTailCall___spec__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
extern uint64_t l_LLVM_Visibility_hidden;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ensureHasDefault_x27(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnbox___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_quoteString___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitDec___closed__1;
lean_object* lean_array_get_size(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toLLVMType___closed__1;
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2(size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_emitMainFn___spec__1(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1;
lean_object* lean_name_mangle(lean_object*, lean_object*);
lean_object* lean_llvm_dispose_pass_manager(size_t, size_t, lean_object*);
lean_object* l_LLVM_i64Type(size_t, lean_object*);
uint8_t l_Lean_isIOUnitInitFn(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUProj(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2(size_t, size_t, lean_object*, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitBox___closed__1;
lean_object* l_LLVM_voidPtrType(size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_usize_dec_lt(size_t, size_t);
static lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2;
static lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName(size_t);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanBox(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_collectUsedDecls(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitFns___spec__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___spec__1(size_t, size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_IR_Decl_normalizeIds(lean_object*);
lean_object* lean_nat_add(lean_object*, lean_object*);
lean_object* lean_llvm_build_sext(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__3(size_t, lean_object*, lean_object*, uint8_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1;
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__4___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3;
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1;
lean_object* l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatExpr(lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitSimpleExternalCall___spec__1(size_t, size_t, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitJp___closed__1;
lean_object* lean_llvm_link_modules(size_t, size_t, size_t, lean_object*);
lean_object* lean_get_libdir(lean_object*, lean_object*);
lean_object* lean_llvm_set_visibility(size_t, size_t, uint64_t, lean_object*);
LEAN_EXPORT lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSetTag___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__5(size_t, size_t, size_t, uint64_t, size_t, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toLLVMType___closed__3;
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1(size_t, lean_object*, lean_object*, lean_object*);
lean_object* l_LLVM_constTrue(size_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1;
lean_object* lean_array_uset(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_toCtorIdx___boxed(lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanObjTag(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitBox___closed__4;
static lean_object* l_Lean_IR_EmitLLVM_emitSProj___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlotStore(size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_build_load2(size_t, size_t, size_t, size_t, lean_object*, lean_object*);
lean_object* lean_llvm_int_type_in_context(size_t, uint64_t, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toLLVMType___closed__5;
LEAN_EXPORT uint8_t l_List_foldr___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(uint8_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2(size_t);
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2___boxed(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_emitUnreachable___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse(size_t, size_t, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_IR_IRType_isScalar(lean_object*);
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2(size_t, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2(size_t, size_t, size_t, lean_object*, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Nat_repr(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__2(lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3(size_t, size_t, lean_object*, size_t, size_t, size_t, uint64_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_toCName___rarg___closed__2;
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addJpTostate___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternDeclAux(size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_leanMainFn;
static lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___closed__2;
lean_object* lean_llvm_create_target_machine(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld(size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* l_List_toArrayAux___rarg(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1;
lean_object* l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDecl___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Array_isEmpty___rarg(lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSetTag(size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFnIfNeeded(size_t, size_t, size_t, lean_object*, lean_object*, lean_object*);
lean_object* lean_llvm_get_next_global(size_t, size_t, lean_object*);
static lean_object* _init_l_Lean_IR_leanMainFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_lean_main", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_leanMainFn() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_IR_leanMainFn___closed__1;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_LLVM_size__tType(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = l_LLVM_i64Type(x_1, x_2);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
return x_3;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
lean_inc(x_6);
lean_inc(x_5);
lean_dec(x_3);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_5);
lean_ctor_set(x_7, 1, x_6);
return x_7;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_LLVM_size__tType___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_LLVM_size__tType(x_3, x_2);
return x_4;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(8u);
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_Context_jpMap___default() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1;
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_Context_mainFn___default() {
_start:
{
lean_object* x_1;
x_1 = lean_box(0);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_Context_mainParams___default() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Error: inhabitant", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2;
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_2);
lean_ctor_set(x_3, 1, x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
x_5 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_instInhabitedM___rarg), 1, 0);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instInhabitedM___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_IR_EmitLLVM_instInhabitedM(x_5, x_2, x_3, x_4);
lean_dec(x_4);
lean_dec(x_3);
return x_6;
}
}
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4;
x_4 = 0;
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 2);
x_7 = lean_nat_dec_eq(x_5, x_2);
if (x_7 == 0)
{
x_3 = x_6;
goto _start;
}
else
{
uint8_t x_9;
x_9 = 1;
return x_9;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_dec(x_2);
return x_3;
}
else
{
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; uint64_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 2);
x_8 = lean_array_get_size(x_3);
lean_inc(x_2);
lean_inc(x_6);
x_9 = lean_apply_1(x_2, x_6);
x_10 = lean_unbox_uint64(x_9);
lean_dec(x_9);
x_11 = lean_hashmap_mk_idx(x_8, x_10);
x_12 = lean_array_uget(x_3, x_11);
lean_ctor_set(x_4, 2, x_12);
x_13 = lean_array_uset(x_3, x_11, x_4);
x_3 = x_13;
x_4 = x_7;
goto _start;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; uint64_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_15 = lean_ctor_get(x_4, 0);
x_16 = lean_ctor_get(x_4, 1);
x_17 = lean_ctor_get(x_4, 2);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_4);
x_18 = lean_array_get_size(x_3);
lean_inc(x_2);
lean_inc(x_15);
x_19 = lean_apply_1(x_2, x_15);
x_20 = lean_unbox_uint64(x_19);
lean_dec(x_19);
x_21 = lean_hashmap_mk_idx(x_18, x_20);
x_22 = lean_array_uget(x_3, x_21);
x_23 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_23, 0, x_15);
lean_ctor_set(x_23, 1, x_16);
lean_ctor_set(x_23, 2, x_22);
x_24 = lean_array_uset(x_3, x_21, x_23);
x_3 = x_24;
x_4 = x_17;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
return x_2;
}
else
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint64_t x_8; size_t x_9; lean_object* x_10; lean_object* x_11;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 2);
x_7 = lean_array_get_size(x_2);
x_8 = lean_uint64_of_nat(x_5);
x_9 = lean_hashmap_mk_idx(x_7, x_8);
x_10 = lean_array_uget(x_2, x_9);
lean_ctor_set(x_3, 2, x_10);
x_11 = lean_array_uset(x_2, x_9, x_3);
x_2 = x_11;
x_3 = x_6;
goto _start;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint64_t x_17; size_t x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_13 = lean_ctor_get(x_3, 0);
x_14 = lean_ctor_get(x_3, 1);
x_15 = lean_ctor_get(x_3, 2);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_3);
x_16 = lean_array_get_size(x_2);
x_17 = lean_uint64_of_nat(x_13);
x_18 = lean_hashmap_mk_idx(x_16, x_17);
x_19 = lean_array_uget(x_2, x_18);
x_20 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_20, 0, x_13);
lean_ctor_set(x_20, 1, x_14);
lean_ctor_set(x_20, 2, x_19);
x_21 = lean_array_uset(x_2, x_18, x_20);
x_2 = x_21;
x_3 = x_15;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4(size_t 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_3);
x_6 = lean_nat_dec_lt(x_2, x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_dec(x_3);
lean_dec(x_2);
return x_4;
}
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_array_fget(x_3, x_2);
x_8 = lean_box(0);
x_9 = lean_array_fset(x_3, x_2, x_8);
x_10 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6(x_1, x_4, x_7);
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_2, x_11);
lean_dec(x_2);
x_2 = x_12;
x_3 = x_9;
x_4 = x_10;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3(size_t 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 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(2u);
x_6 = lean_nat_mul(x_4, x_5);
lean_dec(x_4);
x_7 = lean_box(0);
x_8 = lean_mk_array(x_6, x_7);
x_9 = lean_unsigned_to_nat(0u);
x_10 = l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4(x_1, x_9, x_3, x_8);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_2);
lean_ctor_set(x_11, 1, x_10);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5;
lean_dec(x_3);
lean_dec(x_2);
x_5 = lean_box(0);
return x_5;
}
else
{
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; uint8_t x_10;
x_7 = lean_ctor_get(x_4, 0);
x_8 = lean_ctor_get(x_4, 1);
x_9 = lean_ctor_get(x_4, 2);
x_10 = lean_nat_dec_eq(x_7, x_2);
if (x_10 == 0)
{
lean_object* x_11;
x_11 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(x_1, x_2, x_3, x_9);
lean_ctor_set(x_4, 2, x_11);
return x_4;
}
else
{
lean_dec(x_8);
lean_dec(x_7);
lean_ctor_set(x_4, 1, x_3);
lean_ctor_set(x_4, 0, x_2);
return x_4;
}
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15;
x_12 = lean_ctor_get(x_4, 0);
x_13 = lean_ctor_get(x_4, 1);
x_14 = lean_ctor_get(x_4, 2);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_4);
x_15 = lean_nat_dec_eq(x_12, x_2);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
x_16 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(x_1, x_2, x_3, x_14);
x_17 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_17, 0, x_12);
lean_ctor_set(x_17, 1, x_13);
lean_ctor_set(x_17, 2, x_16);
return x_17;
}
else
{
lean_object* x_18;
lean_dec(x_13);
lean_dec(x_12);
x_18 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_18, 0, x_2);
lean_ctor_set(x_18, 1, x_3);
lean_ctor_set(x_18, 2, x_14);
return x_18;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_2);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint64_t x_9; size_t x_10; lean_object* x_11; uint8_t x_12;
x_6 = lean_ctor_get(x_2, 0);
x_7 = lean_ctor_get(x_2, 1);
x_8 = lean_array_get_size(x_7);
x_9 = lean_uint64_of_nat(x_3);
lean_inc(x_8);
x_10 = lean_hashmap_mk_idx(x_8, x_9);
x_11 = lean_array_uget(x_7, x_10);
x_12 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2(x_1, x_3, 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; uint8_t x_18;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_add(x_6, x_13);
lean_dec(x_6);
x_15 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_15, 0, x_3);
lean_ctor_set(x_15, 1, x_4);
lean_ctor_set(x_15, 2, x_11);
x_16 = lean_array_uset(x_7, x_10, x_15);
x_17 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_14);
x_18 = lean_nat_dec_le(x_17, x_8);
lean_dec(x_8);
lean_dec(x_17);
if (x_18 == 0)
{
lean_object* x_19;
lean_free_object(x_2);
x_19 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3(x_1, x_14, x_16);
return x_19;
}
else
{
lean_ctor_set(x_2, 1, x_16);
lean_ctor_set(x_2, 0, x_14);
return x_2;
}
}
else
{
lean_object* x_20; lean_object* x_21;
lean_dec(x_8);
x_20 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(x_1, x_3, x_4, x_11);
x_21 = lean_array_uset(x_7, x_10, x_20);
lean_ctor_set(x_2, 1, x_21);
return x_2;
}
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; uint64_t x_25; size_t x_26; lean_object* x_27; uint8_t x_28;
x_22 = lean_ctor_get(x_2, 0);
x_23 = lean_ctor_get(x_2, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_2);
x_24 = lean_array_get_size(x_23);
x_25 = lean_uint64_of_nat(x_3);
lean_inc(x_24);
x_26 = lean_hashmap_mk_idx(x_24, x_25);
x_27 = lean_array_uget(x_23, x_26);
x_28 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2(x_1, x_3, x_27);
if (x_28 == 0)
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; uint8_t x_34;
x_29 = lean_unsigned_to_nat(1u);
x_30 = lean_nat_add(x_22, x_29);
lean_dec(x_22);
x_31 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_31, 0, x_3);
lean_ctor_set(x_31, 1, x_4);
lean_ctor_set(x_31, 2, x_27);
x_32 = lean_array_uset(x_23, x_26, x_31);
x_33 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_30);
x_34 = lean_nat_dec_le(x_33, x_24);
lean_dec(x_24);
lean_dec(x_33);
if (x_34 == 0)
{
lean_object* x_35;
x_35 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3(x_1, x_30, x_32);
return x_35;
}
else
{
lean_object* x_36;
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_30);
lean_ctor_set(x_36, 1, x_32);
return x_36;
}
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
lean_dec(x_24);
x_37 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(x_1, x_3, x_4, x_27);
x_38 = lean_array_uset(x_23, x_26, x_37);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_22);
lean_ctor_set(x_39, 1, x_38);
return x_39;
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_addVartoState___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addVartoState(size_t x_1, lean_object* x_2, size_t x_3, size_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; uint8_t x_11;
x_8 = lean_st_ref_take(x_5, x_7);
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_is_exclusive(x_9);
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; uint8_t x_18;
x_12 = lean_ctor_get(x_9, 0);
x_13 = lean_box_usize(x_4);
x_14 = lean_box_usize(x_3);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_13);
lean_ctor_set(x_15, 1, x_14);
x_16 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1(x_1, x_12, x_2, x_15);
lean_ctor_set(x_9, 0, x_16);
x_17 = lean_st_ref_set(x_5, x_9, x_10);
x_18 = !lean_is_exclusive(x_17);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_17, 0);
lean_dec(x_19);
x_20 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_17, 0, x_20);
return x_17;
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_17, 1);
lean_inc(x_21);
lean_dec(x_17);
x_22 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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_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_24 = lean_ctor_get(x_9, 0);
x_25 = lean_ctor_get(x_9, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_9);
x_26 = lean_box_usize(x_4);
x_27 = lean_box_usize(x_3);
x_28 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_28, 0, x_26);
lean_ctor_set(x_28, 1, x_27);
x_29 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1(x_1, x_24, x_2, x_28);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_25);
x_31 = lean_st_ref_set(x_5, x_30, x_10);
x_32 = lean_ctor_get(x_31, 1);
lean_inc(x_32);
if (lean_is_exclusive(x_31)) {
lean_ctor_release(x_31, 0);
lean_ctor_release(x_31, 1);
x_33 = x_31;
} else {
lean_dec_ref(x_31);
x_33 = lean_box(0);
}
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
if (lean_is_scalar(x_33)) {
x_35 = lean_alloc_ctor(0, 2, 0);
} else {
x_35 = x_33;
}
lean_ctor_set(x_35, 0, x_34);
lean_ctor_set(x_35, 1, x_32);
return x_35;
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addVartoState___spec__2(x_4, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
x_6 = lean_box(x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addVartoState___spec__5___at_Lean_IR_EmitLLVM_addVartoState___spec__6(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addVartoState___spec__4(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addVartoState___spec__3(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addVartoState___spec__7(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addVartoState___spec__1(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addVartoState___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = l_Lean_IR_EmitLLVM_addVartoState(x_8, x_2, x_9, x_10, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
LEAN_EXPORT uint8_t l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
uint8_t x_4;
x_4 = 0;
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; uint8_t x_7;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 2);
x_7 = lean_nat_dec_eq(x_5, x_2);
if (x_7 == 0)
{
x_3 = x_6;
goto _start;
}
else
{
uint8_t x_9;
x_9 = 1;
return x_9;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_dec(x_2);
return x_3;
}
else
{
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; uint64_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13;
x_6 = lean_ctor_get(x_4, 0);
x_7 = lean_ctor_get(x_4, 2);
x_8 = lean_array_get_size(x_3);
lean_inc(x_2);
lean_inc(x_6);
x_9 = lean_apply_1(x_2, x_6);
x_10 = lean_unbox_uint64(x_9);
lean_dec(x_9);
x_11 = lean_hashmap_mk_idx(x_8, x_10);
x_12 = lean_array_uget(x_3, x_11);
lean_ctor_set(x_4, 2, x_12);
x_13 = lean_array_uset(x_3, x_11, x_4);
x_3 = x_13;
x_4 = x_7;
goto _start;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; uint64_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_15 = lean_ctor_get(x_4, 0);
x_16 = lean_ctor_get(x_4, 1);
x_17 = lean_ctor_get(x_4, 2);
lean_inc(x_17);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_4);
x_18 = lean_array_get_size(x_3);
lean_inc(x_2);
lean_inc(x_15);
x_19 = lean_apply_1(x_2, x_15);
x_20 = lean_unbox_uint64(x_19);
lean_dec(x_19);
x_21 = lean_hashmap_mk_idx(x_18, x_20);
x_22 = lean_array_uget(x_3, x_21);
x_23 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_23, 0, x_15);
lean_ctor_set(x_23, 1, x_16);
lean_ctor_set(x_23, 2, x_22);
x_24 = lean_array_uset(x_3, x_21, x_23);
x_3 = x_24;
x_4 = x_17;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
return x_2;
}
else
{
uint8_t x_4;
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint64_t x_8; size_t x_9; lean_object* x_10; lean_object* x_11;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 2);
x_7 = lean_array_get_size(x_2);
x_8 = lean_uint64_of_nat(x_5);
x_9 = lean_hashmap_mk_idx(x_7, x_8);
x_10 = lean_array_uget(x_2, x_9);
lean_ctor_set(x_3, 2, x_10);
x_11 = lean_array_uset(x_2, x_9, x_3);
x_2 = x_11;
x_3 = x_6;
goto _start;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint64_t x_17; size_t x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_13 = lean_ctor_get(x_3, 0);
x_14 = lean_ctor_get(x_3, 1);
x_15 = lean_ctor_get(x_3, 2);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_3);
x_16 = lean_array_get_size(x_2);
x_17 = lean_uint64_of_nat(x_13);
x_18 = lean_hashmap_mk_idx(x_16, x_17);
x_19 = lean_array_uget(x_2, x_18);
x_20 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_20, 0, x_13);
lean_ctor_set(x_20, 1, x_14);
lean_ctor_set(x_20, 2, x_19);
x_21 = lean_array_uset(x_2, x_18, x_20);
x_2 = x_21;
x_3 = x_15;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4(size_t 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_3);
x_6 = lean_nat_dec_lt(x_2, x_5);
lean_dec(x_5);
if (x_6 == 0)
{
lean_dec(x_3);
lean_dec(x_2);
return x_4;
}
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_array_fget(x_3, x_2);
x_8 = lean_box(0);
x_9 = lean_array_fset(x_3, x_2, x_8);
x_10 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6(x_1, x_4, x_7);
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_add(x_2, x_11);
lean_dec(x_2);
x_2 = x_12;
x_3 = x_9;
x_4 = x_10;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3(size_t 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 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(2u);
x_6 = lean_nat_mul(x_4, x_5);
lean_dec(x_4);
x_7 = lean_box(0);
x_8 = lean_mk_array(x_6, x_7);
x_9 = lean_unsigned_to_nat(0u);
x_10 = l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4(x_1, x_9, x_3, x_8);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_2);
lean_ctor_set(x_11, 1, x_10);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(size_t x_1, lean_object* x_2, size_t x_3, lean_object* x_4) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_5;
lean_dec(x_2);
x_5 = lean_box(0);
return x_5;
}
else
{
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; uint8_t x_10;
x_7 = lean_ctor_get(x_4, 0);
x_8 = lean_ctor_get(x_4, 1);
x_9 = lean_ctor_get(x_4, 2);
x_10 = lean_nat_dec_eq(x_7, x_2);
if (x_10 == 0)
{
lean_object* x_11;
x_11 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(x_1, x_2, x_3, x_9);
lean_ctor_set(x_4, 2, x_11);
return x_4;
}
else
{
lean_object* x_12;
lean_dec(x_8);
lean_dec(x_7);
x_12 = lean_box_usize(x_3);
lean_ctor_set(x_4, 1, x_12);
lean_ctor_set(x_4, 0, x_2);
return x_4;
}
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_13 = lean_ctor_get(x_4, 0);
x_14 = lean_ctor_get(x_4, 1);
x_15 = lean_ctor_get(x_4, 2);
lean_inc(x_15);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_4);
x_16 = lean_nat_dec_eq(x_13, x_2);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18;
x_17 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(x_1, x_2, x_3, x_15);
x_18 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_18, 0, x_13);
lean_ctor_set(x_18, 1, x_14);
lean_ctor_set(x_18, 2, x_17);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_14);
lean_dec(x_13);
x_19 = lean_box_usize(x_3);
x_20 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_20, 0, x_2);
lean_ctor_set(x_20, 1, x_19);
lean_ctor_set(x_20, 2, x_15);
return x_20;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1(size_t x_1, lean_object* x_2, lean_object* x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = !lean_is_exclusive(x_2);
if (x_5 == 0)
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; uint64_t x_9; size_t x_10; lean_object* x_11; uint8_t x_12;
x_6 = lean_ctor_get(x_2, 0);
x_7 = lean_ctor_get(x_2, 1);
x_8 = lean_array_get_size(x_7);
x_9 = lean_uint64_of_nat(x_3);
lean_inc(x_8);
x_10 = lean_hashmap_mk_idx(x_8, x_9);
x_11 = lean_array_uget(x_7, x_10);
x_12 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2(x_1, x_3, 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; uint8_t x_19;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_add(x_6, x_13);
lean_dec(x_6);
x_15 = lean_box_usize(x_4);
x_16 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_16, 0, x_3);
lean_ctor_set(x_16, 1, x_15);
lean_ctor_set(x_16, 2, x_11);
x_17 = lean_array_uset(x_7, x_10, x_16);
x_18 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_14);
x_19 = lean_nat_dec_le(x_18, x_8);
lean_dec(x_8);
lean_dec(x_18);
if (x_19 == 0)
{
lean_object* x_20;
lean_free_object(x_2);
x_20 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3(x_1, x_14, x_17);
return x_20;
}
else
{
lean_ctor_set(x_2, 1, x_17);
lean_ctor_set(x_2, 0, x_14);
return x_2;
}
}
else
{
lean_object* x_21; lean_object* x_22;
lean_dec(x_8);
x_21 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(x_1, x_3, x_4, x_11);
x_22 = lean_array_uset(x_7, x_10, x_21);
lean_ctor_set(x_2, 1, x_22);
return x_2;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; uint64_t x_26; size_t x_27; lean_object* x_28; uint8_t x_29;
x_23 = lean_ctor_get(x_2, 0);
x_24 = lean_ctor_get(x_2, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_2);
x_25 = lean_array_get_size(x_24);
x_26 = lean_uint64_of_nat(x_3);
lean_inc(x_25);
x_27 = lean_hashmap_mk_idx(x_25, x_26);
x_28 = lean_array_uget(x_24, x_27);
x_29 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2(x_1, x_3, x_28);
if (x_29 == 0)
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36;
x_30 = lean_unsigned_to_nat(1u);
x_31 = lean_nat_add(x_23, x_30);
lean_dec(x_23);
x_32 = lean_box_usize(x_4);
x_33 = lean_alloc_ctor(1, 3, 0);
lean_ctor_set(x_33, 0, x_3);
lean_ctor_set(x_33, 1, x_32);
lean_ctor_set(x_33, 2, x_28);
x_34 = lean_array_uset(x_24, x_27, x_33);
x_35 = l___private_Lean_Data_HashMap_0__Lean_numBucketsForCapacity(x_31);
x_36 = lean_nat_dec_le(x_35, x_25);
lean_dec(x_25);
lean_dec(x_35);
if (x_36 == 0)
{
lean_object* x_37;
x_37 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3(x_1, x_31, x_34);
return x_37;
}
else
{
lean_object* x_38;
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_31);
lean_ctor_set(x_38, 1, x_34);
return x_38;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41;
lean_dec(x_25);
x_39 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(x_1, x_3, x_4, x_28);
x_40 = lean_array_uset(x_24, x_27, x_39);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_23);
lean_ctor_set(x_41, 1, x_40);
return x_41;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addJpTostate(size_t x_1, lean_object* x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_7 = lean_st_ref_take(x_4, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_11 = lean_ctor_get(x_8, 1);
x_12 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1(x_1, x_11, x_2, x_3);
lean_ctor_set(x_8, 1, x_12);
x_13 = lean_st_ref_set(x_4, x_8, x_9);
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_13, 0);
lean_dec(x_15);
x_16 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_13, 0, x_16);
return x_13;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_13, 1);
lean_inc(x_17);
lean_dec(x_13);
x_18 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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; lean_object* x_28;
x_20 = lean_ctor_get(x_8, 0);
x_21 = lean_ctor_get(x_8, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_8);
x_22 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1(x_1, x_21, x_2, x_3);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_20);
lean_ctor_set(x_23, 1, x_22);
x_24 = lean_st_ref_set(x_4, x_23, x_9);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
if (lean_is_exclusive(x_24)) {
lean_ctor_release(x_24, 0);
lean_ctor_release(x_24, 1);
x_26 = x_24;
} else {
lean_dec_ref(x_24);
x_26 = lean_box(0);
}
x_27 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
if (lean_is_scalar(x_26)) {
x_28 = lean_alloc_ctor(0, 2, 0);
} else {
x_28 = x_26;
}
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_28, 1, x_25);
return x_28;
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_contains___at_Lean_IR_EmitLLVM_addJpTostate___spec__2(x_4, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
x_6 = lean_box(x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_foldlM___at_Lean_IR_EmitLLVM_addJpTostate___spec__5___at_Lean_IR_EmitLLVM_addJpTostate___spec__6(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_HashMapImp_moveEntries___at_Lean_IR_EmitLLVM_addJpTostate___spec__4(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_HashMapImp_expand___at_Lean_IR_EmitLLVM_addJpTostate___spec__3(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_7 = l_Lean_AssocList_replace___at_Lean_IR_EmitLLVM_addJpTostate___spec__7(x_5, x_2, x_6, x_4);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Lean_HashMap_insert___at_Lean_IR_EmitLLVM_addJpTostate___spec__1(x_5, x_2, x_3, x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_addJpTostate___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_9 = l_Lean_IR_EmitLLVM_addJpTostate(x_7, x_2, x_8, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_4;
x_4 = lean_box(0);
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
x_7 = lean_ctor_get(x_3, 2);
x_8 = lean_nat_dec_eq(x_5, x_2);
if (x_8 == 0)
{
x_3 = x_7;
goto _start;
}
else
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint64_t x_6; size_t x_7; lean_object* x_8; lean_object* x_9;
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_array_get_size(x_4);
x_6 = lean_uint64_of_nat(x_3);
x_7 = lean_hashmap_mk_idx(x_5, x_6);
x_8 = lean_array_uget(x_4, x_7);
lean_dec(x_4);
x_9 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2(x_1, x_3, x_8);
lean_dec(x_8);
lean_dec(x_3);
return x_9;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("block_", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJp___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unable to find join point ", 26);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJp___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("", 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJp(size_t 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_st_ref_get(x_3, 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;
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
lean_inc(x_2);
x_10 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1(x_1, x_9, x_2);
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;
x_11 = l_Nat_repr(x_2);
x_12 = l_Lean_IR_EmitLLVM_emitJp___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitJp___closed__2;
x_15 = lean_string_append(x_14, x_13);
lean_dec(x_13);
x_16 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_17 = lean_string_append(x_15, x_16);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_6, 0, x_18);
return x_6;
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_2);
x_19 = lean_ctor_get(x_10, 0);
lean_inc(x_19);
lean_dec(x_10);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_6, 0, x_20);
return x_6;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_21 = lean_ctor_get(x_6, 0);
x_22 = lean_ctor_get(x_6, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_6);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
lean_inc(x_2);
x_24 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1(x_1, x_23, x_2);
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; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_25 = l_Nat_repr(x_2);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__1;
x_27 = lean_string_append(x_26, x_25);
lean_dec(x_25);
x_28 = l_Lean_IR_EmitLLVM_emitJp___closed__2;
x_29 = lean_string_append(x_28, x_27);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_31 = lean_string_append(x_29, x_30);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_22);
return x_33;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
lean_dec(x_2);
x_34 = lean_ctor_get(x_24, 0);
lean_inc(x_34);
lean_dec(x_24);
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_34);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_22);
return x_36;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__2(x_4, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJp___spec__1(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJp___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_emitJp(x_6, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_1, 5);
lean_inc(x_3);
x_4 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_4, 0, x_3);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_getLLVMModule___rarg___boxed), 2, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getLLVMModule___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_EmitLLVM_getLLVMModule(x_3, x_2);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_1, 0);
lean_inc(x_3);
x_4 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_4, 0, x_3);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_getEnv___rarg___boxed), 2, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getEnv___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_EmitLLVM_getEnv(x_3, x_2);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
x_4 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_4, 0, x_3);
x_5 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_5, 0, x_4);
lean_ctor_set(x_5, 1, x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_getModName___rarg___boxed), 2, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitLLVM_getModName___rarg(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getModName___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_EmitLLVM_getModName(x_3, x_2);
lean_dec(x_2);
return x_4;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unknown declaration ", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___rarg(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_EmitLLVM_getEnv___rarg(x_3, x_4);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_ctor_get(x_5, 0);
x_8 = !lean_is_exclusive(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_ctor_get(x_7, 0);
lean_inc(x_1);
x_10 = lean_ir_find_env_decl(x_9, x_1);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_11 = 1;
x_12 = l_Lean_Name_toString(x_1, x_11);
x_13 = l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_16 = lean_string_append(x_14, x_15);
lean_ctor_set_tag(x_7, 0);
lean_ctor_set(x_7, 0, x_16);
return x_5;
}
else
{
lean_object* x_17;
lean_dec(x_1);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
lean_dec(x_10);
lean_ctor_set(x_7, 0, x_17);
return x_5;
}
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_7, 0);
lean_inc(x_18);
lean_dec(x_7);
lean_inc(x_1);
x_19 = lean_ir_find_env_decl(x_18, x_1);
if (lean_obj_tag(x_19) == 0)
{
uint8_t 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 = 1;
x_21 = l_Lean_Name_toString(x_1, x_20);
x_22 = l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1;
x_23 = lean_string_append(x_22, x_21);
lean_dec(x_21);
x_24 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_25 = lean_string_append(x_23, x_24);
x_26 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_5, 0, x_26);
return x_5;
}
else
{
lean_object* x_27; lean_object* x_28;
lean_dec(x_1);
x_27 = lean_ctor_get(x_19, 0);
lean_inc(x_27);
lean_dec(x_19);
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_5, 0, x_28);
return x_5;
}
}
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_29 = lean_ctor_get(x_5, 0);
x_30 = lean_ctor_get(x_5, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_5);
x_31 = lean_ctor_get(x_29, 0);
lean_inc(x_31);
if (lean_is_exclusive(x_29)) {
lean_ctor_release(x_29, 0);
x_32 = x_29;
} else {
lean_dec_ref(x_29);
x_32 = lean_box(0);
}
lean_inc(x_1);
x_33 = lean_ir_find_env_decl(x_31, x_1);
if (lean_obj_tag(x_33) == 0)
{
uint8_t 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_34 = 1;
x_35 = l_Lean_Name_toString(x_1, x_34);
x_36 = l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1;
x_37 = lean_string_append(x_36, x_35);
lean_dec(x_35);
x_38 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_39 = lean_string_append(x_37, x_38);
if (lean_is_scalar(x_32)) {
x_40 = lean_alloc_ctor(0, 1, 0);
} else {
x_40 = x_32;
lean_ctor_set_tag(x_40, 0);
}
lean_ctor_set(x_40, 0, x_39);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_30);
return x_41;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
lean_dec(x_1);
x_42 = lean_ctor_get(x_33, 0);
lean_inc(x_42);
lean_dec(x_33);
if (lean_is_scalar(x_32)) {
x_43 = lean_alloc_ctor(1, 1, 0);
} else {
x_43 = x_32;
}
lean_ctor_set(x_43, 0, x_42);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_30);
return x_44;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_getDecl___rarg___boxed), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___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_EmitLLVM_getDecl___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getDecl___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_getDecl(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_constIntUnsigned(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint64_t x_6; uint8_t x_7; lean_object* x_8; uint8_t x_9;
x_6 = lean_uint64_of_nat(x_2);
x_7 = 0;
x_8 = l_LLVM_constIntUnsigned(x_1, x_6, x_7, x_5);
x_9 = !lean_is_exclusive(x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_8, 0);
x_11 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_8, 0, x_11);
return x_8;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
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, 1, 0);
lean_ctor_set(x_14, 0, x_12);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_constIntUnsigned___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_6, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
uint8_t x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; size_t x_13; lean_object* x_14; uint8_t x_15;
x_9 = 0;
x_10 = lean_llvm_function_type(x_1, x_3, x_5, x_9, x_8);
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_unbox_usize(x_11);
lean_dec(x_11);
x_14 = l_LLVM_getOrAddFunction(x_1, x_2, x_4, x_13, x_12);
x_15 = !lean_is_exclusive(x_14);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_ctor_get(x_14, 0);
x_17 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_14, 0, x_17);
return x_14;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_18 = lean_ctor_get(x_14, 0);
x_19 = lean_ctor_get(x_14, 1);
lean_inc(x_19);
lean_inc(x_18);
lean_dec(x_14);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_18);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype___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:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_9, x_10, x_11, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_12;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanBox___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(1u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanBox___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box", 8);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanBox(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_Lean_IR_LLVM_size__tType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanBox___closed__2;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanBox___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanBox(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_mark_persistent", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26; size_t 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; size_t x_34; size_t x_35; lean_object* x_36; uint8_t x_37;
x_7 = lean_llvm_void_type_in_context(x_1, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = l_LLVM_voidPtrType(x_1, x_9);
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_EmitLLVM_callLeanBox___closed__1;
x_14 = lean_array_push(x_13, x_11);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_12);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_8);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_14, x_4, x_5, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = 0;
x_27 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_28 = lean_llvm_function_type(x_1, x_27, x_14, x_26, x_24);
lean_dec(x_14);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_box_usize(x_3);
x_32 = lean_array_push(x_13, x_31);
x_33 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_34 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_35 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_36 = lean_llvm_build_call2(x_1, x_2, x_34, x_35, x_32, x_33, x_30);
lean_dec(x_32);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_36, 0);
lean_dec(x_38);
x_39 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_36, 0, x_39);
return x_36;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_36, 1);
lean_inc(x_40);
lean_dec(x_36);
x_41 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_40);
return x_42;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(x_7, x_8, x_9, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_toCtorIdx(uint8_t x_1) {
_start:
{
if (x_1 == 0)
{
lean_object* x_2;
x_2 = lean_unsigned_to_nat(0u);
return x_2;
}
else
{
lean_object* x_3;
x_3 = lean_unsigned_to_nat(1u);
return x_3;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_toCtorIdx___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_RefcountKind_toCtorIdx(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1(lean_object* x_1) {
_start:
{
lean_inc(x_1);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1___boxed), 1, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg(uint8_t x_1, uint8_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1;
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___lambda__1(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox(x_1);
lean_dec(x_1);
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg(x_4, x_5, x_3);
return x_6;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("inc", 3);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("dec", 3);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind(uint8_t x_1) {
_start:
{
if (x_1 == 0)
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1;
return x_2;
}
else
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2;
return x_3;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_instToStringRefcountKind___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_instToStringRefcountKind(x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(2u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_n", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_ref", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn(size_t x_1, size_t x_2, uint8_t x_3, uint8_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_llvm_void_type_in_context(x_1, x_9);
if (x_3 == 0)
{
lean_object* x_100;
x_100 = l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1;
x_11 = x_100;
goto block_99;
}
else
{
lean_object* x_101;
x_101 = l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2;
x_11 = x_101;
goto block_99;
}
block_99:
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_12 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_15 = lean_string_append(x_13, x_14);
if (x_4 == 0)
{
lean_object* x_98;
x_98 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4;
x_16 = x_98;
goto block_97;
}
else
{
x_16 = x_14;
goto block_97;
}
block_97:
{
lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_17 = lean_string_append(x_15, x_16);
lean_dec(x_16);
x_18 = lean_string_append(x_17, x_14);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_95;
x_95 = 1;
x_19 = x_95;
goto block_94;
}
else
{
uint8_t x_96;
x_96 = 0;
x_19 = x_96;
goto block_94;
}
block_94:
{
uint8_t x_20;
if (x_19 == 0)
{
uint8_t x_92;
x_92 = 0;
x_20 = x_92;
goto block_91;
}
else
{
uint8_t x_93;
x_93 = 1;
x_20 = x_93;
goto block_91;
}
block_91:
{
lean_object* x_21;
if (x_20 == 0)
{
lean_object* x_90;
x_90 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3;
x_21 = x_90;
goto block_89;
}
else
{
x_21 = x_14;
goto block_89;
}
block_89:
{
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_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;
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_10, 1);
lean_inc(x_23);
lean_dec(x_10);
x_24 = lean_string_append(x_18, x_21);
lean_dec(x_21);
x_25 = lean_string_append(x_24, x_14);
x_70 = l_LLVM_voidPtrType(x_1, x_23);
x_71 = lean_ctor_get(x_70, 0);
lean_inc(x_71);
x_72 = lean_ctor_get(x_70, 1);
lean_inc(x_72);
lean_dec(x_70);
x_73 = l_LLVM_voidPtrType(x_1, x_72);
x_74 = lean_ctor_get(x_73, 0);
lean_inc(x_74);
x_75 = lean_ctor_get(x_73, 1);
lean_inc(x_75);
lean_dec(x_73);
x_76 = l_Lean_IR_LLVM_size__tType(x_1, x_75);
x_77 = lean_ctor_get(x_76, 0);
lean_inc(x_77);
x_78 = lean_ctor_get(x_76, 1);
lean_inc(x_78);
lean_dec(x_76);
x_79 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_8, x_78);
if (x_20 == 0)
{
lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
lean_dec(x_71);
x_80 = lean_ctor_get(x_79, 0);
lean_inc(x_80);
x_81 = lean_ctor_get(x_79, 1);
lean_inc(x_81);
lean_dec(x_79);
x_82 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_83 = lean_array_push(x_82, x_74);
x_84 = lean_array_push(x_83, x_77);
x_26 = x_84;
x_27 = x_80;
x_28 = x_81;
goto block_69;
}
else
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
lean_dec(x_77);
lean_dec(x_74);
x_85 = lean_ctor_get(x_79, 0);
lean_inc(x_85);
x_86 = lean_ctor_get(x_79, 1);
lean_inc(x_86);
lean_dec(x_79);
x_87 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_88 = lean_array_push(x_87, x_71);
x_26 = x_88;
x_27 = x_85;
x_28 = x_86;
goto block_69;
}
block_69:
{
lean_object* x_29; size_t x_30; size_t x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36; size_t x_37; lean_object* x_38;
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_31 = lean_unbox_usize(x_22);
x_32 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_30, x_31, x_25, x_26, x_7, x_8, x_28);
lean_dec(x_25);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = 0;
x_37 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_38 = lean_llvm_function_type(x_1, x_37, x_26, x_36, x_34);
lean_dec(x_26);
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; size_t x_44; size_t x_45; lean_object* x_46; uint8_t x_47;
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_42 = lean_box_usize(x_5);
x_43 = lean_array_push(x_41, x_42);
x_44 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_45 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_46 = lean_llvm_build_call2(x_1, x_2, x_44, x_45, x_43, x_14, x_40);
lean_dec(x_43);
x_47 = !lean_is_exclusive(x_46);
if (x_47 == 0)
{
lean_object* x_48; lean_object* x_49;
x_48 = lean_ctor_get(x_46, 0);
lean_dec(x_48);
x_49 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_46, 0, x_49);
return x_46;
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_50 = lean_ctor_get(x_46, 1);
lean_inc(x_50);
lean_dec(x_46);
x_51 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
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; size_t x_60; size_t x_61; lean_object* x_62; uint8_t x_63;
x_53 = lean_ctor_get(x_38, 0);
lean_inc(x_53);
x_54 = lean_ctor_get(x_38, 1);
lean_inc(x_54);
lean_dec(x_38);
x_55 = lean_ctor_get(x_6, 0);
lean_inc(x_55);
lean_dec(x_6);
x_56 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_57 = lean_box_usize(x_5);
x_58 = lean_array_push(x_56, x_57);
x_59 = lean_array_push(x_58, x_55);
x_60 = lean_unbox_usize(x_53);
lean_dec(x_53);
x_61 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_62 = lean_llvm_build_call2(x_1, x_2, x_60, x_61, x_59, x_14, x_54);
lean_dec(x_59);
x_63 = !lean_is_exclusive(x_62);
if (x_63 == 0)
{
lean_object* x_64; lean_object* x_65;
x_64 = lean_ctor_get(x_62, 0);
lean_dec(x_64);
x_65 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_62, 0, x_65);
return x_62;
}
else
{
lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_66 = lean_ctor_get(x_62, 1);
lean_inc(x_66);
lean_dec(x_62);
x_67 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_68 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_68, 0, x_67);
lean_ctor_set(x_68, 1, x_66);
return x_68;
}
}
}
}
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanRefcountFn___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; uint8_t x_12; uint8_t x_13; size_t x_14; lean_object* x_15;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox(x_3);
lean_dec(x_3);
x_13 = lean_unbox(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = l_Lean_IR_EmitLLVM_callLeanRefcountFn(x_10, x_11, x_12, x_13, x_14, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
return x_15;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_dec_ref", 12);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanDecRef(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26; size_t 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; size_t x_34; size_t x_35; lean_object* x_36; uint8_t x_37;
x_7 = lean_llvm_void_type_in_context(x_1, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = l_LLVM_voidPtrType(x_1, x_9);
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_EmitLLVM_callLeanBox___closed__1;
x_14 = lean_array_push(x_13, x_11);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_12);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_8);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_14, x_4, x_5, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = 0;
x_27 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_28 = lean_llvm_function_type(x_1, x_27, x_14, x_26, x_24);
lean_dec(x_14);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_box_usize(x_3);
x_32 = lean_array_push(x_13, x_31);
x_33 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_34 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_35 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_36 = lean_llvm_build_call2(x_1, x_2, x_34, x_35, x_32, x_33, x_30);
lean_dec(x_32);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_36, 0);
lean_dec(x_38);
x_39 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_36, 0, x_39);
return x_36;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_36, 1);
lean_inc(x_40);
lean_dec(x_36);
x_41 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_40);
return x_42;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanDecRef___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_7, x_8, x_9, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unsigned_to_nat", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn(size_t x_1, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_7);
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, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = l_LLVM_i32Type(x_1, x_10);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_16 = lean_array_push(x_15, x_13);
x_17 = l_LLVM_voidPtrType(x_1, x_14);
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_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1;
x_21 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_22 = lean_unbox_usize(x_18);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_16, x_5, x_6, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; uint64_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t x_38; size_t x_39; lean_object* x_40; uint8_t x_41;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_30 = lean_llvm_function_type(x_1, x_29, x_16, x_28, x_25);
lean_dec(x_16);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_uint64_of_nat(x_3);
x_34 = l_LLVM_constInt32(x_1, x_33, x_28, x_32);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_array_push(x_15, x_35);
x_38 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_39 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_40 = lean_llvm_build_call2(x_1, x_2, x_38, x_39, x_37, x_4, x_36);
lean_dec(x_37);
x_41 = !lean_is_exclusive(x_40);
if (x_41 == 0)
{
lean_object* x_42;
x_42 = lean_ctor_get(x_40, 0);
lean_ctor_set(x_24, 0, x_42);
lean_ctor_set(x_40, 0, x_24);
return x_40;
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_43 = lean_ctor_get(x_40, 0);
x_44 = lean_ctor_get(x_40, 1);
lean_inc(x_44);
lean_inc(x_43);
lean_dec(x_40);
lean_ctor_set(x_24, 0, x_43);
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_24);
lean_ctor_set(x_45, 1, x_44);
return x_45;
}
}
else
{
lean_object* x_46; uint8_t x_47; size_t x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; uint64_t x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; size_t x_57; size_t 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_46 = lean_ctor_get(x_24, 0);
lean_inc(x_46);
lean_dec(x_24);
x_47 = 0;
x_48 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_49 = lean_llvm_function_type(x_1, x_48, x_16, x_47, x_25);
lean_dec(x_16);
x_50 = lean_ctor_get(x_49, 0);
lean_inc(x_50);
x_51 = lean_ctor_get(x_49, 1);
lean_inc(x_51);
lean_dec(x_49);
x_52 = lean_uint64_of_nat(x_3);
x_53 = l_LLVM_constInt32(x_1, x_52, x_47, x_51);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
lean_dec(x_53);
x_56 = lean_array_push(x_15, x_54);
x_57 = lean_unbox_usize(x_50);
lean_dec(x_50);
x_58 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_59 = lean_llvm_build_call2(x_1, x_2, x_57, x_58, x_56, x_4, x_55);
lean_dec(x_56);
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
if (lean_is_exclusive(x_59)) {
lean_ctor_release(x_59, 0);
lean_ctor_release(x_59, 1);
x_62 = x_59;
} else {
lean_dec_ref(x_59);
x_62 = lean_box(0);
}
x_63 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_63, 0, x_60);
if (lean_is_scalar(x_62)) {
x_64 = lean_alloc_ctor(0, 2, 0);
} else {
x_64 = x_62;
}
lean_ctor_set(x_64, 0, x_63);
lean_ctor_set(x_64, 1, x_61);
return x_64;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_mk_string_from_bytes", 25);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn(size_t x_1, size_t x_2, size_t x_3, size_t 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; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t x_26; size_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; uint8_t x_31;
x_9 = l_LLVM_voidPtrType(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_LLVM_i64Type(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_17);
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 = lean_ctor_get(x_22, 0);
lean_inc(x_24);
lean_dec(x_22);
x_25 = l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1;
x_26 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_10);
x_28 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_26, x_27, x_25, x_20, x_6, x_7, x_23);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = !lean_is_exclusive(x_29);
if (x_31 == 0)
{
lean_object* x_32; uint8_t x_33; size_t 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; size_t x_42; size_t x_43; lean_object* x_44; uint8_t x_45;
x_32 = lean_ctor_get(x_29, 0);
x_33 = 0;
x_34 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_35 = lean_llvm_function_type(x_1, x_34, x_20, x_33, x_30);
lean_dec(x_20);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_box_usize(x_3);
x_39 = lean_array_push(x_18, x_38);
x_40 = lean_box_usize(x_4);
x_41 = lean_array_push(x_39, x_40);
x_42 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_43 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_44 = lean_llvm_build_call2(x_1, x_2, x_42, x_43, x_41, x_5, x_37);
lean_dec(x_41);
x_45 = !lean_is_exclusive(x_44);
if (x_45 == 0)
{
lean_object* x_46;
x_46 = lean_ctor_get(x_44, 0);
lean_ctor_set(x_29, 0, x_46);
lean_ctor_set(x_44, 0, x_29);
return x_44;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_44, 0);
x_48 = lean_ctor_get(x_44, 1);
lean_inc(x_48);
lean_inc(x_47);
lean_dec(x_44);
lean_ctor_set(x_29, 0, x_47);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_29);
lean_ctor_set(x_49, 1, x_48);
return x_49;
}
}
else
{
lean_object* x_50; uint8_t x_51; size_t 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; size_t x_60; size_t 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_50 = lean_ctor_get(x_29, 0);
lean_inc(x_50);
lean_dec(x_29);
x_51 = 0;
x_52 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_53 = lean_llvm_function_type(x_1, x_52, x_20, x_51, x_30);
lean_dec(x_20);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
lean_dec(x_53);
x_56 = lean_box_usize(x_3);
x_57 = lean_array_push(x_18, x_56);
x_58 = lean_box_usize(x_4);
x_59 = lean_array_push(x_57, x_58);
x_60 = lean_unbox_usize(x_54);
lean_dec(x_54);
x_61 = lean_unbox_usize(x_50);
lean_dec(x_50);
x_62 = lean_llvm_build_call2(x_1, x_2, x_60, x_61, x_59, x_5, x_55);
lean_dec(x_59);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
if (lean_is_exclusive(x_62)) {
lean_ctor_release(x_62, 0);
lean_ctor_release(x_62, 1);
x_65 = x_62;
} else {
lean_dec_ref(x_62);
x_65 = lean_box(0);
}
x_66 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_66, 0, x_63);
if (lean_is_scalar(x_65)) {
x_67 = lean_alloc_ctor(0, 2, 0);
} else {
x_67 = x_65;
}
lean_ctor_set(x_67, 0, x_66);
lean_ctor_set(x_67, 1, x_64);
return x_67;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanMkString___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_mk_string", 14);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkString(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanMkString___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMkString___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanMkString(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_cstr_to_nat", 16);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCStrToNatFn(size_t x_1, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t 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; size_t x_39; size_t x_40; lean_object* x_41; uint8_t x_42;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = l_Nat_repr(x_3);
x_34 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_35 = lean_llvm_build_global_string(x_1, x_2, x_33, x_34, x_32);
lean_dec(x_33);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_array_push(x_14, x_36);
x_39 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_40 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_41 = lean_llvm_build_call2(x_1, x_2, x_39, x_40, x_38, x_4, x_37);
lean_dec(x_38);
x_42 = !lean_is_exclusive(x_41);
if (x_42 == 0)
{
lean_object* x_43;
x_43 = lean_ctor_get(x_41, 0);
lean_ctor_set(x_24, 0, x_43);
lean_ctor_set(x_41, 0, x_24);
return x_41;
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_41, 0);
x_45 = lean_ctor_get(x_41, 1);
lean_inc(x_45);
lean_inc(x_44);
lean_dec(x_41);
lean_ctor_set(x_24, 0, x_44);
x_46 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_46, 0, x_24);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
else
{
lean_object* x_47; uint8_t x_48; size_t 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; size_t x_59; size_t 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_47 = lean_ctor_get(x_24, 0);
lean_inc(x_47);
lean_dec(x_24);
x_48 = 0;
x_49 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_50 = lean_llvm_function_type(x_1, x_49, x_15, x_48, x_25);
lean_dec(x_15);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
lean_dec(x_50);
x_53 = l_Nat_repr(x_3);
x_54 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_55 = lean_llvm_build_global_string(x_1, x_2, x_53, x_54, x_52);
lean_dec(x_53);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = lean_array_push(x_14, x_56);
x_59 = lean_unbox_usize(x_51);
lean_dec(x_51);
x_60 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_61 = lean_llvm_build_call2(x_1, x_2, x_59, x_60, x_58, x_4, x_57);
lean_dec(x_58);
x_62 = lean_ctor_get(x_61, 0);
lean_inc(x_62);
x_63 = lean_ctor_get(x_61, 1);
lean_inc(x_63);
if (lean_is_exclusive(x_61)) {
lean_ctor_release(x_61, 0);
lean_ctor_release(x_61, 1);
x_64 = x_61;
} else {
lean_dec_ref(x_61);
x_64 = lean_box(0);
}
x_65 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_65, 0, x_62);
if (lean_is_scalar(x_64)) {
x_66 = lean_alloc_ctor(0, 2, 0);
} else {
x_66 = x_64;
}
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_63);
return x_66;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_callLeanCStrToNatFn(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_mk_world", 16);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("mk_io_out", 9);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld(size_t x_1, size_t 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; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20;
x_6 = l_LLVM_voidPtrType(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_EmitLLVM_getLLVMModule___rarg(x_4, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1;
x_14 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_15 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_16 = lean_unbox_usize(x_7);
x_17 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_15, x_16, x_13, x_14, x_3, x_4, x_11);
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 = !lean_is_exclusive(x_18);
if (x_20 == 0)
{
lean_object* x_21; uint8_t x_22; size_t x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; size_t x_28; size_t x_29; lean_object* x_30; uint8_t x_31;
x_21 = lean_ctor_get(x_18, 0);
x_22 = 0;
x_23 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_24 = lean_llvm_function_type(x_1, x_23, x_14, x_22, x_19);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2;
x_28 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_29 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_30 = lean_llvm_build_call2(x_1, x_2, x_28, x_29, x_14, x_27, x_26);
x_31 = !lean_is_exclusive(x_30);
if (x_31 == 0)
{
lean_object* x_32;
x_32 = lean_ctor_get(x_30, 0);
lean_ctor_set(x_18, 0, x_32);
lean_ctor_set(x_30, 0, x_18);
return x_30;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_30, 0);
x_34 = lean_ctor_get(x_30, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_30);
lean_ctor_set(x_18, 0, x_33);
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_18);
lean_ctor_set(x_35, 1, x_34);
return x_35;
}
}
else
{
lean_object* x_36; uint8_t x_37; size_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; size_t x_43; size_t 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;
x_36 = lean_ctor_get(x_18, 0);
lean_inc(x_36);
lean_dec(x_18);
x_37 = 0;
x_38 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_39 = lean_llvm_function_type(x_1, x_38, x_14, x_37, x_19);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
lean_dec(x_39);
x_42 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2;
x_43 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_44 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_45 = lean_llvm_build_call2(x_1, x_2, x_43, x_44, x_14, x_42, x_41);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
if (lean_is_exclusive(x_45)) {
lean_ctor_release(x_45, 0);
lean_ctor_release(x_45, 1);
x_48 = x_45;
} else {
lean_dec_ref(x_45);
x_48 = lean_box(0);
}
x_49 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_49, 0, x_46);
if (lean_is_scalar(x_48)) {
x_50 = lean_alloc_ctor(0, 2, 0);
} else {
x_50 = x_48;
}
lean_ctor_set(x_50, 0, x_49);
lean_ctor_set(x_50, 1, x_47);
return x_50;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMkWorld___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_result_is_error", 23);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsError(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i1Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsError___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(3u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_alloc_ctor", 15);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor(size_t x_1, size_t 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, lean_object* x_9) {
_start:
{
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; size_t x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; uint8_t x_30;
x_10 = l_LLVM_voidPtrType(x_1, x_9);
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_LLVM_i32Type(x_1, x_12);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
lean_inc(x_14);
x_17 = lean_array_push(x_16, x_14);
lean_inc(x_14);
x_18 = lean_array_push(x_17, x_14);
x_19 = lean_array_push(x_18, x_14);
x_20 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_8, x_15);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
lean_dec(x_21);
x_24 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2;
x_25 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_11);
x_27 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_25, x_26, x_24, x_19, x_7, x_8, x_22);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = !lean_is_exclusive(x_28);
if (x_30 == 0)
{
lean_object* x_31; uint8_t x_32; size_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint64_t x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; uint64_t x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint64_t 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; size_t x_52; size_t x_53; lean_object* x_54; uint8_t x_55;
x_31 = lean_ctor_get(x_28, 0);
x_32 = 0;
x_33 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_34 = lean_llvm_function_type(x_1, x_33, x_19, x_32, x_29);
lean_dec(x_19);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_uint64_of_nat(x_3);
x_38 = l_LLVM_constInt32(x_1, x_37, x_32, x_36);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = lean_uint64_of_nat(x_4);
x_42 = l_LLVM_constInt32(x_1, x_41, x_32, x_40);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
x_44 = lean_ctor_get(x_42, 1);
lean_inc(x_44);
lean_dec(x_42);
x_45 = lean_uint64_of_nat(x_5);
x_46 = l_LLVM_constInt32(x_1, x_45, x_32, x_44);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_array_push(x_16, x_39);
x_50 = lean_array_push(x_49, x_43);
x_51 = lean_array_push(x_50, x_47);
x_52 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_53 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_54 = lean_llvm_build_call2(x_1, x_2, x_52, x_53, x_51, x_6, x_48);
lean_dec(x_51);
x_55 = !lean_is_exclusive(x_54);
if (x_55 == 0)
{
lean_object* x_56;
x_56 = lean_ctor_get(x_54, 0);
lean_ctor_set(x_28, 0, x_56);
lean_ctor_set(x_54, 0, x_28);
return x_54;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59;
x_57 = lean_ctor_get(x_54, 0);
x_58 = lean_ctor_get(x_54, 1);
lean_inc(x_58);
lean_inc(x_57);
lean_dec(x_54);
lean_ctor_set(x_28, 0, x_57);
x_59 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_59, 0, x_28);
lean_ctor_set(x_59, 1, x_58);
return x_59;
}
}
else
{
lean_object* x_60; uint8_t x_61; size_t x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; uint64_t x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; uint64_t x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; uint64_t 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; size_t x_81; size_t 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;
x_60 = lean_ctor_get(x_28, 0);
lean_inc(x_60);
lean_dec(x_28);
x_61 = 0;
x_62 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_63 = lean_llvm_function_type(x_1, x_62, x_19, x_61, x_29);
lean_dec(x_19);
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_uint64_of_nat(x_3);
x_67 = l_LLVM_constInt32(x_1, x_66, x_61, x_65);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
lean_dec(x_67);
x_70 = lean_uint64_of_nat(x_4);
x_71 = l_LLVM_constInt32(x_1, x_70, x_61, x_69);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = lean_uint64_of_nat(x_5);
x_75 = l_LLVM_constInt32(x_1, x_74, x_61, x_73);
x_76 = lean_ctor_get(x_75, 0);
lean_inc(x_76);
x_77 = lean_ctor_get(x_75, 1);
lean_inc(x_77);
lean_dec(x_75);
x_78 = lean_array_push(x_16, x_68);
x_79 = lean_array_push(x_78, x_72);
x_80 = lean_array_push(x_79, x_76);
x_81 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_82 = lean_unbox_usize(x_60);
lean_dec(x_60);
x_83 = lean_llvm_build_call2(x_1, x_2, x_81, x_82, x_80, x_6, x_77);
lean_dec(x_80);
x_84 = lean_ctor_get(x_83, 0);
lean_inc(x_84);
x_85 = lean_ctor_get(x_83, 1);
lean_inc(x_85);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
lean_ctor_release(x_83, 1);
x_86 = x_83;
} else {
lean_dec_ref(x_83);
x_86 = lean_box(0);
}
x_87 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_87, 0, x_84);
if (lean_is_scalar(x_86)) {
x_88 = lean_alloc_ctor(0, 2, 0);
} else {
x_88 = x_86;
}
lean_ctor_set(x_88, 0, x_87);
lean_ctor_set(x_88, 1, x_85);
return x_88;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocCtor___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; lean_object* x_12;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = l_Lean_IR_EmitLLVM_callLeanAllocCtor(x_10, x_11, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_12;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set", 13);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSet(size_t x_1, size_t x_2, size_t x_3, size_t x_4, size_t 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; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; uint8_t x_33; size_t 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; lean_object* x_42; lean_object* x_43; lean_object* x_44; size_t x_45; size_t x_46; lean_object* x_47; uint8_t x_48;
x_9 = lean_llvm_void_type_in_context(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
lean_inc(x_13);
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = lean_array_push(x_20, x_13);
x_22 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1;
x_27 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_28 = lean_unbox_usize(x_10);
x_29 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_27, x_28, x_26, x_21, x_6, x_7, x_24);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_ctor_get(x_30, 0);
lean_inc(x_32);
lean_dec(x_30);
x_33 = 0;
x_34 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_35 = lean_llvm_function_type(x_1, x_34, x_21, x_33, x_31);
lean_dec(x_21);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_box_usize(x_3);
x_39 = lean_array_push(x_18, x_38);
x_40 = lean_box_usize(x_4);
x_41 = lean_array_push(x_39, x_40);
x_42 = lean_box_usize(x_5);
x_43 = lean_array_push(x_41, x_42);
x_44 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_45 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_46 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_47 = lean_llvm_build_call2(x_1, x_2, x_45, x_46, x_43, x_44, x_37);
lean_dec(x_43);
x_48 = !lean_is_exclusive(x_47);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50;
x_49 = lean_ctor_get(x_47, 0);
lean_dec(x_49);
x_50 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_47, 0, x_50);
return x_47;
}
else
{
lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_51 = lean_ctor_get(x_47, 1);
lean_inc(x_51);
lean_dec(x_47);
x_52 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSet___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitLLVM_callLeanCtorSet(x_9, x_10, x_11, x_12, x_13, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_14;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_result_mk_ok", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(size_t x_1, size_t x_2, size_t 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_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; size_t x_18; size_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
lean_inc(x_9);
x_12 = lean_array_push(x_11, x_9);
x_13 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_10);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1;
x_18 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_19 = lean_unbox_usize(x_9);
x_20 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_18, x_19, x_17, x_12, x_5, x_6, x_15);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = !lean_is_exclusive(x_21);
if (x_23 == 0)
{
lean_object* x_24; uint8_t x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; size_t x_32; size_t x_33; lean_object* x_34; uint8_t x_35;
x_24 = lean_ctor_get(x_21, 0);
x_25 = 0;
x_26 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_27 = lean_llvm_function_type(x_1, x_26, x_12, x_25, x_22);
lean_dec(x_12);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_box_usize(x_3);
x_31 = lean_array_push(x_11, x_30);
x_32 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_33 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_34 = lean_llvm_build_call2(x_1, x_2, x_32, x_33, x_31, x_4, x_29);
lean_dec(x_31);
x_35 = !lean_is_exclusive(x_34);
if (x_35 == 0)
{
lean_object* x_36;
x_36 = lean_ctor_get(x_34, 0);
lean_ctor_set(x_21, 0, x_36);
lean_ctor_set(x_34, 0, x_21);
return x_34;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_34, 0);
x_38 = lean_ctor_get(x_34, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_34);
lean_ctor_set(x_21, 0, x_37);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_21);
lean_ctor_set(x_39, 1, x_38);
return x_39;
}
}
else
{
lean_object* x_40; uint8_t x_41; size_t x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; size_t x_48; size_t 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_40 = lean_ctor_get(x_21, 0);
lean_inc(x_40);
lean_dec(x_21);
x_41 = 0;
x_42 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_43 = lean_llvm_function_type(x_1, x_42, x_12, x_41, x_22);
lean_dec(x_12);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = lean_box_usize(x_3);
x_47 = lean_array_push(x_11, x_46);
x_48 = lean_unbox_usize(x_44);
lean_dec(x_44);
x_49 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_50 = lean_llvm_build_call2(x_1, x_2, x_48, x_49, x_47, x_4, x_45);
lean_dec(x_47);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
if (lean_is_exclusive(x_50)) {
lean_ctor_release(x_50, 0);
lean_ctor_release(x_50, 1);
x_53 = x_50;
} else {
lean_dec_ref(x_50);
x_53 = lean_box(0);
}
x_54 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_54, 0, x_51);
if (lean_is_scalar(x_53)) {
x_55 = lean_alloc_ctor(0, 2, 0);
} else {
x_55 = x_53;
}
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_52);
return x_55;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_alloc_closure", 18);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocClosureFn(size_t x_1, size_t x_2, size_t x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
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; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36;
x_10 = l_LLVM_voidPtrType(x_1, x_9);
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_LLVM_voidPtrType(x_1, x_12);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_LLVM_size__tType(x_1, x_15);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_LLVM_size__tType(x_1, x_18);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_23 = lean_array_push(x_22, x_14);
x_24 = lean_array_push(x_23, x_17);
x_25 = lean_array_push(x_24, x_20);
x_26 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_8, x_21);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1;
x_31 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_32 = lean_unbox_usize(x_11);
x_33 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_31, x_32, x_30, x_25, x_7, x_8, x_28);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = !lean_is_exclusive(x_34);
if (x_36 == 0)
{
lean_object* x_37; uint8_t x_38; size_t 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; size_t x_49; size_t x_50; lean_object* x_51; uint8_t x_52;
x_37 = lean_ctor_get(x_34, 0);
x_38 = 0;
x_39 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_40 = lean_llvm_function_type(x_1, x_39, x_25, x_38, x_35);
lean_dec(x_25);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_box_usize(x_3);
x_44 = lean_array_push(x_22, x_43);
x_45 = lean_box_usize(x_4);
x_46 = lean_array_push(x_44, x_45);
x_47 = lean_box_usize(x_5);
x_48 = lean_array_push(x_46, x_47);
x_49 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_50 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_51 = lean_llvm_build_call2(x_1, x_2, x_49, x_50, x_48, x_6, x_42);
lean_dec(x_48);
x_52 = !lean_is_exclusive(x_51);
if (x_52 == 0)
{
lean_object* x_53;
x_53 = lean_ctor_get(x_51, 0);
lean_ctor_set(x_34, 0, x_53);
lean_ctor_set(x_51, 0, x_34);
return x_51;
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_54 = lean_ctor_get(x_51, 0);
x_55 = lean_ctor_get(x_51, 1);
lean_inc(x_55);
lean_inc(x_54);
lean_dec(x_51);
lean_ctor_set(x_34, 0, x_54);
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_34);
lean_ctor_set(x_56, 1, x_55);
return x_56;
}
}
else
{
lean_object* x_57; uint8_t x_58; size_t 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; lean_object* x_68; size_t x_69; size_t 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_57 = lean_ctor_get(x_34, 0);
lean_inc(x_57);
lean_dec(x_34);
x_58 = 0;
x_59 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_60 = lean_llvm_function_type(x_1, x_59, x_25, x_58, x_35);
lean_dec(x_25);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = lean_box_usize(x_3);
x_64 = lean_array_push(x_22, x_63);
x_65 = lean_box_usize(x_4);
x_66 = lean_array_push(x_64, x_65);
x_67 = lean_box_usize(x_5);
x_68 = lean_array_push(x_66, x_67);
x_69 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_70 = lean_unbox_usize(x_57);
lean_dec(x_57);
x_71 = lean_llvm_build_call2(x_1, x_2, x_69, x_70, x_68, x_6, x_62);
lean_dec(x_68);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
if (lean_is_exclusive(x_71)) {
lean_ctor_release(x_71, 0);
lean_ctor_release(x_71, 1);
x_74 = x_71;
} else {
lean_dec_ref(x_71);
x_74 = lean_box(0);
}
x_75 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_75, 0, x_72);
if (lean_is_scalar(x_74)) {
x_76 = lean_alloc_ctor(0, 2, 0);
} else {
x_76 = x_74;
}
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_73);
return x_76;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; size_t x_14; lean_object* x_15;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = l_Lean_IR_EmitLLVM_callLeanAllocClosureFn(x_10, x_11, x_12, x_13, x_14, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
return x_15;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_closure_set", 16);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanClosureSetFn(size_t x_1, size_t x_2, size_t x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
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; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint8_t x_37; size_t 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; size_t x_48; size_t x_49; lean_object* x_50; uint8_t x_51;
x_10 = lean_llvm_void_type_in_context(x_1, x_9);
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_LLVM_voidPtrType(x_1, x_12);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_LLVM_size__tType(x_1, x_15);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_LLVM_voidPtrType(x_1, x_18);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_23 = lean_array_push(x_22, x_14);
x_24 = lean_array_push(x_23, x_17);
x_25 = lean_array_push(x_24, x_20);
x_26 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_8, x_21);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1;
x_31 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_32 = lean_unbox_usize(x_11);
x_33 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_31, x_32, x_30, x_25, x_7, x_8, x_28);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_ctor_get(x_34, 0);
lean_inc(x_36);
lean_dec(x_34);
x_37 = 0;
x_38 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_39 = lean_llvm_function_type(x_1, x_38, x_25, x_37, x_35);
lean_dec(x_25);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
lean_dec(x_39);
x_42 = lean_box_usize(x_3);
x_43 = lean_array_push(x_22, x_42);
x_44 = lean_box_usize(x_4);
x_45 = lean_array_push(x_43, x_44);
x_46 = lean_box_usize(x_5);
x_47 = lean_array_push(x_45, x_46);
x_48 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_49 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_50 = lean_llvm_build_call2(x_1, x_2, x_48, x_49, x_47, x_6, x_41);
lean_dec(x_47);
x_51 = !lean_is_exclusive(x_50);
if (x_51 == 0)
{
lean_object* x_52; lean_object* x_53;
x_52 = lean_ctor_get(x_50, 0);
lean_dec(x_52);
x_53 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_50, 0, x_53);
return x_50;
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_54 = lean_ctor_get(x_50, 1);
lean_inc(x_54);
lean_dec(x_50);
x_55 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_54);
return x_56;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanClosureSetFn___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; size_t x_14; lean_object* x_15;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = l_Lean_IR_EmitLLVM_callLeanClosureSetFn(x_10, x_11, x_12, x_13, x_14, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
return x_15;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_obj_tag", 12);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanObjTag(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i32Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t 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; size_t x_44; size_t x_45; lean_object* x_46; uint8_t x_47;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = l_LLVM_i64Type(x_1, x_39);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_44 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_45 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_46 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_44, x_45, x_43, x_42);
x_47 = !lean_is_exclusive(x_46);
if (x_47 == 0)
{
lean_object* x_48;
x_48 = lean_ctor_get(x_46, 0);
lean_ctor_set(x_24, 0, x_48);
lean_ctor_set(x_46, 0, x_24);
return x_46;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_46, 0);
x_50 = lean_ctor_get(x_46, 1);
lean_inc(x_50);
lean_inc(x_49);
lean_dec(x_46);
lean_ctor_set(x_24, 0, x_49);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_24);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
else
{
lean_object* x_52; uint8_t x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; size_t x_60; size_t 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; lean_object* x_68; size_t x_69; size_t 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_52 = lean_ctor_get(x_24, 0);
lean_inc(x_52);
lean_dec(x_24);
x_53 = 0;
x_54 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_55 = lean_llvm_function_type(x_1, x_54, x_15, x_53, x_25);
lean_dec(x_15);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = lean_box_usize(x_3);
x_59 = lean_array_push(x_14, x_58);
x_60 = lean_unbox_usize(x_56);
lean_dec(x_56);
x_61 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_62 = lean_llvm_build_call2(x_1, x_2, x_60, x_61, x_59, x_4, x_57);
lean_dec(x_59);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = l_LLVM_i64Type(x_1, x_64);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_69 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_70 = lean_unbox_usize(x_66);
lean_dec(x_66);
x_71 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_69, x_70, x_68, x_67);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
if (lean_is_exclusive(x_71)) {
lean_ctor_release(x_71, 0);
lean_ctor_release(x_71, 1);
x_74 = x_71;
} else {
lean_dec_ref(x_71);
x_74 = lean_box(0);
}
x_75 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_75, 0, x_72);
if (lean_is_scalar(x_74)) {
x_76 = lean_alloc_ctor(0, 2, 0);
} else {
x_76 = x_74;
}
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_73);
return x_76;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanObjTag___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanObjTag(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_result_get_value", 24);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_release", 17);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorRelease(size_t x_1, size_t x_2, size_t x_3, size_t 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; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t x_26; size_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t x_32; size_t 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; size_t x_41; size_t x_42; lean_object* x_43; uint8_t x_44;
x_9 = lean_llvm_void_type_in_context(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_17);
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 = lean_ctor_get(x_22, 0);
lean_inc(x_24);
lean_dec(x_22);
x_25 = l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1;
x_26 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_10);
x_28 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_26, x_27, x_25, x_20, x_6, x_7, x_23);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_ctor_get(x_29, 0);
lean_inc(x_31);
lean_dec(x_29);
x_32 = 0;
x_33 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_34 = lean_llvm_function_type(x_1, x_33, x_20, x_32, x_30);
lean_dec(x_20);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_box_usize(x_3);
x_38 = lean_array_push(x_18, x_37);
x_39 = lean_box_usize(x_4);
x_40 = lean_array_push(x_38, x_39);
x_41 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_42 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_43 = lean_llvm_build_call2(x_1, x_2, x_41, x_42, x_40, x_5, x_36);
lean_dec(x_40);
x_44 = !lean_is_exclusive(x_43);
if (x_44 == 0)
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_43, 0);
lean_dec(x_45);
x_46 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_43, 0, x_46);
return x_43;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_43, 1);
lean_inc(x_47);
lean_dec(x_43);
x_48 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorRelease___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_callLeanCtorRelease(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_tag", 17);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSetTag(size_t x_1, size_t x_2, size_t x_3, size_t 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; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t x_26; size_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t x_32; size_t 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; size_t x_41; size_t x_42; lean_object* x_43; uint8_t x_44;
x_9 = lean_llvm_void_type_in_context(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_17);
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 = lean_ctor_get(x_22, 0);
lean_inc(x_24);
lean_dec(x_22);
x_25 = l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1;
x_26 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_10);
x_28 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_26, x_27, x_25, x_20, x_6, x_7, x_23);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_ctor_get(x_29, 0);
lean_inc(x_31);
lean_dec(x_29);
x_32 = 0;
x_33 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_34 = lean_llvm_function_type(x_1, x_33, x_20, x_32, x_30);
lean_dec(x_20);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_box_usize(x_3);
x_38 = lean_array_push(x_18, x_37);
x_39 = lean_box_usize(x_4);
x_40 = lean_array_push(x_38, x_39);
x_41 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_42 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_43 = lean_llvm_build_call2(x_1, x_2, x_41, x_42, x_40, x_5, x_36);
lean_dec(x_40);
x_44 = !lean_is_exclusive(x_43);
if (x_44 == 0)
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_43, 0);
lean_dec(x_45);
x_46 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_43, 0, x_46);
return x_43;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_43, 1);
lean_inc(x_47);
lean_dec(x_43);
x_48 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorSetTag___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_callLeanCtorSetTag(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1(size_t 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;
x_6 = lean_box_usize(x_1);
x_7 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_instInhabitedM___boxed), 4, 2);
lean_closure_set(x_7, 0, x_6);
lean_closure_set(x_7, 1, lean_box(0));
x_8 = lean_panic_fn(x_7, x_2);
x_9 = lean_apply_3(x_8, x_3, x_4, x_5);
return x_9;
}
}
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2(size_t 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;
x_6 = lean_box_usize(x_1);
x_7 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_instInhabitedM___boxed), 4, 2);
lean_closure_set(x_7, 0, x_6);
lean_closure_set(x_7, 1, lean_box(0));
x_8 = lean_panic_fn(x_7, x_2);
x_9 = lean_apply_3(x_8, x_3, x_4, x_5);
return x_9;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean.Compiler.IR.EmitLLVM", 25);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean.IR.EmitLLVM.toLLVMType", 27);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("not implemented yet", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_1 = l_Lean_IR_EmitLLVM_toLLVMType___closed__1;
x_2 = l_Lean_IR_EmitLLVM_toLLVMType___closed__2;
x_3 = lean_unsigned_to_nat(293u);
x_4 = lean_unsigned_to_nat(25u);
x_5 = l_Lean_IR_EmitLLVM_toLLVMType___closed__3;
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
return x_6;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_1 = l_Lean_IR_EmitLLVM_toLLVMType___closed__1;
x_2 = l_Lean_IR_EmitLLVM_toLLVMType___closed__2;
x_3 = lean_unsigned_to_nat(294u);
x_4 = lean_unsigned_to_nat(25u);
x_5 = l_Lean_IR_EmitLLVM_toLLVMType___closed__3;
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toLLVMType(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
switch (lean_obj_tag(x_2)) {
case 0:
{
lean_object* x_6; uint8_t x_7;
lean_dec(x_4);
lean_dec(x_3);
x_6 = lean_llvm_double_type_in_context(x_1, x_5);
x_7 = !lean_is_exclusive(x_6);
if (x_7 == 0)
{
lean_object* x_8; lean_object* x_9;
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_6, 0, x_9);
return x_6;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_6, 0);
x_11 = lean_ctor_get(x_6, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_6);
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_10);
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 1:
{
uint64_t x_14; lean_object* x_15; uint8_t x_16;
lean_dec(x_4);
lean_dec(x_3);
x_14 = 8;
x_15 = lean_llvm_int_type_in_context(x_1, x_14, x_5);
x_16 = !lean_is_exclusive(x_15);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_15, 0);
x_18 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_15, 0, x_18);
return x_15;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_19 = lean_ctor_get(x_15, 0);
x_20 = lean_ctor_get(x_15, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_15);
x_21 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_21, 0, x_19);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_20);
return x_22;
}
}
case 2:
{
uint64_t x_23; lean_object* x_24; uint8_t x_25;
lean_dec(x_4);
lean_dec(x_3);
x_23 = 16;
x_24 = lean_llvm_int_type_in_context(x_1, x_23, x_5);
x_25 = !lean_is_exclusive(x_24);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_24, 0);
x_27 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_24, 0, x_27);
return x_24;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_28 = lean_ctor_get(x_24, 0);
x_29 = lean_ctor_get(x_24, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_24);
x_30 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_30, 0, x_28);
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;
}
}
case 3:
{
uint64_t x_32; lean_object* x_33; uint8_t x_34;
lean_dec(x_4);
lean_dec(x_3);
x_32 = 32;
x_33 = lean_llvm_int_type_in_context(x_1, x_32, x_5);
x_34 = !lean_is_exclusive(x_33);
if (x_34 == 0)
{
lean_object* x_35; lean_object* x_36;
x_35 = lean_ctor_get(x_33, 0);
x_36 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_33, 0, x_36);
return x_33;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_37 = lean_ctor_get(x_33, 0);
x_38 = lean_ctor_get(x_33, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_33);
x_39 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_39, 0, x_37);
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;
}
}
case 4:
{
uint64_t x_41; lean_object* x_42; uint8_t x_43;
lean_dec(x_4);
lean_dec(x_3);
x_41 = 64;
x_42 = lean_llvm_int_type_in_context(x_1, x_41, x_5);
x_43 = !lean_is_exclusive(x_42);
if (x_43 == 0)
{
lean_object* x_44; lean_object* x_45;
x_44 = lean_ctor_get(x_42, 0);
x_45 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_42, 0, x_45);
return x_42;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_46 = lean_ctor_get(x_42, 0);
x_47 = lean_ctor_get(x_42, 1);
lean_inc(x_47);
lean_inc(x_46);
lean_dec(x_42);
x_48 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_48, 0, x_46);
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;
}
}
case 5:
{
lean_object* x_50; uint8_t x_51;
lean_dec(x_4);
lean_dec(x_3);
x_50 = l_Lean_IR_LLVM_size__tType(x_1, x_5);
x_51 = !lean_is_exclusive(x_50);
if (x_51 == 0)
{
lean_object* x_52; lean_object* x_53;
x_52 = lean_ctor_get(x_50, 0);
x_53 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_50, 0, x_53);
return x_50;
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_54 = lean_ctor_get(x_50, 0);
x_55 = lean_ctor_get(x_50, 1);
lean_inc(x_55);
lean_inc(x_54);
lean_dec(x_50);
x_56 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_56, 0, x_54);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_55);
return x_57;
}
}
case 9:
{
lean_object* x_58; lean_object* x_59;
lean_dec(x_2);
x_58 = l_Lean_IR_EmitLLVM_toLLVMType___closed__4;
x_59 = l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1(x_1, x_58, x_3, x_4, x_5);
return x_59;
}
case 10:
{
lean_object* x_60; lean_object* x_61;
lean_dec(x_2);
x_60 = l_Lean_IR_EmitLLVM_toLLVMType___closed__5;
x_61 = l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2(x_1, x_60, x_3, x_4, x_5);
return x_61;
}
default:
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; size_t x_65; lean_object* x_66; uint8_t x_67;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_62 = l_LLVM_i8Type(x_1, x_5);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_66 = lean_llvm_pointer_type(x_1, x_65, x_64);
x_67 = !lean_is_exclusive(x_66);
if (x_67 == 0)
{
lean_object* x_68; lean_object* x_69;
x_68 = lean_ctor_get(x_66, 0);
x_69 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_69, 0, x_68);
lean_ctor_set(x_66, 0, x_69);
return x_66;
}
else
{
lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_70 = lean_ctor_get(x_66, 0);
x_71 = lean_ctor_get(x_66, 1);
lean_inc(x_71);
lean_inc(x_70);
lean_dec(x_66);
x_72 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_72, 0, x_70);
x_73 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_73, 0, x_72);
lean_ctor_set(x_73, 1, x_71);
return x_73;
}
}
}
}
}
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__1(x_6, x_2, x_3, x_4, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_panic___at_Lean_IR_EmitLLVM_toLLVMType___spec__2(x_6, x_2, x_3, x_4, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toLLVMType___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_toLLVMType(x_6, x_2, x_3, x_4, x_5);
return x_7;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("invalid export name ", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(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; 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_5 = 1;
x_6 = l_Lean_Name_toString(x_1, x_5);
x_7 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1;
x_8 = lean_string_append(x_7, x_6);
lean_dec(x_6);
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = lean_string_append(x_8, x_9);
x_11 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_11, 0, x_10);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_4);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___boxed), 4, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___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_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_throwInvalidExportName___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_EmitLLVM_throwInvalidExportName(x_3, x_2);
return x_4;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_exportAttr;
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("main", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCName___rarg___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_EmitLLVM_toCName___rarg___closed__2;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("l_", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__5() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_leanMainFn;
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___rarg(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_EmitLLVM_getEnv___rarg(x_3, x_4);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_ctor_get(x_5, 0);
x_8 = !lean_is_exclusive(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;
x_9 = lean_ctor_get(x_5, 1);
x_10 = lean_ctor_get(x_7, 0);
x_11 = l_Lean_instInhabitedName;
x_12 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_13 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_11, x_12, x_10, x_1);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
x_15 = lean_name_eq(x_1, x_14);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
x_16 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_17 = lean_name_mangle(x_1, x_16);
lean_ctor_set(x_7, 0, x_17);
return x_5;
}
else
{
lean_object* x_18;
lean_free_object(x_7);
lean_dec(x_1);
x_18 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__5;
lean_ctor_set(x_5, 0, x_18);
return x_5;
}
}
else
{
lean_object* x_19;
x_19 = lean_ctor_get(x_13, 0);
lean_inc(x_19);
lean_dec(x_13);
if (lean_obj_tag(x_19) == 1)
{
lean_object* x_20;
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21;
lean_dec(x_1);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
lean_ctor_set(x_7, 0, x_21);
return x_5;
}
else
{
lean_object* x_22;
lean_dec(x_20);
lean_dec(x_19);
lean_free_object(x_7);
lean_free_object(x_5);
x_22 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_9);
return x_22;
}
}
else
{
lean_object* x_23;
lean_dec(x_19);
lean_free_object(x_7);
lean_free_object(x_5);
x_23 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_9);
return x_23;
}
}
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_24 = lean_ctor_get(x_5, 1);
x_25 = lean_ctor_get(x_7, 0);
lean_inc(x_25);
lean_dec(x_7);
x_26 = l_Lean_instInhabitedName;
x_27 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_28 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_26, x_27, x_25, x_1);
if (lean_obj_tag(x_28) == 0)
{
lean_object* x_29; uint8_t x_30;
x_29 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
x_30 = lean_name_eq(x_1, x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_32 = lean_name_mangle(x_1, x_31);
x_33 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_5, 0, x_33);
return x_5;
}
else
{
lean_object* x_34;
lean_dec(x_1);
x_34 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__5;
lean_ctor_set(x_5, 0, x_34);
return x_5;
}
}
else
{
lean_object* x_35;
x_35 = lean_ctor_get(x_28, 0);
lean_inc(x_35);
lean_dec(x_28);
if (lean_obj_tag(x_35) == 1)
{
lean_object* x_36;
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37; lean_object* x_38;
lean_dec(x_1);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_5, 0, x_38);
return x_5;
}
else
{
lean_object* x_39;
lean_dec(x_36);
lean_dec(x_35);
lean_free_object(x_5);
x_39 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_24);
return x_39;
}
}
else
{
lean_object* x_40;
lean_dec(x_35);
lean_free_object(x_5);
x_40 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_24);
return x_40;
}
}
}
}
else
{
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_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_ctor_get(x_41, 0);
lean_inc(x_43);
if (lean_is_exclusive(x_41)) {
lean_ctor_release(x_41, 0);
x_44 = x_41;
} else {
lean_dec_ref(x_41);
x_44 = lean_box(0);
}
x_45 = l_Lean_instInhabitedName;
x_46 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_47 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_45, x_46, x_43, x_1);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; uint8_t x_49;
x_48 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
x_49 = lean_name_eq(x_1, x_48);
if (x_49 == 0)
{
lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_50 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_51 = lean_name_mangle(x_1, x_50);
if (lean_is_scalar(x_44)) {
x_52 = lean_alloc_ctor(1, 1, 0);
} else {
x_52 = x_44;
}
lean_ctor_set(x_52, 0, x_51);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_42);
return x_53;
}
else
{
lean_object* x_54; lean_object* x_55;
lean_dec(x_44);
lean_dec(x_1);
x_54 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__5;
x_55 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_42);
return x_55;
}
}
else
{
lean_object* x_56;
x_56 = lean_ctor_get(x_47, 0);
lean_inc(x_56);
lean_dec(x_47);
if (lean_obj_tag(x_56) == 1)
{
lean_object* x_57;
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
if (lean_obj_tag(x_57) == 0)
{
lean_object* x_58; lean_object* x_59; lean_object* x_60;
lean_dec(x_1);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
if (lean_is_scalar(x_44)) {
x_59 = lean_alloc_ctor(1, 1, 0);
} else {
x_59 = x_44;
}
lean_ctor_set(x_59, 0, x_58);
x_60 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_60, 0, x_59);
lean_ctor_set(x_60, 1, x_42);
return x_60;
}
else
{
lean_object* x_61;
lean_dec(x_57);
lean_dec(x_56);
lean_dec(x_44);
x_61 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_42);
return x_61;
}
}
else
{
lean_object* x_62;
lean_dec(x_56);
lean_dec(x_44);
x_62 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_42);
return x_62;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_toCName___rarg___boxed), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___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_EmitLLVM_toCName___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCName___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_toCName(x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_init_", 6);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___rarg(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_EmitLLVM_getEnv___rarg(x_3, x_4);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_ctor_get(x_5, 0);
x_8 = !lean_is_exclusive(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;
x_9 = lean_ctor_get(x_5, 1);
x_10 = lean_ctor_get(x_7, 0);
x_11 = l_Lean_instInhabitedName;
x_12 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_13 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_11, x_12, x_10, x_1);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_14 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_15 = lean_name_mangle(x_1, x_14);
x_16 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
lean_ctor_set(x_7, 0, x_17);
return x_5;
}
else
{
lean_object* x_18;
x_18 = lean_ctor_get(x_13, 0);
lean_inc(x_18);
lean_dec(x_13);
if (lean_obj_tag(x_18) == 1)
{
lean_object* x_19;
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
if (lean_obj_tag(x_19) == 0)
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_1);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_22 = lean_string_append(x_21, x_20);
lean_dec(x_20);
lean_ctor_set(x_7, 0, x_22);
return x_5;
}
else
{
lean_object* x_23;
lean_dec(x_19);
lean_dec(x_18);
lean_free_object(x_7);
lean_free_object(x_5);
x_23 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_9);
return x_23;
}
}
else
{
lean_object* x_24;
lean_dec(x_18);
lean_free_object(x_7);
lean_free_object(x_5);
x_24 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_9);
return x_24;
}
}
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_25 = lean_ctor_get(x_5, 1);
x_26 = lean_ctor_get(x_7, 0);
lean_inc(x_26);
lean_dec(x_7);
x_27 = l_Lean_instInhabitedName;
x_28 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_29 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_27, x_28, x_26, x_1);
if (lean_obj_tag(x_29) == 0)
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_30 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_31 = lean_name_mangle(x_1, x_30);
x_32 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_33 = lean_string_append(x_32, x_31);
lean_dec(x_31);
x_34 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_5, 0, x_34);
return x_5;
}
else
{
lean_object* x_35;
x_35 = lean_ctor_get(x_29, 0);
lean_inc(x_35);
lean_dec(x_29);
if (lean_obj_tag(x_35) == 1)
{
lean_object* x_36;
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
lean_dec(x_1);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_39 = lean_string_append(x_38, x_37);
lean_dec(x_37);
x_40 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_5, 0, x_40);
return x_5;
}
else
{
lean_object* x_41;
lean_dec(x_36);
lean_dec(x_35);
lean_free_object(x_5);
x_41 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_25);
return x_41;
}
}
else
{
lean_object* x_42;
lean_dec(x_35);
lean_free_object(x_5);
x_42 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_25);
return x_42;
}
}
}
}
else
{
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_43 = lean_ctor_get(x_5, 0);
x_44 = lean_ctor_get(x_5, 1);
lean_inc(x_44);
lean_inc(x_43);
lean_dec(x_5);
x_45 = lean_ctor_get(x_43, 0);
lean_inc(x_45);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
x_46 = x_43;
} else {
lean_dec_ref(x_43);
x_46 = lean_box(0);
}
x_47 = l_Lean_instInhabitedName;
x_48 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__1;
lean_inc(x_1);
x_49 = l_Lean_ParametricAttribute_getParam_x3f___rarg(x_47, x_48, x_45, x_1);
if (lean_obj_tag(x_49) == 0)
{
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_50 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_51 = lean_name_mangle(x_1, x_50);
x_52 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_53 = lean_string_append(x_52, x_51);
lean_dec(x_51);
if (lean_is_scalar(x_46)) {
x_54 = lean_alloc_ctor(1, 1, 0);
} else {
x_54 = x_46;
}
lean_ctor_set(x_54, 0, x_53);
x_55 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_44);
return x_55;
}
else
{
lean_object* x_56;
x_56 = lean_ctor_get(x_49, 0);
lean_inc(x_56);
lean_dec(x_49);
if (lean_obj_tag(x_56) == 1)
{
lean_object* x_57;
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
if (lean_obj_tag(x_57) == 0)
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
lean_dec(x_1);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_60 = lean_string_append(x_59, x_58);
lean_dec(x_58);
if (lean_is_scalar(x_46)) {
x_61 = lean_alloc_ctor(1, 1, 0);
} else {
x_61 = x_46;
}
lean_ctor_set(x_61, 0, x_60);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_44);
return x_62;
}
else
{
lean_object* x_63;
lean_dec(x_57);
lean_dec(x_56);
lean_dec(x_46);
x_63 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_44);
return x_63;
}
}
else
{
lean_object* x_64;
lean_dec(x_56);
lean_dec(x_46);
x_64 = l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg(x_1, x_2, x_3, x_44);
return x_64;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_toCInitName___rarg___boxed), 4, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___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_EmitLLVM_toCInitName___rarg(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toCInitName___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_toCInitName(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_toCtorIdx(uint8_t x_1) {
_start:
{
if (x_1 == 0)
{
lean_object* x_2;
x_2 = lean_unsigned_to_nat(0u);
return x_2;
}
else
{
lean_object* x_3;
x_3 = lean_unsigned_to_nat(1u);
return x_3;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_toCtorIdx___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = lean_unbox(x_1);
lean_dec(x_1);
x_3 = l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_toCtorIdx(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg(uint8_t x_1, uint8_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1;
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg___boxed), 3, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
uint8_t x_4; uint8_t x_5; lean_object* x_6;
x_4 = lean_unbox(x_1);
lean_dec(x_1);
x_5 = lean_unbox(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_EmitLLVM_ShouldForwardControlFlow_noConfusion___rarg(x_4, x_5, x_3);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderGetInsertionFn(size_t x_1, size_t 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; size_t x_10; lean_object* x_11; uint8_t x_12;
x_6 = lean_box_usize(x_1);
x_7 = lean_llvm_get_insert_block(x_6, x_2, 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);
lean_dec(x_7);
x_10 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_11 = lean_llvm_get_basic_block_parent(x_1, x_10, x_9);
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_11, 0);
x_14 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_11, 0, x_14);
return x_11;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
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, 1, 0);
lean_ctor_set(x_17, 0, x_15);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderGetInsertionFn___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_builderGetInsertionFn(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderAppendBasicBlock(size_t x_1, size_t 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_8; lean_object* x_9; uint8_t x_10;
x_7 = l_Lean_IR_EmitLLVM_builderGetInsertionFn(x_1, x_2, x_4, x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; size_t x_12; lean_object* x_13; uint8_t x_14;
x_11 = lean_ctor_get(x_8, 0);
x_12 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_13 = lean_llvm_append_basic_block_in_context(x_1, x_12, x_3, x_9);
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_13, 0);
lean_ctor_set(x_8, 0, x_15);
lean_ctor_set(x_13, 0, x_8);
return x_13;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_13, 0);
x_17 = lean_ctor_get(x_13, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_13);
lean_ctor_set(x_8, 0, x_16);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_8);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
else
{
lean_object* x_19; size_t 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_19 = lean_ctor_get(x_8, 0);
lean_inc(x_19);
lean_dec(x_8);
x_20 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_21 = lean_llvm_append_basic_block_in_context(x_1, x_20, x_3, x_9);
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
if (lean_is_exclusive(x_21)) {
lean_ctor_release(x_21, 0);
lean_ctor_release(x_21, 1);
x_24 = x_21;
} else {
lean_dec_ref(x_21);
x_24 = lean_box(0);
}
x_25 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_25, 0, x_22);
if (lean_is_scalar(x_24)) {
x_26 = lean_alloc_ctor(0, 2, 0);
} else {
x_26 = x_24;
}
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_23);
return x_26;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_builderAppendBasicBlock___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_7, x_8, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("header", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("body", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("merge", 5);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildWhile__(size_t x_1, size_t 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; size_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; size_t x_23; lean_object* x_24; lean_object* x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; size_t x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_9 = l_Lean_IR_EmitLLVM_builderGetInsertionFn(x_1, x_2, x_6, x_7, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_buildWhile_____closed__1;
lean_inc(x_3);
x_14 = lean_string_append(x_3, x_13);
x_15 = l_Lean_IR_EmitLLVM_buildWhile_____closed__2;
lean_inc(x_3);
x_16 = lean_string_append(x_3, x_15);
x_17 = l_Lean_IR_EmitLLVM_buildWhile_____closed__3;
x_18 = lean_string_append(x_3, x_17);
x_19 = lean_unbox_usize(x_12);
x_20 = lean_llvm_append_basic_block_in_context(x_1, x_19, x_14, x_11);
lean_dec(x_14);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_unbox_usize(x_21);
x_24 = lean_llvm_build_br(x_1, x_2, x_23, x_22);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = lean_unbox_usize(x_12);
x_27 = lean_llvm_append_basic_block_in_context(x_1, x_26, x_16, x_25);
lean_dec(x_16);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_31 = lean_llvm_append_basic_block_in_context(x_1, x_30, x_18, x_29);
lean_dec(x_18);
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_box_usize(x_1);
x_35 = lean_unbox_usize(x_21);
x_36 = lean_llvm_position_builder_at_end(x_34, x_2, x_35, x_33);
x_37 = lean_ctor_get(x_36, 1);
lean_inc(x_37);
lean_dec(x_36);
x_38 = lean_box_usize(x_2);
lean_inc(x_7);
lean_inc(x_6);
x_39 = lean_apply_4(x_4, x_38, x_6, x_7, x_37);
if (lean_obj_tag(x_39) == 0)
{
lean_object* x_40;
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
if (lean_obj_tag(x_40) == 0)
{
uint8_t x_41;
lean_dec(x_32);
lean_dec(x_28);
lean_dec(x_21);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_41 = !lean_is_exclusive(x_39);
if (x_41 == 0)
{
lean_object* x_42; uint8_t x_43;
x_42 = lean_ctor_get(x_39, 0);
lean_dec(x_42);
x_43 = !lean_is_exclusive(x_40);
if (x_43 == 0)
{
return x_39;
}
else
{
lean_object* x_44; lean_object* x_45;
x_44 = lean_ctor_get(x_40, 0);
lean_inc(x_44);
lean_dec(x_40);
x_45 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_45, 0, 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_ctor_get(x_40, 0);
lean_inc(x_47);
if (lean_is_exclusive(x_40)) {
lean_ctor_release(x_40, 0);
x_48 = x_40;
} else {
lean_dec_ref(x_40);
x_48 = lean_box(0);
}
if (lean_is_scalar(x_48)) {
x_49 = lean_alloc_ctor(0, 1, 0);
} else {
x_49 = x_48;
}
lean_ctor_set(x_49, 0, x_47);
x_50 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_50, 0, x_49);
lean_ctor_set(x_50, 1, x_46);
return x_50;
}
}
else
{
lean_object* x_51; lean_object* x_52; size_t x_53; size_t x_54; size_t x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; size_t x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_51 = lean_ctor_get(x_39, 1);
lean_inc(x_51);
lean_dec(x_39);
x_52 = lean_ctor_get(x_40, 0);
lean_inc(x_52);
lean_dec(x_40);
x_53 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_54 = lean_unbox_usize(x_28);
x_55 = lean_unbox_usize(x_32);
x_56 = lean_llvm_build_cond_br(x_1, x_2, x_53, x_54, x_55, x_51);
x_57 = lean_ctor_get(x_56, 1);
lean_inc(x_57);
lean_dec(x_56);
x_58 = lean_box_usize(x_1);
x_59 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_60 = lean_llvm_position_builder_at_end(x_58, x_2, x_59, x_57);
x_61 = lean_ctor_get(x_60, 1);
lean_inc(x_61);
lean_dec(x_60);
x_62 = lean_box_usize(x_2);
x_63 = lean_apply_4(x_5, x_62, x_6, x_7, x_61);
if (lean_obj_tag(x_63) == 0)
{
lean_object* x_64;
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
if (lean_obj_tag(x_64) == 0)
{
uint8_t x_65;
lean_dec(x_32);
lean_dec(x_21);
x_65 = !lean_is_exclusive(x_63);
if (x_65 == 0)
{
lean_object* x_66; uint8_t x_67;
x_66 = lean_ctor_get(x_63, 0);
lean_dec(x_66);
x_67 = !lean_is_exclusive(x_64);
if (x_67 == 0)
{
return x_63;
}
else
{
lean_object* x_68; lean_object* x_69;
x_68 = lean_ctor_get(x_64, 0);
lean_inc(x_68);
lean_dec(x_64);
x_69 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_69, 0, x_68);
lean_ctor_set(x_63, 0, x_69);
return x_63;
}
}
else
{
lean_object* x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74;
x_70 = lean_ctor_get(x_63, 1);
lean_inc(x_70);
lean_dec(x_63);
x_71 = lean_ctor_get(x_64, 0);
lean_inc(x_71);
if (lean_is_exclusive(x_64)) {
lean_ctor_release(x_64, 0);
x_72 = x_64;
} else {
lean_dec_ref(x_64);
x_72 = lean_box(0);
}
if (lean_is_scalar(x_72)) {
x_73 = lean_alloc_ctor(0, 1, 0);
} else {
x_73 = x_72;
}
lean_ctor_set(x_73, 0, x_71);
x_74 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_74, 0, x_73);
lean_ctor_set(x_74, 1, x_70);
return x_74;
}
}
else
{
uint8_t x_75;
x_75 = !lean_is_exclusive(x_64);
if (x_75 == 0)
{
lean_object* x_76; lean_object* x_77; size_t x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; size_t x_82; lean_object* x_83; uint8_t x_84;
x_76 = lean_ctor_get(x_64, 0);
lean_dec(x_76);
x_77 = lean_ctor_get(x_63, 1);
lean_inc(x_77);
lean_dec(x_63);
x_78 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_79 = lean_llvm_build_br(x_1, x_2, x_78, x_77);
x_80 = lean_ctor_get(x_79, 1);
lean_inc(x_80);
lean_dec(x_79);
x_81 = lean_box_usize(x_1);
x_82 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_83 = lean_llvm_position_builder_at_end(x_81, x_2, x_82, x_80);
x_84 = !lean_is_exclusive(x_83);
if (x_84 == 0)
{
lean_object* x_85;
x_85 = lean_ctor_get(x_83, 0);
lean_ctor_set(x_64, 0, x_85);
lean_ctor_set(x_83, 0, x_64);
return x_83;
}
else
{
lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_86 = lean_ctor_get(x_83, 0);
x_87 = lean_ctor_get(x_83, 1);
lean_inc(x_87);
lean_inc(x_86);
lean_dec(x_83);
lean_ctor_set(x_64, 0, x_86);
x_88 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_88, 0, x_64);
lean_ctor_set(x_88, 1, x_87);
return x_88;
}
}
else
{
lean_object* x_89; size_t x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; size_t x_94; 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_dec(x_64);
x_89 = lean_ctor_get(x_63, 1);
lean_inc(x_89);
lean_dec(x_63);
x_90 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_91 = lean_llvm_build_br(x_1, x_2, x_90, x_89);
x_92 = lean_ctor_get(x_91, 1);
lean_inc(x_92);
lean_dec(x_91);
x_93 = lean_box_usize(x_1);
x_94 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_95 = lean_llvm_position_builder_at_end(x_93, x_2, x_94, x_92);
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_95, 1);
lean_inc(x_97);
if (lean_is_exclusive(x_95)) {
lean_ctor_release(x_95, 0);
lean_ctor_release(x_95, 1);
x_98 = x_95;
} else {
lean_dec_ref(x_95);
x_98 = lean_box(0);
}
x_99 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_99, 0, x_96);
if (lean_is_scalar(x_98)) {
x_100 = lean_alloc_ctor(0, 2, 0);
} else {
x_100 = x_98;
}
lean_ctor_set(x_100, 0, x_99);
lean_ctor_set(x_100, 1, x_97);
return x_100;
}
}
}
else
{
uint8_t x_101;
lean_dec(x_32);
lean_dec(x_21);
x_101 = !lean_is_exclusive(x_63);
if (x_101 == 0)
{
return x_63;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_102 = lean_ctor_get(x_63, 0);
x_103 = lean_ctor_get(x_63, 1);
lean_inc(x_103);
lean_inc(x_102);
lean_dec(x_63);
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_105;
lean_dec(x_32);
lean_dec(x_28);
lean_dec(x_21);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_105 = !lean_is_exclusive(x_39);
if (x_105 == 0)
{
return x_39;
}
else
{
lean_object* x_106; lean_object* x_107; lean_object* x_108;
x_106 = lean_ctor_get(x_39, 0);
x_107 = lean_ctor_get(x_39, 1);
lean_inc(x_107);
lean_inc(x_106);
lean_dec(x_39);
x_108 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_108, 0, x_106);
lean_ctor_set(x_108, 1, x_107);
return x_108;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildWhile_____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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_buildWhile__(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1(size_t x_1, size_t x_2, size_t x_3, size_t 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; uint8_t x_16;
x_9 = lean_box_usize(x_1);
x_10 = lean_llvm_position_builder_at_end(x_9, x_2, x_3, x_8);
x_11 = lean_ctor_get(x_10, 1);
lean_inc(x_11);
lean_dec(x_10);
x_12 = lean_llvm_build_br(x_1, x_2, x_4, x_11);
x_13 = lean_ctor_get(x_12, 1);
lean_inc(x_13);
lean_dec(x_12);
x_14 = lean_box_usize(x_1);
x_15 = lean_llvm_position_builder_at_end(x_14, x_2, x_4, x_13);
x_16 = !lean_is_exclusive(x_15);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_15, 0);
x_18 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_15, 0, x_18);
return x_15;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_19 = lean_ctor_get(x_15, 0);
x_20 = lean_ctor_get(x_15, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_15);
x_21 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_21, 0, x_19);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_20);
return x_22;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Then", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Else", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Merge", 5);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen__(size_t x_1, size_t x_2, lean_object* x_3, size_t 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; size_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; size_t x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; size_t x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_9 = l_Lean_IR_EmitLLVM_builderGetInsertionFn(x_1, x_2, x_6, x_7, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_buildIfThen_____closed__1;
lean_inc(x_3);
x_14 = lean_string_append(x_3, x_13);
x_15 = l_Lean_IR_EmitLLVM_buildIfThen_____closed__2;
lean_inc(x_3);
x_16 = lean_string_append(x_3, x_15);
x_17 = l_Lean_IR_EmitLLVM_buildIfThen_____closed__3;
x_18 = lean_string_append(x_3, x_17);
x_19 = lean_unbox_usize(x_12);
x_20 = lean_llvm_append_basic_block_in_context(x_1, x_19, x_14, x_11);
lean_dec(x_14);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_unbox_usize(x_12);
x_24 = lean_llvm_append_basic_block_in_context(x_1, x_23, x_16, x_22);
lean_dec(x_16);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_28 = lean_llvm_append_basic_block_in_context(x_1, x_27, x_18, x_26);
lean_dec(x_18);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_21);
x_32 = lean_unbox_usize(x_25);
x_33 = lean_llvm_build_cond_br(x_1, x_2, x_4, x_31, x_32, x_30);
x_34 = lean_ctor_get(x_33, 1);
lean_inc(x_34);
lean_dec(x_33);
x_35 = lean_box_usize(x_1);
x_36 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_37 = lean_llvm_position_builder_at_end(x_35, x_2, x_36, x_34);
x_38 = lean_ctor_get(x_37, 1);
lean_inc(x_38);
lean_dec(x_37);
x_39 = lean_box_usize(x_2);
lean_inc(x_7);
lean_inc(x_6);
x_40 = lean_apply_4(x_5, x_39, x_6, x_7, x_38);
if (lean_obj_tag(x_40) == 0)
{
lean_object* x_41;
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
if (lean_obj_tag(x_41) == 0)
{
uint8_t x_42;
lean_dec(x_29);
lean_dec(x_25);
lean_dec(x_7);
lean_dec(x_6);
x_42 = !lean_is_exclusive(x_40);
if (x_42 == 0)
{
lean_object* x_43; uint8_t x_44;
x_43 = lean_ctor_get(x_40, 0);
lean_dec(x_43);
x_44 = !lean_is_exclusive(x_41);
if (x_44 == 0)
{
return x_40;
}
else
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_41, 0);
lean_inc(x_45);
lean_dec(x_41);
x_46 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_46, 0, x_45);
lean_ctor_set(x_40, 0, x_46);
return x_40;
}
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_47 = lean_ctor_get(x_40, 1);
lean_inc(x_47);
lean_dec(x_40);
x_48 = lean_ctor_get(x_41, 0);
lean_inc(x_48);
if (lean_is_exclusive(x_41)) {
lean_ctor_release(x_41, 0);
x_49 = x_41;
} else {
lean_dec_ref(x_41);
x_49 = lean_box(0);
}
if (lean_is_scalar(x_49)) {
x_50 = lean_alloc_ctor(0, 1, 0);
} else {
x_50 = x_49;
}
lean_ctor_set(x_50, 0, x_48);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_51, 1, x_47);
return x_51;
}
}
else
{
lean_object* x_52; uint8_t x_53;
x_52 = lean_ctor_get(x_41, 0);
lean_inc(x_52);
lean_dec(x_41);
x_53 = lean_unbox(x_52);
lean_dec(x_52);
if (x_53 == 0)
{
lean_object* x_54; size_t x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; size_t x_59; size_t x_60; lean_object* x_61;
x_54 = lean_ctor_get(x_40, 1);
lean_inc(x_54);
lean_dec(x_40);
x_55 = lean_unbox_usize(x_29);
x_56 = lean_llvm_build_br(x_1, x_2, x_55, x_54);
x_57 = lean_ctor_get(x_56, 1);
lean_inc(x_57);
lean_dec(x_56);
x_58 = lean_box(0);
x_59 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_60 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_61 = l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1(x_1, x_2, x_59, x_60, x_58, x_6, x_7, x_57);
lean_dec(x_7);
lean_dec(x_6);
return x_61;
}
else
{
lean_object* x_62; lean_object* x_63; size_t x_64; size_t x_65; lean_object* x_66;
x_62 = lean_ctor_get(x_40, 1);
lean_inc(x_62);
lean_dec(x_40);
x_63 = lean_box(0);
x_64 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_65 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_66 = l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1(x_1, x_2, x_64, x_65, x_63, x_6, x_7, x_62);
lean_dec(x_7);
lean_dec(x_6);
return x_66;
}
}
}
else
{
uint8_t x_67;
lean_dec(x_29);
lean_dec(x_25);
lean_dec(x_7);
lean_dec(x_6);
x_67 = !lean_is_exclusive(x_40);
if (x_67 == 0)
{
return x_40;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_68 = lean_ctor_get(x_40, 0);
x_69 = lean_ctor_get(x_40, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_40);
x_70 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_70, 0, x_68);
lean_ctor_set(x_70, 1, x_69);
return x_70;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____lambda__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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_buildIfThen_____lambda__1(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThen_____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:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_buildIfThen__(x_9, x_10, x_3, x_11, x_5, x_6, x_7, x_8);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1(size_t x_1, size_t x_2, size_t 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_9; uint8_t x_10;
x_8 = lean_box_usize(x_1);
x_9 = lean_llvm_position_builder_at_end(x_8, x_2, x_3, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_9, 0);
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_9, 0, x_12);
return x_9;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_9, 0);
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_9);
x_15 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_15, 0, x_13);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_6);
x_10 = lean_box_usize(x_1);
x_11 = lean_llvm_position_builder_at_end(x_10, x_2, x_3, x_9);
x_12 = lean_ctor_get(x_11, 1);
lean_inc(x_12);
lean_dec(x_11);
x_13 = lean_box_usize(x_2);
lean_inc(x_8);
lean_inc(x_7);
x_14 = lean_apply_4(x_4, x_13, x_7, x_8, x_12);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
lean_dec(x_8);
lean_dec(x_7);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17; uint8_t x_18;
x_17 = lean_ctor_get(x_14, 0);
lean_dec(x_17);
x_18 = !lean_is_exclusive(x_15);
if (x_18 == 0)
{
return x_14;
}
else
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_14, 0, x_20);
return x_14;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_dec(x_14);
x_22 = lean_ctor_get(x_15, 0);
lean_inc(x_22);
if (lean_is_exclusive(x_15)) {
lean_ctor_release(x_15, 0);
x_23 = x_15;
} else {
lean_dec_ref(x_15);
x_23 = lean_box(0);
}
if (lean_is_scalar(x_23)) {
x_24 = lean_alloc_ctor(0, 1, 0);
} else {
x_24 = x_23;
}
lean_ctor_set(x_24, 0, x_22);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_21);
return x_25;
}
}
else
{
lean_object* x_26; uint8_t x_27;
x_26 = lean_ctor_get(x_15, 0);
lean_inc(x_26);
lean_dec(x_15);
x_27 = lean_unbox(x_26);
lean_dec(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;
x_28 = lean_ctor_get(x_14, 1);
lean_inc(x_28);
lean_dec(x_14);
x_29 = lean_llvm_build_br(x_1, x_2, x_5, x_28);
x_30 = lean_ctor_get(x_29, 1);
lean_inc(x_30);
lean_dec(x_29);
x_31 = lean_box(0);
x_32 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1(x_1, x_2, x_5, x_31, x_7, x_8, x_30);
lean_dec(x_8);
lean_dec(x_7);
return x_32;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_14, 1);
lean_inc(x_33);
lean_dec(x_14);
x_34 = lean_box(0);
x_35 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1(x_1, x_2, x_5, x_34, x_7, x_8, x_33);
lean_dec(x_8);
lean_dec(x_7);
return x_35;
}
}
}
else
{
uint8_t x_36;
lean_dec(x_8);
lean_dec(x_7);
x_36 = !lean_is_exclusive(x_14);
if (x_36 == 0)
{
return x_14;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_14, 0);
x_38 = lean_ctor_get(x_14, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_14);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse__(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; size_t x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; size_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; size_t x_36; size_t x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; size_t x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_10 = lean_box_usize(x_1);
x_11 = lean_llvm_get_insert_block(x_10, x_2, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_15 = lean_llvm_get_basic_block_parent(x_1, x_14, x_13);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_buildIfThen_____closed__1;
lean_inc(x_3);
x_19 = lean_string_append(x_3, x_18);
x_20 = lean_unbox_usize(x_16);
x_21 = lean_llvm_append_basic_block_in_context(x_1, x_20, x_19, x_17);
lean_dec(x_19);
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_EmitLLVM_buildIfThen_____closed__2;
lean_inc(x_3);
x_25 = lean_string_append(x_3, x_24);
x_26 = lean_unbox_usize(x_16);
x_27 = lean_llvm_append_basic_block_in_context(x_1, x_26, x_25, x_23);
lean_dec(x_25);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_buildIfThen_____closed__3;
x_31 = lean_string_append(x_3, x_30);
x_32 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_33 = lean_llvm_append_basic_block_in_context(x_1, x_32, x_31, x_29);
lean_dec(x_31);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_unbox_usize(x_22);
x_37 = lean_unbox_usize(x_28);
x_38 = lean_llvm_build_cond_br(x_1, x_2, x_4, x_36, x_37, x_35);
x_39 = lean_ctor_get(x_38, 1);
lean_inc(x_39);
lean_dec(x_38);
x_40 = lean_box_usize(x_1);
x_41 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_42 = lean_llvm_position_builder_at_end(x_40, x_2, x_41, x_39);
x_43 = lean_ctor_get(x_42, 1);
lean_inc(x_43);
lean_dec(x_42);
x_44 = lean_box_usize(x_2);
lean_inc(x_8);
lean_inc(x_7);
x_45 = lean_apply_4(x_5, x_44, x_7, x_8, x_43);
if (lean_obj_tag(x_45) == 0)
{
lean_object* x_46;
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
if (lean_obj_tag(x_46) == 0)
{
uint8_t x_47;
lean_dec(x_34);
lean_dec(x_28);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
x_47 = !lean_is_exclusive(x_45);
if (x_47 == 0)
{
lean_object* x_48; uint8_t x_49;
x_48 = lean_ctor_get(x_45, 0);
lean_dec(x_48);
x_49 = !lean_is_exclusive(x_46);
if (x_49 == 0)
{
return x_45;
}
else
{
lean_object* x_50; lean_object* x_51;
x_50 = lean_ctor_get(x_46, 0);
lean_inc(x_50);
lean_dec(x_46);
x_51 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_45, 0, x_51);
return x_45;
}
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_52 = lean_ctor_get(x_45, 1);
lean_inc(x_52);
lean_dec(x_45);
x_53 = lean_ctor_get(x_46, 0);
lean_inc(x_53);
if (lean_is_exclusive(x_46)) {
lean_ctor_release(x_46, 0);
x_54 = x_46;
} else {
lean_dec_ref(x_46);
x_54 = lean_box(0);
}
if (lean_is_scalar(x_54)) {
x_55 = lean_alloc_ctor(0, 1, 0);
} else {
x_55 = x_54;
}
lean_ctor_set(x_55, 0, x_53);
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_52);
return x_56;
}
}
else
{
lean_object* x_57; uint8_t x_58;
x_57 = lean_ctor_get(x_46, 0);
lean_inc(x_57);
lean_dec(x_46);
x_58 = lean_unbox(x_57);
lean_dec(x_57);
if (x_58 == 0)
{
lean_object* x_59; size_t x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; size_t x_64; size_t x_65; lean_object* x_66;
x_59 = lean_ctor_get(x_45, 1);
lean_inc(x_59);
lean_dec(x_45);
x_60 = lean_unbox_usize(x_34);
x_61 = lean_llvm_build_br(x_1, x_2, x_60, x_59);
x_62 = lean_ctor_get(x_61, 1);
lean_inc(x_62);
lean_dec(x_61);
x_63 = lean_box(0);
x_64 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_65 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_66 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2(x_1, x_2, x_64, x_6, x_65, x_63, x_7, x_8, x_62);
return x_66;
}
else
{
lean_object* x_67; lean_object* x_68; size_t x_69; size_t x_70; lean_object* x_71;
x_67 = lean_ctor_get(x_45, 1);
lean_inc(x_67);
lean_dec(x_45);
x_68 = lean_box(0);
x_69 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_70 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_71 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2(x_1, x_2, x_69, x_6, x_70, x_68, x_7, x_8, x_67);
return x_71;
}
}
}
else
{
uint8_t x_72;
lean_dec(x_34);
lean_dec(x_28);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
x_72 = !lean_is_exclusive(x_45);
if (x_72 == 0)
{
return x_45;
}
else
{
lean_object* x_73; lean_object* x_74; lean_object* x_75;
x_73 = lean_ctor_get(x_45, 0);
x_74 = lean_ctor_get(x_45, 1);
lean_inc(x_74);
lean_inc(x_73);
lean_dec(x_45);
x_75 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_75, 0, x_73);
lean_ctor_set(x_75, 1, x_74);
return x_75;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__1(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitLLVM_buildIfThenElse_____lambda__2(x_10, x_11, x_12, x_4, x_13, x_6, x_7, x_8, x_9);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildIfThenElse_____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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_buildIfThenElse__(x_10, x_11, x_3, x_12, x_5, x_6, x_7, x_8, x_9);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint64_t x_8; uint8_t x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; uint64_t x_13; size_t x_14; lean_object* x_15; uint8_t x_16;
x_8 = 0;
x_9 = 0;
x_10 = l_LLVM_constInt8(x_1, x_8, x_9, x_7);
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_LLVM_IntPredicate_NE;
x_14 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_15 = lean_llvm_build_icmp(x_1, x_2, x_13, x_3, x_14, x_4, x_12);
x_16 = !lean_is_exclusive(x_15);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_15, 0);
x_18 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_15, 0, x_18);
return x_15;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_19 = lean_ctor_get(x_15, 0);
x_20 = lean_ctor_get(x_15, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_15);
x_21 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_21, 0, x_19);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_20);
return x_22;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___spec__1(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, size_t x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12; uint8_t x_35;
x_35 = lean_usize_dec_lt(x_6, x_5);
if (x_35 == 0)
{
lean_object* x_36; lean_object* x_37;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_36 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_36, 0, x_7);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_10);
return x_37;
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_61; uint8_t x_62;
x_38 = lean_array_uget(x_4, x_6);
x_61 = l_Lean_IR_Decl_name(x_2);
lean_inc(x_3);
x_62 = l_Lean_isExternC(x_3, x_61);
if (x_62 == 0)
{
lean_object* x_63;
x_63 = lean_box(0);
x_39 = x_63;
goto block_60;
}
else
{
lean_object* x_64; uint8_t x_65;
x_64 = lean_ctor_get(x_38, 1);
lean_inc(x_64);
x_65 = l_Lean_IR_IRType_isIrrelevant(x_64);
lean_dec(x_64);
if (x_65 == 0)
{
lean_object* x_66;
x_66 = lean_box(0);
x_39 = x_66;
goto block_60;
}
else
{
lean_object* x_67; lean_object* x_68;
lean_dec(x_38);
x_67 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_67, 0, x_7);
x_68 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_68, 0, x_67);
x_11 = x_68;
x_12 = x_10;
goto block_34;
}
}
block_60:
{
lean_object* x_40; lean_object* x_41;
lean_dec(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
lean_inc(x_9);
lean_inc(x_8);
x_41 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_40, x_8, x_9, x_10);
if (lean_obj_tag(x_41) == 0)
{
lean_object* x_42;
x_42 = lean_ctor_get(x_41, 0);
lean_inc(x_42);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_43; uint8_t x_44;
lean_dec(x_7);
x_43 = lean_ctor_get(x_41, 1);
lean_inc(x_43);
lean_dec(x_41);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
x_11 = x_42;
x_12 = x_43;
goto block_34;
}
else
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_inc(x_45);
lean_dec(x_42);
x_46 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_46, 0, x_45);
x_11 = x_46;
x_12 = x_43;
goto block_34;
}
}
else
{
lean_object* x_47; uint8_t x_48;
x_47 = lean_ctor_get(x_41, 1);
lean_inc(x_47);
lean_dec(x_41);
x_48 = !lean_is_exclusive(x_42);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_42, 0);
x_50 = lean_array_push(x_7, x_49);
x_51 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_42, 0, x_51);
x_11 = x_42;
x_12 = x_47;
goto block_34;
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_52 = lean_ctor_get(x_42, 0);
lean_inc(x_52);
lean_dec(x_42);
x_53 = lean_array_push(x_7, x_52);
x_54 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_54, 0, x_53);
x_55 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_55, 0, x_54);
x_11 = x_55;
x_12 = x_47;
goto block_34;
}
}
}
else
{
uint8_t x_56;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_56 = !lean_is_exclusive(x_41);
if (x_56 == 0)
{
return x_41;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59;
x_57 = lean_ctor_get(x_41, 0);
x_58 = lean_ctor_get(x_41, 1);
lean_inc(x_58);
lean_inc(x_57);
lean_dec(x_41);
x_59 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_59, 0, x_57);
lean_ctor_set(x_59, 1, x_58);
return x_59;
}
}
}
}
block_34:
{
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_13;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14;
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_11);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_12);
return x_17;
}
}
else
{
uint8_t x_18;
x_18 = !lean_is_exclusive(x_11);
if (x_18 == 0)
{
lean_object* x_19;
x_19 = lean_ctor_get(x_11, 0);
if (lean_obj_tag(x_19) == 0)
{
lean_object* x_20; lean_object* x_21;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
lean_dec(x_19);
lean_ctor_set(x_11, 0, x_20);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_11);
lean_ctor_set(x_21, 1, x_12);
return x_21;
}
else
{
lean_object* x_22; size_t x_23; size_t x_24;
lean_free_object(x_11);
x_22 = lean_ctor_get(x_19, 0);
lean_inc(x_22);
lean_dec(x_19);
x_23 = 1;
x_24 = lean_usize_add(x_6, x_23);
x_6 = x_24;
x_7 = x_22;
x_10 = x_12;
goto _start;
}
}
else
{
lean_object* x_26;
x_26 = lean_ctor_get(x_11, 0);
lean_inc(x_26);
lean_dec(x_11);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
lean_dec(x_26);
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_27);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_12);
return x_29;
}
else
{
lean_object* x_30; size_t x_31; size_t x_32;
x_30 = lean_ctor_get(x_26, 0);
lean_inc(x_30);
lean_dec(x_26);
x_31 = 1;
x_32 = lean_usize_add(x_6, x_31);
x_6 = x_32;
x_7 = x_30;
x_10 = x_12;
goto _start;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(size_t 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 = lean_box_usize(x_1);
x_7 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_7, 0, x_6);
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_5);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2(lean_object* x_1, uint8_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10;
x_10 = l_Array_isEmpty___rarg(x_1);
lean_dec(x_1);
if (x_10 == 0)
{
lean_dec(x_5);
if (x_2 == 0)
{
uint64_t x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_11 = l_LLVM_DLLStorageClass_export;
x_12 = lean_llvm_set_dll_storage_class(x_3, x_6, x_11, x_9);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_13, x_7, x_8, x_14);
lean_dec(x_13);
return x_15;
}
else
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_box(0);
x_17 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_16, x_7, x_8, x_9);
return x_17;
}
}
else
{
lean_object* x_18; uint8_t x_19;
x_18 = l_Lean_IR_Decl_name(x_4);
x_19 = l_Lean_isClosedTermName(x_5, x_18);
lean_dec(x_18);
lean_dec(x_5);
if (x_19 == 0)
{
if (x_2 == 0)
{
uint64_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_20 = l_LLVM_DLLStorageClass_export;
x_21 = lean_llvm_set_dll_storage_class(x_3, x_6, x_20, x_9);
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_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_22, x_7, x_8, x_23);
lean_dec(x_22);
return x_24;
}
else
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_box(0);
x_26 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_25, x_7, x_8, x_9);
return x_26;
}
}
else
{
uint64_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_27 = l_LLVM_Visibility_hidden;
x_28 = lean_llvm_set_visibility(x_3, x_6, x_27, x_9);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_29, x_7, x_8, x_30);
lean_dec(x_29);
return x_31;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(size_t x_1, size_t x_2, size_t 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) {
_start:
{
uint8_t x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; size_t x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_11 = 0;
x_12 = lean_llvm_function_type(x_1, x_2, x_6, x_11, x_10);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_16 = l_LLVM_getOrAddFunction(x_1, x_3, x_4, x_15, x_14);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_apply_4(x_5, x_17, x_8, x_9, x_18);
return x_19;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__4(lean_object* x_1, size_t 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_8;
x_7 = lean_box_usize(x_2);
x_8 = lean_apply_4(x_1, x_7, x_4, x_5, x_6);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, uint8_t 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; uint8_t x_17;
x_9 = l_Lean_IR_Decl_params(x_3);
x_10 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_7, x_8);
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, 0);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_box(x_5);
x_15 = lean_box_usize(x_1);
lean_inc(x_13);
lean_inc(x_3);
lean_inc(x_9);
x_16 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2___boxed), 9, 5);
lean_closure_set(x_16, 0, x_9);
lean_closure_set(x_16, 1, x_14);
lean_closure_set(x_16, 2, x_15);
lean_closure_set(x_16, 3, x_3);
lean_closure_set(x_16, 4, x_13);
x_17 = l_Array_isEmpty___rarg(x_9);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19;
x_18 = l_Lean_IR_Decl_resultType(x_3);
lean_inc(x_7);
lean_inc(x_6);
x_19 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_18, x_6, x_7, x_12);
if (lean_obj_tag(x_19) == 0)
{
lean_object* x_20;
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
if (lean_obj_tag(x_20) == 0)
{
uint8_t x_21;
lean_dec(x_16);
lean_dec(x_13);
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_21 = !lean_is_exclusive(x_19);
if (x_21 == 0)
{
lean_object* x_22; uint8_t x_23;
x_22 = lean_ctor_get(x_19, 0);
lean_dec(x_22);
x_23 = !lean_is_exclusive(x_20);
if (x_23 == 0)
{
return x_19;
}
else
{
lean_object* x_24; lean_object* x_25;
x_24 = lean_ctor_get(x_20, 0);
lean_inc(x_24);
lean_dec(x_20);
x_25 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_19, 0, x_25);
return x_19;
}
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_26 = lean_ctor_get(x_19, 1);
lean_inc(x_26);
lean_dec(x_19);
x_27 = lean_ctor_get(x_20, 0);
lean_inc(x_27);
if (lean_is_exclusive(x_20)) {
lean_ctor_release(x_20, 0);
x_28 = x_20;
} else {
lean_dec_ref(x_20);
x_28 = lean_box(0);
}
if (lean_is_scalar(x_28)) {
x_29 = lean_alloc_ctor(0, 1, 0);
} else {
x_29 = x_28;
}
lean_ctor_set(x_29, 0, x_27);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_26);
return x_30;
}
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; size_t x_35; lean_object* x_36; lean_object* x_37;
x_31 = lean_ctor_get(x_19, 1);
lean_inc(x_31);
lean_dec(x_19);
x_32 = lean_ctor_get(x_20, 0);
lean_inc(x_32);
lean_dec(x_20);
x_33 = lean_array_get_size(x_9);
x_34 = lean_usize_of_nat(x_33);
lean_dec(x_33);
x_35 = 0;
x_36 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
lean_inc(x_7);
lean_inc(x_6);
x_37 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___spec__1(x_1, x_3, x_13, x_9, x_34, x_35, x_36, x_6, x_7, x_31);
lean_dec(x_9);
if (lean_obj_tag(x_37) == 0)
{
lean_object* x_38;
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
if (lean_obj_tag(x_38) == 0)
{
uint8_t x_39;
lean_dec(x_32);
lean_dec(x_16);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_39 = !lean_is_exclusive(x_37);
if (x_39 == 0)
{
lean_object* x_40; uint8_t x_41;
x_40 = lean_ctor_get(x_37, 0);
lean_dec(x_40);
x_41 = !lean_is_exclusive(x_38);
if (x_41 == 0)
{
return x_37;
}
else
{
lean_object* x_42; lean_object* x_43;
x_42 = lean_ctor_get(x_38, 0);
lean_inc(x_42);
lean_dec(x_38);
x_43 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_37, 0, x_43);
return x_37;
}
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_44 = lean_ctor_get(x_37, 1);
lean_inc(x_44);
lean_dec(x_37);
x_45 = lean_ctor_get(x_38, 0);
lean_inc(x_45);
if (lean_is_exclusive(x_38)) {
lean_ctor_release(x_38, 0);
x_46 = x_38;
} else {
lean_dec_ref(x_38);
x_46 = lean_box(0);
}
if (lean_is_scalar(x_46)) {
x_47 = lean_alloc_ctor(0, 1, 0);
} else {
x_47 = x_46;
}
lean_ctor_set(x_47, 0, x_45);
x_48 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_48, 1, x_44);
return x_48;
}
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; uint8_t x_53;
x_49 = lean_ctor_get(x_37, 1);
lean_inc(x_49);
lean_dec(x_37);
x_50 = lean_ctor_get(x_38, 0);
lean_inc(x_50);
lean_dec(x_38);
x_51 = lean_array_get_size(x_50);
x_52 = l_Lean_closureMaxArgs;
x_53 = lean_nat_dec_lt(x_52, x_51);
lean_dec(x_51);
if (x_53 == 0)
{
lean_object* x_54; size_t x_55; lean_object* x_56;
lean_dec(x_3);
x_54 = lean_box(0);
x_55 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_56 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(x_1, x_55, x_2, x_4, x_16, x_50, x_54, x_6, x_7, x_49);
lean_dec(x_50);
lean_dec(x_4);
return x_56;
}
else
{
lean_object* x_57; uint8_t x_58;
x_57 = l_Lean_IR_Decl_name(x_3);
lean_dec(x_3);
x_58 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_57);
lean_dec(x_57);
if (x_58 == 0)
{
lean_object* x_59; size_t x_60; lean_object* x_61;
x_59 = lean_box(0);
x_60 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_61 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(x_1, x_60, x_2, x_4, x_16, x_50, x_59, x_6, x_7, x_49);
lean_dec(x_50);
lean_dec(x_4);
return x_61;
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; size_t 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; size_t x_72; lean_object* x_73;
lean_dec(x_50);
x_62 = l_LLVM_voidPtrType(x_1, x_49);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_66 = lean_llvm_pointer_type(x_1, x_65, x_64);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_ctor_get(x_66, 1);
lean_inc(x_68);
lean_dec(x_66);
x_69 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_70 = lean_array_push(x_69, x_67);
x_71 = lean_box(0);
x_72 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_73 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(x_1, x_72, x_2, x_4, x_16, x_70, x_71, x_6, x_7, x_68);
lean_dec(x_70);
lean_dec(x_4);
return x_73;
}
}
}
}
else
{
uint8_t x_74;
lean_dec(x_32);
lean_dec(x_16);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_74 = !lean_is_exclusive(x_37);
if (x_74 == 0)
{
return x_37;
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_37, 0);
x_76 = lean_ctor_get(x_37, 1);
lean_inc(x_76);
lean_inc(x_75);
lean_dec(x_37);
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
{
uint8_t x_78;
lean_dec(x_16);
lean_dec(x_13);
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_78 = !lean_is_exclusive(x_19);
if (x_78 == 0)
{
return x_19;
}
else
{
lean_object* x_79; lean_object* x_80; lean_object* x_81;
x_79 = lean_ctor_get(x_19, 0);
x_80 = lean_ctor_get(x_19, 1);
lean_inc(x_80);
lean_inc(x_79);
lean_dec(x_19);
x_81 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_81, 0, x_79);
lean_ctor_set(x_81, 1, x_80);
return x_81;
}
}
}
else
{
lean_object* x_82; lean_object* x_83;
lean_dec(x_16);
x_82 = l_Lean_IR_Decl_resultType(x_3);
lean_inc(x_7);
lean_inc(x_6);
x_83 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_82, x_6, x_7, x_12);
if (lean_obj_tag(x_83) == 0)
{
lean_object* x_84;
x_84 = lean_ctor_get(x_83, 0);
lean_inc(x_84);
if (lean_obj_tag(x_84) == 0)
{
uint8_t x_85;
lean_dec(x_13);
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_85 = !lean_is_exclusive(x_83);
if (x_85 == 0)
{
lean_object* x_86; uint8_t x_87;
x_86 = lean_ctor_get(x_83, 0);
lean_dec(x_86);
x_87 = !lean_is_exclusive(x_84);
if (x_87 == 0)
{
return x_83;
}
else
{
lean_object* x_88; lean_object* x_89;
x_88 = lean_ctor_get(x_84, 0);
lean_inc(x_88);
lean_dec(x_84);
x_89 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_89, 0, x_88);
lean_ctor_set(x_83, 0, x_89);
return x_83;
}
}
else
{
lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94;
x_90 = lean_ctor_get(x_83, 1);
lean_inc(x_90);
lean_dec(x_83);
x_91 = lean_ctor_get(x_84, 0);
lean_inc(x_91);
if (lean_is_exclusive(x_84)) {
lean_ctor_release(x_84, 0);
x_92 = x_84;
} else {
lean_dec_ref(x_84);
x_92 = lean_box(0);
}
if (lean_is_scalar(x_92)) {
x_93 = lean_alloc_ctor(0, 1, 0);
} else {
x_93 = x_92;
}
lean_ctor_set(x_93, 0, x_91);
x_94 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_94, 0, x_93);
lean_ctor_set(x_94, 1, x_90);
return x_94;
}
}
else
{
lean_object* x_95; lean_object* x_96; size_t x_97; lean_object* x_98;
x_95 = lean_ctor_get(x_83, 1);
lean_inc(x_95);
lean_dec(x_83);
x_96 = lean_ctor_get(x_84, 0);
lean_inc(x_96);
lean_dec(x_84);
x_97 = lean_unbox_usize(x_96);
x_98 = l_LLVM_getOrAddGlobal(x_1, x_2, x_4, x_97, x_95);
lean_dec(x_4);
if (x_5 == 0)
{
lean_object* x_99; lean_object* x_100; size_t x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; size_t x_105; size_t x_106; lean_object* x_107; lean_object* x_108; size_t x_109; lean_object* x_110;
x_99 = lean_ctor_get(x_98, 0);
lean_inc(x_99);
x_100 = lean_ctor_get(x_98, 1);
lean_inc(x_100);
lean_dec(x_98);
x_101 = lean_unbox_usize(x_96);
lean_dec(x_96);
x_102 = lean_llvm_get_undef(x_1, x_101, x_100);
x_103 = lean_ctor_get(x_102, 0);
lean_inc(x_103);
x_104 = lean_ctor_get(x_102, 1);
lean_inc(x_104);
lean_dec(x_102);
x_105 = lean_unbox_usize(x_99);
x_106 = lean_unbox_usize(x_103);
lean_dec(x_103);
x_107 = lean_llvm_set_initializer(x_1, x_105, x_106, x_104);
x_108 = lean_ctor_get(x_107, 1);
lean_inc(x_108);
lean_dec(x_107);
x_109 = lean_unbox_usize(x_99);
lean_dec(x_99);
x_110 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2(x_9, x_5, x_1, x_3, x_13, x_109, x_6, x_7, x_108);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_3);
return x_110;
}
else
{
lean_object* x_111; lean_object* x_112; size_t x_113; lean_object* x_114;
lean_dec(x_96);
x_111 = lean_ctor_get(x_98, 0);
lean_inc(x_111);
x_112 = lean_ctor_get(x_98, 1);
lean_inc(x_112);
lean_dec(x_98);
x_113 = lean_unbox_usize(x_111);
lean_dec(x_111);
x_114 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2(x_9, x_5, x_1, x_3, x_13, x_113, x_6, x_7, x_112);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_3);
return x_114;
}
}
}
else
{
uint8_t x_115;
lean_dec(x_13);
lean_dec(x_9);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_115 = !lean_is_exclusive(x_83);
if (x_115 == 0)
{
return x_83;
}
else
{
lean_object* x_116; lean_object* x_117; lean_object* x_118;
x_116 = lean_ctor_get(x_83, 0);
x_117 = lean_ctor_get(x_83, 1);
lean_inc(x_117);
lean_inc(x_116);
lean_dec(x_83);
x_118 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_118, 0, x_116);
lean_ctor_set(x_118, 1, x_117);
return x_118;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_13 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_14 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitFnDeclAux___spec__1(x_11, x_2, x_3, x_4, x_12, x_13, x_7, x_8, x_9, x_10);
lean_dec(x_4);
lean_dec(x_2);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__1(x_6, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_10 = lean_unbox(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_13 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__2(x_1, x_10, x_11, x_4, x_5, x_12, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_4);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_14 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__3(x_11, x_12, x_13, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__4___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:
{
size_t x_7; lean_object* x_8;
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_emitFnDeclAux___lambda__4(x_1, x_7, x_3, x_4, x_5, x_6);
lean_dec(x_3);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDeclAux___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:
{
size_t x_9; size_t x_10; uint8_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox(x_5);
lean_dec(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitFnDeclAux(x_9, x_10, x_3, x_4, x_11, x_6, x_7, x_8);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecl(size_t x_1, lean_object* x_2, uint8_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = l_Lean_IR_Decl_name(x_2);
x_8 = l_Lean_IR_EmitLLVM_toCName___rarg(x_7, x_4, x_5, x_6);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
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; size_t x_26; lean_object* x_27;
x_20 = lean_ctor_get(x_8, 1);
lean_inc(x_20);
lean_dec(x_8);
x_21 = lean_ctor_get(x_9, 0);
lean_inc(x_21);
lean_dec(x_9);
x_22 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_20);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_27 = l_Lean_IR_EmitLLVM_emitFnDeclAux(x_1, x_26, x_2, x_21, x_3, x_4, x_5, x_24);
if (lean_obj_tag(x_27) == 0)
{
lean_object* x_28;
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
if (lean_obj_tag(x_28) == 0)
{
uint8_t x_29;
x_29 = !lean_is_exclusive(x_27);
if (x_29 == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = lean_ctor_get(x_27, 0);
lean_dec(x_30);
x_31 = !lean_is_exclusive(x_28);
if (x_31 == 0)
{
return x_27;
}
else
{
lean_object* x_32; lean_object* x_33;
x_32 = lean_ctor_get(x_28, 0);
lean_inc(x_32);
lean_dec(x_28);
x_33 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_27, 0, x_33);
return x_27;
}
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_34 = lean_ctor_get(x_27, 1);
lean_inc(x_34);
lean_dec(x_27);
x_35 = lean_ctor_get(x_28, 0);
lean_inc(x_35);
if (lean_is_exclusive(x_28)) {
lean_ctor_release(x_28, 0);
x_36 = x_28;
} else {
lean_dec_ref(x_28);
x_36 = lean_box(0);
}
if (lean_is_scalar(x_36)) {
x_37 = lean_alloc_ctor(0, 1, 0);
} else {
x_37 = x_36;
}
lean_ctor_set(x_37, 0, x_35);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_34);
return x_38;
}
}
else
{
uint8_t x_39;
lean_dec(x_28);
x_39 = !lean_is_exclusive(x_27);
if (x_39 == 0)
{
lean_object* x_40; lean_object* x_41;
x_40 = lean_ctor_get(x_27, 0);
lean_dec(x_40);
x_41 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_27, 0, x_41);
return x_27;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_42 = lean_ctor_get(x_27, 1);
lean_inc(x_42);
lean_dec(x_27);
x_43 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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
{
uint8_t x_45;
x_45 = !lean_is_exclusive(x_27);
if (x_45 == 0)
{
return x_27;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_46 = lean_ctor_get(x_27, 0);
x_47 = lean_ctor_get(x_27, 1);
lean_inc(x_47);
lean_inc(x_46);
lean_dec(x_27);
x_48 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_48, 0, x_46);
lean_ctor_set(x_48, 1, x_47);
return x_48;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecl___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:
{
size_t x_7; uint8_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox(x_3);
lean_dec(x_3);
x_9 = l_Lean_IR_EmitLLVM_emitFnDecl(x_7, x_2, x_8, x_4, x_5, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternDeclAux(size_t 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_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; size_t x_17; lean_object* x_18;
x_7 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_ctor_get(x_8, 0);
lean_inc(x_10);
lean_dec(x_8);
x_11 = l_Lean_IR_Decl_name(x_2);
x_12 = l_Lean_isExternC(x_10, x_11);
x_13 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_9);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_18 = l_Lean_IR_EmitLLVM_emitFnDeclAux(x_1, x_17, x_2, x_3, x_12, x_4, x_5, x_15);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19;
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
if (lean_obj_tag(x_19) == 0)
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_18);
if (x_20 == 0)
{
lean_object* x_21; uint8_t x_22;
x_21 = lean_ctor_get(x_18, 0);
lean_dec(x_21);
x_22 = !lean_is_exclusive(x_19);
if (x_22 == 0)
{
return x_18;
}
else
{
lean_object* x_23; lean_object* x_24;
x_23 = lean_ctor_get(x_19, 0);
lean_inc(x_23);
lean_dec(x_19);
x_24 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_18, 0, x_24);
return x_18;
}
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_25 = lean_ctor_get(x_18, 1);
lean_inc(x_25);
lean_dec(x_18);
x_26 = lean_ctor_get(x_19, 0);
lean_inc(x_26);
if (lean_is_exclusive(x_19)) {
lean_ctor_release(x_19, 0);
x_27 = x_19;
} else {
lean_dec_ref(x_19);
x_27 = lean_box(0);
}
if (lean_is_scalar(x_27)) {
x_28 = lean_alloc_ctor(0, 1, 0);
} else {
x_28 = x_27;
}
lean_ctor_set(x_28, 0, 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_25);
return x_29;
}
}
else
{
uint8_t x_30;
lean_dec(x_19);
x_30 = !lean_is_exclusive(x_18);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_18, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_18, 0, x_32);
return x_18;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_18, 1);
lean_inc(x_33);
lean_dec(x_18);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
x_36 = !lean_is_exclusive(x_18);
if (x_36 == 0)
{
return x_18;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_18, 0);
x_38 = lean_ctor_get(x_18, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_18);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternDeclAux___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:
{
size_t x_7; lean_object* x_8;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = l_Lean_IR_EmitLLVM_emitExternDeclAux(x_7, x_2, x_3, x_4, x_5, x_6);
return x_8;
}
}
LEAN_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_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_Lean_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_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_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_Lean_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_EXPORT lean_object* l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4(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 = lean_ctor_get(x_2, 3);
x_6 = l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4(x_1, x_5);
lean_inc(x_4);
x_7 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_7, 0, x_4);
lean_ctor_set(x_7, 1, x_6);
x_1 = x_7;
x_2 = x_3;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Lean_RBTree_toList___at_Lean_IR_EmitLLVM_emitFnDecls___spec__3(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = lean_box(0);
x_3 = l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4(x_2, x_1);
lean_dec(x_1);
return x_3;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("c", 1);
return x_1;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_box(0);
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3;
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5(size_t 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:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_5);
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; lean_object* x_33; lean_object* x_34;
lean_dec(x_5);
x_11 = lean_ctor_get(x_4, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_4, 1);
lean_inc(x_12);
lean_dec(x_4);
lean_inc(x_11);
x_33 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_11, x_6, x_7, x_8);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
if (lean_obj_tag(x_34) == 0)
{
lean_object* x_35; uint8_t x_36;
lean_dec(x_11);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = !lean_is_exclusive(x_34);
if (x_36 == 0)
{
x_13 = x_34;
x_14 = x_35;
goto block_32;
}
else
{
lean_object* x_37; lean_object* x_38;
x_37 = lean_ctor_get(x_34, 0);
lean_inc(x_37);
lean_dec(x_34);
x_38 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_38, 0, x_37);
x_13 = x_38;
x_14 = x_35;
goto block_32;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_39 = lean_ctor_get(x_33, 1);
lean_inc(x_39);
lean_dec(x_33);
x_40 = lean_ctor_get(x_34, 0);
lean_inc(x_40);
lean_dec(x_34);
x_41 = l_Lean_IR_Decl_name(x_40);
x_42 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2;
lean_inc(x_2);
x_43 = l_Lean_getExternNameFor(x_2, x_42, x_41);
if (lean_obj_tag(x_43) == 0)
{
uint8_t x_44;
x_44 = l_Lean_NameSet_contains(x_3, x_11);
lean_dec(x_11);
if (x_44 == 0)
{
uint8_t x_45; lean_object* x_46;
x_45 = 1;
lean_inc(x_7);
lean_inc(x_6);
x_46 = l_Lean_IR_EmitLLVM_emitFnDecl(x_1, x_40, x_45, x_6, x_7, x_39);
if (lean_obj_tag(x_46) == 0)
{
lean_object* x_47;
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; uint8_t x_49;
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = !lean_is_exclusive(x_47);
if (x_49 == 0)
{
x_13 = x_47;
x_14 = x_48;
goto block_32;
}
else
{
lean_object* x_50; lean_object* x_51;
x_50 = lean_ctor_get(x_47, 0);
lean_inc(x_50);
lean_dec(x_47);
x_51 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_51, 0, x_50);
x_13 = x_51;
x_14 = x_48;
goto block_32;
}
}
else
{
lean_object* x_52; lean_object* x_53;
lean_dec(x_47);
x_52 = lean_ctor_get(x_46, 1);
lean_inc(x_52);
lean_dec(x_46);
x_53 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_13 = x_53;
x_14 = x_52;
goto block_32;
}
}
else
{
uint8_t x_54;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_54 = !lean_is_exclusive(x_46);
if (x_54 == 0)
{
return x_46;
}
else
{
lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_55 = lean_ctor_get(x_46, 0);
x_56 = lean_ctor_get(x_46, 1);
lean_inc(x_56);
lean_inc(x_55);
lean_dec(x_46);
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; lean_object* x_59;
x_58 = 0;
lean_inc(x_7);
lean_inc(x_6);
x_59 = l_Lean_IR_EmitLLVM_emitFnDecl(x_1, x_40, x_58, x_6, x_7, x_39);
if (lean_obj_tag(x_59) == 0)
{
lean_object* x_60;
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
if (lean_obj_tag(x_60) == 0)
{
lean_object* x_61; uint8_t x_62;
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
lean_dec(x_59);
x_62 = !lean_is_exclusive(x_60);
if (x_62 == 0)
{
x_13 = x_60;
x_14 = x_61;
goto block_32;
}
else
{
lean_object* x_63; lean_object* x_64;
x_63 = lean_ctor_get(x_60, 0);
lean_inc(x_63);
lean_dec(x_60);
x_64 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_64, 0, x_63);
x_13 = x_64;
x_14 = x_61;
goto block_32;
}
}
else
{
lean_object* x_65; lean_object* x_66;
lean_dec(x_60);
x_65 = lean_ctor_get(x_59, 1);
lean_inc(x_65);
lean_dec(x_59);
x_66 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_13 = x_66;
x_14 = x_65;
goto block_32;
}
}
else
{
uint8_t x_67;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_67 = !lean_is_exclusive(x_59);
if (x_67 == 0)
{
return x_59;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_68 = lean_ctor_get(x_59, 0);
x_69 = lean_ctor_get(x_59, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_59);
x_70 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_70, 0, x_68);
lean_ctor_set(x_70, 1, x_69);
return x_70;
}
}
}
}
else
{
lean_object* x_71; lean_object* x_72;
lean_dec(x_11);
x_71 = lean_ctor_get(x_43, 0);
lean_inc(x_71);
lean_dec(x_43);
lean_inc(x_7);
lean_inc(x_6);
x_72 = l_Lean_IR_EmitLLVM_emitExternDeclAux(x_1, x_40, x_71, x_6, x_7, x_39);
if (lean_obj_tag(x_72) == 0)
{
lean_object* x_73;
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
if (lean_obj_tag(x_73) == 0)
{
lean_object* x_74; uint8_t x_75;
x_74 = lean_ctor_get(x_72, 1);
lean_inc(x_74);
lean_dec(x_72);
x_75 = !lean_is_exclusive(x_73);
if (x_75 == 0)
{
x_13 = x_73;
x_14 = x_74;
goto block_32;
}
else
{
lean_object* x_76; lean_object* x_77;
x_76 = lean_ctor_get(x_73, 0);
lean_inc(x_76);
lean_dec(x_73);
x_77 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_77, 0, x_76);
x_13 = x_77;
x_14 = x_74;
goto block_32;
}
}
else
{
lean_object* x_78; lean_object* x_79;
lean_dec(x_73);
x_78 = lean_ctor_get(x_72, 1);
lean_inc(x_78);
lean_dec(x_72);
x_79 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_13 = x_79;
x_14 = x_78;
goto block_32;
}
}
else
{
uint8_t x_80;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_80 = !lean_is_exclusive(x_72);
if (x_80 == 0)
{
return x_72;
}
else
{
lean_object* x_81; lean_object* x_82; lean_object* x_83;
x_81 = lean_ctor_get(x_72, 0);
x_82 = lean_ctor_get(x_72, 1);
lean_inc(x_82);
lean_inc(x_81);
lean_dec(x_72);
x_83 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_83, 0, x_81);
lean_ctor_set(x_83, 1, x_82);
return x_83;
}
}
}
}
block_32:
{
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_15;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16;
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_13);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, 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_14);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_13);
if (x_20 == 0)
{
lean_object* x_21;
x_21 = lean_ctor_get(x_13, 0);
if (lean_obj_tag(x_21) == 0)
{
lean_object* x_22; lean_object* x_23;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
lean_dec(x_21);
lean_ctor_set(x_13, 0, x_22);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_13);
lean_ctor_set(x_23, 1, x_14);
return x_23;
}
else
{
lean_object* x_24;
lean_free_object(x_13);
x_24 = lean_ctor_get(x_21, 0);
lean_inc(x_24);
lean_dec(x_21);
x_4 = x_12;
x_5 = x_24;
x_8 = x_14;
goto _start;
}
}
else
{
lean_object* x_26;
x_26 = lean_ctor_get(x_13, 0);
lean_inc(x_26);
lean_dec(x_13);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
lean_dec(x_12);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
lean_dec(x_26);
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_27);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_14);
return x_29;
}
else
{
lean_object* x_30;
x_30 = lean_ctor_get(x_26, 0);
lean_inc(x_30);
lean_dec(x_26);
x_4 = x_12;
x_5 = x_30;
x_8 = x_14;
goto _start;
}
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecls(size_t 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;
x_5 = l_Lean_IR_EmitLLVM_getEnv___rarg(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 = lean_ctor_get(x_6, 0);
lean_inc(x_8);
lean_dec(x_6);
x_9 = l_Lean_IR_getDecls(x_8);
x_10 = l_Lean_NameSet_empty;
x_11 = l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__1(x_10, x_9);
lean_inc(x_8);
x_12 = l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__2(x_8, x_10, x_9);
x_13 = l_Lean_RBTree_toList___at_Lean_IR_EmitLLVM_emitFnDecls___spec__3(x_12);
x_14 = lean_box(0);
x_15 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5(x_1, x_8, x_11, x_13, x_14, x_2, x_3, x_7);
lean_dec(x_11);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19;
x_18 = lean_ctor_get(x_15, 0);
lean_dec(x_18);
x_19 = !lean_is_exclusive(x_16);
if (x_19 == 0)
{
return x_15;
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_16, 0);
lean_inc(x_20);
lean_dec(x_16);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_15, 0, x_21);
return x_15;
}
}
else
{
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_15, 1);
lean_inc(x_22);
lean_dec(x_15);
x_23 = lean_ctor_get(x_16, 0);
lean_inc(x_23);
if (lean_is_exclusive(x_16)) {
lean_ctor_release(x_16, 0);
x_24 = x_16;
} else {
lean_dec_ref(x_16);
x_24 = lean_box(0);
}
if (lean_is_scalar(x_24)) {
x_25 = lean_alloc_ctor(0, 1, 0);
} else {
x_25 = x_24;
}
lean_ctor_set(x_25, 0, x_23);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_22);
return x_26;
}
}
else
{
uint8_t x_27;
lean_dec(x_16);
x_27 = !lean_is_exclusive(x_15);
if (x_27 == 0)
{
lean_object* x_28; lean_object* x_29;
x_28 = lean_ctor_get(x_15, 0);
lean_dec(x_28);
x_29 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_15, 0, x_29);
return x_15;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_15, 1);
lean_inc(x_30);
lean_dec(x_15);
x_31 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
else
{
uint8_t x_33;
x_33 = !lean_is_exclusive(x_15);
if (x_33 == 0)
{
return x_15;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_15, 0);
x_35 = lean_ctor_get(x_15, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_15);
x_36 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
LEAN_EXPORT lean_object* l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_List_foldl___at_Lean_IR_EmitLLVM_emitFnDecls___spec__1(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_revFold___at_Lean_IR_EmitLLVM_emitFnDecls___spec__4(x_1, x_2);
lean_dec(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___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:
{
size_t x_9; lean_object* x_10;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5(x_9, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_3);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnDecls___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_IR_EmitLLVM_emitFnDecls(x_5, x_2, x_3, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_4;
x_4 = lean_box(0);
return x_4;
}
else
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_3, 0);
x_6 = lean_ctor_get(x_3, 1);
x_7 = lean_ctor_get(x_3, 2);
x_8 = lean_nat_dec_eq(x_5, x_2);
if (x_8 == 0)
{
x_3 = x_7;
goto _start;
}
else
{
lean_object* x_10;
lean_inc(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
return x_10;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1(size_t x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint64_t x_6; size_t x_7; lean_object* x_8; lean_object* x_9;
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_array_get_size(x_4);
x_6 = lean_uint64_of_nat(x_3);
x_7 = lean_hashmap_mk_idx(x_5, x_6);
x_8 = lean_array_uget(x_4, x_7);
lean_dec(x_4);
x_9 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2(x_1, x_3, x_8);
lean_dec(x_8);
lean_dec(x_3);
return x_9;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("x_", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unable to find variable ", 24);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot__(size_t 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_st_ref_get(x_3, 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;
x_8 = lean_ctor_get(x_6, 0);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
lean_dec(x_8);
lean_inc(x_2);
x_10 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1(x_1, x_9, x_2);
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;
x_11 = l_Nat_repr(x_2);
x_12 = l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1;
x_13 = lean_string_append(x_12, x_11);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2;
x_15 = lean_string_append(x_14, x_13);
lean_dec(x_13);
x_16 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_17 = lean_string_append(x_15, x_16);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_6, 0, x_18);
return x_6;
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_2);
x_19 = lean_ctor_get(x_10, 0);
lean_inc(x_19);
lean_dec(x_10);
x_20 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_6, 0, x_20);
return x_6;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_21 = lean_ctor_get(x_6, 0);
x_22 = lean_ctor_get(x_6, 1);
lean_inc(x_22);
lean_inc(x_21);
lean_dec(x_6);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
lean_dec(x_21);
lean_inc(x_2);
x_24 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1(x_1, x_23, x_2);
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; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_25 = l_Nat_repr(x_2);
x_26 = l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1;
x_27 = lean_string_append(x_26, x_25);
lean_dec(x_25);
x_28 = l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2;
x_29 = lean_string_append(x_28, x_27);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_31 = lean_string_append(x_29, x_30);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_22);
return x_33;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
lean_dec(x_2);
x_34 = lean_ctor_get(x_24, 0);
lean_inc(x_34);
lean_dec(x_24);
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_34);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_22);
return x_36;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__2(x_4, x_2, x_3);
lean_dec(x_3);
lean_dec(x_2);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; lean_object* x_5;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitLhsSlot_____spec__1(x_4, x_2, x_3);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlot_____boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_6, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsVal(size_t x_1, size_t 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_9;
x_8 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_3, x_5, x_6, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
lean_dec(x_4);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_9);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; size_t x_25; size_t x_26; lean_object* x_27; uint8_t x_28;
x_21 = lean_ctor_get(x_9, 0);
x_22 = lean_ctor_get(x_8, 1);
lean_inc(x_22);
lean_dec(x_8);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_21, 1);
lean_inc(x_24);
lean_dec(x_21);
x_25 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_27 = lean_llvm_build_load2(x_1, x_2, x_25, x_26, x_4, x_22);
x_28 = !lean_is_exclusive(x_27);
if (x_28 == 0)
{
lean_object* x_29;
x_29 = lean_ctor_get(x_27, 0);
lean_ctor_set(x_9, 0, x_29);
lean_ctor_set(x_27, 0, x_9);
return x_27;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_27, 0);
x_31 = lean_ctor_get(x_27, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_27);
lean_ctor_set(x_9, 0, x_30);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_9);
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_object* x_36; size_t x_37; size_t 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_33 = lean_ctor_get(x_9, 0);
lean_inc(x_33);
lean_dec(x_9);
x_34 = lean_ctor_get(x_8, 1);
lean_inc(x_34);
lean_dec(x_8);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_33, 1);
lean_inc(x_36);
lean_dec(x_33);
x_37 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_38 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_39 = lean_llvm_build_load2(x_1, x_2, x_37, x_38, x_4, x_34);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
if (lean_is_exclusive(x_39)) {
lean_ctor_release(x_39, 0);
lean_ctor_release(x_39, 1);
x_42 = x_39;
} else {
lean_dec_ref(x_39);
x_42 = lean_box(0);
}
x_43 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_43, 0, x_40);
if (lean_is_scalar(x_42)) {
x_44 = lean_alloc_ctor(0, 2, 0);
} else {
x_44 = x_42;
}
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_41);
return x_44;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsVal___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlotStore(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9;
x_8 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_3, x_5, x_6, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_9);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; uint8_t x_26;
x_21 = lean_ctor_get(x_9, 0);
x_22 = lean_ctor_get(x_8, 1);
lean_inc(x_22);
lean_dec(x_8);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
x_24 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_25 = lean_llvm_build_store(x_1, x_2, x_4, x_24, x_22);
x_26 = !lean_is_exclusive(x_25);
if (x_26 == 0)
{
lean_object* x_27;
x_27 = lean_ctor_get(x_25, 0);
lean_ctor_set(x_9, 0, x_27);
lean_ctor_set(x_25, 0, x_9);
return x_25;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_25, 0);
x_29 = lean_ctor_get(x_25, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_25);
lean_ctor_set(x_9, 0, x_28);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_9);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t 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_31 = lean_ctor_get(x_9, 0);
lean_inc(x_31);
lean_dec(x_9);
x_32 = lean_ctor_get(x_8, 1);
lean_inc(x_32);
lean_dec(x_8);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_35 = lean_llvm_build_store(x_1, x_2, x_4, x_34, x_32);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
if (lean_is_exclusive(x_35)) {
lean_ctor_release(x_35, 0);
lean_ctor_release(x_35, 1);
x_38 = x_35;
} else {
lean_dec_ref(x_35);
x_38 = lean_box(0);
}
x_39 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_39, 0, x_36);
if (lean_is_scalar(x_38)) {
x_40 = lean_alloc_ctor(0, 2, 0);
} else {
x_40 = x_38;
}
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_37);
return x_40;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLhsSlotStore___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_8, x_9, x_3, x_10, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitArgSlot_____closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("irrelevant_slot", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("irrelevant_val", 14);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgSlot__(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_7; lean_object* x_8;
x_7 = lean_ctor_get(x_3, 0);
lean_inc(x_7);
lean_dec(x_3);
x_8 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_7, x_4, x_5, x_6);
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; size_t x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint64_t x_17; uint8_t x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; size_t x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27;
x_9 = l_LLVM_voidPtrType(x_1, x_6);
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_EmitLLVM_emitArgSlot_____closed__1;
x_13 = lean_unbox_usize(x_10);
x_14 = lean_llvm_build_alloca(x_1, x_2, x_13, x_12, x_11);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = 0;
x_18 = 0;
x_19 = l_LLVM_constIntUnsigned(x_1, x_17, x_18, x_16);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2;
x_23 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_24 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_2, x_23, x_22, x_4, x_5, x_21);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = !lean_is_exclusive(x_25);
if (x_27 == 0)
{
lean_object* x_28; size_t x_29; size_t x_30; lean_object* x_31; uint8_t x_32;
x_28 = lean_ctor_get(x_25, 0);
x_29 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_30 = lean_unbox_usize(x_15);
x_31 = lean_llvm_build_store(x_1, x_2, x_29, x_30, x_26);
x_32 = !lean_is_exclusive(x_31);
if (x_32 == 0)
{
lean_object* x_33; lean_object* x_34;
x_33 = lean_ctor_get(x_31, 0);
lean_dec(x_33);
x_34 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_34, 0, x_10);
lean_ctor_set(x_34, 1, x_15);
lean_ctor_set(x_25, 0, x_34);
lean_ctor_set(x_31, 0, x_25);
return x_31;
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_35 = lean_ctor_get(x_31, 1);
lean_inc(x_35);
lean_dec(x_31);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_10);
lean_ctor_set(x_36, 1, x_15);
lean_ctor_set(x_25, 0, x_36);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_25);
lean_ctor_set(x_37, 1, x_35);
return x_37;
}
}
else
{
lean_object* x_38; size_t x_39; size_t 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_25, 0);
lean_inc(x_38);
lean_dec(x_25);
x_39 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_40 = lean_unbox_usize(x_15);
x_41 = lean_llvm_build_store(x_1, x_2, x_39, x_40, x_26);
x_42 = lean_ctor_get(x_41, 1);
lean_inc(x_42);
if (lean_is_exclusive(x_41)) {
lean_ctor_release(x_41, 0);
lean_ctor_release(x_41, 1);
x_43 = x_41;
} else {
lean_dec_ref(x_41);
x_43 = lean_box(0);
}
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_10);
lean_ctor_set(x_44, 1, x_15);
x_45 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_45, 0, x_44);
if (lean_is_scalar(x_43)) {
x_46 = lean_alloc_ctor(0, 2, 0);
} else {
x_46 = x_43;
}
lean_ctor_set(x_46, 0, x_45);
lean_ctor_set(x_46, 1, x_42);
return x_46;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgSlot_____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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_emitArgSlot__(x_7, x_8, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgVal(size_t x_1, size_t 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_9;
x_8 = l_Lean_IR_EmitLLVM_emitArgSlot__(x_1, x_2, x_3, x_5, x_6, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
lean_dec(x_4);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_9);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_21 = lean_ctor_get(x_9, 0);
x_22 = lean_ctor_get(x_8, 1);
lean_inc(x_22);
lean_dec(x_8);
x_23 = !lean_is_exclusive(x_21);
if (x_23 == 0)
{
lean_object* x_24; lean_object* x_25; size_t x_26; size_t x_27; lean_object* x_28; uint8_t x_29;
x_24 = lean_ctor_get(x_21, 0);
x_25 = lean_ctor_get(x_21, 1);
x_26 = lean_unbox_usize(x_24);
x_27 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_28 = lean_llvm_build_load2(x_1, x_2, x_26, x_27, x_4, x_22);
x_29 = !lean_is_exclusive(x_28);
if (x_29 == 0)
{
lean_object* x_30;
x_30 = lean_ctor_get(x_28, 0);
lean_ctor_set(x_21, 1, x_30);
lean_ctor_set(x_28, 0, x_9);
return x_28;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_28, 0);
x_32 = lean_ctor_get(x_28, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_28);
lean_ctor_set(x_21, 1, x_31);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_9);
lean_ctor_set(x_33, 1, x_32);
return x_33;
}
}
else
{
lean_object* x_34; lean_object* x_35; size_t x_36; size_t 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;
x_34 = lean_ctor_get(x_21, 0);
x_35 = lean_ctor_get(x_21, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_21);
x_36 = lean_unbox_usize(x_34);
x_37 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_38 = lean_llvm_build_load2(x_1, x_2, x_36, x_37, x_4, x_22);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
if (lean_is_exclusive(x_38)) {
lean_ctor_release(x_38, 0);
lean_ctor_release(x_38, 1);
x_41 = x_38;
} else {
lean_dec_ref(x_38);
x_41 = lean_box(0);
}
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_34);
lean_ctor_set(x_42, 1, x_39);
lean_ctor_set(x_9, 0, x_42);
if (lean_is_scalar(x_41)) {
x_43 = lean_alloc_ctor(0, 2, 0);
} else {
x_43 = x_41;
}
lean_ctor_set(x_43, 0, x_9);
lean_ctor_set(x_43, 1, x_40);
return x_43;
}
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; size_t x_49; size_t 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_44 = lean_ctor_get(x_9, 0);
lean_inc(x_44);
lean_dec(x_9);
x_45 = lean_ctor_get(x_8, 1);
lean_inc(x_45);
lean_dec(x_8);
x_46 = lean_ctor_get(x_44, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_44, 1);
lean_inc(x_47);
if (lean_is_exclusive(x_44)) {
lean_ctor_release(x_44, 0);
lean_ctor_release(x_44, 1);
x_48 = x_44;
} else {
lean_dec_ref(x_44);
x_48 = lean_box(0);
}
x_49 = lean_unbox_usize(x_46);
x_50 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_51 = lean_llvm_build_load2(x_1, x_2, x_49, x_50, x_4, x_45);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
if (lean_is_exclusive(x_51)) {
lean_ctor_release(x_51, 0);
lean_ctor_release(x_51, 1);
x_54 = x_51;
} else {
lean_dec_ref(x_51);
x_54 = lean_box(0);
}
if (lean_is_scalar(x_48)) {
x_55 = lean_alloc_ctor(0, 2, 0);
} else {
x_55 = x_48;
}
lean_ctor_set(x_55, 0, x_46);
lean_ctor_set(x_55, 1, x_52);
x_56 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_56, 0, x_55);
if (lean_is_scalar(x_54)) {
x_57 = lean_alloc_ctor(0, 2, 0);
} else {
x_57 = x_54;
}
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_53);
return x_57;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitArgVal___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitArgVal(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_alloc_ctor_out", 19);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitAllocCtor(size_t x_1, size_t 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_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_3, 3);
x_8 = lean_unsigned_to_nat(8u);
x_9 = lean_nat_mul(x_8, x_7);
x_10 = lean_ctor_get(x_3, 4);
x_11 = lean_nat_add(x_9, x_10);
lean_dec(x_9);
x_12 = lean_ctor_get(x_3, 1);
x_13 = lean_ctor_get(x_3, 2);
x_14 = l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1;
x_15 = l_Lean_IR_EmitLLVM_callLeanAllocCtor(x_1, x_2, x_12, x_13, x_11, x_14, x_4, x_5, x_6);
lean_dec(x_11);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitAllocCtor___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_emitAllocCtor(x_7, x_8, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitCtorSetArgs___spec__1(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_unsigned_to_nat(0u);
x_12 = lean_nat_dec_eq(x_7, 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_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_sub(x_7, x_13);
lean_dec(x_7);
x_24 = lean_nat_sub(x_6, x_14);
x_25 = lean_nat_sub(x_24, x_13);
lean_dec(x_24);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
lean_inc(x_3);
x_27 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_26, x_8, x_9, x_10);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
if (lean_obj_tag(x_28) == 0)
{
lean_object* x_29; uint8_t x_30;
lean_dec(x_25);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = !lean_is_exclusive(x_28);
if (x_30 == 0)
{
x_15 = x_28;
x_16 = x_29;
goto block_23;
}
else
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_28, 0);
lean_inc(x_31);
lean_dec(x_28);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
x_15 = x_32;
x_16 = x_29;
goto block_23;
}
}
else
{
lean_object* x_33; lean_object* x_34; uint8_t x_35;
x_33 = lean_ctor_get(x_27, 1);
lean_inc(x_33);
lean_dec(x_27);
x_34 = lean_ctor_get(x_28, 0);
lean_inc(x_34);
lean_dec(x_28);
x_35 = lean_nat_dec_lt(x_25, x_5);
if (x_35 == 0)
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_36 = l_Lean_IR_instInhabitedArg;
x_37 = l___private_Init_Util_0__outOfBounds___rarg(x_36);
x_38 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_37, x_26, x_8, x_9, x_33);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
if (lean_obj_tag(x_39) == 0)
{
lean_object* x_40; uint8_t x_41;
lean_dec(x_34);
lean_dec(x_25);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = !lean_is_exclusive(x_39);
if (x_41 == 0)
{
x_15 = x_39;
x_16 = x_40;
goto block_23;
}
else
{
lean_object* x_42; lean_object* x_43;
x_42 = lean_ctor_get(x_39, 0);
lean_inc(x_42);
lean_dec(x_39);
x_43 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_43, 0, x_42);
x_15 = x_43;
x_16 = x_40;
goto block_23;
}
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46; uint64_t x_47; uint8_t x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; size_t x_52; size_t x_53; size_t x_54; lean_object* x_55; lean_object* x_56; size_t x_57; lean_object* x_58; lean_object* x_59;
x_44 = lean_ctor_get(x_39, 0);
lean_inc(x_44);
lean_dec(x_39);
x_45 = lean_ctor_get(x_38, 1);
lean_inc(x_45);
lean_dec(x_38);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = lean_uint64_of_nat(x_25);
lean_dec(x_25);
x_48 = 0;
x_49 = l_LLVM_constIntUnsigned(x_1, x_47, x_48, x_45);
x_50 = lean_ctor_get(x_49, 0);
lean_inc(x_50);
x_51 = lean_ctor_get(x_49, 1);
lean_inc(x_51);
lean_dec(x_49);
x_52 = lean_unbox_usize(x_34);
x_53 = lean_unbox_usize(x_50);
lean_dec(x_50);
x_54 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_55 = l_Lean_IR_EmitLLVM_callLeanCtorSet(x_1, x_2, x_52, x_53, x_54, x_8, x_9, x_51);
x_56 = lean_ctor_get(x_55, 1);
lean_inc(x_56);
lean_dec(x_55);
x_57 = lean_unbox_usize(x_34);
lean_dec(x_34);
lean_inc(x_3);
x_58 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_57, x_8, x_9, x_56);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
if (lean_obj_tag(x_59) == 0)
{
lean_object* x_60; uint8_t x_61;
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = !lean_is_exclusive(x_59);
if (x_61 == 0)
{
x_15 = x_59;
x_16 = x_60;
goto block_23;
}
else
{
lean_object* x_62; lean_object* x_63;
x_62 = lean_ctor_get(x_59, 0);
lean_inc(x_62);
lean_dec(x_59);
x_63 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_63, 0, x_62);
x_15 = x_63;
x_16 = x_60;
goto block_23;
}
}
else
{
lean_object* x_64; lean_object* x_65;
lean_dec(x_59);
x_64 = lean_ctor_get(x_58, 1);
lean_inc(x_64);
lean_dec(x_58);
x_65 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_15 = x_65;
x_16 = x_64;
goto block_23;
}
}
}
else
{
lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_66 = lean_array_fget(x_4, x_25);
x_67 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_66, x_26, x_8, x_9, x_33);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
if (lean_obj_tag(x_68) == 0)
{
lean_object* x_69; uint8_t x_70;
lean_dec(x_34);
lean_dec(x_25);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
lean_dec(x_67);
x_70 = !lean_is_exclusive(x_68);
if (x_70 == 0)
{
x_15 = x_68;
x_16 = x_69;
goto block_23;
}
else
{
lean_object* x_71; lean_object* x_72;
x_71 = lean_ctor_get(x_68, 0);
lean_inc(x_71);
lean_dec(x_68);
x_72 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_72, 0, x_71);
x_15 = x_72;
x_16 = x_69;
goto block_23;
}
}
else
{
lean_object* x_73; lean_object* x_74; lean_object* x_75; uint64_t x_76; uint8_t x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; size_t x_81; size_t x_82; size_t x_83; lean_object* x_84; lean_object* x_85; size_t x_86; lean_object* x_87; lean_object* x_88;
x_73 = lean_ctor_get(x_68, 0);
lean_inc(x_73);
lean_dec(x_68);
x_74 = lean_ctor_get(x_67, 1);
lean_inc(x_74);
lean_dec(x_67);
x_75 = lean_ctor_get(x_73, 1);
lean_inc(x_75);
lean_dec(x_73);
x_76 = lean_uint64_of_nat(x_25);
lean_dec(x_25);
x_77 = 0;
x_78 = l_LLVM_constIntUnsigned(x_1, x_76, x_77, x_74);
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 = lean_unbox_usize(x_34);
x_82 = lean_unbox_usize(x_79);
lean_dec(x_79);
x_83 = lean_unbox_usize(x_75);
lean_dec(x_75);
x_84 = l_Lean_IR_EmitLLVM_callLeanCtorSet(x_1, x_2, x_81, x_82, x_83, x_8, x_9, x_80);
x_85 = lean_ctor_get(x_84, 1);
lean_inc(x_85);
lean_dec(x_84);
x_86 = lean_unbox_usize(x_34);
lean_dec(x_34);
lean_inc(x_3);
x_87 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_86, x_8, x_9, x_85);
x_88 = lean_ctor_get(x_87, 0);
lean_inc(x_88);
if (lean_obj_tag(x_88) == 0)
{
lean_object* x_89; uint8_t x_90;
x_89 = lean_ctor_get(x_87, 1);
lean_inc(x_89);
lean_dec(x_87);
x_90 = !lean_is_exclusive(x_88);
if (x_90 == 0)
{
x_15 = x_88;
x_16 = x_89;
goto block_23;
}
else
{
lean_object* x_91; lean_object* x_92;
x_91 = lean_ctor_get(x_88, 0);
lean_inc(x_91);
lean_dec(x_88);
x_92 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_92, 0, x_91);
x_15 = x_92;
x_16 = x_89;
goto block_23;
}
}
else
{
lean_object* x_93; lean_object* x_94;
lean_dec(x_88);
x_93 = lean_ctor_get(x_87, 1);
lean_inc(x_93);
lean_dec(x_87);
x_94 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_15 = x_94;
x_16 = x_93;
goto block_23;
}
}
}
}
block_23:
{
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_17;
lean_dec(x_14);
lean_dec(x_3);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_15);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_16);
return x_21;
}
}
else
{
lean_dec(x_15);
x_7 = x_14;
x_10 = x_16;
goto _start;
}
}
}
else
{
lean_object* x_95; lean_object* x_96;
lean_dec(x_7);
lean_dec(x_3);
x_95 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_96 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_96, 0, x_95);
lean_ctor_set(x_96, 1, x_10);
return x_96;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtorSetArgs(size_t x_1, size_t 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_9;
x_8 = lean_array_get_size(x_4);
lean_inc(x_8);
x_9 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitCtorSetArgs___spec__1(x_1, x_2, x_3, x_4, x_8, x_8, x_8, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_8);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitCtorSetArgs___spec__1(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtorSetArgs___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitCtorSetArgs(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_4);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitCtor___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box_outv", 13);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtor(size_t x_1, size_t 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_inc(x_3);
x_9 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_3, x_6, x_7, x_8);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_3);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_21 = lean_ctor_get(x_10, 0);
lean_inc(x_21);
lean_dec(x_10);
x_22 = lean_ctor_get(x_9, 1);
lean_inc(x_22);
lean_dec(x_9);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
x_24 = lean_ctor_get(x_4, 2);
x_25 = lean_unsigned_to_nat(0u);
x_26 = lean_nat_dec_eq(x_24, x_25);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_27 = l_Lean_IR_EmitLLVM_emitAllocCtor(x_1, x_2, x_4, x_6, x_7, x_22);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_32 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_33 = lean_llvm_build_store(x_1, x_2, x_31, x_32, x_29);
x_34 = lean_ctor_get(x_33, 1);
lean_inc(x_34);
lean_dec(x_33);
x_35 = l_Lean_IR_EmitLLVM_emitCtorSetArgs(x_1, x_2, x_3, x_5, x_6, x_7, x_34);
return x_35;
}
else
{
lean_object* x_36; uint8_t x_37;
x_36 = lean_ctor_get(x_4, 3);
x_37 = lean_nat_dec_eq(x_36, x_25);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; size_t x_42; size_t x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_38 = l_Lean_IR_EmitLLVM_emitAllocCtor(x_1, x_2, x_4, x_6, x_7, x_22);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = lean_ctor_get(x_39, 0);
lean_inc(x_41);
lean_dec(x_39);
x_42 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_43 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_44 = lean_llvm_build_store(x_1, x_2, x_42, x_43, x_40);
x_45 = lean_ctor_get(x_44, 1);
lean_inc(x_45);
lean_dec(x_44);
x_46 = l_Lean_IR_EmitLLVM_emitCtorSetArgs(x_1, x_2, x_3, x_5, x_6, x_7, x_45);
return x_46;
}
else
{
lean_object* x_47; uint8_t x_48;
x_47 = lean_ctor_get(x_4, 4);
x_48 = lean_nat_dec_eq(x_47, x_25);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; size_t x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_49 = l_Lean_IR_EmitLLVM_emitAllocCtor(x_1, x_2, x_4, x_6, x_7, x_22);
x_50 = lean_ctor_get(x_49, 0);
lean_inc(x_50);
x_51 = lean_ctor_get(x_49, 1);
lean_inc(x_51);
lean_dec(x_49);
x_52 = lean_ctor_get(x_50, 0);
lean_inc(x_52);
lean_dec(x_50);
x_53 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_54 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_55 = lean_llvm_build_store(x_1, x_2, x_53, x_54, x_51);
x_56 = lean_ctor_get(x_55, 1);
lean_inc(x_56);
lean_dec(x_55);
x_57 = l_Lean_IR_EmitLLVM_emitCtorSetArgs(x_1, x_2, x_3, x_5, x_6, x_7, x_56);
return x_57;
}
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; size_t x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; size_t x_69; size_t x_70; lean_object* x_71; uint8_t x_72;
lean_dec(x_3);
x_58 = lean_ctor_get(x_4, 1);
x_59 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_58, x_6, x_7, x_22);
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
lean_dec(x_59);
x_62 = lean_ctor_get(x_60, 0);
lean_inc(x_62);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_emitCtor___closed__1;
x_64 = lean_unbox_usize(x_62);
lean_dec(x_62);
x_65 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_2, x_64, x_63, x_6, x_7, x_61);
lean_dec(x_7);
lean_dec(x_6);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = lean_ctor_get(x_66, 0);
lean_inc(x_68);
lean_dec(x_66);
x_69 = lean_unbox_usize(x_68);
lean_dec(x_68);
x_70 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_71 = lean_llvm_build_store(x_1, x_2, x_69, x_70, x_67);
x_72 = !lean_is_exclusive(x_71);
if (x_72 == 0)
{
lean_object* x_73; lean_object* x_74;
x_73 = lean_ctor_get(x_71, 0);
lean_dec(x_73);
x_74 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_71, 0, x_74);
return x_71;
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_71, 1);
lean_inc(x_75);
lean_dec(x_71);
x_76 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_77 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_77, 0, x_76);
lean_ctor_set(x_77, 1, x_75);
return x_77;
}
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCtor___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitCtor(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_5);
lean_dec(x_4);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInc(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, uint8_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_unsigned_to_nat(1u);
x_25 = lean_nat_dec_eq(x_4, x_24);
if (x_25 == 0)
{
uint64_t x_26; uint8_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t x_32; size_t x_33; lean_object* x_34;
x_26 = lean_uint64_of_nat(x_4);
x_27 = 0;
x_28 = l_LLVM_constIntUnsigned(x_1, x_26, x_27, x_22);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_31, 0, x_29);
x_32 = 0;
x_33 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_34 = l_Lean_IR_EmitLLVM_callLeanRefcountFn(x_1, x_2, x_32, x_5, x_33, x_31, x_6, x_7, x_30);
return x_34;
}
else
{
lean_object* x_35; uint8_t x_36; size_t x_37; lean_object* x_38;
x_35 = lean_box(0);
x_36 = 0;
x_37 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_38 = l_Lean_IR_EmitLLVM_callLeanRefcountFn(x_1, x_2, x_36, x_5, x_37, x_35, x_6, x_7, x_22);
return x_38;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInc___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:
{
size_t x_9; size_t x_10; uint8_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox(x_5);
lean_dec(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitInc(x_9, x_10, x_3, x_4, x_11, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_12;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDec___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("expected n = 1 for emitDec", 26);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDec___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitDec___closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDec(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, uint8_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
uint8_t x_22;
x_22 = !lean_is_exclusive(x_10);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27;
x_23 = lean_ctor_get(x_10, 1);
x_24 = lean_ctor_get(x_10, 0);
lean_dec(x_24);
x_25 = lean_ctor_get(x_11, 0);
lean_inc(x_25);
lean_dec(x_11);
x_26 = lean_unsigned_to_nat(1u);
x_27 = lean_nat_dec_eq(x_4, x_26);
if (x_27 == 0)
{
lean_object* x_28;
lean_dec(x_25);
x_28 = l_Lean_IR_EmitLLVM_emitDec___closed__2;
lean_ctor_set(x_10, 0, x_28);
return x_10;
}
else
{
lean_object* x_29; uint8_t x_30; size_t x_31; lean_object* x_32;
lean_free_object(x_10);
x_29 = lean_box(0);
x_30 = 1;
x_31 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_32 = l_Lean_IR_EmitLLVM_callLeanRefcountFn(x_1, x_2, x_30, x_5, x_31, x_29, x_6, x_7, x_23);
return x_32;
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36;
x_33 = lean_ctor_get(x_10, 1);
lean_inc(x_33);
lean_dec(x_10);
x_34 = lean_ctor_get(x_11, 0);
lean_inc(x_34);
lean_dec(x_11);
x_35 = lean_unsigned_to_nat(1u);
x_36 = lean_nat_dec_eq(x_4, x_35);
if (x_36 == 0)
{
lean_object* x_37; lean_object* x_38;
lean_dec(x_34);
x_37 = l_Lean_IR_EmitLLVM_emitDec___closed__2;
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_33);
return x_38;
}
else
{
lean_object* x_39; uint8_t x_40; size_t x_41; lean_object* x_42;
x_39 = lean_box(0);
x_40 = 1;
x_41 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_42 = l_Lean_IR_EmitLLVM_callLeanRefcountFn(x_1, x_2, x_40, x_5, x_41, x_39, x_6, x_7, x_33);
return x_42;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDec___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:
{
size_t x_9; size_t x_10; uint8_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox(x_5);
lean_dec(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitDec(x_9, x_10, x_3, x_4, x_11, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitNumLit(size_t x_1, size_t 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;
x_8 = l_Lean_IR_IRType_isObj(x_3);
if (x_8 == 0)
{
lean_object* x_9;
x_9 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_3, x_5, x_6, x_7);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10;
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_4);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; uint8_t x_22;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = !lean_is_exclusive(x_10);
if (x_22 == 0)
{
lean_object* x_23; uint64_t x_24; uint8_t x_25; size_t x_26; lean_object* x_27; uint8_t x_28;
x_23 = lean_ctor_get(x_10, 0);
x_24 = lean_uint64_of_nat(x_4);
lean_dec(x_4);
x_25 = 0;
x_26 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_27 = lean_llvm_const_int(x_1, x_26, x_24, x_25, x_21);
x_28 = !lean_is_exclusive(x_27);
if (x_28 == 0)
{
lean_object* x_29;
x_29 = lean_ctor_get(x_27, 0);
lean_ctor_set(x_10, 0, x_29);
lean_ctor_set(x_27, 0, x_10);
return x_27;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_27, 0);
x_31 = lean_ctor_get(x_27, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_27);
lean_ctor_set(x_10, 0, x_30);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_10);
lean_ctor_set(x_32, 1, x_31);
return x_32;
}
}
else
{
lean_object* x_33; uint64_t x_34; uint8_t x_35; size_t 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;
x_33 = lean_ctor_get(x_10, 0);
lean_inc(x_33);
lean_dec(x_10);
x_34 = lean_uint64_of_nat(x_4);
lean_dec(x_4);
x_35 = 0;
x_36 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_37 = lean_llvm_const_int(x_1, x_36, x_34, x_35, x_21);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
if (lean_is_exclusive(x_37)) {
lean_ctor_release(x_37, 0);
lean_ctor_release(x_37, 1);
x_40 = x_37;
} else {
lean_dec_ref(x_37);
x_40 = lean_box(0);
}
x_41 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_41, 0, x_38);
if (lean_is_scalar(x_40)) {
x_42 = lean_alloc_ctor(0, 2, 0);
} else {
x_42 = x_40;
}
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_39);
return x_42;
}
}
}
else
{
uint8_t x_43;
lean_dec(x_4);
x_43 = !lean_is_exclusive(x_9);
if (x_43 == 0)
{
return x_9;
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_44 = lean_ctor_get(x_9, 0);
x_45 = lean_ctor_get(x_9, 1);
lean_inc(x_45);
lean_inc(x_44);
lean_dec(x_9);
x_46 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_46, 0, x_44);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
}
else
{
lean_object* x_47; uint8_t x_48;
lean_dec(x_3);
x_47 = l_UInt32_size;
x_48 = lean_nat_dec_lt(x_4, x_47);
if (x_48 == 0)
{
lean_object* x_49; lean_object* x_50;
x_49 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_50 = l_Lean_IR_EmitLLVM_callLeanCStrToNatFn(x_1, x_2, x_4, x_49, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_50;
}
else
{
lean_object* x_51; lean_object* x_52;
x_51 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_52 = l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn(x_1, x_2, x_4, x_51, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_52;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitNumLit___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitNumLit(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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_Lean_IR_EmitLLVM_emitJp___closed__3;
x_4 = lean_string_push(x_3, x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_toHexDigit___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitLLVM_toHexDigit(x_1);
lean_dec(x_1);
return x_2;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\x", 2);
return x_1;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\\"", 2);
return x_1;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\\\", 2);
return x_1;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\t", 2);
return x_1;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\r", 2);
return x_1;
}
}
static lean_object* _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\\n", 2);
return x_1;
}
}
LEAN_EXPORT lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_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_lt(x_3, x_2);
if (x_5 == 0)
{
lean_dec(x_3);
return x_4;
}
else
{
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 = lean_uint32_dec_eq(x_7, x_8);
if (x_9 == 0)
{
uint32_t x_10; uint8_t x_11;
x_10 = 13;
x_11 = lean_uint32_dec_eq(x_7, x_10);
if (x_11 == 0)
{
uint32_t x_12; uint8_t x_13;
x_12 = 9;
x_13 = lean_uint32_dec_eq(x_7, x_12);
if (x_13 == 0)
{
uint32_t x_14; uint8_t x_15;
x_14 = 92;
x_15 = lean_uint32_dec_eq(x_7, x_14);
if (x_15 == 0)
{
uint32_t x_16; uint8_t x_17;
x_16 = 34;
x_17 = lean_uint32_dec_eq(x_7, x_16);
if (x_17 == 0)
{
lean_object* x_18; lean_object* x_19; uint8_t x_20;
x_18 = lean_uint32_to_nat(x_7);
x_19 = lean_unsigned_to_nat(31u);
x_20 = lean_nat_dec_le(x_18, x_19);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_22 = lean_string_push(x_21, x_7);
x_23 = lean_string_append(x_4, x_22);
lean_dec(x_22);
x_3 = x_6;
x_4 = x_23;
goto _start;
}
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;
x_25 = lean_unsigned_to_nat(16u);
x_26 = lean_nat_div(x_18, x_25);
x_27 = l_Lean_IR_EmitLLVM_toHexDigit(x_26);
lean_dec(x_26);
x_28 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1;
x_29 = lean_string_append(x_28, x_27);
lean_dec(x_27);
x_30 = lean_nat_mod(x_18, x_25);
lean_dec(x_18);
x_31 = l_Lean_IR_EmitLLVM_toHexDigit(x_30);
lean_dec(x_30);
x_32 = lean_string_append(x_29, x_31);
lean_dec(x_31);
x_33 = lean_string_append(x_4, x_32);
lean_dec(x_32);
x_3 = x_6;
x_4 = x_33;
goto _start;
}
}
else
{
lean_object* x_35; lean_object* x_36;
x_35 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2;
x_36 = lean_string_append(x_4, x_35);
x_3 = x_6;
x_4 = x_36;
goto _start;
}
}
else
{
lean_object* x_38; lean_object* x_39;
x_38 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3;
x_39 = lean_string_append(x_4, x_38);
x_3 = x_6;
x_4 = x_39;
goto _start;
}
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4;
x_42 = lean_string_append(x_4, x_41);
x_3 = x_6;
x_4 = x_42;
goto _start;
}
}
else
{
lean_object* x_44; lean_object* x_45;
x_44 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5;
x_45 = lean_string_append(x_4, x_44);
x_3 = x_6;
x_4 = x_45;
goto _start;
}
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6;
x_48 = lean_string_append(x_4, x_47);
x_3 = x_6;
x_4 = x_48;
goto _start;
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_quoteString___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\"", 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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_Lean_IR_EmitLLVM_quoteString___closed__1;
x_5 = l_String_foldlAux___at_Lean_IR_EmitLLVM_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_EXPORT lean_object* l_String_foldlAux___at_Lean_IR_EmitLLVM_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___at_Lean_IR_EmitLLVM_quoteString___spec__1(x_1, x_2, x_3, x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_quoteString___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_IR_EmitLLVM_quoteString(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitSimpleExternalCall___spec__1(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; uint8_t x_34;
x_34 = lean_usize_dec_lt(x_5, x_4);
if (x_34 == 0)
{
lean_object* x_35; lean_object* x_36;
lean_dec(x_8);
lean_dec(x_7);
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_6);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_9);
return x_36;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; uint8_t x_40;
x_37 = lean_array_uget(x_3, x_5);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = !lean_is_exclusive(x_6);
if (x_40 == 0)
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; uint8_t x_44;
x_41 = lean_ctor_get(x_6, 0);
x_42 = lean_ctor_get(x_6, 1);
x_43 = lean_ctor_get(x_38, 1);
lean_inc(x_43);
lean_dec(x_38);
x_44 = l_Lean_IR_IRType_isIrrelevant(x_43);
if (x_44 == 0)
{
lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_45 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_46 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_39, x_45, x_7, x_8, x_9);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
lean_object* x_48; uint8_t x_49;
lean_dec(x_43);
lean_free_object(x_6);
lean_dec(x_42);
lean_dec(x_41);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = !lean_is_exclusive(x_47);
if (x_49 == 0)
{
x_10 = x_47;
x_11 = x_48;
goto block_33;
}
else
{
lean_object* x_50; lean_object* x_51;
x_50 = lean_ctor_get(x_47, 0);
lean_inc(x_50);
lean_dec(x_47);
x_51 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_51, 0, x_50);
x_10 = x_51;
x_11 = x_48;
goto block_33;
}
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_52 = lean_ctor_get(x_47, 0);
lean_inc(x_52);
lean_dec(x_47);
x_53 = lean_ctor_get(x_46, 1);
lean_inc(x_53);
lean_dec(x_46);
x_54 = lean_ctor_get(x_52, 1);
lean_inc(x_54);
lean_dec(x_52);
lean_inc(x_8);
lean_inc(x_7);
x_55 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_43, x_7, x_8, x_53);
if (lean_obj_tag(x_55) == 0)
{
lean_object* x_56;
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
if (lean_obj_tag(x_56) == 0)
{
lean_object* x_57; uint8_t x_58;
lean_dec(x_54);
lean_free_object(x_6);
lean_dec(x_42);
lean_dec(x_41);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = !lean_is_exclusive(x_56);
if (x_58 == 0)
{
x_10 = x_56;
x_11 = x_57;
goto block_33;
}
else
{
lean_object* x_59; lean_object* x_60;
x_59 = lean_ctor_get(x_56, 0);
lean_inc(x_59);
lean_dec(x_56);
x_60 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_60, 0, x_59);
x_10 = x_60;
x_11 = x_57;
goto block_33;
}
}
else
{
lean_object* x_61; uint8_t x_62;
x_61 = lean_ctor_get(x_55, 1);
lean_inc(x_61);
lean_dec(x_55);
x_62 = !lean_is_exclusive(x_56);
if (x_62 == 0)
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_63 = lean_ctor_get(x_56, 0);
x_64 = lean_array_push(x_41, x_63);
x_65 = lean_array_push(x_42, x_54);
lean_ctor_set(x_6, 1, x_65);
lean_ctor_set(x_6, 0, x_64);
x_66 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_66, 0, x_6);
lean_ctor_set(x_56, 0, x_66);
x_10 = x_56;
x_11 = x_61;
goto block_33;
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_67 = lean_ctor_get(x_56, 0);
lean_inc(x_67);
lean_dec(x_56);
x_68 = lean_array_push(x_41, x_67);
x_69 = lean_array_push(x_42, x_54);
lean_ctor_set(x_6, 1, x_69);
lean_ctor_set(x_6, 0, x_68);
x_70 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_70, 0, x_6);
x_71 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_71, 0, x_70);
x_10 = x_71;
x_11 = x_61;
goto block_33;
}
}
}
else
{
uint8_t x_72;
lean_dec(x_54);
lean_free_object(x_6);
lean_dec(x_42);
lean_dec(x_41);
lean_dec(x_8);
lean_dec(x_7);
x_72 = !lean_is_exclusive(x_55);
if (x_72 == 0)
{
return x_55;
}
else
{
lean_object* x_73; lean_object* x_74; lean_object* x_75;
x_73 = lean_ctor_get(x_55, 0);
x_74 = lean_ctor_get(x_55, 1);
lean_inc(x_74);
lean_inc(x_73);
lean_dec(x_55);
x_75 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_75, 0, x_73);
lean_ctor_set(x_75, 1, x_74);
return x_75;
}
}
}
}
else
{
lean_object* x_76; lean_object* x_77;
lean_dec(x_43);
lean_dec(x_39);
x_76 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_76, 0, x_6);
x_77 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_77, 0, x_76);
x_10 = x_77;
x_11 = x_9;
goto block_33;
}
}
else
{
lean_object* x_78; lean_object* x_79; lean_object* x_80; uint8_t x_81;
x_78 = lean_ctor_get(x_6, 0);
x_79 = lean_ctor_get(x_6, 1);
lean_inc(x_79);
lean_inc(x_78);
lean_dec(x_6);
x_80 = lean_ctor_get(x_38, 1);
lean_inc(x_80);
lean_dec(x_38);
x_81 = l_Lean_IR_IRType_isIrrelevant(x_80);
if (x_81 == 0)
{
lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_82 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_83 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_39, x_82, x_7, x_8, x_9);
x_84 = lean_ctor_get(x_83, 0);
lean_inc(x_84);
if (lean_obj_tag(x_84) == 0)
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
lean_dec(x_80);
lean_dec(x_79);
lean_dec(x_78);
x_85 = lean_ctor_get(x_83, 1);
lean_inc(x_85);
lean_dec(x_83);
x_86 = lean_ctor_get(x_84, 0);
lean_inc(x_86);
if (lean_is_exclusive(x_84)) {
lean_ctor_release(x_84, 0);
x_87 = x_84;
} else {
lean_dec_ref(x_84);
x_87 = lean_box(0);
}
if (lean_is_scalar(x_87)) {
x_88 = lean_alloc_ctor(0, 1, 0);
} else {
x_88 = x_87;
}
lean_ctor_set(x_88, 0, x_86);
x_10 = x_88;
x_11 = x_85;
goto block_33;
}
else
{
lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_89 = lean_ctor_get(x_84, 0);
lean_inc(x_89);
lean_dec(x_84);
x_90 = lean_ctor_get(x_83, 1);
lean_inc(x_90);
lean_dec(x_83);
x_91 = lean_ctor_get(x_89, 1);
lean_inc(x_91);
lean_dec(x_89);
lean_inc(x_8);
lean_inc(x_7);
x_92 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_80, x_7, x_8, x_90);
if (lean_obj_tag(x_92) == 0)
{
lean_object* x_93;
x_93 = lean_ctor_get(x_92, 0);
lean_inc(x_93);
if (lean_obj_tag(x_93) == 0)
{
lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97;
lean_dec(x_91);
lean_dec(x_79);
lean_dec(x_78);
x_94 = lean_ctor_get(x_92, 1);
lean_inc(x_94);
lean_dec(x_92);
x_95 = lean_ctor_get(x_93, 0);
lean_inc(x_95);
if (lean_is_exclusive(x_93)) {
lean_ctor_release(x_93, 0);
x_96 = x_93;
} else {
lean_dec_ref(x_93);
x_96 = lean_box(0);
}
if (lean_is_scalar(x_96)) {
x_97 = lean_alloc_ctor(0, 1, 0);
} else {
x_97 = x_96;
}
lean_ctor_set(x_97, 0, x_95);
x_10 = x_97;
x_11 = x_94;
goto block_33;
}
else
{
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;
x_98 = lean_ctor_get(x_92, 1);
lean_inc(x_98);
lean_dec(x_92);
x_99 = lean_ctor_get(x_93, 0);
lean_inc(x_99);
if (lean_is_exclusive(x_93)) {
lean_ctor_release(x_93, 0);
x_100 = x_93;
} else {
lean_dec_ref(x_93);
x_100 = lean_box(0);
}
x_101 = lean_array_push(x_78, x_99);
x_102 = lean_array_push(x_79, x_91);
x_103 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_103, 0, x_101);
lean_ctor_set(x_103, 1, x_102);
x_104 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_104, 0, x_103);
if (lean_is_scalar(x_100)) {
x_105 = lean_alloc_ctor(1, 1, 0);
} else {
x_105 = x_100;
}
lean_ctor_set(x_105, 0, x_104);
x_10 = x_105;
x_11 = x_98;
goto block_33;
}
}
else
{
lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109;
lean_dec(x_91);
lean_dec(x_79);
lean_dec(x_78);
lean_dec(x_8);
lean_dec(x_7);
x_106 = lean_ctor_get(x_92, 0);
lean_inc(x_106);
x_107 = lean_ctor_get(x_92, 1);
lean_inc(x_107);
if (lean_is_exclusive(x_92)) {
lean_ctor_release(x_92, 0);
lean_ctor_release(x_92, 1);
x_108 = x_92;
} else {
lean_dec_ref(x_92);
x_108 = lean_box(0);
}
if (lean_is_scalar(x_108)) {
x_109 = lean_alloc_ctor(1, 2, 0);
} else {
x_109 = x_108;
}
lean_ctor_set(x_109, 0, x_106);
lean_ctor_set(x_109, 1, x_107);
return x_109;
}
}
}
else
{
lean_object* x_110; lean_object* x_111; lean_object* x_112;
lean_dec(x_80);
lean_dec(x_39);
x_110 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_110, 0, x_78);
lean_ctor_set(x_110, 1, x_79);
x_111 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_111, 0, x_110);
x_112 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_112, 0, x_111);
x_10 = x_112;
x_11 = x_9;
goto block_33;
}
}
}
block_33:
{
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_12;
lean_dec(x_8);
lean_dec(x_7);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13;
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_10);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, 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_11);
return x_16;
}
}
else
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_10);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_ctor_get(x_10, 0);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_8);
lean_dec(x_7);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
lean_dec(x_18);
lean_ctor_set(x_10, 0, x_19);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_10);
lean_ctor_set(x_20, 1, x_11);
return x_20;
}
else
{
lean_object* x_21; size_t x_22; size_t x_23;
lean_free_object(x_10);
x_21 = lean_ctor_get(x_18, 0);
lean_inc(x_21);
lean_dec(x_18);
x_22 = 1;
x_23 = lean_usize_add(x_5, x_22);
x_5 = x_23;
x_6 = x_21;
x_9 = x_11;
goto _start;
}
}
else
{
lean_object* x_25;
x_25 = lean_ctor_get(x_10, 0);
lean_inc(x_25);
lean_dec(x_10);
if (lean_obj_tag(x_25) == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
lean_dec(x_8);
lean_dec(x_7);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
lean_dec(x_25);
x_27 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_27, 0, 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_11);
return x_28;
}
else
{
lean_object* x_29; size_t x_30; size_t x_31;
x_29 = lean_ctor_get(x_25, 0);
lean_inc(x_29);
lean_dec(x_25);
x_30 = 1;
x_31 = lean_usize_add(x_5, x_30);
x_5 = x_31;
x_6 = x_29;
x_9 = x_11;
goto _start;
}
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_2 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_2, 0, x_1);
lean_ctor_set(x_2, 1, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSimpleExternalCall(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12; size_t x_13; size_t x_14; lean_object* x_15; lean_object* x_16;
x_11 = l_Array_zip___rarg(x_4, x_5);
x_12 = lean_array_get_size(x_11);
x_13 = lean_usize_of_nat(x_12);
lean_dec(x_12);
x_14 = 0;
x_15 = l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1;
lean_inc(x_9);
lean_inc(x_8);
x_16 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitSimpleExternalCall___spec__1(x_1, x_2, x_11, x_13, x_14, x_15, x_8, x_9, x_10);
lean_dec(x_11);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17;
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
if (lean_obj_tag(x_17) == 0)
{
uint8_t x_18;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
x_18 = !lean_is_exclusive(x_16);
if (x_18 == 0)
{
lean_object* x_19; uint8_t x_20;
x_19 = lean_ctor_get(x_16, 0);
lean_dec(x_19);
x_20 = !lean_is_exclusive(x_17);
if (x_20 == 0)
{
return x_16;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_17, 0);
lean_inc(x_21);
lean_dec(x_17);
x_22 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_16, 0, x_22);
return x_16;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_16, 1);
lean_inc(x_23);
lean_dec(x_16);
x_24 = lean_ctor_get(x_17, 0);
lean_inc(x_24);
if (lean_is_exclusive(x_17)) {
lean_ctor_release(x_17, 0);
x_25 = x_17;
} else {
lean_dec_ref(x_17);
x_25 = lean_box(0);
}
if (lean_is_scalar(x_25)) {
x_26 = lean_alloc_ctor(0, 1, 0);
} else {
x_26 = x_25;
}
lean_ctor_set(x_26, 0, x_24);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_23);
return x_27;
}
}
else
{
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_17, 0);
lean_inc(x_28);
lean_dec(x_17);
x_29 = lean_ctor_get(x_16, 1);
lean_inc(x_29);
lean_dec(x_16);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_28, 1);
lean_inc(x_31);
lean_dec(x_28);
lean_inc(x_9);
x_32 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_6, x_8, x_9, x_29);
if (lean_obj_tag(x_32) == 0)
{
lean_object* x_33;
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
if (lean_obj_tag(x_33) == 0)
{
uint8_t x_34;
lean_dec(x_31);
lean_dec(x_30);
lean_dec(x_9);
lean_dec(x_7);
x_34 = !lean_is_exclusive(x_32);
if (x_34 == 0)
{
lean_object* x_35; uint8_t x_36;
x_35 = lean_ctor_get(x_32, 0);
lean_dec(x_35);
x_36 = !lean_is_exclusive(x_33);
if (x_36 == 0)
{
return x_32;
}
else
{
lean_object* x_37; lean_object* x_38;
x_37 = lean_ctor_get(x_33, 0);
lean_inc(x_37);
lean_dec(x_33);
x_38 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_32, 0, x_38);
return x_32;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_39 = lean_ctor_get(x_32, 1);
lean_inc(x_39);
lean_dec(x_32);
x_40 = lean_ctor_get(x_33, 0);
lean_inc(x_40);
if (lean_is_exclusive(x_33)) {
lean_ctor_release(x_33, 0);
x_41 = x_33;
} else {
lean_dec_ref(x_33);
x_41 = lean_box(0);
}
if (lean_is_scalar(x_41)) {
x_42 = lean_alloc_ctor(0, 1, 0);
} else {
x_42 = x_41;
}
lean_ctor_set(x_42, 0, x_40);
x_43 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_39);
return x_43;
}
}
else
{
lean_object* x_44; lean_object* x_45; uint8_t x_46; size_t 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; uint8_t x_54;
x_44 = lean_ctor_get(x_32, 1);
lean_inc(x_44);
lean_dec(x_32);
x_45 = lean_ctor_get(x_33, 0);
lean_inc(x_45);
lean_dec(x_33);
x_46 = 0;
x_47 = lean_unbox_usize(x_45);
lean_dec(x_45);
x_48 = lean_llvm_function_type(x_1, x_47, x_30, x_46, x_44);
lean_dec(x_30);
x_49 = lean_ctor_get(x_48, 0);
lean_inc(x_49);
x_50 = lean_ctor_get(x_48, 1);
lean_inc(x_50);
lean_dec(x_48);
x_51 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_9, x_50);
lean_dec(x_9);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = !lean_is_exclusive(x_52);
if (x_54 == 0)
{
lean_object* x_55; size_t x_56; size_t x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; size_t x_61; size_t x_62; lean_object* x_63; uint8_t x_64;
x_55 = lean_ctor_get(x_52, 0);
x_56 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_57 = lean_unbox_usize(x_49);
x_58 = l_LLVM_getOrAddFunction(x_1, x_56, x_3, x_57, x_53);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_62 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_63 = lean_llvm_build_call2(x_1, x_2, x_61, x_62, x_31, x_7, x_60);
lean_dec(x_31);
x_64 = !lean_is_exclusive(x_63);
if (x_64 == 0)
{
lean_object* x_65;
x_65 = lean_ctor_get(x_63, 0);
lean_ctor_set(x_52, 0, x_65);
lean_ctor_set(x_63, 0, x_52);
return x_63;
}
else
{
lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_66 = lean_ctor_get(x_63, 0);
x_67 = lean_ctor_get(x_63, 1);
lean_inc(x_67);
lean_inc(x_66);
lean_dec(x_63);
lean_ctor_set(x_52, 0, x_66);
x_68 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_68, 0, x_52);
lean_ctor_set(x_68, 1, x_67);
return x_68;
}
}
else
{
lean_object* x_69; size_t x_70; size_t x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; size_t x_75; size_t x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82;
x_69 = lean_ctor_get(x_52, 0);
lean_inc(x_69);
lean_dec(x_52);
x_70 = lean_unbox_usize(x_69);
lean_dec(x_69);
x_71 = lean_unbox_usize(x_49);
x_72 = l_LLVM_getOrAddFunction(x_1, x_70, x_3, x_71, x_53);
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
x_74 = lean_ctor_get(x_72, 1);
lean_inc(x_74);
lean_dec(x_72);
x_75 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_76 = lean_unbox_usize(x_73);
lean_dec(x_73);
x_77 = lean_llvm_build_call2(x_1, x_2, x_75, x_76, x_31, x_7, x_74);
lean_dec(x_31);
x_78 = lean_ctor_get(x_77, 0);
lean_inc(x_78);
x_79 = lean_ctor_get(x_77, 1);
lean_inc(x_79);
if (lean_is_exclusive(x_77)) {
lean_ctor_release(x_77, 0);
lean_ctor_release(x_77, 1);
x_80 = x_77;
} else {
lean_dec_ref(x_77);
x_80 = lean_box(0);
}
x_81 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_81, 0, x_78);
if (lean_is_scalar(x_80)) {
x_82 = lean_alloc_ctor(0, 2, 0);
} else {
x_82 = x_80;
}
lean_ctor_set(x_82, 0, x_81);
lean_ctor_set(x_82, 1, x_79);
return x_82;
}
}
}
else
{
uint8_t x_83;
lean_dec(x_31);
lean_dec(x_30);
lean_dec(x_9);
lean_dec(x_7);
x_83 = !lean_is_exclusive(x_32);
if (x_83 == 0)
{
return x_32;
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_84 = lean_ctor_get(x_32, 0);
x_85 = lean_ctor_get(x_32, 1);
lean_inc(x_85);
lean_inc(x_84);
lean_dec(x_32);
x_86 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_86, 0, x_84);
lean_ctor_set(x_86, 1, x_85);
return x_86;
}
}
}
}
else
{
uint8_t x_87;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
x_87 = !lean_is_exclusive(x_16);
if (x_87 == 0)
{
return x_16;
}
else
{
lean_object* x_88; lean_object* x_89; lean_object* x_90;
x_88 = lean_ctor_get(x_16, 0);
x_89 = lean_ctor_get(x_16, 1);
lean_inc(x_89);
lean_inc(x_88);
lean_dec(x_16);
x_90 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_90, 0, x_88);
lean_ctor_set(x_90, 1, x_89);
return x_90;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_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, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitSimpleExternalCall___spec__1(x_10, x_11, x_3, x_12, x_13, x_6, x_7, x_8, x_9);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSimpleExternalCall___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, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Lean_IR_EmitLLVM_emitSimpleExternalCall(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_13;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Failed to emit extern application '", 35);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'.", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Cannot codegen non-LLVM inline code '", 37);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("llvm", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Unimplemented codegen of inline LLVM", 36);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitExternCall___closed__5;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitExternCall(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
lean_object* x_12; lean_object* x_13;
x_12 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2;
x_13 = l_Lean_getExternEntryFor(x_5, x_12);
if (lean_obj_tag(x_13) == 0)
{
uint8_t 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_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
x_14 = 1;
x_15 = l_Lean_Name_toString(x_3, x_14);
x_16 = l_Lean_IR_EmitLLVM_emitExternCall___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_11);
return x_21;
}
else
{
lean_object* x_22;
x_22 = lean_ctor_get(x_13, 0);
lean_inc(x_22);
lean_dec(x_13);
switch (lean_obj_tag(x_22)) {
case 0:
{
uint8_t 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_22);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
x_23 = 1;
x_24 = l_Lean_Name_toString(x_3, x_23);
x_25 = l_Lean_IR_EmitLLVM_emitExternCall___closed__1;
x_26 = lean_string_append(x_25, x_24);
lean_dec(x_24);
x_27 = l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_29, 0, x_28);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_11);
return x_30;
}
case 1:
{
lean_object* x_31;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_31 = lean_ctor_get(x_22, 0);
lean_inc(x_31);
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_object* x_35; uint8_t x_36;
x_33 = lean_ctor_get(x_22, 1);
lean_inc(x_33);
lean_dec(x_22);
x_34 = lean_ctor_get(x_31, 1);
lean_inc(x_34);
lean_dec(x_31);
x_35 = l_Lean_IR_EmitLLVM_emitExternCall___closed__4;
x_36 = lean_string_dec_eq(x_34, x_35);
lean_dec(x_34);
if (x_36 == 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;
x_37 = l_Lean_IR_EmitLLVM_emitExternCall___closed__3;
x_38 = lean_string_append(x_37, x_33);
lean_dec(x_33);
x_39 = l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
x_40 = lean_string_append(x_38, x_39);
x_41 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_41, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_11);
return x_42;
}
else
{
lean_object* x_43; lean_object* x_44;
lean_dec(x_33);
x_43 = l_Lean_IR_EmitLLVM_emitExternCall___closed__6;
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_11);
return x_44;
}
}
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_dec(x_32);
lean_dec(x_31);
x_45 = lean_ctor_get(x_22, 1);
lean_inc(x_45);
lean_dec(x_22);
x_46 = l_Lean_IR_EmitLLVM_emitExternCall___closed__3;
x_47 = lean_string_append(x_46, x_45);
lean_dec(x_45);
x_48 = l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
x_49 = lean_string_append(x_47, x_48);
x_50 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_50, 0, x_49);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_51, 1, x_11);
return x_51;
}
}
else
{
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_dec(x_31);
x_52 = lean_ctor_get(x_22, 1);
lean_inc(x_52);
lean_dec(x_22);
x_53 = l_Lean_IR_EmitLLVM_emitExternCall___closed__3;
x_54 = lean_string_append(x_53, x_52);
lean_dec(x_52);
x_55 = l_Lean_IR_EmitLLVM_emitExternCall___closed__2;
x_56 = lean_string_append(x_54, x_55);
x_57 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_57, 0, x_56);
x_58 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_11);
return x_58;
}
}
default:
{
lean_object* x_59; lean_object* x_60;
lean_dec(x_3);
x_59 = lean_ctor_get(x_22, 1);
lean_inc(x_59);
lean_dec(x_22);
x_60 = l_Lean_IR_EmitLLVM_emitSimpleExternalCall(x_1, x_2, x_59, x_4, x_6, x_7, x_8, x_9, x_10, x_11);
lean_dec(x_59);
return x_60;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
size_t x_12; size_t x_13; lean_object* x_14;
x_12 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_13 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_14 = l_Lean_IR_EmitLLVM_emitExternCall(x_12, x_13, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___spec__1(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_lt(x_3, x_2);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_6);
lean_dec(x_5);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_4);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_7);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_11 = lean_array_uget(x_4, x_3);
x_12 = lean_unsigned_to_nat(0u);
x_13 = lean_array_uset(x_4, x_3, x_12);
x_14 = lean_ctor_get(x_11, 1);
lean_inc(x_14);
lean_dec(x_11);
lean_inc(x_6);
lean_inc(x_5);
x_15 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_14, x_5, x_6, x_7);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19;
x_18 = lean_ctor_get(x_15, 0);
lean_dec(x_18);
x_19 = !lean_is_exclusive(x_16);
if (x_19 == 0)
{
return x_15;
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_16, 0);
lean_inc(x_20);
lean_dec(x_16);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_15, 0, x_21);
return x_15;
}
}
else
{
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_15, 1);
lean_inc(x_22);
lean_dec(x_15);
x_23 = lean_ctor_get(x_16, 0);
lean_inc(x_23);
if (lean_is_exclusive(x_16)) {
lean_ctor_release(x_16, 0);
x_24 = x_16;
} else {
lean_dec_ref(x_16);
x_24 = lean_box(0);
}
if (lean_is_scalar(x_24)) {
x_25 = lean_alloc_ctor(0, 1, 0);
} else {
x_25 = x_24;
}
lean_ctor_set(x_25, 0, x_23);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_22);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; size_t x_29; size_t x_30; lean_object* x_31;
x_27 = lean_ctor_get(x_15, 1);
lean_inc(x_27);
lean_dec(x_15);
x_28 = lean_ctor_get(x_16, 0);
lean_inc(x_28);
lean_dec(x_16);
x_29 = 1;
x_30 = lean_usize_add(x_3, x_29);
x_31 = lean_array_uset(x_13, x_3, x_28);
x_3 = x_30;
x_4 = x_31;
x_7 = x_27;
goto _start;
}
}
else
{
uint8_t x_33;
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_33 = !lean_is_exclusive(x_15);
if (x_33 == 0)
{
return x_15;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_15, 0);
x_35 = lean_ctor_get(x_15, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_15);
x_36 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getFunIdTy(size_t 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;
x_6 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_2, x_3, x_4, x_5);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
if (lean_obj_tag(x_7) == 0)
{
uint8_t x_8;
lean_dec(x_4);
lean_dec(x_3);
x_8 = !lean_is_exclusive(x_6);
if (x_8 == 0)
{
lean_object* x_9; uint8_t x_10;
x_9 = lean_ctor_get(x_6, 0);
lean_dec(x_9);
x_10 = !lean_is_exclusive(x_7);
if (x_10 == 0)
{
return x_6;
}
else
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_7, 0);
lean_inc(x_11);
lean_dec(x_7);
x_12 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_6, 0, x_12);
return x_6;
}
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_13 = lean_ctor_get(x_6, 1);
lean_inc(x_13);
lean_dec(x_6);
x_14 = lean_ctor_get(x_7, 0);
lean_inc(x_14);
if (lean_is_exclusive(x_7)) {
lean_ctor_release(x_7, 0);
x_15 = x_7;
} else {
lean_dec_ref(x_7);
x_15 = lean_box(0);
}
if (lean_is_scalar(x_15)) {
x_16 = lean_alloc_ctor(0, 1, 0);
} else {
x_16 = x_15;
}
lean_ctor_set(x_16, 0, x_14);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_13);
return x_17;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_18 = lean_ctor_get(x_6, 1);
lean_inc(x_18);
lean_dec(x_6);
x_19 = lean_ctor_get(x_7, 0);
lean_inc(x_19);
lean_dec(x_7);
x_20 = l_Lean_IR_Decl_resultType(x_19);
lean_inc(x_4);
lean_inc(x_3);
x_21 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_20, x_3, x_4, x_18);
if (lean_obj_tag(x_21) == 0)
{
lean_object* x_22;
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
if (lean_obj_tag(x_22) == 0)
{
uint8_t x_23;
lean_dec(x_19);
lean_dec(x_4);
lean_dec(x_3);
x_23 = !lean_is_exclusive(x_21);
if (x_23 == 0)
{
lean_object* x_24; uint8_t x_25;
x_24 = lean_ctor_get(x_21, 0);
lean_dec(x_24);
x_25 = !lean_is_exclusive(x_22);
if (x_25 == 0)
{
return x_21;
}
else
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_22, 0);
lean_inc(x_26);
lean_dec(x_22);
x_27 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_21, 0, x_27);
return x_21;
}
}
else
{
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_21, 1);
lean_inc(x_28);
lean_dec(x_21);
x_29 = lean_ctor_get(x_22, 0);
lean_inc(x_29);
if (lean_is_exclusive(x_22)) {
lean_ctor_release(x_22, 0);
x_30 = x_22;
} else {
lean_dec_ref(x_22);
x_30 = lean_box(0);
}
if (lean_is_scalar(x_30)) {
x_31 = lean_alloc_ctor(0, 1, 0);
} else {
x_31 = x_30;
}
lean_ctor_set(x_31, 0, x_29);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_28);
return x_32;
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; size_t x_37; size_t x_38; lean_object* x_39;
x_33 = lean_ctor_get(x_21, 1);
lean_inc(x_33);
lean_dec(x_21);
x_34 = lean_ctor_get(x_22, 0);
lean_inc(x_34);
lean_dec(x_22);
x_35 = l_Lean_IR_Decl_params(x_19);
lean_dec(x_19);
x_36 = lean_array_get_size(x_35);
x_37 = lean_usize_of_nat(x_36);
lean_dec(x_36);
x_38 = 0;
x_39 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___spec__1(x_1, x_37, x_38, x_35, x_3, x_4, x_33);
if (lean_obj_tag(x_39) == 0)
{
lean_object* x_40;
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
if (lean_obj_tag(x_40) == 0)
{
uint8_t x_41;
lean_dec(x_34);
x_41 = !lean_is_exclusive(x_39);
if (x_41 == 0)
{
lean_object* x_42; uint8_t x_43;
x_42 = lean_ctor_get(x_39, 0);
lean_dec(x_42);
x_43 = !lean_is_exclusive(x_40);
if (x_43 == 0)
{
return x_39;
}
else
{
lean_object* x_44; lean_object* x_45;
x_44 = lean_ctor_get(x_40, 0);
lean_inc(x_44);
lean_dec(x_40);
x_45 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_45, 0, 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_ctor_get(x_40, 0);
lean_inc(x_47);
if (lean_is_exclusive(x_40)) {
lean_ctor_release(x_40, 0);
x_48 = x_40;
} else {
lean_dec_ref(x_40);
x_48 = lean_box(0);
}
if (lean_is_scalar(x_48)) {
x_49 = lean_alloc_ctor(0, 1, 0);
} else {
x_49 = x_48;
}
lean_ctor_set(x_49, 0, x_47);
x_50 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_50, 0, x_49);
lean_ctor_set(x_50, 1, x_46);
return x_50;
}
}
else
{
lean_object* x_51; uint8_t x_52;
x_51 = lean_ctor_get(x_39, 1);
lean_inc(x_51);
lean_dec(x_39);
x_52 = !lean_is_exclusive(x_40);
if (x_52 == 0)
{
lean_object* x_53; uint8_t x_54; size_t x_55; lean_object* x_56; uint8_t x_57;
x_53 = lean_ctor_get(x_40, 0);
x_54 = 0;
x_55 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_56 = lean_llvm_function_type(x_1, x_55, x_53, x_54, x_51);
lean_dec(x_53);
x_57 = !lean_is_exclusive(x_56);
if (x_57 == 0)
{
lean_object* x_58;
x_58 = lean_ctor_get(x_56, 0);
lean_ctor_set(x_40, 0, x_58);
lean_ctor_set(x_56, 0, x_40);
return x_56;
}
else
{
lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_59 = lean_ctor_get(x_56, 0);
x_60 = lean_ctor_get(x_56, 1);
lean_inc(x_60);
lean_inc(x_59);
lean_dec(x_56);
lean_ctor_set(x_40, 0, x_59);
x_61 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_61, 0, x_40);
lean_ctor_set(x_61, 1, x_60);
return x_61;
}
}
else
{
lean_object* x_62; uint8_t x_63; size_t x_64; 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_62 = lean_ctor_get(x_40, 0);
lean_inc(x_62);
lean_dec(x_40);
x_63 = 0;
x_64 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_65 = lean_llvm_function_type(x_1, x_64, x_62, x_63, x_51);
lean_dec(x_62);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
if (lean_is_exclusive(x_65)) {
lean_ctor_release(x_65, 0);
lean_ctor_release(x_65, 1);
x_68 = x_65;
} else {
lean_dec_ref(x_65);
x_68 = lean_box(0);
}
x_69 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_69, 0, x_66);
if (lean_is_scalar(x_68)) {
x_70 = lean_alloc_ctor(0, 2, 0);
} else {
x_70 = x_68;
}
lean_ctor_set(x_70, 0, x_69);
lean_ctor_set(x_70, 1, x_67);
return x_70;
}
}
}
else
{
uint8_t x_71;
lean_dec(x_34);
x_71 = !lean_is_exclusive(x_39);
if (x_71 == 0)
{
return x_39;
}
else
{
lean_object* x_72; lean_object* x_73; lean_object* x_74;
x_72 = lean_ctor_get(x_39, 0);
x_73 = lean_ctor_get(x_39, 1);
lean_inc(x_73);
lean_inc(x_72);
lean_dec(x_39);
x_74 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_74, 0, x_72);
lean_ctor_set(x_74, 1, x_73);
return x_74;
}
}
}
}
else
{
uint8_t x_75;
lean_dec(x_19);
lean_dec(x_4);
lean_dec(x_3);
x_75 = !lean_is_exclusive(x_21);
if (x_75 == 0)
{
return x_21;
}
else
{
lean_object* x_76; lean_object* x_77; lean_object* x_78;
x_76 = lean_ctor_get(x_21, 0);
x_77 = lean_ctor_get(x_21, 1);
lean_inc(x_77);
lean_inc(x_76);
lean_dec(x_21);
x_78 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_78, 0, x_76);
lean_ctor_set(x_78, 1, x_77);
return x_78;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getFunIdTy___spec__1(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getFunIdTy___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Lean_IR_EmitLLVM_getFunIdTy(x_6, x_2, x_3, x_4, x_5);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___spec__1(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_lt(x_3, x_2);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_6);
lean_dec(x_5);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_4);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_9);
lean_ctor_set(x_10, 1, x_7);
return x_10;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_11 = lean_array_uget(x_4, x_3);
x_12 = lean_unsigned_to_nat(0u);
x_13 = lean_array_uset(x_4, x_3, x_12);
x_14 = lean_ctor_get(x_11, 1);
lean_inc(x_14);
lean_dec(x_11);
lean_inc(x_6);
lean_inc(x_5);
x_15 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_14, x_5, x_6, x_7);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19;
x_18 = lean_ctor_get(x_15, 0);
lean_dec(x_18);
x_19 = !lean_is_exclusive(x_16);
if (x_19 == 0)
{
return x_15;
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_16, 0);
lean_inc(x_20);
lean_dec(x_16);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_15, 0, x_21);
return x_15;
}
}
else
{
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_15, 1);
lean_inc(x_22);
lean_dec(x_15);
x_23 = lean_ctor_get(x_16, 0);
lean_inc(x_23);
if (lean_is_exclusive(x_16)) {
lean_ctor_release(x_16, 0);
x_24 = x_16;
} else {
lean_dec_ref(x_16);
x_24 = lean_box(0);
}
if (lean_is_scalar(x_24)) {
x_25 = lean_alloc_ctor(0, 1, 0);
} else {
x_25 = x_24;
}
lean_ctor_set(x_25, 0, x_23);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_22);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; size_t x_29; size_t x_30; lean_object* x_31;
x_27 = lean_ctor_get(x_15, 1);
lean_inc(x_27);
lean_dec(x_15);
x_28 = lean_ctor_get(x_16, 0);
lean_inc(x_28);
lean_dec(x_16);
x_29 = 1;
x_30 = lean_usize_add(x_3, x_29);
x_31 = lean_array_uset(x_13, x_3, x_28);
x_3 = x_30;
x_4 = x_31;
x_7 = x_27;
goto _start;
}
}
else
{
uint8_t x_33;
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_33 = !lean_is_exclusive(x_15);
if (x_33 == 0)
{
return x_15;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_15, 0);
x_35 = lean_ctor_get(x_15, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_15);
x_36 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrAddFunIdValue(size_t x_1, size_t 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_8;
lean_inc(x_3);
x_7 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_3, x_4, x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
if (lean_obj_tag(x_8) == 0)
{
uint8_t x_9;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_9 = !lean_is_exclusive(x_7);
if (x_9 == 0)
{
lean_object* x_10; uint8_t x_11;
x_10 = lean_ctor_get(x_7, 0);
lean_dec(x_10);
x_11 = !lean_is_exclusive(x_8);
if (x_11 == 0)
{
return x_7;
}
else
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_8, 0);
lean_inc(x_12);
lean_dec(x_8);
x_13 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_7, 0, x_13);
return x_7;
}
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_14 = lean_ctor_get(x_7, 1);
lean_inc(x_14);
lean_dec(x_7);
x_15 = lean_ctor_get(x_8, 0);
lean_inc(x_15);
if (lean_is_exclusive(x_8)) {
lean_ctor_release(x_8, 0);
x_16 = x_8;
} else {
lean_dec_ref(x_8);
x_16 = lean_box(0);
}
if (lean_is_scalar(x_16)) {
x_17 = lean_alloc_ctor(0, 1, 0);
} else {
x_17 = x_16;
}
lean_ctor_set(x_17, 0, x_15);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_14);
return x_18;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_19 = lean_ctor_get(x_7, 1);
lean_inc(x_19);
lean_dec(x_7);
x_20 = lean_ctor_get(x_8, 0);
lean_inc(x_20);
lean_dec(x_8);
x_21 = l_Lean_IR_EmitLLVM_toCName___rarg(x_3, x_4, x_5, x_19);
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
if (lean_obj_tag(x_22) == 0)
{
uint8_t x_23;
lean_dec(x_20);
lean_dec(x_5);
lean_dec(x_4);
x_23 = !lean_is_exclusive(x_21);
if (x_23 == 0)
{
lean_object* x_24; uint8_t x_25;
x_24 = lean_ctor_get(x_21, 0);
lean_dec(x_24);
x_25 = !lean_is_exclusive(x_22);
if (x_25 == 0)
{
return x_21;
}
else
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_22, 0);
lean_inc(x_26);
lean_dec(x_22);
x_27 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_21, 0, x_27);
return x_21;
}
}
else
{
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_21, 1);
lean_inc(x_28);
lean_dec(x_21);
x_29 = lean_ctor_get(x_22, 0);
lean_inc(x_29);
if (lean_is_exclusive(x_22)) {
lean_ctor_release(x_22, 0);
x_30 = x_22;
} else {
lean_dec_ref(x_22);
x_30 = lean_box(0);
}
if (lean_is_scalar(x_30)) {
x_31 = lean_alloc_ctor(0, 1, 0);
} else {
x_31 = x_30;
}
lean_ctor_set(x_31, 0, x_29);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_32, 1, x_28);
return x_32;
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_33 = lean_ctor_get(x_21, 1);
lean_inc(x_33);
lean_dec(x_21);
x_34 = lean_ctor_get(x_22, 0);
lean_inc(x_34);
lean_dec(x_22);
x_35 = l_Lean_IR_Decl_resultType(x_20);
lean_inc(x_5);
lean_inc(x_4);
x_36 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_35, x_4, x_5, x_33);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37;
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
if (lean_obj_tag(x_37) == 0)
{
uint8_t x_38;
lean_dec(x_34);
lean_dec(x_20);
lean_dec(x_5);
lean_dec(x_4);
x_38 = !lean_is_exclusive(x_36);
if (x_38 == 0)
{
lean_object* x_39; uint8_t x_40;
x_39 = lean_ctor_get(x_36, 0);
lean_dec(x_39);
x_40 = !lean_is_exclusive(x_37);
if (x_40 == 0)
{
return x_36;
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_37, 0);
lean_inc(x_41);
lean_dec(x_37);
x_42 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_36, 0, x_42);
return x_36;
}
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_43 = lean_ctor_get(x_36, 1);
lean_inc(x_43);
lean_dec(x_36);
x_44 = lean_ctor_get(x_37, 0);
lean_inc(x_44);
if (lean_is_exclusive(x_37)) {
lean_ctor_release(x_37, 0);
x_45 = x_37;
} else {
lean_dec_ref(x_37);
x_45 = lean_box(0);
}
if (lean_is_scalar(x_45)) {
x_46 = lean_alloc_ctor(0, 1, 0);
} else {
x_46 = x_45;
}
lean_ctor_set(x_46, 0, x_44);
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_43);
return x_47;
}
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; uint8_t x_51;
x_48 = lean_ctor_get(x_36, 1);
lean_inc(x_48);
lean_dec(x_36);
x_49 = lean_ctor_get(x_37, 0);
lean_inc(x_49);
lean_dec(x_37);
x_50 = l_Lean_IR_Decl_params(x_20);
lean_dec(x_20);
x_51 = l_Array_isEmpty___rarg(x_50);
if (x_51 == 0)
{
lean_object* x_52; size_t x_53; size_t x_54; lean_object* x_55;
x_52 = lean_array_get_size(x_50);
x_53 = lean_usize_of_nat(x_52);
lean_dec(x_52);
x_54 = 0;
lean_inc(x_5);
x_55 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___spec__1(x_1, x_53, x_54, x_50, x_4, x_5, x_48);
if (lean_obj_tag(x_55) == 0)
{
lean_object* x_56;
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
if (lean_obj_tag(x_56) == 0)
{
uint8_t x_57;
lean_dec(x_49);
lean_dec(x_34);
lean_dec(x_5);
x_57 = !lean_is_exclusive(x_55);
if (x_57 == 0)
{
lean_object* x_58; uint8_t x_59;
x_58 = lean_ctor_get(x_55, 0);
lean_dec(x_58);
x_59 = !lean_is_exclusive(x_56);
if (x_59 == 0)
{
return x_55;
}
else
{
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_56, 0);
lean_inc(x_60);
lean_dec(x_56);
x_61 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_55, 0, x_61);
return x_55;
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_62 = lean_ctor_get(x_55, 1);
lean_inc(x_62);
lean_dec(x_55);
x_63 = lean_ctor_get(x_56, 0);
lean_inc(x_63);
if (lean_is_exclusive(x_56)) {
lean_ctor_release(x_56, 0);
x_64 = x_56;
} else {
lean_dec_ref(x_56);
x_64 = lean_box(0);
}
if (lean_is_scalar(x_64)) {
x_65 = lean_alloc_ctor(0, 1, 0);
} else {
x_65 = x_64;
}
lean_ctor_set(x_65, 0, x_63);
x_66 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_62);
return x_66;
}
}
else
{
lean_object* x_67; lean_object* x_68; uint8_t x_69; size_t 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; uint8_t x_77;
x_67 = lean_ctor_get(x_55, 1);
lean_inc(x_67);
lean_dec(x_55);
x_68 = lean_ctor_get(x_56, 0);
lean_inc(x_68);
lean_dec(x_56);
x_69 = 0;
x_70 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_71 = lean_llvm_function_type(x_1, x_70, x_68, x_69, x_67);
lean_dec(x_68);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_73);
lean_dec(x_5);
x_75 = lean_ctor_get(x_74, 0);
lean_inc(x_75);
x_76 = lean_ctor_get(x_74, 1);
lean_inc(x_76);
lean_dec(x_74);
x_77 = !lean_is_exclusive(x_75);
if (x_77 == 0)
{
lean_object* x_78; size_t x_79; size_t x_80; lean_object* x_81; uint8_t x_82;
x_78 = lean_ctor_get(x_75, 0);
x_79 = lean_unbox_usize(x_78);
lean_dec(x_78);
x_80 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_81 = l_LLVM_getOrAddFunction(x_1, x_79, x_34, x_80, x_76);
lean_dec(x_34);
x_82 = !lean_is_exclusive(x_81);
if (x_82 == 0)
{
lean_object* x_83;
x_83 = lean_ctor_get(x_81, 0);
lean_ctor_set(x_75, 0, x_83);
lean_ctor_set(x_81, 0, x_75);
return x_81;
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_84 = lean_ctor_get(x_81, 0);
x_85 = lean_ctor_get(x_81, 1);
lean_inc(x_85);
lean_inc(x_84);
lean_dec(x_81);
lean_ctor_set(x_75, 0, x_84);
x_86 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_86, 0, x_75);
lean_ctor_set(x_86, 1, x_85);
return x_86;
}
}
else
{
lean_object* x_87; size_t x_88; size_t x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95;
x_87 = lean_ctor_get(x_75, 0);
lean_inc(x_87);
lean_dec(x_75);
x_88 = lean_unbox_usize(x_87);
lean_dec(x_87);
x_89 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_90 = l_LLVM_getOrAddFunction(x_1, x_88, x_34, x_89, x_76);
lean_dec(x_34);
x_91 = lean_ctor_get(x_90, 0);
lean_inc(x_91);
x_92 = lean_ctor_get(x_90, 1);
lean_inc(x_92);
if (lean_is_exclusive(x_90)) {
lean_ctor_release(x_90, 0);
lean_ctor_release(x_90, 1);
x_93 = x_90;
} else {
lean_dec_ref(x_90);
x_93 = lean_box(0);
}
x_94 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_94, 0, x_91);
if (lean_is_scalar(x_93)) {
x_95 = lean_alloc_ctor(0, 2, 0);
} else {
x_95 = x_93;
}
lean_ctor_set(x_95, 0, x_94);
lean_ctor_set(x_95, 1, x_92);
return x_95;
}
}
}
else
{
uint8_t x_96;
lean_dec(x_49);
lean_dec(x_34);
lean_dec(x_5);
x_96 = !lean_is_exclusive(x_55);
if (x_96 == 0)
{
return x_55;
}
else
{
lean_object* x_97; lean_object* x_98; lean_object* x_99;
x_97 = lean_ctor_get(x_55, 0);
x_98 = lean_ctor_get(x_55, 1);
lean_inc(x_98);
lean_inc(x_97);
lean_dec(x_55);
x_99 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_99, 0, x_97);
lean_ctor_set(x_99, 1, x_98);
return x_99;
}
}
}
else
{
lean_object* x_100; lean_object* x_101; lean_object* x_102; uint8_t x_103;
lean_dec(x_50);
lean_dec(x_4);
x_100 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_48);
lean_dec(x_5);
x_101 = lean_ctor_get(x_100, 0);
lean_inc(x_101);
x_102 = lean_ctor_get(x_100, 1);
lean_inc(x_102);
lean_dec(x_100);
x_103 = !lean_is_exclusive(x_101);
if (x_103 == 0)
{
lean_object* x_104; size_t x_105; size_t x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; size_t x_111; size_t x_112; lean_object* x_113; uint8_t x_114;
x_104 = lean_ctor_get(x_101, 0);
x_105 = lean_unbox_usize(x_104);
lean_dec(x_104);
x_106 = lean_unbox_usize(x_49);
x_107 = l_LLVM_getOrAddGlobal(x_1, x_105, x_34, x_106, x_102);
lean_dec(x_34);
x_108 = lean_ctor_get(x_107, 0);
lean_inc(x_108);
x_109 = lean_ctor_get(x_107, 1);
lean_inc(x_109);
lean_dec(x_107);
x_110 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_111 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_112 = lean_unbox_usize(x_108);
lean_dec(x_108);
x_113 = lean_llvm_build_load2(x_1, x_2, x_111, x_112, x_110, x_109);
x_114 = !lean_is_exclusive(x_113);
if (x_114 == 0)
{
lean_object* x_115;
x_115 = lean_ctor_get(x_113, 0);
lean_ctor_set(x_101, 0, x_115);
lean_ctor_set(x_113, 0, x_101);
return x_113;
}
else
{
lean_object* x_116; lean_object* x_117; lean_object* x_118;
x_116 = lean_ctor_get(x_113, 0);
x_117 = lean_ctor_get(x_113, 1);
lean_inc(x_117);
lean_inc(x_116);
lean_dec(x_113);
lean_ctor_set(x_101, 0, x_116);
x_118 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_118, 0, x_101);
lean_ctor_set(x_118, 1, x_117);
return x_118;
}
}
else
{
lean_object* x_119; size_t x_120; size_t x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; size_t x_126; size_t 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;
x_119 = lean_ctor_get(x_101, 0);
lean_inc(x_119);
lean_dec(x_101);
x_120 = lean_unbox_usize(x_119);
lean_dec(x_119);
x_121 = lean_unbox_usize(x_49);
x_122 = l_LLVM_getOrAddGlobal(x_1, x_120, x_34, x_121, x_102);
lean_dec(x_34);
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_EmitLLVM_emitJp___closed__3;
x_126 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_127 = lean_unbox_usize(x_123);
lean_dec(x_123);
x_128 = lean_llvm_build_load2(x_1, x_2, x_126, x_127, x_125, x_124);
x_129 = lean_ctor_get(x_128, 0);
lean_inc(x_129);
x_130 = lean_ctor_get(x_128, 1);
lean_inc(x_130);
if (lean_is_exclusive(x_128)) {
lean_ctor_release(x_128, 0);
lean_ctor_release(x_128, 1);
x_131 = x_128;
} else {
lean_dec_ref(x_128);
x_131 = lean_box(0);
}
x_132 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_132, 0, x_129);
if (lean_is_scalar(x_131)) {
x_133 = lean_alloc_ctor(0, 2, 0);
} else {
x_133 = x_131;
}
lean_ctor_set(x_133, 0, x_132);
lean_ctor_set(x_133, 1, x_130);
return x_133;
}
}
}
}
else
{
uint8_t x_134;
lean_dec(x_34);
lean_dec(x_20);
lean_dec(x_5);
lean_dec(x_4);
x_134 = !lean_is_exclusive(x_36);
if (x_134 == 0)
{
return x_36;
}
else
{
lean_object* x_135; lean_object* x_136; lean_object* x_137;
x_135 = lean_ctor_get(x_36, 0);
x_136 = lean_ctor_get(x_36, 1);
lean_inc(x_136);
lean_inc(x_135);
lean_dec(x_36);
x_137 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_137, 0, x_135);
lean_ctor_set(x_137, 1, x_136);
return x_137;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_getOrAddFunIdValue___spec__1(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_getOrAddFunIdValue___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_getOrAddFunIdValue(x_7, x_8, x_3, x_4, x_5, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitPartialApp___spec__1(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_unsigned_to_nat(0u);
x_12 = lean_nat_dec_eq(x_7, 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_24; lean_object* x_25; uint8_t x_26;
x_13 = lean_unsigned_to_nat(1u);
x_14 = lean_nat_sub(x_7, x_13);
lean_dec(x_7);
x_24 = lean_nat_sub(x_6, x_14);
x_25 = lean_nat_sub(x_24, x_13);
lean_dec(x_24);
x_26 = lean_nat_dec_lt(x_25, x_4);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_27 = l_Lean_IR_instInhabitedArg;
x_28 = l___private_Init_Util_0__outOfBounds___rarg(x_27);
x_29 = l_Lean_IR_EmitLLVM_emitArgSlot__(x_1, x_2, x_28, x_8, x_9, x_10);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
if (lean_obj_tag(x_30) == 0)
{
lean_object* x_31; uint8_t x_32;
lean_dec(x_25);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = !lean_is_exclusive(x_30);
if (x_32 == 0)
{
x_15 = x_30;
x_16 = x_31;
goto block_23;
}
else
{
lean_object* x_33; lean_object* x_34;
x_33 = lean_ctor_get(x_30, 0);
lean_inc(x_33);
lean_dec(x_30);
x_34 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_34, 0, x_33);
x_15 = x_34;
x_16 = x_31;
goto block_23;
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; size_t x_40; size_t 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; size_t x_49; size_t x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_35 = lean_ctor_get(x_30, 0);
lean_inc(x_35);
lean_dec(x_30);
x_36 = lean_ctor_get(x_29, 1);
lean_inc(x_36);
lean_dec(x_29);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_35, 1);
lean_inc(x_38);
lean_dec(x_35);
x_39 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_40 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_41 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_42 = lean_llvm_build_load2(x_1, x_2, x_40, x_41, x_39, x_36);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
x_44 = lean_ctor_get(x_42, 1);
lean_inc(x_44);
lean_dec(x_42);
x_45 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_25, x_8, x_9, x_44);
lean_dec(x_25);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_48 = lean_ctor_get(x_46, 0);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_50 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_51 = l_Lean_IR_EmitLLVM_callLeanClosureSetFn(x_1, x_2, x_5, x_49, x_50, x_39, x_8, x_9, x_47);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_15 = x_52;
x_16 = x_53;
goto block_23;
}
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_54 = lean_array_fget(x_3, x_25);
x_55 = l_Lean_IR_EmitLLVM_emitArgSlot__(x_1, x_2, x_54, x_8, x_9, x_10);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
if (lean_obj_tag(x_56) == 0)
{
lean_object* x_57; uint8_t x_58;
lean_dec(x_25);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = !lean_is_exclusive(x_56);
if (x_58 == 0)
{
x_15 = x_56;
x_16 = x_57;
goto block_23;
}
else
{
lean_object* x_59; lean_object* x_60;
x_59 = lean_ctor_get(x_56, 0);
lean_inc(x_59);
lean_dec(x_56);
x_60 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_60, 0, x_59);
x_15 = x_60;
x_16 = x_57;
goto block_23;
}
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; size_t x_66; size_t 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; size_t x_75; size_t x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79;
x_61 = lean_ctor_get(x_56, 0);
lean_inc(x_61);
lean_dec(x_56);
x_62 = lean_ctor_get(x_55, 1);
lean_inc(x_62);
lean_dec(x_55);
x_63 = lean_ctor_get(x_61, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_61, 1);
lean_inc(x_64);
lean_dec(x_61);
x_65 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_66 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_67 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_68 = lean_llvm_build_load2(x_1, x_2, x_66, x_67, x_65, x_62);
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
lean_dec(x_68);
x_71 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_25, x_8, x_9, x_70);
lean_dec(x_25);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = lean_ctor_get(x_72, 0);
lean_inc(x_74);
lean_dec(x_72);
x_75 = lean_unbox_usize(x_74);
lean_dec(x_74);
x_76 = lean_unbox_usize(x_69);
lean_dec(x_69);
x_77 = l_Lean_IR_EmitLLVM_callLeanClosureSetFn(x_1, x_2, x_5, x_75, x_76, x_65, x_8, x_9, x_73);
x_78 = lean_ctor_get(x_77, 0);
lean_inc(x_78);
x_79 = lean_ctor_get(x_77, 1);
lean_inc(x_79);
lean_dec(x_77);
x_15 = x_78;
x_16 = x_79;
goto block_23;
}
}
block_23:
{
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_17;
lean_dec(x_14);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_15);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_16);
return x_21;
}
}
else
{
lean_dec(x_15);
x_7 = x_14;
x_10 = x_16;
goto _start;
}
}
}
else
{
lean_object* x_80; lean_object* x_81;
lean_dec(x_7);
x_80 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_81 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_81, 0, x_80);
lean_ctor_set(x_81, 1, x_10);
return x_81;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitPartialApp(size_t x_1, size_t 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_inc(x_4);
x_9 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_4, x_6, x_7, x_8);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
lean_dec(x_10);
lean_inc(x_7);
lean_inc(x_6);
x_23 = l_Lean_IR_EmitLLVM_getOrAddFunIdValue(x_1, x_2, x_4, x_6, x_7, x_21);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24;
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
if (lean_obj_tag(x_24) == 0)
{
uint8_t x_25;
lean_dec(x_22);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_25 = !lean_is_exclusive(x_23);
if (x_25 == 0)
{
lean_object* x_26; uint8_t x_27;
x_26 = lean_ctor_get(x_23, 0);
lean_dec(x_26);
x_27 = !lean_is_exclusive(x_24);
if (x_27 == 0)
{
return x_23;
}
else
{
lean_object* x_28; lean_object* x_29;
x_28 = lean_ctor_get(x_24, 0);
lean_inc(x_28);
lean_dec(x_24);
x_29 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_23, 0, x_29);
return x_23;
}
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_30 = lean_ctor_get(x_23, 1);
lean_inc(x_30);
lean_dec(x_23);
x_31 = lean_ctor_get(x_24, 0);
lean_inc(x_31);
if (lean_is_exclusive(x_24)) {
lean_ctor_release(x_24, 0);
x_32 = x_24;
} else {
lean_dec_ref(x_24);
x_32 = lean_box(0);
}
if (lean_is_scalar(x_32)) {
x_33 = lean_alloc_ctor(0, 1, 0);
} else {
x_33 = x_32;
}
lean_ctor_set(x_33, 0, 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_30);
return x_34;
}
}
else
{
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_35 = lean_ctor_get(x_23, 1);
lean_inc(x_35);
lean_dec(x_23);
x_36 = lean_ctor_get(x_24, 0);
lean_inc(x_36);
lean_dec(x_24);
x_37 = l_Lean_IR_Decl_params(x_22);
lean_dec(x_22);
x_38 = lean_array_get_size(x_37);
lean_dec(x_37);
x_39 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_3, x_6, x_7, x_35);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
if (lean_obj_tag(x_40) == 0)
{
uint8_t x_41;
lean_dec(x_38);
lean_dec(x_36);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_41 = !lean_is_exclusive(x_39);
if (x_41 == 0)
{
lean_object* x_42; uint8_t x_43;
x_42 = lean_ctor_get(x_39, 0);
lean_dec(x_42);
x_43 = !lean_is_exclusive(x_40);
if (x_43 == 0)
{
return x_39;
}
else
{
lean_object* x_44; lean_object* x_45;
x_44 = lean_ctor_get(x_40, 0);
lean_inc(x_44);
lean_dec(x_40);
x_45 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_45, 0, 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_ctor_get(x_40, 0);
lean_inc(x_47);
if (lean_is_exclusive(x_40)) {
lean_ctor_release(x_40, 0);
x_48 = x_40;
} else {
lean_dec_ref(x_40);
x_48 = lean_box(0);
}
if (lean_is_scalar(x_48)) {
x_49 = lean_alloc_ctor(0, 1, 0);
} else {
x_49 = x_48;
}
lean_ctor_set(x_49, 0, x_47);
x_50 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_50, 0, x_49);
lean_ctor_set(x_50, 1, x_46);
return x_50;
}
}
else
{
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; size_t x_64; size_t x_65; size_t x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; size_t x_71; size_t x_72; lean_object* x_73; lean_object* x_74; size_t x_75; lean_object* x_76;
x_51 = lean_ctor_get(x_40, 0);
lean_inc(x_51);
lean_dec(x_40);
x_52 = lean_ctor_get(x_39, 1);
lean_inc(x_52);
lean_dec(x_39);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_38, x_6, x_7, x_52);
lean_dec(x_38);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
lean_dec(x_54);
x_57 = lean_ctor_get(x_55, 0);
lean_inc(x_57);
lean_dec(x_55);
x_58 = lean_array_get_size(x_5);
x_59 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_58, x_6, x_7, x_56);
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
lean_dec(x_59);
x_62 = lean_ctor_get(x_60, 0);
lean_inc(x_62);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_64 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_65 = lean_unbox_usize(x_57);
lean_dec(x_57);
x_66 = lean_unbox_usize(x_62);
lean_dec(x_62);
x_67 = l_Lean_IR_EmitLLVM_callLeanAllocClosureFn(x_1, x_2, x_64, x_65, x_66, x_63, x_6, x_7, x_61);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
lean_dec(x_67);
x_70 = lean_ctor_get(x_68, 0);
lean_inc(x_70);
lean_dec(x_68);
x_71 = lean_unbox_usize(x_70);
x_72 = lean_unbox_usize(x_53);
lean_dec(x_53);
x_73 = lean_llvm_build_store(x_1, x_2, x_71, x_72, x_69);
x_74 = lean_ctor_get(x_73, 1);
lean_inc(x_74);
lean_dec(x_73);
x_75 = lean_unbox_usize(x_70);
lean_dec(x_70);
lean_inc(x_58);
x_76 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitPartialApp___spec__1(x_1, x_2, x_5, x_58, x_75, x_58, x_58, x_6, x_7, x_74);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_58);
lean_dec(x_5);
return x_76;
}
}
}
else
{
uint8_t x_77;
lean_dec(x_22);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_77 = !lean_is_exclusive(x_23);
if (x_77 == 0)
{
return x_23;
}
else
{
lean_object* x_78; lean_object* x_79; lean_object* x_80;
x_78 = lean_ctor_get(x_23, 0);
x_79 = lean_ctor_get(x_23, 1);
lean_inc(x_79);
lean_inc(x_78);
lean_dec(x_23);
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;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitPartialApp___spec__1(x_11, x_12, x_3, x_4, x_13, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitPartialApp___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitPartialApp(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___spec__1(size_t x_1, size_t x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
uint8_t x_9;
x_9 = lean_usize_dec_lt(x_4, x_3);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_5);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_8);
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;
x_12 = lean_array_uget(x_5, x_4);
x_13 = lean_unsigned_to_nat(0u);
x_14 = lean_array_uset(x_5, x_4, x_13);
x_15 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_16 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_12, x_15, x_6, x_7, x_8);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
if (lean_obj_tag(x_17) == 0)
{
uint8_t x_18;
lean_dec(x_14);
x_18 = !lean_is_exclusive(x_16);
if (x_18 == 0)
{
lean_object* x_19; uint8_t x_20;
x_19 = lean_ctor_get(x_16, 0);
lean_dec(x_19);
x_20 = !lean_is_exclusive(x_17);
if (x_20 == 0)
{
return x_16;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_17, 0);
lean_inc(x_21);
lean_dec(x_17);
x_22 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_16, 0, x_22);
return x_16;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_16, 1);
lean_inc(x_23);
lean_dec(x_16);
x_24 = lean_ctor_get(x_17, 0);
lean_inc(x_24);
if (lean_is_exclusive(x_17)) {
lean_ctor_release(x_17, 0);
x_25 = x_17;
} else {
lean_dec_ref(x_17);
x_25 = lean_box(0);
}
if (lean_is_scalar(x_25)) {
x_26 = lean_alloc_ctor(0, 1, 0);
} else {
x_26 = x_25;
}
lean_ctor_set(x_26, 0, x_24);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_23);
return x_27;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; size_t x_32; lean_object* x_33;
x_28 = lean_ctor_get(x_16, 1);
lean_inc(x_28);
lean_dec(x_16);
x_29 = lean_ctor_get(x_17, 0);
lean_inc(x_29);
lean_dec(x_17);
x_30 = lean_ctor_get(x_29, 1);
lean_inc(x_30);
lean_dec(x_29);
x_31 = 1;
x_32 = lean_usize_add(x_4, x_31);
x_33 = lean_array_uset(x_14, x_4, x_30);
x_4 = x_32;
x_5 = x_33;
x_8 = x_28;
goto _start;
}
}
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("param_", 6);
return x_1;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_slot", 5);
return x_1;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_11, 0, x_7);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_35; uint8_t x_74;
lean_dec(x_7);
x_13 = lean_ctor_get(x_6, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_6, 1);
lean_inc(x_14);
lean_dec(x_6);
x_74 = lean_nat_dec_lt(x_13, x_4);
if (x_74 == 0)
{
lean_object* x_75; lean_object* x_76;
x_75 = l_Lean_IR_instInhabitedArg;
x_76 = l___private_Init_Util_0__outOfBounds___rarg(x_75);
x_35 = x_76;
goto block_73;
}
else
{
lean_object* x_77;
x_77 = lean_array_fget(x_3, x_13);
x_35 = x_77;
goto block_73;
}
block_34:
{
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_17;
lean_dec(x_14);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_15);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_16);
return x_21;
}
}
else
{
uint8_t x_22;
x_22 = !lean_is_exclusive(x_15);
if (x_22 == 0)
{
lean_object* x_23;
x_23 = lean_ctor_get(x_15, 0);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24; lean_object* x_25;
lean_dec(x_14);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
lean_dec(x_23);
lean_ctor_set(x_15, 0, x_24);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_15);
lean_ctor_set(x_25, 1, x_16);
return x_25;
}
else
{
lean_object* x_26;
lean_free_object(x_15);
x_26 = lean_ctor_get(x_23, 0);
lean_inc(x_26);
lean_dec(x_23);
x_6 = x_14;
x_7 = x_26;
x_10 = x_16;
goto _start;
}
}
else
{
lean_object* x_28;
x_28 = lean_ctor_get(x_15, 0);
lean_inc(x_28);
lean_dec(x_15);
if (lean_obj_tag(x_28) == 0)
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_14);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
lean_dec(x_28);
x_30 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_30, 0, x_29);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_16);
return x_31;
}
else
{
lean_object* x_32;
x_32 = lean_ctor_get(x_28, 0);
lean_inc(x_32);
lean_dec(x_28);
x_6 = x_14;
x_7 = x_32;
x_10 = x_16;
goto _start;
}
}
}
}
block_73:
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_37 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_35, x_36, x_8, x_9, x_10);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
if (lean_obj_tag(x_38) == 0)
{
lean_object* x_39; uint8_t x_40;
lean_dec(x_13);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = !lean_is_exclusive(x_38);
if (x_40 == 0)
{
x_15 = x_38;
x_16 = x_39;
goto block_34;
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_38, 0);
lean_inc(x_41);
lean_dec(x_38);
x_42 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_42, 0, x_41);
x_15 = x_42;
x_16 = x_39;
goto block_34;
}
}
else
{
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; 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; size_t x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; size_t x_68; size_t x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72;
x_43 = lean_ctor_get(x_38, 0);
lean_inc(x_43);
lean_dec(x_38);
x_44 = lean_ctor_get(x_37, 1);
lean_inc(x_44);
lean_dec(x_37);
x_45 = lean_ctor_get(x_43, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_43, 1);
lean_inc(x_46);
lean_dec(x_43);
x_47 = lean_unsigned_to_nat(0u);
x_48 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_47, x_8, x_9, x_44);
x_49 = lean_ctor_get(x_48, 0);
lean_inc(x_49);
x_50 = lean_ctor_get(x_48, 1);
lean_inc(x_50);
lean_dec(x_48);
x_51 = lean_ctor_get(x_49, 0);
lean_inc(x_51);
lean_dec(x_49);
x_52 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_13, x_8, x_9, x_50);
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 = lean_ctor_get(x_53, 0);
lean_inc(x_55);
lean_dec(x_53);
x_56 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_57 = lean_array_push(x_56, x_51);
x_58 = lean_array_push(x_57, x_55);
x_59 = l_Nat_repr(x_13);
x_60 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1;
x_61 = lean_string_append(x_60, x_59);
lean_dec(x_59);
x_62 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2;
x_63 = lean_string_append(x_61, x_62);
x_64 = lean_unbox_usize(x_45);
lean_dec(x_45);
x_65 = lean_llvm_build_inbounds_gep2(x_1, x_2, x_64, x_5, x_58, x_63, x_54);
lean_dec(x_58);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_69 = lean_unbox_usize(x_66);
lean_dec(x_66);
x_70 = lean_llvm_build_store(x_1, x_2, x_68, x_69, x_67);
x_71 = lean_ctor_get(x_70, 1);
lean_inc(x_71);
lean_dec(x_70);
x_72 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_15 = x_72;
x_16 = x_71;
goto block_34;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitApp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_apply_", 11);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitApp___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("aargs", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitApp___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_apply_m", 12);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitApp(size_t x_1, size_t 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; uint8_t x_11;
x_9 = lean_array_get_size(x_5);
x_10 = l_Lean_closureMaxArgs;
x_11 = lean_nat_dec_lt(x_10, x_9);
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; lean_object* x_20; lean_object* x_21;
lean_inc(x_9);
x_12 = l_Nat_repr(x_9);
x_13 = l_Lean_IR_EmitLLVM_emitApp___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_16 = lean_string_append(x_14, x_15);
x_17 = l_LLVM_voidPtrType(x_1, x_8);
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_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_4, x_15, x_6, x_7, x_19);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
if (lean_obj_tag(x_21) == 0)
{
uint8_t x_22;
lean_dec(x_18);
lean_dec(x_16);
lean_dec(x_9);
lean_dec(x_5);
lean_dec(x_3);
x_22 = !lean_is_exclusive(x_20);
if (x_22 == 0)
{
lean_object* x_23; uint8_t x_24;
x_23 = lean_ctor_get(x_20, 0);
lean_dec(x_23);
x_24 = !lean_is_exclusive(x_21);
if (x_24 == 0)
{
return x_20;
}
else
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_21, 0);
lean_inc(x_25);
lean_dec(x_21);
x_26 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_20, 0, x_26);
return x_20;
}
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_27 = lean_ctor_get(x_20, 1);
lean_inc(x_27);
lean_dec(x_20);
x_28 = lean_ctor_get(x_21, 0);
lean_inc(x_28);
if (lean_is_exclusive(x_21)) {
lean_ctor_release(x_21, 0);
x_29 = x_21;
} else {
lean_dec_ref(x_21);
x_29 = lean_box(0);
}
if (lean_is_scalar(x_29)) {
x_30 = lean_alloc_ctor(0, 1, 0);
} else {
x_30 = x_29;
}
lean_ctor_set(x_30, 0, x_28);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_27);
return x_31;
}
}
else
{
lean_object* x_32; lean_object* x_33; size_t x_34; size_t x_35; lean_object* x_36; lean_object* x_37;
x_32 = lean_ctor_get(x_20, 1);
lean_inc(x_32);
lean_dec(x_20);
x_33 = lean_ctor_get(x_21, 0);
lean_inc(x_33);
lean_dec(x_21);
x_34 = lean_usize_of_nat(x_9);
x_35 = 0;
x_36 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___spec__1(x_1, x_2, x_34, x_35, x_5, x_6, x_7, x_32);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
if (lean_obj_tag(x_37) == 0)
{
uint8_t x_38;
lean_dec(x_33);
lean_dec(x_18);
lean_dec(x_16);
lean_dec(x_9);
lean_dec(x_3);
x_38 = !lean_is_exclusive(x_36);
if (x_38 == 0)
{
lean_object* x_39; uint8_t x_40;
x_39 = lean_ctor_get(x_36, 0);
lean_dec(x_39);
x_40 = !lean_is_exclusive(x_37);
if (x_40 == 0)
{
return x_36;
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_37, 0);
lean_inc(x_41);
lean_dec(x_37);
x_42 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_36, 0, x_42);
return x_36;
}
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_43 = lean_ctor_get(x_36, 1);
lean_inc(x_43);
lean_dec(x_36);
x_44 = lean_ctor_get(x_37, 0);
lean_inc(x_44);
if (lean_is_exclusive(x_37)) {
lean_ctor_release(x_37, 0);
x_45 = x_37;
} else {
lean_dec_ref(x_37);
x_45 = lean_box(0);
}
if (lean_is_scalar(x_45)) {
x_46 = lean_alloc_ctor(0, 1, 0);
} else {
x_46 = x_45;
}
lean_ctor_set(x_46, 0, x_44);
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_43);
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_object* x_63; lean_object* x_64; lean_object* x_65; size_t x_66; size_t x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71; uint8_t x_72; size_t x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; size_t x_77; size_t x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; size_t x_82; lean_object* x_83;
x_48 = lean_ctor_get(x_36, 1);
lean_inc(x_48);
lean_dec(x_36);
x_49 = lean_ctor_get(x_37, 0);
lean_inc(x_49);
lean_dec(x_37);
x_50 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_51 = lean_array_push(x_50, x_33);
x_52 = l_Array_append___rarg(x_51, x_49);
x_53 = l_LLVM_voidPtrType(x_1, x_48);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
lean_dec(x_53);
x_56 = lean_unsigned_to_nat(1u);
x_57 = lean_nat_add(x_56, x_9);
lean_dec(x_9);
x_58 = l_List_replicateTR___rarg(x_57, x_54);
x_59 = l_List_redLength___rarg(x_58);
x_60 = lean_mk_empty_array_with_capacity(x_59);
lean_dec(x_59);
x_61 = l_List_toArrayAux___rarg(x_58, x_60);
x_62 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_55);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = lean_ctor_get(x_63, 0);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_unbox_usize(x_65);
lean_dec(x_65);
x_67 = lean_unbox_usize(x_18);
x_68 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_66, x_67, x_16, x_61, x_6, x_7, x_64);
lean_dec(x_16);
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
lean_dec(x_68);
x_71 = lean_ctor_get(x_69, 0);
lean_inc(x_71);
lean_dec(x_69);
x_72 = 0;
x_73 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_74 = lean_llvm_function_type(x_1, x_73, x_61, x_72, x_70);
lean_dec(x_61);
x_75 = lean_ctor_get(x_74, 0);
lean_inc(x_75);
x_76 = lean_ctor_get(x_74, 1);
lean_inc(x_76);
lean_dec(x_74);
x_77 = lean_unbox_usize(x_75);
lean_dec(x_75);
x_78 = lean_unbox_usize(x_71);
lean_dec(x_71);
x_79 = lean_llvm_build_call2(x_1, x_2, x_77, x_78, x_52, x_15, x_76);
lean_dec(x_52);
x_80 = lean_ctor_get(x_79, 0);
lean_inc(x_80);
x_81 = lean_ctor_get(x_79, 1);
lean_inc(x_81);
lean_dec(x_79);
x_82 = lean_unbox_usize(x_80);
lean_dec(x_80);
x_83 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_82, x_6, x_7, x_81);
return x_83;
}
}
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86; uint64_t x_87; size_t x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; size_t x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; size_t x_99; lean_object* x_100; lean_object* x_101;
x_84 = l_LLVM_voidPtrType(x_1, x_8);
x_85 = lean_ctor_get(x_84, 0);
lean_inc(x_85);
x_86 = lean_ctor_get(x_84, 1);
lean_inc(x_86);
lean_dec(x_84);
x_87 = lean_uint64_of_nat(x_9);
x_88 = lean_unbox_usize(x_85);
lean_dec(x_85);
x_89 = lean_llvm_array_type(x_1, x_88, x_87, x_86);
x_90 = lean_ctor_get(x_89, 0);
lean_inc(x_90);
x_91 = lean_ctor_get(x_89, 1);
lean_inc(x_91);
lean_dec(x_89);
x_92 = l_Lean_IR_EmitLLVM_emitApp___closed__2;
x_93 = lean_unbox_usize(x_90);
lean_dec(x_90);
x_94 = lean_llvm_build_alloca(x_1, x_2, x_93, x_92, x_91);
x_95 = lean_ctor_get(x_94, 0);
lean_inc(x_95);
x_96 = lean_ctor_get(x_94, 1);
lean_inc(x_96);
lean_dec(x_94);
lean_inc(x_9);
x_97 = l_List_range(x_9);
x_98 = lean_box(0);
x_99 = lean_unbox_usize(x_95);
x_100 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2(x_1, x_2, x_5, x_9, x_99, x_97, x_98, x_6, x_7, x_96);
lean_dec(x_5);
x_101 = lean_ctor_get(x_100, 0);
lean_inc(x_101);
if (lean_obj_tag(x_101) == 0)
{
uint8_t x_102;
lean_dec(x_95);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_102 = !lean_is_exclusive(x_100);
if (x_102 == 0)
{
lean_object* x_103; uint8_t x_104;
x_103 = lean_ctor_get(x_100, 0);
lean_dec(x_103);
x_104 = !lean_is_exclusive(x_101);
if (x_104 == 0)
{
return x_100;
}
else
{
lean_object* x_105; lean_object* x_106;
x_105 = lean_ctor_get(x_101, 0);
lean_inc(x_105);
lean_dec(x_101);
x_106 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_106, 0, x_105);
lean_ctor_set(x_100, 0, x_106);
return x_100;
}
}
else
{
lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111;
x_107 = lean_ctor_get(x_100, 1);
lean_inc(x_107);
lean_dec(x_100);
x_108 = lean_ctor_get(x_101, 0);
lean_inc(x_108);
if (lean_is_exclusive(x_101)) {
lean_ctor_release(x_101, 0);
x_109 = x_101;
} else {
lean_dec_ref(x_101);
x_109 = lean_box(0);
}
if (lean_is_scalar(x_109)) {
x_110 = lean_alloc_ctor(0, 1, 0);
} else {
x_110 = x_109;
}
lean_ctor_set(x_110, 0, x_108);
x_111 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_111, 0, x_110);
lean_ctor_set(x_111, 1, x_107);
return x_111;
}
}
else
{
lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118;
lean_dec(x_101);
x_112 = lean_ctor_get(x_100, 1);
lean_inc(x_112);
lean_dec(x_100);
x_113 = l_LLVM_voidPtrType(x_1, x_112);
x_114 = lean_ctor_get(x_113, 0);
lean_inc(x_114);
x_115 = lean_ctor_get(x_113, 1);
lean_inc(x_115);
lean_dec(x_113);
x_116 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_117 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_4, x_116, x_6, x_7, x_115);
x_118 = lean_ctor_get(x_117, 0);
lean_inc(x_118);
if (lean_obj_tag(x_118) == 0)
{
uint8_t x_119;
lean_dec(x_114);
lean_dec(x_95);
lean_dec(x_9);
lean_dec(x_3);
x_119 = !lean_is_exclusive(x_117);
if (x_119 == 0)
{
lean_object* x_120; uint8_t x_121;
x_120 = lean_ctor_get(x_117, 0);
lean_dec(x_120);
x_121 = !lean_is_exclusive(x_118);
if (x_121 == 0)
{
return x_117;
}
else
{
lean_object* x_122; lean_object* x_123;
x_122 = lean_ctor_get(x_118, 0);
lean_inc(x_122);
lean_dec(x_118);
x_123 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_123, 0, x_122);
lean_ctor_set(x_117, 0, x_123);
return x_117;
}
}
else
{
lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128;
x_124 = lean_ctor_get(x_117, 1);
lean_inc(x_124);
lean_dec(x_117);
x_125 = lean_ctor_get(x_118, 0);
lean_inc(x_125);
if (lean_is_exclusive(x_118)) {
lean_ctor_release(x_118, 0);
x_126 = x_118;
} else {
lean_dec_ref(x_118);
x_126 = lean_box(0);
}
if (lean_is_scalar(x_126)) {
x_127 = lean_alloc_ctor(0, 1, 0);
} else {
x_127 = x_126;
}
lean_ctor_set(x_127, 0, x_125);
x_128 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_128, 0, x_127);
lean_ctor_set(x_128, 1, x_124);
return x_128;
}
}
else
{
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; 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; lean_object* x_147; lean_object* x_148; size_t x_149; size_t x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154; uint8_t x_155; size_t x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159; size_t x_160; size_t x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; size_t x_165; lean_object* x_166;
x_129 = lean_ctor_get(x_117, 1);
lean_inc(x_129);
lean_dec(x_117);
x_130 = lean_ctor_get(x_118, 0);
lean_inc(x_130);
lean_dec(x_118);
x_131 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_9, x_6, x_7, x_129);
lean_dec(x_9);
x_132 = lean_ctor_get(x_131, 0);
lean_inc(x_132);
x_133 = lean_ctor_get(x_131, 1);
lean_inc(x_133);
lean_dec(x_131);
x_134 = lean_ctor_get(x_132, 0);
lean_inc(x_134);
lean_dec(x_132);
x_135 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_136 = lean_array_push(x_135, x_130);
x_137 = lean_array_push(x_136, x_134);
x_138 = lean_array_push(x_137, x_95);
x_139 = l_LLVM_voidPtrType(x_1, x_133);
x_140 = lean_ctor_get(x_139, 0);
lean_inc(x_140);
x_141 = lean_ctor_get(x_139, 1);
lean_inc(x_141);
lean_dec(x_139);
x_142 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_143 = lean_array_push(x_142, x_140);
x_144 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_141);
x_145 = lean_ctor_get(x_144, 0);
lean_inc(x_145);
x_146 = lean_ctor_get(x_144, 1);
lean_inc(x_146);
lean_dec(x_144);
x_147 = lean_ctor_get(x_145, 0);
lean_inc(x_147);
lean_dec(x_145);
x_148 = l_Lean_IR_EmitLLVM_emitApp___closed__3;
x_149 = lean_unbox_usize(x_147);
lean_dec(x_147);
x_150 = lean_unbox_usize(x_114);
x_151 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_149, x_150, x_148, x_143, x_6, x_7, x_146);
x_152 = lean_ctor_get(x_151, 0);
lean_inc(x_152);
x_153 = lean_ctor_get(x_151, 1);
lean_inc(x_153);
lean_dec(x_151);
x_154 = lean_ctor_get(x_152, 0);
lean_inc(x_154);
lean_dec(x_152);
x_155 = 0;
x_156 = lean_unbox_usize(x_114);
lean_dec(x_114);
x_157 = lean_llvm_function_type(x_1, x_156, x_143, x_155, x_153);
lean_dec(x_143);
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 = lean_unbox_usize(x_158);
lean_dec(x_158);
x_161 = lean_unbox_usize(x_154);
lean_dec(x_154);
x_162 = lean_llvm_build_call2(x_1, x_2, x_160, x_161, x_138, x_116, x_159);
lean_dec(x_138);
x_163 = lean_ctor_get(x_162, 0);
lean_inc(x_163);
x_164 = lean_ctor_get(x_162, 1);
lean_inc(x_164);
lean_dec(x_162);
x_165 = lean_unbox_usize(x_163);
lean_dec(x_163);
x_166 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_165, x_6, x_7, x_164);
return x_166;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitApp___spec__1(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2(x_11, x_12, x_3, x_4, x_13, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_4);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitApp___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitApp(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___spec__1(size_t x_1, size_t x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
uint8_t x_9;
x_9 = lean_usize_dec_lt(x_4, x_3);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_5);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_8);
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_28; lean_object* x_29;
x_12 = lean_array_uget(x_5, x_4);
x_13 = lean_unsigned_to_nat(0u);
x_14 = lean_array_uset(x_5, x_4, x_13);
x_28 = l_Lean_IR_EmitLLVM_emitArgSlot__(x_1, x_2, x_12, x_6, x_7, x_8);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
if (lean_obj_tag(x_29) == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = !lean_is_exclusive(x_29);
if (x_31 == 0)
{
x_15 = x_29;
x_16 = x_30;
goto block_27;
}
else
{
lean_object* x_32; lean_object* x_33;
x_32 = lean_ctor_get(x_29, 0);
lean_inc(x_32);
lean_dec(x_29);
x_33 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_33, 0, x_32);
x_15 = x_33;
x_16 = x_30;
goto block_27;
}
}
else
{
uint8_t x_34;
x_34 = !lean_is_exclusive(x_29);
if (x_34 == 0)
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; size_t x_40; size_t x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_35 = lean_ctor_get(x_29, 0);
x_36 = lean_ctor_get(x_28, 1);
lean_inc(x_36);
lean_dec(x_28);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_35, 1);
lean_inc(x_38);
lean_dec(x_35);
x_39 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_40 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_41 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_42 = lean_llvm_build_load2(x_1, x_2, x_40, x_41, x_39, x_36);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
x_44 = lean_ctor_get(x_42, 1);
lean_inc(x_44);
lean_dec(x_42);
lean_ctor_set(x_29, 0, x_43);
x_15 = x_29;
x_16 = x_44;
goto block_27;
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; size_t x_50; size_t x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_45 = lean_ctor_get(x_29, 0);
lean_inc(x_45);
lean_dec(x_29);
x_46 = lean_ctor_get(x_28, 1);
lean_inc(x_46);
lean_dec(x_28);
x_47 = lean_ctor_get(x_45, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_45, 1);
lean_inc(x_48);
lean_dec(x_45);
x_49 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_50 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_51 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_52 = lean_llvm_build_load2(x_1, x_2, x_50, x_51, x_49, x_46);
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 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_55, 0, x_53);
x_15 = x_55;
x_16 = x_54;
goto block_27;
}
}
block_27:
{
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_17;
lean_dec(x_14);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_15);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_16);
return x_21;
}
}
else
{
lean_object* x_22; size_t x_23; size_t x_24; lean_object* x_25;
x_22 = lean_ctor_get(x_15, 0);
lean_inc(x_22);
lean_dec(x_15);
x_23 = 1;
x_24 = lean_usize_add(x_4, x_23);
x_25 = lean_array_uset(x_14, x_4, x_22);
x_4 = x_24;
x_5 = x_25;
x_8 = x_16;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFullApp(size_t x_1, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitLhsSlot__(x_1, x_3, x_6, x_7, x_8);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_10, 0);
lean_inc(x_21);
lean_dec(x_10);
x_22 = lean_ctor_get(x_9, 1);
lean_inc(x_22);
lean_dec(x_9);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
lean_inc(x_4);
x_24 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_4, x_6, x_7, x_22);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
if (lean_obj_tag(x_25) == 0)
{
uint8_t x_26;
lean_dec(x_23);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28;
x_27 = lean_ctor_get(x_24, 0);
lean_dec(x_27);
x_28 = !lean_is_exclusive(x_25);
if (x_28 == 0)
{
return x_24;
}
else
{
lean_object* x_29; lean_object* x_30;
x_29 = lean_ctor_get(x_25, 0);
lean_inc(x_29);
lean_dec(x_25);
x_30 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_24, 0, x_30);
return x_24;
}
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_31 = lean_ctor_get(x_24, 1);
lean_inc(x_31);
lean_dec(x_24);
x_32 = lean_ctor_get(x_25, 0);
lean_inc(x_32);
if (lean_is_exclusive(x_25)) {
lean_ctor_release(x_25, 0);
x_33 = x_25;
} else {
lean_dec_ref(x_25);
x_33 = lean_box(0);
}
if (lean_is_scalar(x_33)) {
x_34 = lean_alloc_ctor(0, 1, 0);
} else {
x_34 = x_33;
}
lean_ctor_set(x_34, 0, 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_31);
return x_35;
}
}
else
{
lean_object* x_36;
x_36 = lean_ctor_get(x_25, 0);
lean_inc(x_36);
lean_dec(x_25);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; uint8_t x_40;
lean_dec(x_36);
x_37 = lean_ctor_get(x_24, 1);
lean_inc(x_37);
lean_dec(x_24);
x_38 = lean_array_get_size(x_5);
x_39 = lean_unsigned_to_nat(0u);
x_40 = lean_nat_dec_lt(x_39, x_38);
if (x_40 == 0)
{
lean_object* x_41;
lean_dec(x_38);
lean_dec(x_5);
x_41 = l_Lean_IR_EmitLLVM_getOrAddFunIdValue(x_1, x_2, x_4, x_6, x_7, x_37);
if (lean_obj_tag(x_41) == 0)
{
lean_object* x_42;
x_42 = lean_ctor_get(x_41, 0);
lean_inc(x_42);
if (lean_obj_tag(x_42) == 0)
{
uint8_t x_43;
lean_dec(x_23);
x_43 = !lean_is_exclusive(x_41);
if (x_43 == 0)
{
lean_object* x_44; uint8_t x_45;
x_44 = lean_ctor_get(x_41, 0);
lean_dec(x_44);
x_45 = !lean_is_exclusive(x_42);
if (x_45 == 0)
{
return x_41;
}
else
{
lean_object* x_46; lean_object* x_47;
x_46 = lean_ctor_get(x_42, 0);
lean_inc(x_46);
lean_dec(x_42);
x_47 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_41, 0, x_47);
return x_41;
}
}
else
{
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_41, 1);
lean_inc(x_48);
lean_dec(x_41);
x_49 = lean_ctor_get(x_42, 0);
lean_inc(x_49);
if (lean_is_exclusive(x_42)) {
lean_ctor_release(x_42, 0);
x_50 = x_42;
} else {
lean_dec_ref(x_42);
x_50 = lean_box(0);
}
if (lean_is_scalar(x_50)) {
x_51 = lean_alloc_ctor(0, 1, 0);
} else {
x_51 = x_50;
}
lean_ctor_set(x_51, 0, x_49);
x_52 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_52, 1, x_48);
return x_52;
}
}
else
{
lean_object* x_53; uint8_t x_54;
x_53 = lean_ctor_get(x_41, 1);
lean_inc(x_53);
lean_dec(x_41);
x_54 = !lean_is_exclusive(x_42);
if (x_54 == 0)
{
lean_object* x_55; size_t x_56; size_t x_57; lean_object* x_58; uint8_t x_59;
x_55 = lean_ctor_get(x_42, 0);
x_56 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_57 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_58 = lean_llvm_build_store(x_1, x_2, x_56, x_57, x_53);
x_59 = !lean_is_exclusive(x_58);
if (x_59 == 0)
{
lean_object* x_60;
x_60 = lean_ctor_get(x_58, 0);
lean_ctor_set(x_42, 0, x_60);
lean_ctor_set(x_58, 0, x_42);
return x_58;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_61 = lean_ctor_get(x_58, 0);
x_62 = lean_ctor_get(x_58, 1);
lean_inc(x_62);
lean_inc(x_61);
lean_dec(x_58);
lean_ctor_set(x_42, 0, x_61);
x_63 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_63, 0, x_42);
lean_ctor_set(x_63, 1, x_62);
return x_63;
}
}
else
{
lean_object* x_64; size_t x_65; size_t 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;
x_64 = lean_ctor_get(x_42, 0);
lean_inc(x_64);
lean_dec(x_42);
x_65 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_66 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_67 = lean_llvm_build_store(x_1, x_2, x_65, x_66, x_53);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
if (lean_is_exclusive(x_67)) {
lean_ctor_release(x_67, 0);
lean_ctor_release(x_67, 1);
x_70 = x_67;
} else {
lean_dec_ref(x_67);
x_70 = lean_box(0);
}
x_71 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_71, 0, x_68);
if (lean_is_scalar(x_70)) {
x_72 = lean_alloc_ctor(0, 2, 0);
} else {
x_72 = x_70;
}
lean_ctor_set(x_72, 0, x_71);
lean_ctor_set(x_72, 1, x_69);
return x_72;
}
}
}
else
{
uint8_t x_73;
lean_dec(x_23);
x_73 = !lean_is_exclusive(x_41);
if (x_73 == 0)
{
return x_41;
}
else
{
lean_object* x_74; lean_object* x_75; lean_object* x_76;
x_74 = lean_ctor_get(x_41, 0);
x_75 = lean_ctor_get(x_41, 1);
lean_inc(x_75);
lean_inc(x_74);
lean_dec(x_41);
x_76 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_76, 0, x_74);
lean_ctor_set(x_76, 1, x_75);
return x_76;
}
}
}
else
{
lean_object* x_77;
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_4);
x_77 = l_Lean_IR_EmitLLVM_getOrAddFunIdValue(x_1, x_2, x_4, x_6, x_7, x_37);
if (lean_obj_tag(x_77) == 0)
{
lean_object* x_78;
x_78 = lean_ctor_get(x_77, 0);
lean_inc(x_78);
if (lean_obj_tag(x_78) == 0)
{
uint8_t x_79;
lean_dec(x_38);
lean_dec(x_23);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_79 = !lean_is_exclusive(x_77);
if (x_79 == 0)
{
lean_object* x_80; uint8_t x_81;
x_80 = lean_ctor_get(x_77, 0);
lean_dec(x_80);
x_81 = !lean_is_exclusive(x_78);
if (x_81 == 0)
{
return x_77;
}
else
{
lean_object* x_82; lean_object* x_83;
x_82 = lean_ctor_get(x_78, 0);
lean_inc(x_82);
lean_dec(x_78);
x_83 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_83, 0, x_82);
lean_ctor_set(x_77, 0, x_83);
return x_77;
}
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_84 = lean_ctor_get(x_77, 1);
lean_inc(x_84);
lean_dec(x_77);
x_85 = lean_ctor_get(x_78, 0);
lean_inc(x_85);
if (lean_is_exclusive(x_78)) {
lean_ctor_release(x_78, 0);
x_86 = x_78;
} else {
lean_dec_ref(x_78);
x_86 = lean_box(0);
}
if (lean_is_scalar(x_86)) {
x_87 = lean_alloc_ctor(0, 1, 0);
} else {
x_87 = x_86;
}
lean_ctor_set(x_87, 0, x_85);
x_88 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_88, 0, x_87);
lean_ctor_set(x_88, 1, x_84);
return x_88;
}
}
else
{
lean_object* x_89; lean_object* x_90; size_t x_91; size_t x_92; lean_object* x_93; lean_object* x_94;
x_89 = lean_ctor_get(x_77, 1);
lean_inc(x_89);
lean_dec(x_77);
x_90 = lean_ctor_get(x_78, 0);
lean_inc(x_90);
lean_dec(x_78);
x_91 = lean_usize_of_nat(x_38);
lean_dec(x_38);
x_92 = 0;
x_93 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___spec__1(x_1, x_2, x_91, x_92, x_5, x_6, x_7, x_89);
x_94 = lean_ctor_get(x_93, 0);
lean_inc(x_94);
if (lean_obj_tag(x_94) == 0)
{
uint8_t x_95;
lean_dec(x_90);
lean_dec(x_23);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
x_95 = !lean_is_exclusive(x_93);
if (x_95 == 0)
{
lean_object* x_96; uint8_t x_97;
x_96 = lean_ctor_get(x_93, 0);
lean_dec(x_96);
x_97 = !lean_is_exclusive(x_94);
if (x_97 == 0)
{
return x_93;
}
else
{
lean_object* x_98; lean_object* x_99;
x_98 = lean_ctor_get(x_94, 0);
lean_inc(x_98);
lean_dec(x_94);
x_99 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_99, 0, x_98);
lean_ctor_set(x_93, 0, x_99);
return x_93;
}
}
else
{
lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_100 = lean_ctor_get(x_93, 1);
lean_inc(x_100);
lean_dec(x_93);
x_101 = lean_ctor_get(x_94, 0);
lean_inc(x_101);
if (lean_is_exclusive(x_94)) {
lean_ctor_release(x_94, 0);
x_102 = x_94;
} else {
lean_dec_ref(x_94);
x_102 = lean_box(0);
}
if (lean_is_scalar(x_102)) {
x_103 = lean_alloc_ctor(0, 1, 0);
} else {
x_103 = x_102;
}
lean_ctor_set(x_103, 0, x_101);
x_104 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_104, 0, x_103);
lean_ctor_set(x_104, 1, x_100);
return x_104;
}
}
else
{
lean_object* x_105; lean_object* x_106; lean_object* x_107;
x_105 = lean_ctor_get(x_93, 1);
lean_inc(x_105);
lean_dec(x_93);
x_106 = lean_ctor_get(x_94, 0);
lean_inc(x_106);
lean_dec(x_94);
x_107 = l_Lean_IR_EmitLLVM_getFunIdTy(x_1, x_4, x_6, x_7, x_105);
if (lean_obj_tag(x_107) == 0)
{
lean_object* x_108;
x_108 = lean_ctor_get(x_107, 0);
lean_inc(x_108);
if (lean_obj_tag(x_108) == 0)
{
uint8_t x_109;
lean_dec(x_106);
lean_dec(x_90);
lean_dec(x_23);
x_109 = !lean_is_exclusive(x_107);
if (x_109 == 0)
{
lean_object* x_110; uint8_t x_111;
x_110 = lean_ctor_get(x_107, 0);
lean_dec(x_110);
x_111 = !lean_is_exclusive(x_108);
if (x_111 == 0)
{
return x_107;
}
else
{
lean_object* x_112; lean_object* x_113;
x_112 = lean_ctor_get(x_108, 0);
lean_inc(x_112);
lean_dec(x_108);
x_113 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_113, 0, x_112);
lean_ctor_set(x_107, 0, x_113);
return x_107;
}
}
else
{
lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118;
x_114 = lean_ctor_get(x_107, 1);
lean_inc(x_114);
lean_dec(x_107);
x_115 = lean_ctor_get(x_108, 0);
lean_inc(x_115);
if (lean_is_exclusive(x_108)) {
lean_ctor_release(x_108, 0);
x_116 = x_108;
} else {
lean_dec_ref(x_108);
x_116 = lean_box(0);
}
if (lean_is_scalar(x_116)) {
x_117 = lean_alloc_ctor(0, 1, 0);
} else {
x_117 = x_116;
}
lean_ctor_set(x_117, 0, x_115);
x_118 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_118, 0, x_117);
lean_ctor_set(x_118, 1, x_114);
return x_118;
}
}
else
{
lean_object* x_119; uint8_t x_120;
x_119 = lean_ctor_get(x_107, 1);
lean_inc(x_119);
lean_dec(x_107);
x_120 = !lean_is_exclusive(x_108);
if (x_120 == 0)
{
lean_object* x_121; lean_object* x_122; size_t x_123; size_t x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; size_t x_128; size_t x_129; lean_object* x_130; uint8_t x_131;
x_121 = lean_ctor_get(x_108, 0);
x_122 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_123 = lean_unbox_usize(x_121);
lean_dec(x_121);
x_124 = lean_unbox_usize(x_90);
lean_dec(x_90);
x_125 = lean_llvm_build_call2(x_1, x_2, x_123, x_124, x_106, x_122, x_119);
lean_dec(x_106);
x_126 = lean_ctor_get(x_125, 0);
lean_inc(x_126);
x_127 = lean_ctor_get(x_125, 1);
lean_inc(x_127);
lean_dec(x_125);
x_128 = lean_unbox_usize(x_126);
lean_dec(x_126);
x_129 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_130 = lean_llvm_build_store(x_1, x_2, x_128, x_129, x_127);
x_131 = !lean_is_exclusive(x_130);
if (x_131 == 0)
{
lean_object* x_132;
x_132 = lean_ctor_get(x_130, 0);
lean_ctor_set(x_108, 0, x_132);
lean_ctor_set(x_130, 0, x_108);
return x_130;
}
else
{
lean_object* x_133; lean_object* x_134; lean_object* x_135;
x_133 = lean_ctor_get(x_130, 0);
x_134 = lean_ctor_get(x_130, 1);
lean_inc(x_134);
lean_inc(x_133);
lean_dec(x_130);
lean_ctor_set(x_108, 0, x_133);
x_135 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_135, 0, x_108);
lean_ctor_set(x_135, 1, x_134);
return x_135;
}
}
else
{
lean_object* x_136; lean_object* x_137; size_t x_138; size_t x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; size_t x_143; size_t x_144; lean_object* x_145; lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150;
x_136 = lean_ctor_get(x_108, 0);
lean_inc(x_136);
lean_dec(x_108);
x_137 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_138 = lean_unbox_usize(x_136);
lean_dec(x_136);
x_139 = lean_unbox_usize(x_90);
lean_dec(x_90);
x_140 = lean_llvm_build_call2(x_1, x_2, x_138, x_139, x_106, x_137, x_119);
lean_dec(x_106);
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 = lean_unbox_usize(x_141);
lean_dec(x_141);
x_144 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_145 = lean_llvm_build_store(x_1, x_2, x_143, x_144, x_142);
x_146 = lean_ctor_get(x_145, 0);
lean_inc(x_146);
x_147 = lean_ctor_get(x_145, 1);
lean_inc(x_147);
if (lean_is_exclusive(x_145)) {
lean_ctor_release(x_145, 0);
lean_ctor_release(x_145, 1);
x_148 = x_145;
} else {
lean_dec_ref(x_145);
x_148 = lean_box(0);
}
x_149 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_149, 0, x_146);
if (lean_is_scalar(x_148)) {
x_150 = lean_alloc_ctor(0, 2, 0);
} else {
x_150 = x_148;
}
lean_ctor_set(x_150, 0, x_149);
lean_ctor_set(x_150, 1, x_147);
return x_150;
}
}
}
else
{
uint8_t x_151;
lean_dec(x_106);
lean_dec(x_90);
lean_dec(x_23);
x_151 = !lean_is_exclusive(x_107);
if (x_151 == 0)
{
return x_107;
}
else
{
lean_object* x_152; lean_object* x_153; lean_object* x_154;
x_152 = lean_ctor_get(x_107, 0);
x_153 = lean_ctor_get(x_107, 1);
lean_inc(x_153);
lean_inc(x_152);
lean_dec(x_107);
x_154 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_154, 0, x_152);
lean_ctor_set(x_154, 1, x_153);
return x_154;
}
}
}
}
}
else
{
uint8_t x_155;
lean_dec(x_38);
lean_dec(x_23);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_155 = !lean_is_exclusive(x_77);
if (x_155 == 0)
{
return x_77;
}
else
{
lean_object* x_156; lean_object* x_157; lean_object* x_158;
x_156 = lean_ctor_get(x_77, 0);
x_157 = lean_ctor_get(x_77, 1);
lean_inc(x_157);
lean_inc(x_156);
lean_dec(x_77);
x_158 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_158, 0, x_156);
lean_ctor_set(x_158, 1, x_157);
return x_158;
}
}
}
}
else
{
lean_object* x_159; lean_object* x_160; lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164;
x_159 = lean_ctor_get(x_24, 1);
lean_inc(x_159);
lean_dec(x_24);
x_160 = lean_ctor_get(x_36, 1);
lean_inc(x_160);
x_161 = lean_ctor_get(x_36, 2);
lean_inc(x_161);
x_162 = lean_ctor_get(x_36, 3);
lean_inc(x_162);
lean_dec(x_36);
x_163 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_164 = l_Lean_IR_EmitLLVM_emitExternCall(x_1, x_2, x_4, x_160, x_162, x_5, x_161, x_163, x_6, x_7, x_159);
lean_dec(x_5);
lean_dec(x_162);
lean_dec(x_160);
if (lean_obj_tag(x_164) == 0)
{
lean_object* x_165;
x_165 = lean_ctor_get(x_164, 0);
lean_inc(x_165);
if (lean_obj_tag(x_165) == 0)
{
uint8_t x_166;
lean_dec(x_23);
x_166 = !lean_is_exclusive(x_164);
if (x_166 == 0)
{
lean_object* x_167; uint8_t x_168;
x_167 = lean_ctor_get(x_164, 0);
lean_dec(x_167);
x_168 = !lean_is_exclusive(x_165);
if (x_168 == 0)
{
return x_164;
}
else
{
lean_object* x_169; lean_object* x_170;
x_169 = lean_ctor_get(x_165, 0);
lean_inc(x_169);
lean_dec(x_165);
x_170 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_170, 0, x_169);
lean_ctor_set(x_164, 0, x_170);
return x_164;
}
}
else
{
lean_object* x_171; lean_object* x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175;
x_171 = lean_ctor_get(x_164, 1);
lean_inc(x_171);
lean_dec(x_164);
x_172 = lean_ctor_get(x_165, 0);
lean_inc(x_172);
if (lean_is_exclusive(x_165)) {
lean_ctor_release(x_165, 0);
x_173 = x_165;
} else {
lean_dec_ref(x_165);
x_173 = lean_box(0);
}
if (lean_is_scalar(x_173)) {
x_174 = lean_alloc_ctor(0, 1, 0);
} else {
x_174 = x_173;
}
lean_ctor_set(x_174, 0, x_172);
x_175 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_175, 0, x_174);
lean_ctor_set(x_175, 1, x_171);
return x_175;
}
}
else
{
lean_object* x_176; uint8_t x_177;
x_176 = lean_ctor_get(x_164, 1);
lean_inc(x_176);
lean_dec(x_164);
x_177 = !lean_is_exclusive(x_165);
if (x_177 == 0)
{
lean_object* x_178; size_t x_179; size_t x_180; lean_object* x_181; uint8_t x_182;
x_178 = lean_ctor_get(x_165, 0);
x_179 = lean_unbox_usize(x_178);
lean_dec(x_178);
x_180 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_181 = lean_llvm_build_store(x_1, x_2, x_179, x_180, x_176);
x_182 = !lean_is_exclusive(x_181);
if (x_182 == 0)
{
lean_object* x_183;
x_183 = lean_ctor_get(x_181, 0);
lean_ctor_set(x_165, 0, x_183);
lean_ctor_set(x_181, 0, x_165);
return x_181;
}
else
{
lean_object* x_184; lean_object* x_185; lean_object* x_186;
x_184 = lean_ctor_get(x_181, 0);
x_185 = lean_ctor_get(x_181, 1);
lean_inc(x_185);
lean_inc(x_184);
lean_dec(x_181);
lean_ctor_set(x_165, 0, x_184);
x_186 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_186, 0, x_165);
lean_ctor_set(x_186, 1, x_185);
return x_186;
}
}
else
{
lean_object* x_187; size_t x_188; size_t 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_187 = lean_ctor_get(x_165, 0);
lean_inc(x_187);
lean_dec(x_165);
x_188 = lean_unbox_usize(x_187);
lean_dec(x_187);
x_189 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_190 = lean_llvm_build_store(x_1, x_2, x_188, x_189, x_176);
x_191 = lean_ctor_get(x_190, 0);
lean_inc(x_191);
x_192 = lean_ctor_get(x_190, 1);
lean_inc(x_192);
if (lean_is_exclusive(x_190)) {
lean_ctor_release(x_190, 0);
lean_ctor_release(x_190, 1);
x_193 = x_190;
} else {
lean_dec_ref(x_190);
x_193 = lean_box(0);
}
x_194 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_194, 0, x_191);
if (lean_is_scalar(x_193)) {
x_195 = lean_alloc_ctor(0, 2, 0);
} else {
x_195 = x_193;
}
lean_ctor_set(x_195, 0, x_194);
lean_ctor_set(x_195, 1, x_192);
return x_195;
}
}
}
else
{
uint8_t x_196;
lean_dec(x_23);
x_196 = !lean_is_exclusive(x_164);
if (x_196 == 0)
{
return x_164;
}
else
{
lean_object* x_197; lean_object* x_198; lean_object* x_199;
x_197 = lean_ctor_get(x_164, 0);
x_198 = lean_ctor_get(x_164, 1);
lean_inc(x_198);
lean_inc(x_197);
lean_dec(x_164);
x_199 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_199, 0, x_197);
lean_ctor_set(x_199, 1, x_198);
return x_199;
}
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitFullApp___spec__1(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFullApp___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitFullApp(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___lambda__1(size_t x_1, size_t x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; uint8_t x_9;
x_8 = lean_llvm_build_store(x_1, x_2, x_4, x_3, x_7);
x_9 = !lean_is_exclusive(x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_8, 0);
lean_dec(x_10);
x_11 = lean_box_usize(x_3);
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_8, 0, x_12);
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_8, 1);
lean_inc(x_13);
lean_dec(x_8);
x_14 = lean_box_usize(x_3);
x_15 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_15, 0, 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_13);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit(size_t x_1, size_t 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_inc(x_7);
lean_inc(x_6);
lean_inc(x_4);
x_9 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_4, x_6, x_7, x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10;
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; size_t x_28; size_t x_29; lean_object* x_30;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
lean_dec(x_10);
x_23 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_24 = lean_unbox_usize(x_22);
x_25 = lean_llvm_build_alloca(x_1, x_2, x_24, x_23, x_21);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_unbox_usize(x_26);
x_29 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_30 = l_Lean_IR_EmitLLVM_addVartoState(x_1, x_3, x_28, x_29, x_6, x_7, x_27);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_30, 1);
lean_inc(x_31);
lean_dec(x_30);
x_32 = lean_ctor_get(x_5, 0);
lean_inc(x_32);
lean_dec(x_5);
lean_inc(x_7);
lean_inc(x_6);
x_33 = l_Lean_IR_EmitLLVM_emitNumLit(x_1, x_2, x_4, x_32, x_6, x_7, x_31);
if (lean_obj_tag(x_33) == 0)
{
lean_object* x_34;
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
if (lean_obj_tag(x_34) == 0)
{
uint8_t x_35;
lean_dec(x_26);
lean_dec(x_7);
lean_dec(x_6);
x_35 = !lean_is_exclusive(x_33);
if (x_35 == 0)
{
lean_object* x_36; uint8_t x_37;
x_36 = lean_ctor_get(x_33, 0);
lean_dec(x_36);
x_37 = !lean_is_exclusive(x_34);
if (x_37 == 0)
{
return x_33;
}
else
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_34, 0);
lean_inc(x_38);
lean_dec(x_34);
x_39 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_33, 0, x_39);
return x_33;
}
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_40 = lean_ctor_get(x_33, 1);
lean_inc(x_40);
lean_dec(x_33);
x_41 = lean_ctor_get(x_34, 0);
lean_inc(x_41);
if (lean_is_exclusive(x_34)) {
lean_ctor_release(x_34, 0);
x_42 = x_34;
} else {
lean_dec_ref(x_34);
x_42 = lean_box(0);
}
if (lean_is_scalar(x_42)) {
x_43 = lean_alloc_ctor(0, 1, 0);
} else {
x_43 = x_42;
}
lean_ctor_set(x_43, 0, x_41);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_40);
return x_44;
}
}
else
{
lean_object* x_45; lean_object* x_46; size_t x_47; size_t x_48; lean_object* x_49;
x_45 = lean_ctor_get(x_33, 1);
lean_inc(x_45);
lean_dec(x_33);
x_46 = lean_ctor_get(x_34, 0);
lean_inc(x_46);
lean_dec(x_34);
x_47 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_48 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_49 = l_Lean_IR_EmitLLVM_emitLit___lambda__1(x_1, x_2, x_47, x_48, x_6, x_7, x_45);
lean_dec(x_7);
lean_dec(x_6);
return x_49;
}
}
else
{
uint8_t x_50;
lean_dec(x_26);
lean_dec(x_7);
lean_dec(x_6);
x_50 = !lean_is_exclusive(x_33);
if (x_50 == 0)
{
return x_33;
}
else
{
lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_51 = lean_ctor_get(x_33, 0);
x_52 = lean_ctor_get(x_33, 1);
lean_inc(x_52);
lean_inc(x_51);
lean_dec(x_33);
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;
}
}
}
else
{
lean_object* x_54; lean_object* x_55; uint64_t x_56; uint8_t 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; lean_object* x_68; size_t x_69; size_t x_70; lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; uint64_t x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; size_t x_79; size_t x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84; size_t x_85; size_t x_86; lean_object* x_87;
lean_dec(x_4);
x_54 = lean_ctor_get(x_30, 1);
lean_inc(x_54);
lean_dec(x_30);
x_55 = lean_ctor_get(x_5, 0);
lean_inc(x_55);
lean_dec(x_5);
x_56 = 0;
x_57 = 0;
x_58 = l_LLVM_constIntUnsigned(x_1, x_56, x_57, x_54);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = lean_llvm_build_global_string(x_1, x_2, x_55, x_23, x_60);
x_62 = lean_ctor_get(x_61, 0);
lean_inc(x_62);
x_63 = lean_ctor_get(x_61, 1);
lean_inc(x_63);
lean_dec(x_61);
x_64 = lean_llvm_opaque_pointer_type_in_context(x_1, x_56, x_63);
x_65 = lean_ctor_get(x_64, 0);
lean_inc(x_65);
x_66 = lean_ctor_get(x_64, 1);
lean_inc(x_66);
lean_dec(x_64);
x_67 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_68 = lean_array_push(x_67, x_59);
x_69 = lean_unbox_usize(x_65);
lean_dec(x_65);
x_70 = lean_unbox_usize(x_62);
lean_dec(x_62);
x_71 = lean_llvm_build_inbounds_gep2(x_1, x_2, x_69, x_70, x_68, x_23, x_66);
lean_dec(x_68);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = lean_string_utf8_byte_size(x_55);
lean_dec(x_55);
x_75 = lean_uint64_of_nat(x_74);
lean_dec(x_74);
x_76 = l_LLVM_constIntUnsigned(x_1, x_75, x_57, x_73);
x_77 = lean_ctor_get(x_76, 0);
lean_inc(x_77);
x_78 = lean_ctor_get(x_76, 1);
lean_inc(x_78);
lean_dec(x_76);
x_79 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_80 = lean_unbox_usize(x_77);
lean_dec(x_77);
x_81 = l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn(x_1, x_2, x_79, x_80, x_23, x_6, x_7, x_78);
x_82 = lean_ctor_get(x_81, 0);
lean_inc(x_82);
x_83 = lean_ctor_get(x_81, 1);
lean_inc(x_83);
lean_dec(x_81);
x_84 = lean_ctor_get(x_82, 0);
lean_inc(x_84);
lean_dec(x_82);
x_85 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_86 = lean_unbox_usize(x_84);
lean_dec(x_84);
x_87 = l_Lean_IR_EmitLLVM_emitLit___lambda__1(x_1, x_2, x_85, x_86, x_6, x_7, x_83);
lean_dec(x_7);
lean_dec(x_6);
return x_87;
}
}
}
else
{
uint8_t x_88;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_88 = !lean_is_exclusive(x_9);
if (x_88 == 0)
{
return x_9;
}
else
{
lean_object* x_89; lean_object* x_90; lean_object* x_91;
x_89 = lean_ctor_get(x_9, 0);
x_90 = lean_ctor_get(x_9, 1);
lean_inc(x_90);
lean_inc(x_89);
lean_dec(x_9);
x_91 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_91, 0, x_89);
lean_ctor_set(x_91, 1, x_90);
return x_91;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___lambda__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:
{
size_t x_8; size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_emitLit___lambda__1(x_8, x_9, x_10, x_11, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitLit___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitLit(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get", 13);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGet(size_t x_1, size_t x_2, size_t x_3, size_t 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; uint8_t x_21; size_t 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; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36;
x_9 = l_LLVM_voidPtrType(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_LLVM_i32Type(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = 0;
x_22 = lean_unbox_usize(x_10);
x_23 = lean_llvm_function_type(x_1, x_22, x_20, x_21, x_17);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_25);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1;
x_31 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_32 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_33 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_31, x_32, x_30, x_20, x_6, x_7, x_28);
lean_dec(x_20);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = !lean_is_exclusive(x_34);
if (x_36 == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; size_t 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; size_t x_49; size_t x_50; lean_object* x_51; uint8_t x_52;
x_37 = lean_ctor_get(x_34, 0);
x_38 = l_LLVM_i32Type(x_1, x_35);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_42 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_43 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_4, x_42, x_41, x_40);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = lean_box_usize(x_3);
x_47 = lean_array_push(x_18, x_46);
x_48 = lean_array_push(x_47, x_44);
x_49 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_50 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_51 = lean_llvm_build_call2(x_1, x_2, x_49, x_50, x_48, x_5, x_45);
lean_dec(x_48);
x_52 = !lean_is_exclusive(x_51);
if (x_52 == 0)
{
lean_object* x_53;
x_53 = lean_ctor_get(x_51, 0);
lean_ctor_set(x_34, 0, x_53);
lean_ctor_set(x_51, 0, x_34);
return x_51;
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_54 = lean_ctor_get(x_51, 0);
x_55 = lean_ctor_get(x_51, 1);
lean_inc(x_55);
lean_inc(x_54);
lean_dec(x_51);
lean_ctor_set(x_34, 0, x_54);
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_34);
lean_ctor_set(x_56, 1, x_55);
return x_56;
}
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; size_t x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; size_t x_69; size_t 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_57 = lean_ctor_get(x_34, 0);
lean_inc(x_57);
lean_dec(x_34);
x_58 = l_LLVM_i32Type(x_1, x_35);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_62 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_63 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_4, x_62, x_61, x_60);
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_box_usize(x_3);
x_67 = lean_array_push(x_18, x_66);
x_68 = lean_array_push(x_67, x_64);
x_69 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_70 = lean_unbox_usize(x_57);
lean_dec(x_57);
x_71 = lean_llvm_build_call2(x_1, x_2, x_69, x_70, x_68, x_5, x_65);
lean_dec(x_68);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
if (lean_is_exclusive(x_71)) {
lean_ctor_release(x_71, 0);
lean_ctor_release(x_71, 1);
x_74 = x_71;
} else {
lean_dec_ref(x_71);
x_74 = lean_box(0);
}
x_75 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_75, 0, x_72);
if (lean_is_scalar(x_74)) {
x_76 = lean_alloc_ctor(0, 2, 0);
} else {
x_76 = x_74;
}
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_73);
return x_76;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGet___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_callLeanCtorGet(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitProj(size_t x_1, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_5, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_3);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
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; size_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; lean_object* x_35;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_6, x_7, x_22);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_ctor_get(x_25, 0);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_29 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanCtorGet(x_1, x_2, x_28, x_29, x_9, x_6, x_7, x_26);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_ctor_get(x_31, 0);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_35 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_34, x_6, x_7, x_32);
return x_35;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitProj___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitProj(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_usize", 19);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGetUsize(size_t x_1, size_t x_2, size_t x_3, size_t 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; uint8_t x_21; size_t 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; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36;
x_9 = l_Lean_IR_LLVM_size__tType(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_19 = lean_array_push(x_18, x_13);
x_20 = lean_array_push(x_19, x_16);
x_21 = 0;
x_22 = lean_unbox_usize(x_10);
x_23 = lean_llvm_function_type(x_1, x_22, x_20, x_21, x_17);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_25);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1;
x_31 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_32 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_33 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_31, x_32, x_30, x_20, x_6, x_7, x_28);
lean_dec(x_20);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = !lean_is_exclusive(x_34);
if (x_36 == 0)
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; size_t x_42; size_t x_43; lean_object* x_44; uint8_t x_45;
x_37 = lean_ctor_get(x_34, 0);
x_38 = lean_box_usize(x_3);
x_39 = lean_array_push(x_18, x_38);
x_40 = lean_box_usize(x_4);
x_41 = lean_array_push(x_39, x_40);
x_42 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_43 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_44 = lean_llvm_build_call2(x_1, x_2, x_42, x_43, x_41, x_5, x_35);
lean_dec(x_41);
x_45 = !lean_is_exclusive(x_44);
if (x_45 == 0)
{
lean_object* x_46;
x_46 = lean_ctor_get(x_44, 0);
lean_ctor_set(x_34, 0, x_46);
lean_ctor_set(x_44, 0, x_34);
return x_44;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_44, 0);
x_48 = lean_ctor_get(x_44, 1);
lean_inc(x_48);
lean_inc(x_47);
lean_dec(x_44);
lean_ctor_set(x_34, 0, x_47);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_34);
lean_ctor_set(x_49, 1, x_48);
return x_49;
}
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; size_t x_55; size_t 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;
x_50 = lean_ctor_get(x_34, 0);
lean_inc(x_50);
lean_dec(x_34);
x_51 = lean_box_usize(x_3);
x_52 = lean_array_push(x_18, x_51);
x_53 = lean_box_usize(x_4);
x_54 = lean_array_push(x_52, x_53);
x_55 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_56 = lean_unbox_usize(x_50);
lean_dec(x_50);
x_57 = lean_llvm_build_call2(x_1, x_2, x_55, x_56, x_54, x_5, x_35);
lean_dec(x_54);
x_58 = lean_ctor_get(x_57, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_57, 1);
lean_inc(x_59);
if (lean_is_exclusive(x_57)) {
lean_ctor_release(x_57, 0);
lean_ctor_release(x_57, 1);
x_60 = x_57;
} else {
lean_dec_ref(x_57);
x_60 = lean_box(0);
}
x_61 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_61, 0, x_58);
if (lean_is_scalar(x_60)) {
x_62 = lean_alloc_ctor(0, 2, 0);
} else {
x_62 = x_60;
}
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_59);
return x_62;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___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:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_callLeanCtorGetUsize(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUProj(size_t x_1, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_5, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_3);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
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; size_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; lean_object* x_35;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_6, x_7, x_22);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_ctor_get(x_25, 0);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_29 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_callLeanCtorGetUsize(x_1, x_2, x_28, x_29, x_9, x_6, x_7, x_26);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_ctor_get(x_31, 0);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_35 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_34, x_6, x_7, x_32);
return x_35;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUProj___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitUProj(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitOffset(size_t x_1, size_t 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_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; size_t x_18; size_t 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; uint8_t x_26;
x_8 = lean_unsigned_to_nat(8u);
x_9 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_8, x_5, x_6, x_7);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_3, x_5, x_6, x_11);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_18 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_19 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_20 = lean_llvm_build_mul(x_1, x_2, x_18, x_19, x_17, x_15);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_5, x_6, x_22);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; size_t x_28; size_t x_29; lean_object* x_30; uint8_t x_31;
x_27 = lean_ctor_get(x_24, 0);
x_28 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_29 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_30 = lean_llvm_build_add(x_1, x_2, x_28, x_29, x_17, x_25);
x_31 = !lean_is_exclusive(x_30);
if (x_31 == 0)
{
lean_object* x_32;
x_32 = lean_ctor_get(x_30, 0);
lean_ctor_set(x_24, 0, x_32);
lean_ctor_set(x_30, 0, x_24);
return x_30;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_30, 0);
x_34 = lean_ctor_get(x_30, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_30);
lean_ctor_set(x_24, 0, x_33);
x_35 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_35, 0, x_24);
lean_ctor_set(x_35, 1, x_34);
return x_35;
}
}
else
{
lean_object* x_36; size_t x_37; size_t 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_24, 0);
lean_inc(x_36);
lean_dec(x_24);
x_37 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_38 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_39 = lean_llvm_build_add(x_1, x_2, x_37, x_38, x_17, x_25);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
if (lean_is_exclusive(x_39)) {
lean_ctor_release(x_39, 0);
lean_ctor_release(x_39, 1);
x_42 = x_39;
} else {
lean_dec_ref(x_39);
x_42 = lean_box(0);
}
x_43 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_43, 0, x_40);
if (lean_is_scalar(x_42)) {
x_44 = lean_alloc_ctor(0, 2, 0);
} else {
x_44 = x_42;
}
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_41);
return x_44;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitOffset___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitOffset(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj___lambda__1(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
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; size_t x_26; size_t 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;
x_11 = lean_ctor_get(x_7, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_7, 1);
lean_inc(x_12);
lean_dec(x_7);
x_13 = l_LLVM_voidPtrType(x_1, x_10);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_LLVM_size__tType(x_1, x_15);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_20 = lean_array_push(x_19, x_14);
x_21 = lean_array_push(x_20, x_17);
x_22 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_9, x_18);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_27 = lean_unbox_usize(x_12);
x_28 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_26, x_27, x_11, x_21, x_8, x_9, x_24);
lean_dec(x_11);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_ctor_get(x_29, 0);
lean_inc(x_31);
lean_dec(x_29);
x_32 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_33 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_32, x_8, x_9, x_30);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
if (lean_obj_tag(x_34) == 0)
{
uint8_t x_35;
lean_dec(x_31);
lean_dec(x_21);
lean_dec(x_12);
lean_dec(x_6);
x_35 = !lean_is_exclusive(x_33);
if (x_35 == 0)
{
lean_object* x_36; uint8_t x_37;
x_36 = lean_ctor_get(x_33, 0);
lean_dec(x_36);
x_37 = !lean_is_exclusive(x_34);
if (x_37 == 0)
{
return x_33;
}
else
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_34, 0);
lean_inc(x_38);
lean_dec(x_34);
x_39 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_33, 0, x_39);
return x_33;
}
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_40 = lean_ctor_get(x_33, 1);
lean_inc(x_40);
lean_dec(x_33);
x_41 = lean_ctor_get(x_34, 0);
lean_inc(x_41);
if (lean_is_exclusive(x_34)) {
lean_ctor_release(x_34, 0);
x_42 = x_34;
} else {
lean_dec_ref(x_34);
x_42 = lean_box(0);
}
if (lean_is_scalar(x_42)) {
x_43 = lean_alloc_ctor(0, 1, 0);
} else {
x_43 = x_42;
}
lean_ctor_set(x_43, 0, x_41);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_40);
return x_44;
}
}
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; uint8_t x_51; size_t x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; size_t x_58; size_t x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; size_t x_63; lean_object* x_64;
x_45 = lean_ctor_get(x_33, 1);
lean_inc(x_45);
lean_dec(x_33);
x_46 = lean_ctor_get(x_34, 0);
lean_inc(x_46);
lean_dec(x_34);
x_47 = l_Lean_IR_EmitLLVM_emitOffset(x_1, x_2, x_4, x_5, x_8, x_9, x_45);
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
lean_dec(x_47);
x_50 = lean_ctor_get(x_48, 0);
lean_inc(x_50);
lean_dec(x_48);
x_51 = 0;
x_52 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_53 = lean_llvm_function_type(x_1, x_52, x_21, x_51, x_49);
lean_dec(x_21);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
lean_dec(x_53);
x_56 = lean_array_push(x_19, x_46);
x_57 = lean_array_push(x_56, x_50);
x_58 = lean_unbox_usize(x_54);
lean_dec(x_54);
x_59 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_60 = lean_llvm_build_call2(x_1, x_2, x_58, x_59, x_57, x_32, x_55);
lean_dec(x_57);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_64 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_6, x_63, x_8, x_9, x_62);
return x_64;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_float", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_uint8", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_uint16", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_uint32", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_get_uint64", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Invalid type for lean_ctor_get: '", 33);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSProj___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("'", 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
switch (lean_obj_tag(x_4)) {
case 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;
x_11 = lean_llvm_double_type_in_context(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitSProj___closed__1;
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_12);
x_16 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_1, x_2, x_7, x_5, x_6, x_3, x_15, x_8, x_9, x_13);
lean_dec(x_6);
lean_dec(x_5);
return x_16;
}
case 1:
{
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_17 = l_LLVM_i8Type(x_1, x_10);
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_Lean_IR_EmitLLVM_emitSProj___closed__2;
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_18);
x_22 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_1, x_2, x_7, x_5, x_6, x_3, x_21, x_8, x_9, x_19);
lean_dec(x_6);
lean_dec(x_5);
return x_22;
}
case 2:
{
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_23 = l_LLVM_i16Type(x_1, x_10);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitSProj___closed__3;
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_24);
x_28 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_1, x_2, x_7, x_5, x_6, x_3, x_27, x_8, x_9, x_25);
lean_dec(x_6);
lean_dec(x_5);
return x_28;
}
case 3:
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_29 = l_LLVM_i32Type(x_1, x_10);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = l_Lean_IR_EmitLLVM_emitSProj___closed__4;
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_30);
x_34 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_1, x_2, x_7, x_5, x_6, x_3, x_33, x_8, x_9, x_31);
lean_dec(x_6);
lean_dec(x_5);
return x_34;
}
case 4:
{
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_35 = l_LLVM_i64Type(x_1, x_10);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = l_Lean_IR_EmitLLVM_emitSProj___closed__5;
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_36);
x_40 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_1, x_2, x_7, x_5, x_6, x_3, x_39, x_8, x_9, x_37);
lean_dec(x_6);
lean_dec(x_5);
return x_40;
}
default:
{
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_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_41 = l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatIRType(x_4);
x_42 = l_Std_Format_defWidth;
x_43 = lean_format_pretty(x_41, x_42);
x_44 = l_Lean_IR_EmitLLVM_emitSProj___closed__6;
x_45 = lean_string_append(x_44, x_43);
lean_dec(x_43);
x_46 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_47 = lean_string_append(x_45, x_46);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_49, 1, x_10);
return x_49;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSProj___lambda__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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Lean_IR_EmitLLVM_emitSProj___lambda__1(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_5);
lean_dec(x_4);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Lean_IR_EmitLLVM_emitSProj(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
return x_13;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_is_exclusive", 17);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsExclusive(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i1Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t 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; size_t x_44; size_t x_45; lean_object* x_46; uint8_t x_47;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = l_LLVM_i8Type(x_1, x_39);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_44 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_45 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_46 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_44, x_45, x_43, x_42);
x_47 = !lean_is_exclusive(x_46);
if (x_47 == 0)
{
lean_object* x_48;
x_48 = lean_ctor_get(x_46, 0);
lean_ctor_set(x_24, 0, x_48);
lean_ctor_set(x_46, 0, x_24);
return x_46;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_46, 0);
x_50 = lean_ctor_get(x_46, 1);
lean_inc(x_50);
lean_inc(x_49);
lean_dec(x_46);
lean_ctor_set(x_24, 0, x_49);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_24);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
else
{
lean_object* x_52; uint8_t x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; size_t x_60; size_t 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; lean_object* x_68; size_t x_69; size_t 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_52 = lean_ctor_get(x_24, 0);
lean_inc(x_52);
lean_dec(x_24);
x_53 = 0;
x_54 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_55 = lean_llvm_function_type(x_1, x_54, x_15, x_53, x_25);
lean_dec(x_15);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = lean_box_usize(x_3);
x_59 = lean_array_push(x_14, x_58);
x_60 = lean_unbox_usize(x_56);
lean_dec(x_56);
x_61 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_62 = lean_llvm_build_call2(x_1, x_2, x_60, x_61, x_59, x_4, x_57);
lean_dec(x_59);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = l_LLVM_i8Type(x_1, x_64);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_69 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_70 = lean_unbox_usize(x_66);
lean_dec(x_66);
x_71 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_69, x_70, x_68, x_67);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
if (lean_is_exclusive(x_71)) {
lean_ctor_release(x_71, 0);
lean_ctor_release(x_71, 1);
x_74 = x_71;
} else {
lean_dec_ref(x_71);
x_74 = lean_box(0);
}
x_75 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_75, 0, x_72);
if (lean_is_scalar(x_74)) {
x_76 = lean_alloc_ctor(0, 2, 0);
} else {
x_76 = x_74;
}
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_73);
return x_76;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsExclusive___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIsExclusive(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_is_scalar", 14);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsScalar(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i8Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIsScalar___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIsScalar(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitIsShared(size_t x_1, size_t 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_9; lean_object* x_10;
x_8 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_9 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_4, x_8, x_5, x_6, x_7);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_3);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; size_t 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; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; size_t 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; size_t x_43; size_t x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; size_t x_48; lean_object* x_49;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitLLVM_callLeanIsExclusive(x_1, x_2, x_23, x_8, x_5, x_6, x_21);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_ctor_get(x_25, 0);
lean_inc(x_27);
lean_dec(x_25);
x_28 = l_LLVM_i1Type(x_1, x_26);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_32 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_33 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_31, x_32, x_8, x_30);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_unbox_usize(x_34);
lean_dec(x_34);
x_37 = lean_llvm_build_not(x_1, x_2, x_36, x_8, x_35);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = l_LLVM_i8Type(x_1, x_39);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_44 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_45 = lean_llvm_build_sext(x_1, x_2, x_43, x_44, x_8, x_42);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_48 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_49 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_48, x_5, x_6, x_47);
return x_49;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitIsShared___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitIsShared(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___lambda__1(size_t x_1, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; size_t x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; size_t x_39; lean_object* x_40;
x_8 = lean_ctor_get(x_4, 1);
lean_inc(x_8);
x_9 = lean_ctor_get(x_4, 0);
lean_inc(x_9);
lean_dec(x_4);
x_10 = lean_ctor_get(x_8, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_8, 1);
lean_inc(x_11);
lean_dec(x_8);
x_12 = l_LLVM_voidPtrType(x_1, x_7);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_16 = lean_array_push(x_15, x_10);
x_17 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_14);
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 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_22 = lean_unbox_usize(x_13);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_9, x_16, x_5, x_6, x_19);
lean_dec(x_9);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_ctor_get(x_24, 0);
lean_inc(x_26);
lean_dec(x_24);
x_27 = 0;
x_28 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_29 = lean_llvm_function_type(x_1, x_28, x_16, x_27, x_25);
lean_dec(x_16);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_array_push(x_15, x_11);
x_33 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_34 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_35 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_36 = lean_llvm_build_call2(x_1, x_2, x_34, x_35, x_32, x_33, x_31);
lean_dec(x_32);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_40 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_39, x_5, x_6, x_38);
return x_40;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitBox___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box_float", 14);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitBox___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box_uint32", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitBox___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box_uint64", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitBox___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_box_usize", 14);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox(size_t x_1, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_4, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
switch (lean_obj_tag(x_5)) {
case 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_30;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_llvm_double_type_in_context(x_1, x_22);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_25);
lean_ctor_set(x_27, 1, x_23);
x_28 = l_Lean_IR_EmitLLVM_emitBox___closed__1;
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_27);
x_30 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_1, x_2, x_3, x_29, x_6, x_7, x_26);
lean_dec(x_7);
lean_dec(x_6);
return x_30;
}
case 3:
{
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_31 = lean_ctor_get(x_10, 1);
lean_inc(x_31);
lean_dec(x_10);
x_32 = lean_ctor_get(x_11, 0);
lean_inc(x_32);
lean_dec(x_11);
x_33 = l_LLVM_i32Type(x_1, x_31);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_32);
x_37 = l_Lean_IR_EmitLLVM_emitBox___closed__2;
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_36);
x_39 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_1, x_2, x_3, x_38, x_6, x_7, x_35);
lean_dec(x_7);
lean_dec(x_6);
return x_39;
}
case 4:
{
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;
x_40 = lean_ctor_get(x_10, 1);
lean_inc(x_40);
lean_dec(x_10);
x_41 = lean_ctor_get(x_11, 0);
lean_inc(x_41);
lean_dec(x_11);
x_42 = l_Lean_IR_LLVM_size__tType(x_1, x_40);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
x_44 = lean_ctor_get(x_42, 1);
lean_inc(x_44);
lean_dec(x_42);
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_43);
lean_ctor_set(x_45, 1, x_41);
x_46 = l_Lean_IR_EmitLLVM_emitBox___closed__3;
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_45);
x_48 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_1, x_2, x_3, x_47, x_6, x_7, x_44);
lean_dec(x_7);
lean_dec(x_6);
return x_48;
}
case 5:
{
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_10, 1);
lean_inc(x_49);
lean_dec(x_10);
x_50 = lean_ctor_get(x_11, 0);
lean_inc(x_50);
lean_dec(x_11);
x_51 = l_Lean_IR_LLVM_size__tType(x_1, x_49);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_52);
lean_ctor_set(x_54, 1, x_50);
x_55 = l_Lean_IR_EmitLLVM_emitBox___closed__4;
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_54);
x_57 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_1, x_2, x_3, x_56, x_6, x_7, x_53);
lean_dec(x_7);
lean_dec(x_6);
return x_57;
}
default:
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; size_t x_63; size_t x_64; 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_dec(x_5);
x_58 = lean_ctor_get(x_10, 1);
lean_inc(x_58);
lean_dec(x_10);
x_59 = lean_ctor_get(x_11, 0);
lean_inc(x_59);
lean_dec(x_11);
x_60 = l_Lean_IR_LLVM_size__tType(x_1, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_64 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_65 = lean_llvm_build_sext(x_1, x_2, x_63, x_64, x_9, x_62);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = l_Lean_IR_LLVM_size__tType(x_1, x_67);
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
lean_dec(x_68);
x_71 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_71, 0, x_69);
lean_ctor_set(x_71, 1, x_66);
x_72 = l_Lean_IR_EmitLLVM_callLeanBox___closed__2;
x_73 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_73, 0, x_72);
lean_ctor_set(x_73, 1, x_71);
x_74 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_1, x_2, x_3, x_73, x_6, x_7, x_70);
lean_dec(x_7);
lean_dec(x_6);
return x_74;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___lambda__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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitBox___lambda__1(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBox___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitBox(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT uint8_t l_Lean_IR_EmitLLVM_IRType_isIntegerType(lean_object* x_1) {
_start:
{
switch (lean_obj_tag(x_1)) {
case 1:
{
uint8_t x_2;
x_2 = 1;
return x_2;
}
case 2:
{
uint8_t x_3;
x_3 = 1;
return x_3;
}
case 3:
{
uint8_t x_4;
x_4 = 1;
return x_4;
}
case 4:
{
uint8_t x_5;
x_5 = 1;
return x_5;
}
case 5:
{
uint8_t x_6;
x_6 = 1;
return x_6;
}
default:
{
uint8_t x_7;
x_7 = 0;
return x_7;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_IRType_isIntegerType___boxed(lean_object* x_1) {
_start:
{
uint8_t x_2; lean_object* x_3;
x_2 = l_Lean_IR_EmitLLVM_IRType_isIntegerType(x_1);
lean_dec(x_1);
x_3 = lean_box(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(size_t x_1, size_t x_2, size_t 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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_9 = lean_ctor_get(x_5, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_5, 1);
lean_inc(x_10);
lean_dec(x_5);
x_11 = l_LLVM_voidPtrType(x_1, x_8);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_21 = lean_unbox_usize(x_10);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_9, x_15, x_6, x_7, x_18);
lean_dec(x_9);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = !lean_is_exclusive(x_23);
if (x_25 == 0)
{
lean_object* x_26; uint8_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; size_t x_35; lean_object* x_36; uint8_t x_37;
x_26 = lean_ctor_get(x_23, 0);
x_27 = 0;
x_28 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_29 = lean_llvm_function_type(x_1, x_28, x_15, x_27, x_24);
lean_dec(x_15);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_box_usize(x_2);
x_33 = lean_array_push(x_14, x_32);
x_34 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_35 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_36 = lean_llvm_build_call2(x_1, x_3, x_34, x_35, x_33, x_4, x_31);
lean_dec(x_33);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38;
x_38 = lean_ctor_get(x_36, 0);
lean_ctor_set(x_23, 0, x_38);
lean_ctor_set(x_36, 0, x_23);
return x_36;
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_39 = lean_ctor_get(x_36, 0);
x_40 = lean_ctor_get(x_36, 1);
lean_inc(x_40);
lean_inc(x_39);
lean_dec(x_36);
lean_ctor_set(x_23, 0, x_39);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_23);
lean_ctor_set(x_41, 1, x_40);
return x_41;
}
}
else
{
lean_object* x_42; uint8_t x_43; size_t x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; size_t x_50; size_t 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_42 = lean_ctor_get(x_23, 0);
lean_inc(x_42);
lean_dec(x_23);
x_43 = 0;
x_44 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_45 = lean_llvm_function_type(x_1, x_44, x_15, x_43, x_24);
lean_dec(x_15);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_48 = lean_box_usize(x_2);
x_49 = lean_array_push(x_14, x_48);
x_50 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_51 = lean_unbox_usize(x_42);
lean_dec(x_42);
x_52 = lean_llvm_build_call2(x_1, x_3, x_50, x_51, x_49, x_4, x_47);
lean_dec(x_49);
x_53 = lean_ctor_get(x_52, 0);
lean_inc(x_53);
x_54 = lean_ctor_get(x_52, 1);
lean_inc(x_54);
if (lean_is_exclusive(x_52)) {
lean_ctor_release(x_52, 0);
lean_ctor_release(x_52, 1);
x_55 = x_52;
} else {
lean_dec_ref(x_52);
x_55 = lean_box(0);
}
x_56 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_56, 0, x_53);
if (lean_is_scalar(x_55)) {
x_57 = lean_alloc_ctor(0, 2, 0);
} else {
x_57 = x_55;
}
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_54);
return x_57;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unbox_float", 16);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unbox", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unbox_uint32", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unbox_uint64", 17);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_unbox_usize", 16);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
switch (lean_obj_tag(x_3)) {
case 0:
{
lean_object* x_9;
lean_inc(x_7);
lean_inc(x_6);
x_9 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_3, x_6, x_7, x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10;
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
lean_dec(x_10);
x_23 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__1;
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_22);
x_25 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_1, x_4, x_2, x_5, x_24, x_6, x_7, x_21);
lean_dec(x_7);
lean_dec(x_6);
return x_25;
}
}
else
{
uint8_t x_26;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_9);
if (x_26 == 0)
{
return x_9;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_9, 0);
x_28 = lean_ctor_get(x_9, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_9);
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;
}
}
}
case 3:
{
lean_object* x_30;
lean_inc(x_7);
lean_inc(x_6);
x_30 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_3, x_6, x_7, x_8);
if (lean_obj_tag(x_30) == 0)
{
lean_object* x_31;
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
if (lean_obj_tag(x_31) == 0)
{
uint8_t x_32;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_32 = !lean_is_exclusive(x_30);
if (x_32 == 0)
{
lean_object* x_33; uint8_t x_34;
x_33 = lean_ctor_get(x_30, 0);
lean_dec(x_33);
x_34 = !lean_is_exclusive(x_31);
if (x_34 == 0)
{
return x_30;
}
else
{
lean_object* x_35; lean_object* x_36;
x_35 = lean_ctor_get(x_31, 0);
lean_inc(x_35);
lean_dec(x_31);
x_36 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_30, 0, x_36);
return x_30;
}
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_37 = lean_ctor_get(x_30, 1);
lean_inc(x_37);
lean_dec(x_30);
x_38 = lean_ctor_get(x_31, 0);
lean_inc(x_38);
if (lean_is_exclusive(x_31)) {
lean_ctor_release(x_31, 0);
x_39 = x_31;
} else {
lean_dec_ref(x_31);
x_39 = lean_box(0);
}
if (lean_is_scalar(x_39)) {
x_40 = lean_alloc_ctor(0, 1, 0);
} else {
x_40 = x_39;
}
lean_ctor_set(x_40, 0, x_38);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_37);
return x_41;
}
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_42 = lean_ctor_get(x_30, 1);
lean_inc(x_42);
lean_dec(x_30);
x_43 = lean_ctor_get(x_31, 0);
lean_inc(x_43);
lean_dec(x_31);
x_44 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__3;
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_43);
x_46 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_1, x_4, x_2, x_5, x_45, x_6, x_7, x_42);
lean_dec(x_7);
lean_dec(x_6);
return x_46;
}
}
else
{
uint8_t x_47;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_47 = !lean_is_exclusive(x_30);
if (x_47 == 0)
{
return x_30;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_48 = lean_ctor_get(x_30, 0);
x_49 = lean_ctor_get(x_30, 1);
lean_inc(x_49);
lean_inc(x_48);
lean_dec(x_30);
x_50 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_50, 0, x_48);
lean_ctor_set(x_50, 1, x_49);
return x_50;
}
}
}
case 4:
{
lean_object* x_51;
lean_inc(x_7);
lean_inc(x_6);
x_51 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_3, x_6, x_7, x_8);
if (lean_obj_tag(x_51) == 0)
{
lean_object* x_52;
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
if (lean_obj_tag(x_52) == 0)
{
uint8_t x_53;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_53 = !lean_is_exclusive(x_51);
if (x_53 == 0)
{
lean_object* x_54; uint8_t x_55;
x_54 = lean_ctor_get(x_51, 0);
lean_dec(x_54);
x_55 = !lean_is_exclusive(x_52);
if (x_55 == 0)
{
return x_51;
}
else
{
lean_object* x_56; lean_object* x_57;
x_56 = lean_ctor_get(x_52, 0);
lean_inc(x_56);
lean_dec(x_52);
x_57 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_51, 0, x_57);
return x_51;
}
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
x_58 = lean_ctor_get(x_51, 1);
lean_inc(x_58);
lean_dec(x_51);
x_59 = lean_ctor_get(x_52, 0);
lean_inc(x_59);
if (lean_is_exclusive(x_52)) {
lean_ctor_release(x_52, 0);
x_60 = x_52;
} else {
lean_dec_ref(x_52);
x_60 = lean_box(0);
}
if (lean_is_scalar(x_60)) {
x_61 = lean_alloc_ctor(0, 1, 0);
} else {
x_61 = x_60;
}
lean_ctor_set(x_61, 0, x_59);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_61);
lean_ctor_set(x_62, 1, x_58);
return x_62;
}
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_63 = lean_ctor_get(x_51, 1);
lean_inc(x_63);
lean_dec(x_51);
x_64 = lean_ctor_get(x_52, 0);
lean_inc(x_64);
lean_dec(x_52);
x_65 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__4;
x_66 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_64);
x_67 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_1, x_4, x_2, x_5, x_66, x_6, x_7, x_63);
lean_dec(x_7);
lean_dec(x_6);
return x_67;
}
}
else
{
uint8_t x_68;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_68 = !lean_is_exclusive(x_51);
if (x_68 == 0)
{
return x_51;
}
else
{
lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_69 = lean_ctor_get(x_51, 0);
x_70 = lean_ctor_get(x_51, 1);
lean_inc(x_70);
lean_inc(x_69);
lean_dec(x_51);
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;
}
}
}
case 5:
{
lean_object* x_72;
lean_inc(x_7);
lean_inc(x_6);
x_72 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_3, x_6, x_7, x_8);
if (lean_obj_tag(x_72) == 0)
{
lean_object* x_73;
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
if (lean_obj_tag(x_73) == 0)
{
uint8_t x_74;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_74 = !lean_is_exclusive(x_72);
if (x_74 == 0)
{
lean_object* x_75; uint8_t x_76;
x_75 = lean_ctor_get(x_72, 0);
lean_dec(x_75);
x_76 = !lean_is_exclusive(x_73);
if (x_76 == 0)
{
return x_72;
}
else
{
lean_object* x_77; lean_object* x_78;
x_77 = lean_ctor_get(x_73, 0);
lean_inc(x_77);
lean_dec(x_73);
x_78 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_78, 0, x_77);
lean_ctor_set(x_72, 0, x_78);
return x_72;
}
}
else
{
lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83;
x_79 = lean_ctor_get(x_72, 1);
lean_inc(x_79);
lean_dec(x_72);
x_80 = lean_ctor_get(x_73, 0);
lean_inc(x_80);
if (lean_is_exclusive(x_73)) {
lean_ctor_release(x_73, 0);
x_81 = x_73;
} else {
lean_dec_ref(x_73);
x_81 = lean_box(0);
}
if (lean_is_scalar(x_81)) {
x_82 = lean_alloc_ctor(0, 1, 0);
} else {
x_82 = x_81;
}
lean_ctor_set(x_82, 0, x_80);
x_83 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_83, 0, x_82);
lean_ctor_set(x_83, 1, x_79);
return x_83;
}
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_84 = lean_ctor_get(x_72, 1);
lean_inc(x_84);
lean_dec(x_72);
x_85 = lean_ctor_get(x_73, 0);
lean_inc(x_85);
lean_dec(x_73);
x_86 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__5;
x_87 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_87, 0, x_86);
lean_ctor_set(x_87, 1, x_85);
x_88 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_1, x_4, x_2, x_5, x_87, x_6, x_7, x_84);
lean_dec(x_7);
lean_dec(x_6);
return x_88;
}
}
else
{
uint8_t x_89;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_89 = !lean_is_exclusive(x_72);
if (x_89 == 0)
{
return x_72;
}
else
{
lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_90 = lean_ctor_get(x_72, 0);
x_91 = lean_ctor_get(x_72, 1);
lean_inc(x_91);
lean_inc(x_90);
lean_dec(x_72);
x_92 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_92, 0, x_90);
lean_ctor_set(x_92, 1, x_91);
return x_92;
}
}
}
default:
{
lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98;
lean_dec(x_3);
x_93 = l_Lean_IR_LLVM_size__tType(x_1, x_8);
x_94 = lean_ctor_get(x_93, 0);
lean_inc(x_94);
x_95 = lean_ctor_get(x_93, 1);
lean_inc(x_95);
lean_dec(x_93);
x_96 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__2;
x_97 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_97, 0, x_96);
lean_ctor_set(x_97, 1, x_94);
x_98 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_1, x_4, x_2, x_5, x_97, x_6, x_7, x_95);
lean_dec(x_7);
lean_dec(x_6);
return x_98;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___lambda__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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = l_Lean_IR_EmitLLVM_callUnboxForType___lambda__1(x_9, x_10, x_11, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callUnboxForType___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:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_callUnboxForType(x_9, x_10, x_3, x_11, x_5, x_6, x_7, x_8);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnbox(size_t x_1, size_t 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, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_11 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_5, x_10, x_7, x_8, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
lean_dec(x_3);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = !lean_is_exclusive(x_12);
if (x_15 == 0)
{
return x_11;
}
else
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_ctor_get(x_12, 0);
lean_inc(x_16);
lean_dec(x_12);
x_17 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_11, 0, x_17);
return x_11;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_18 = lean_ctor_get(x_11, 1);
lean_inc(x_18);
lean_dec(x_11);
x_19 = lean_ctor_get(x_12, 0);
lean_inc(x_19);
if (lean_is_exclusive(x_12)) {
lean_ctor_release(x_12, 0);
x_20 = x_12;
} else {
lean_dec_ref(x_12);
x_20 = lean_box(0);
}
if (lean_is_scalar(x_20)) {
x_21 = lean_alloc_ctor(0, 1, 0);
} else {
x_21 = x_20;
}
lean_ctor_set(x_21, 0, x_19);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_18);
return x_22;
}
}
else
{
lean_object* x_23; lean_object* x_24; size_t x_25; lean_object* x_26;
x_23 = lean_ctor_get(x_11, 1);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_ctor_get(x_12, 0);
lean_inc(x_24);
lean_dec(x_12);
x_25 = lean_unbox_usize(x_24);
lean_dec(x_24);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_4);
x_26 = l_Lean_IR_EmitLLVM_callUnboxForType(x_1, x_2, x_4, x_25, x_6, x_7, x_8, x_23);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_27;
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
if (lean_obj_tag(x_27) == 0)
{
uint8_t x_28;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
x_28 = !lean_is_exclusive(x_26);
if (x_28 == 0)
{
lean_object* x_29; uint8_t x_30;
x_29 = lean_ctor_get(x_26, 0);
lean_dec(x_29);
x_30 = !lean_is_exclusive(x_27);
if (x_30 == 0)
{
return x_26;
}
else
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_27, 0);
lean_inc(x_31);
lean_dec(x_27);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_26, 0, x_32);
return x_26;
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_33 = lean_ctor_get(x_26, 1);
lean_inc(x_33);
lean_dec(x_26);
x_34 = lean_ctor_get(x_27, 0);
lean_inc(x_34);
if (lean_is_exclusive(x_27)) {
lean_ctor_release(x_27, 0);
x_35 = x_27;
} else {
lean_dec_ref(x_27);
x_35 = lean_box(0);
}
if (lean_is_scalar(x_35)) {
x_36 = lean_alloc_ctor(0, 1, 0);
} else {
x_36 = x_35;
}
lean_ctor_set(x_36, 0, x_34);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_33);
return x_37;
}
}
else
{
lean_object* x_38; lean_object* x_39; uint8_t x_40;
x_38 = lean_ctor_get(x_26, 1);
lean_inc(x_38);
lean_dec(x_26);
x_39 = lean_ctor_get(x_27, 0);
lean_inc(x_39);
lean_dec(x_27);
x_40 = l_Lean_IR_EmitLLVM_IRType_isIntegerType(x_4);
if (x_40 == 0)
{
size_t x_41; lean_object* x_42;
lean_dec(x_4);
x_41 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_42 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_41, x_7, x_8, x_38);
lean_dec(x_8);
lean_dec(x_7);
return x_42;
}
else
{
lean_object* x_43;
lean_inc(x_8);
lean_inc(x_7);
x_43 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_4, x_7, x_8, x_38);
if (lean_obj_tag(x_43) == 0)
{
lean_object* x_44;
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
if (lean_obj_tag(x_44) == 0)
{
uint8_t x_45;
lean_dec(x_39);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_45 = !lean_is_exclusive(x_43);
if (x_45 == 0)
{
lean_object* x_46; uint8_t x_47;
x_46 = lean_ctor_get(x_43, 0);
lean_dec(x_46);
x_47 = !lean_is_exclusive(x_44);
if (x_47 == 0)
{
return x_43;
}
else
{
lean_object* x_48; lean_object* x_49;
x_48 = lean_ctor_get(x_44, 0);
lean_inc(x_48);
lean_dec(x_44);
x_49 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_43, 0, x_49);
return x_43;
}
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_50 = lean_ctor_get(x_43, 1);
lean_inc(x_50);
lean_dec(x_43);
x_51 = lean_ctor_get(x_44, 0);
lean_inc(x_51);
if (lean_is_exclusive(x_44)) {
lean_ctor_release(x_44, 0);
x_52 = x_44;
} else {
lean_dec_ref(x_44);
x_52 = lean_box(0);
}
if (lean_is_scalar(x_52)) {
x_53 = lean_alloc_ctor(0, 1, 0);
} else {
x_53 = x_52;
}
lean_ctor_set(x_53, 0, x_51);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_53);
lean_ctor_set(x_54, 1, x_50);
return x_54;
}
}
else
{
lean_object* x_55; lean_object* x_56; size_t x_57; size_t x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; size_t x_62; lean_object* x_63;
x_55 = lean_ctor_get(x_43, 1);
lean_inc(x_55);
lean_dec(x_43);
x_56 = lean_ctor_get(x_44, 0);
lean_inc(x_56);
lean_dec(x_44);
x_57 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_58 = lean_unbox_usize(x_56);
lean_dec(x_56);
x_59 = lean_llvm_build_sext_or_trunc(x_1, x_2, x_57, x_58, x_10, x_55);
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
lean_dec(x_59);
x_62 = lean_unbox_usize(x_60);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_3, x_62, x_7, x_8, x_61);
lean_dec(x_8);
lean_dec(x_7);
return x_63;
}
}
else
{
uint8_t x_64;
lean_dec(x_39);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_64 = !lean_is_exclusive(x_43);
if (x_64 == 0)
{
return x_43;
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_65 = lean_ctor_get(x_43, 0);
x_66 = lean_ctor_get(x_43, 1);
lean_inc(x_66);
lean_inc(x_65);
lean_dec(x_43);
x_67 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_67, 0, x_65);
lean_ctor_set(x_67, 1, x_66);
return x_67;
}
}
}
}
}
else
{
uint8_t x_68;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
x_68 = !lean_is_exclusive(x_26);
if (x_68 == 0)
{
return x_26;
}
else
{
lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_69 = lean_ctor_get(x_26, 0);
x_70 = lean_ctor_get(x_26, 1);
lean_inc(x_70);
lean_inc(x_69);
lean_dec(x_26);
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;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnbox___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; lean_object* x_12;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = l_Lean_IR_EmitLLVM_emitUnbox(x_10, x_11, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___spec__1(size_t x_1, size_t x_2, size_t 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; uint8_t x_10;
x_9 = lean_unsigned_to_nat(0u);
x_10 = lean_nat_dec_eq(x_5, 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; lean_object* x_18; lean_object* x_19; size_t x_20; lean_object* x_21; lean_object* x_22;
x_11 = lean_unsigned_to_nat(1u);
x_12 = lean_nat_sub(x_5, x_11);
lean_dec(x_5);
x_13 = lean_nat_sub(x_4, x_12);
x_14 = lean_nat_sub(x_13, x_11);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_14, x_6, x_7, x_8);
lean_dec(x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_callLeanCtorRelease(x_1, x_2, x_3, x_20, x_19, x_6, x_7, x_17);
x_22 = lean_ctor_get(x_21, 1);
lean_inc(x_22);
lean_dec(x_21);
x_5 = x_12;
x_8 = x_22;
goto _start;
}
else
{
lean_object* x_24; lean_object* x_25;
lean_dec(x_5);
x_24 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_8);
return x_25;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1() {
_start:
{
uint8_t x_1; lean_object* x_2; lean_object* x_3;
x_1 = 0;
x_2 = lean_box(x_1);
x_3 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_3, 0, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__1(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_5, x_2, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_4);
lean_dec(x_3);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; lean_object* x_26; size_t x_27; lean_object* x_28; lean_object* x_29;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_unbox_usize(x_23);
lean_inc(x_3);
x_25 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___spec__1(x_1, x_5, x_24, x_3, x_3, x_6, x_7, x_22);
lean_dec(x_3);
x_26 = lean_ctor_get(x_25, 1);
lean_inc(x_26);
lean_dec(x_25);
x_27 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_28 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_5, x_4, x_27, x_6, x_7, x_26);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
if (lean_obj_tag(x_29) == 0)
{
uint8_t x_30;
x_30 = !lean_is_exclusive(x_28);
if (x_30 == 0)
{
lean_object* x_31; uint8_t x_32;
x_31 = lean_ctor_get(x_28, 0);
lean_dec(x_31);
x_32 = !lean_is_exclusive(x_29);
if (x_32 == 0)
{
return x_28;
}
else
{
lean_object* x_33; lean_object* x_34;
x_33 = lean_ctor_get(x_29, 0);
lean_inc(x_33);
lean_dec(x_29);
x_34 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_28, 0, x_34);
return x_28;
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_35 = lean_ctor_get(x_28, 1);
lean_inc(x_35);
lean_dec(x_28);
x_36 = lean_ctor_get(x_29, 0);
lean_inc(x_36);
if (lean_is_exclusive(x_29)) {
lean_ctor_release(x_29, 0);
x_37 = x_29;
} else {
lean_dec_ref(x_29);
x_37 = lean_box(0);
}
if (lean_is_scalar(x_37)) {
x_38 = lean_alloc_ctor(0, 1, 0);
} else {
x_38 = x_37;
}
lean_ctor_set(x_38, 0, x_36);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_35);
return x_39;
}
}
else
{
uint8_t x_40;
lean_dec(x_29);
x_40 = !lean_is_exclusive(x_28);
if (x_40 == 0)
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_28, 0);
lean_dec(x_41);
x_42 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
lean_ctor_set(x_28, 0, x_42);
return x_28;
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_43 = lean_ctor_get(x_28, 1);
lean_inc(x_43);
lean_dec(x_28);
x_44 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
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;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("box0", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__2(size_t x_1, lean_object* x_2, lean_object* x_3, size_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;
x_8 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_9 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_4, x_2, x_8, x_5, x_6, x_7);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
lean_dec(x_3);
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_9, 0, x_15);
return x_9;
}
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_ctor_get(x_10, 0);
lean_inc(x_17);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_18 = x_10;
} else {
lean_dec_ref(x_10);
x_18 = lean_box(0);
}
if (lean_is_scalar(x_18)) {
x_19 = lean_alloc_ctor(0, 1, 0);
} else {
x_19 = x_18;
}
lean_ctor_set(x_19, 0, x_17);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
else
{
lean_object* x_21; lean_object* x_22; size_t 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; size_t x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; size_t x_37; lean_object* x_38; lean_object* x_39;
x_21 = lean_ctor_get(x_9, 1);
lean_inc(x_21);
lean_dec(x_9);
x_22 = lean_ctor_get(x_10, 0);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_24 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_1, x_4, x_23, x_5, x_6, x_21);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = lean_unsigned_to_nat(0u);
x_27 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_26, x_5, x_6, x_25);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
x_32 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_33 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_4, x_32, x_31, x_5, x_6, x_29);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_ctor_get(x_34, 0);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_unbox_usize(x_36);
lean_dec(x_36);
x_38 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_4, x_3, x_37, x_5, x_6, x_35);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
if (lean_obj_tag(x_39) == 0)
{
uint8_t x_40;
x_40 = !lean_is_exclusive(x_38);
if (x_40 == 0)
{
lean_object* x_41; uint8_t x_42;
x_41 = lean_ctor_get(x_38, 0);
lean_dec(x_41);
x_42 = !lean_is_exclusive(x_39);
if (x_42 == 0)
{
return x_38;
}
else
{
lean_object* x_43; lean_object* x_44;
x_43 = lean_ctor_get(x_39, 0);
lean_inc(x_43);
lean_dec(x_39);
x_44 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_38, 0, x_44);
return x_38;
}
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_45 = lean_ctor_get(x_38, 1);
lean_inc(x_45);
lean_dec(x_38);
x_46 = lean_ctor_get(x_39, 0);
lean_inc(x_46);
if (lean_is_exclusive(x_39)) {
lean_ctor_release(x_39, 0);
x_47 = x_39;
} else {
lean_dec_ref(x_39);
x_47 = lean_box(0);
}
if (lean_is_scalar(x_47)) {
x_48 = lean_alloc_ctor(0, 1, 0);
} else {
x_48 = x_47;
}
lean_ctor_set(x_48, 0, x_46);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_49, 1, x_45);
return x_49;
}
}
else
{
uint8_t x_50;
lean_dec(x_39);
x_50 = !lean_is_exclusive(x_38);
if (x_50 == 0)
{
lean_object* x_51; lean_object* x_52;
x_51 = lean_ctor_get(x_38, 0);
lean_dec(x_51);
x_52 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
lean_ctor_set(x_38, 0, x_52);
return x_38;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_53 = lean_ctor_get(x_38, 1);
lean_inc(x_53);
lean_dec(x_38);
x_54 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
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;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitReset___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("isExclusive", 11);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset(size_t x_1, size_t 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;
x_9 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
lean_inc(x_5);
x_10 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_5, x_9, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; size_t 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; size_t x_39; lean_object* x_40;
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_23 = lean_ctor_get(x_11, 0);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_25 = l_Lean_IR_EmitLLVM_callLeanIsExclusive(x_1, x_2, x_24, x_9, x_6, x_7, x_22);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_ctor_get(x_26, 0);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_30 = l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(x_1, x_2, x_29, x_9, x_6, x_7, x_27);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_ctor_get(x_31, 0);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_box_usize(x_1);
lean_inc(x_3);
lean_inc(x_5);
x_35 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitReset___lambda__1___boxed), 8, 4);
lean_closure_set(x_35, 0, x_34);
lean_closure_set(x_35, 1, x_5);
lean_closure_set(x_35, 2, x_4);
lean_closure_set(x_35, 3, x_3);
x_36 = lean_box_usize(x_1);
x_37 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitReset___lambda__2___boxed), 7, 3);
lean_closure_set(x_37, 0, x_36);
lean_closure_set(x_37, 1, x_5);
lean_closure_set(x_37, 2, x_3);
x_38 = l_Lean_IR_EmitLLVM_emitReset___closed__1;
x_39 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_40 = l_Lean_IR_EmitLLVM_buildIfThenElse__(x_1, x_2, x_38, x_39, x_35, x_37, x_6, x_7, x_32);
return x_40;
}
}
}
LEAN_EXPORT lean_object* l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = l_Nat_forM_loop___at_Lean_IR_EmitLLVM_emitReset___spec__1(x_9, x_10, x_11, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_11 = l_Lean_IR_EmitLLVM_emitReset___lambda__1(x_9, x_2, x_3, x_4, x_10, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___lambda__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, lean_object* x_7) {
_start:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_10 = l_Lean_IR_EmitLLVM_emitReset___lambda__2(x_8, x_2, x_3, x_9, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReset___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitReset(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__1(size_t x_1, lean_object* x_2, lean_object* x_3, size_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; size_t x_12; lean_object* x_13; lean_object* x_14;
x_8 = l_Lean_IR_EmitLLVM_emitAllocCtor(x_1, x_4, x_2, x_5, x_6, x_7);
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, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_13 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_4, x_3, x_12, x_5, x_6, x_10);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16; uint8_t x_17;
x_16 = lean_ctor_get(x_13, 0);
lean_dec(x_16);
x_17 = !lean_is_exclusive(x_14);
if (x_17 == 0)
{
return x_13;
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_13, 0, x_19);
return x_13;
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_20 = lean_ctor_get(x_13, 1);
lean_inc(x_20);
lean_dec(x_13);
x_21 = lean_ctor_get(x_14, 0);
lean_inc(x_21);
if (lean_is_exclusive(x_14)) {
lean_ctor_release(x_14, 0);
x_22 = x_14;
} else {
lean_dec_ref(x_14);
x_22 = lean_box(0);
}
if (lean_is_scalar(x_22)) {
x_23 = lean_alloc_ctor(0, 1, 0);
} else {
x_23 = x_22;
}
lean_ctor_set(x_23, 0, x_21);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_20);
return x_24;
}
}
else
{
uint8_t x_25;
lean_dec(x_14);
x_25 = !lean_is_exclusive(x_13);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_13, 0);
lean_dec(x_26);
x_27 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
lean_ctor_set(x_13, 0, x_27);
return x_13;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_dec(x_13);
x_29 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
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;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__2(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 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
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;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitReuse___lambda__2___boxed), 4, 0);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__3(size_t x_1, lean_object* x_2, lean_object* x_3, uint8_t x_4, lean_object* x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_11 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_6, x_2, x_10, x_7, x_8, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14; uint8_t x_15;
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = !lean_is_exclusive(x_12);
if (x_15 == 0)
{
return x_11;
}
else
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_ctor_get(x_12, 0);
lean_inc(x_16);
lean_dec(x_12);
x_17 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_11, 0, x_17);
return x_11;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_18 = lean_ctor_get(x_11, 1);
lean_inc(x_18);
lean_dec(x_11);
x_19 = lean_ctor_get(x_12, 0);
lean_inc(x_19);
if (lean_is_exclusive(x_12)) {
lean_ctor_release(x_12, 0);
x_20 = x_12;
} else {
lean_dec_ref(x_12);
x_20 = lean_box(0);
}
if (lean_is_scalar(x_20)) {
x_21 = lean_alloc_ctor(0, 1, 0);
} else {
x_21 = x_20;
}
lean_ctor_set(x_21, 0, x_19);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_18);
return x_22;
}
}
else
{
lean_object* x_23; lean_object* x_24; size_t x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_11, 1);
lean_inc(x_23);
lean_dec(x_11);
x_24 = lean_ctor_get(x_12, 0);
lean_inc(x_24);
lean_dec(x_12);
x_25 = lean_unbox_usize(x_24);
lean_dec(x_24);
lean_inc(x_3);
x_26 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_6, x_3, x_25, x_7, x_8, x_23);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
if (lean_obj_tag(x_27) == 0)
{
uint8_t x_28;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
x_28 = !lean_is_exclusive(x_26);
if (x_28 == 0)
{
lean_object* x_29; uint8_t x_30;
x_29 = lean_ctor_get(x_26, 0);
lean_dec(x_29);
x_30 = !lean_is_exclusive(x_27);
if (x_30 == 0)
{
return x_26;
}
else
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_27, 0);
lean_inc(x_31);
lean_dec(x_27);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_26, 0, x_32);
return x_26;
}
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_33 = lean_ctor_get(x_26, 1);
lean_inc(x_33);
lean_dec(x_26);
x_34 = lean_ctor_get(x_27, 0);
lean_inc(x_34);
if (lean_is_exclusive(x_27)) {
lean_ctor_release(x_27, 0);
x_35 = x_27;
} else {
lean_dec_ref(x_27);
x_35 = lean_box(0);
}
if (lean_is_scalar(x_35)) {
x_36 = lean_alloc_ctor(0, 1, 0);
} else {
x_36 = x_35;
}
lean_ctor_set(x_36, 0, x_34);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_33);
return x_37;
}
}
else
{
lean_object* x_38; lean_object* x_39;
lean_dec(x_27);
x_38 = lean_ctor_get(x_26, 1);
lean_inc(x_38);
lean_dec(x_26);
x_39 = l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1;
if (x_4 == 0)
{
lean_object* x_40; lean_object* x_41;
lean_dec(x_3);
x_40 = lean_box(0);
x_41 = lean_apply_4(x_39, x_40, x_7, x_8, x_38);
return x_41;
}
else
{
lean_object* x_42; lean_object* x_43;
x_42 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_6, x_3, x_10, x_7, x_8, x_38);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
if (lean_obj_tag(x_43) == 0)
{
uint8_t x_44;
lean_dec(x_8);
lean_dec(x_7);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
lean_object* x_45; uint8_t x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_dec(x_45);
x_46 = !lean_is_exclusive(x_43);
if (x_46 == 0)
{
return x_42;
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_43, 0);
lean_inc(x_47);
lean_dec(x_43);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_42, 0, x_48);
return x_42;
}
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_49 = lean_ctor_get(x_42, 1);
lean_inc(x_49);
lean_dec(x_42);
x_50 = lean_ctor_get(x_43, 0);
lean_inc(x_50);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
x_51 = x_43;
} else {
lean_dec_ref(x_43);
x_51 = lean_box(0);
}
if (lean_is_scalar(x_51)) {
x_52 = lean_alloc_ctor(0, 1, 0);
} else {
x_52 = x_51;
}
lean_ctor_set(x_52, 0, x_50);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_49);
return x_53;
}
}
else
{
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; size_t x_61; size_t x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_54 = lean_ctor_get(x_42, 1);
lean_inc(x_54);
lean_dec(x_42);
x_55 = lean_ctor_get(x_43, 0);
lean_inc(x_55);
lean_dec(x_43);
x_56 = lean_ctor_get(x_5, 1);
x_57 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_56, x_7, x_8, x_54);
x_58 = lean_ctor_get(x_57, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_57, 1);
lean_inc(x_59);
lean_dec(x_57);
x_60 = lean_ctor_get(x_58, 0);
lean_inc(x_60);
lean_dec(x_58);
x_61 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_62 = lean_unbox_usize(x_60);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_callLeanCtorSetTag(x_1, x_6, x_61, x_62, x_10, x_7, x_8, x_59);
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_ctor_get(x_64, 0);
lean_inc(x_66);
lean_dec(x_64);
x_67 = lean_apply_4(x_39, x_66, x_7, x_8, x_65);
return x_67;
}
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitReuse___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("isScalar", 8);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, uint8_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
lean_inc(x_4);
x_12 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_4, x_11, x_8, x_9, x_10);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
else
{
lean_object* x_24; lean_object* x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t 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; size_t x_42; lean_object* x_43;
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_25 = lean_ctor_get(x_13, 0);
lean_inc(x_25);
lean_dec(x_13);
x_26 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_27 = l_Lean_IR_EmitLLVM_callLeanIsScalar(x_1, x_2, x_26, x_11, x_8, x_9, x_24);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_32 = l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(x_1, x_2, x_31, x_11, x_8, x_9, x_29);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = lean_box_usize(x_1);
lean_inc(x_3);
lean_inc(x_5);
x_37 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitReuse___lambda__1___boxed), 7, 3);
lean_closure_set(x_37, 0, x_36);
lean_closure_set(x_37, 1, x_5);
lean_closure_set(x_37, 2, x_3);
x_38 = lean_box_usize(x_1);
x_39 = lean_box(x_6);
lean_inc(x_3);
x_40 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitReuse___lambda__3___boxed), 9, 5);
lean_closure_set(x_40, 0, x_38);
lean_closure_set(x_40, 1, x_4);
lean_closure_set(x_40, 2, x_3);
lean_closure_set(x_40, 3, x_39);
lean_closure_set(x_40, 4, x_5);
x_41 = l_Lean_IR_EmitLLVM_emitReuse___closed__1;
x_42 = lean_unbox_usize(x_35);
lean_dec(x_35);
lean_inc(x_9);
lean_inc(x_8);
x_43 = l_Lean_IR_EmitLLVM_buildIfThenElse__(x_1, x_2, x_41, x_42, x_37, x_40, x_8, x_9, x_34);
if (lean_obj_tag(x_43) == 0)
{
lean_object* x_44;
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
if (lean_obj_tag(x_44) == 0)
{
uint8_t x_45;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_45 = !lean_is_exclusive(x_43);
if (x_45 == 0)
{
lean_object* x_46; uint8_t x_47;
x_46 = lean_ctor_get(x_43, 0);
lean_dec(x_46);
x_47 = !lean_is_exclusive(x_44);
if (x_47 == 0)
{
return x_43;
}
else
{
lean_object* x_48; lean_object* x_49;
x_48 = lean_ctor_get(x_44, 0);
lean_inc(x_48);
lean_dec(x_44);
x_49 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_43, 0, x_49);
return x_43;
}
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_50 = lean_ctor_get(x_43, 1);
lean_inc(x_50);
lean_dec(x_43);
x_51 = lean_ctor_get(x_44, 0);
lean_inc(x_51);
if (lean_is_exclusive(x_44)) {
lean_ctor_release(x_44, 0);
x_52 = x_44;
} else {
lean_dec_ref(x_44);
x_52 = lean_box(0);
}
if (lean_is_scalar(x_52)) {
x_53 = lean_alloc_ctor(0, 1, 0);
} else {
x_53 = x_52;
}
lean_ctor_set(x_53, 0, x_51);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_53);
lean_ctor_set(x_54, 1, x_50);
return x_54;
}
}
else
{
lean_object* x_55; lean_object* x_56;
lean_dec(x_44);
x_55 = lean_ctor_get(x_43, 1);
lean_inc(x_55);
lean_dec(x_43);
x_56 = l_Lean_IR_EmitLLVM_emitCtorSetArgs(x_1, x_2, x_3, x_7, x_8, x_9, x_55);
return x_56;
}
}
else
{
uint8_t x_57;
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_57 = !lean_is_exclusive(x_43);
if (x_57 == 0)
{
return x_43;
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60;
x_58 = lean_ctor_get(x_43, 0);
x_59 = lean_ctor_get(x_43, 1);
lean_inc(x_59);
lean_inc(x_58);
lean_dec(x_43);
x_60 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_60, 0, x_58);
lean_ctor_set(x_60, 1, x_59);
return x_60;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_10 = l_Lean_IR_EmitLLVM_emitReuse___lambda__1(x_8, x_2, x_3, x_9, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_2);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__2___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_EmitLLVM_emitReuse___lambda__2(x_1, x_2, x_3, x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitReuse___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; uint8_t x_11; size_t x_12; lean_object* x_13;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox(x_4);
lean_dec(x_4);
x_12 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_13 = l_Lean_IR_EmitLLVM_emitReuse___lambda__3(x_10, x_2, x_3, x_11, x_5, x_12, x_7, x_8, x_9);
lean_dec(x_5);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; uint8_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox(x_6);
lean_dec(x_6);
x_14 = l_Lean_IR_EmitLLVM_emitReuse(x_11, x_12, x_3, x_4, x_5, x_13, x_7, x_8, x_9, x_10);
lean_dec(x_7);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitVDecl(size_t x_1, size_t 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:
{
switch (lean_obj_tag(x_5)) {
case 0:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11;
lean_dec(x_4);
x_9 = lean_ctor_get(x_5, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_5, 1);
lean_inc(x_10);
lean_dec(x_5);
x_11 = l_Lean_IR_EmitLLVM_emitCtor(x_1, x_2, x_3, x_9, x_10, x_6, x_7, x_8);
lean_dec(x_10);
lean_dec(x_9);
return x_11;
}
case 1:
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
lean_dec(x_4);
x_12 = lean_ctor_get(x_5, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_5, 1);
lean_inc(x_13);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitLLVM_emitReset(x_1, x_2, x_3, x_12, x_13, x_6, x_7, x_8);
return x_14;
}
case 2:
{
lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18; lean_object* x_19;
lean_dec(x_4);
x_15 = lean_ctor_get(x_5, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_5, 1);
lean_inc(x_16);
x_17 = lean_ctor_get_uint8(x_5, sizeof(void*)*3);
x_18 = lean_ctor_get(x_5, 2);
lean_inc(x_18);
lean_dec(x_5);
x_19 = l_Lean_IR_EmitLLVM_emitReuse(x_1, x_2, x_3, x_15, x_16, x_17, x_18, x_6, x_7, x_8);
lean_dec(x_18);
return x_19;
}
case 3:
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_4);
x_20 = lean_ctor_get(x_5, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_5, 1);
lean_inc(x_21);
lean_dec(x_5);
x_22 = l_Lean_IR_EmitLLVM_emitProj(x_1, x_2, x_3, x_20, x_21, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_20);
return x_22;
}
case 4:
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
lean_dec(x_4);
x_23 = lean_ctor_get(x_5, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_5, 1);
lean_inc(x_24);
lean_dec(x_5);
x_25 = l_Lean_IR_EmitLLVM_emitUProj(x_1, x_2, x_3, x_23, x_24, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_23);
return x_25;
}
case 5:
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_26 = lean_ctor_get(x_5, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_5, 1);
lean_inc(x_27);
x_28 = lean_ctor_get(x_5, 2);
lean_inc(x_28);
lean_dec(x_5);
x_29 = l_Lean_IR_EmitLLVM_emitSProj(x_1, x_2, x_3, x_4, x_26, x_27, x_28, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_29;
}
case 6:
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
lean_dec(x_4);
x_30 = lean_ctor_get(x_5, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_5, 1);
lean_inc(x_31);
lean_dec(x_5);
x_32 = l_Lean_IR_EmitLLVM_emitFullApp(x_1, x_2, x_3, x_30, x_31, x_6, x_7, x_8);
return x_32;
}
case 7:
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
lean_dec(x_4);
x_33 = lean_ctor_get(x_5, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_5, 1);
lean_inc(x_34);
lean_dec(x_5);
x_35 = l_Lean_IR_EmitLLVM_emitPartialApp(x_1, x_2, x_3, x_33, x_34, x_6, x_7, x_8);
return x_35;
}
case 8:
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
lean_dec(x_4);
x_36 = lean_ctor_get(x_5, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_5, 1);
lean_inc(x_37);
lean_dec(x_5);
x_38 = l_Lean_IR_EmitLLVM_emitApp(x_1, x_2, x_3, x_36, x_37, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_38;
}
case 9:
{
lean_object* x_39; lean_object* x_40; lean_object* x_41;
lean_dec(x_4);
x_39 = lean_ctor_get(x_5, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_5, 1);
lean_inc(x_40);
lean_dec(x_5);
x_41 = l_Lean_IR_EmitLLVM_emitBox(x_1, x_2, x_3, x_40, x_39, x_6, x_7, x_8);
return x_41;
}
case 10:
{
lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_42 = lean_ctor_get(x_5, 0);
lean_inc(x_42);
lean_dec(x_5);
x_43 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_44 = l_Lean_IR_EmitLLVM_emitUnbox(x_1, x_2, x_3, x_4, x_42, x_43, x_6, x_7, x_8);
return x_44;
}
case 11:
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_5, 0);
lean_inc(x_45);
lean_dec(x_5);
x_46 = l_Lean_IR_EmitLLVM_emitLit(x_1, x_2, x_3, x_4, x_45, x_6, x_7, x_8);
if (lean_obj_tag(x_46) == 0)
{
lean_object* x_47;
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
uint8_t x_48;
x_48 = !lean_is_exclusive(x_46);
if (x_48 == 0)
{
lean_object* x_49; uint8_t x_50;
x_49 = lean_ctor_get(x_46, 0);
lean_dec(x_49);
x_50 = !lean_is_exclusive(x_47);
if (x_50 == 0)
{
return x_46;
}
else
{
lean_object* x_51; lean_object* x_52;
x_51 = lean_ctor_get(x_47, 0);
lean_inc(x_51);
lean_dec(x_47);
x_52 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_46, 0, x_52);
return x_46;
}
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_53 = lean_ctor_get(x_46, 1);
lean_inc(x_53);
lean_dec(x_46);
x_54 = lean_ctor_get(x_47, 0);
lean_inc(x_54);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
x_55 = x_47;
} else {
lean_dec_ref(x_47);
x_55 = lean_box(0);
}
if (lean_is_scalar(x_55)) {
x_56 = lean_alloc_ctor(0, 1, 0);
} else {
x_56 = x_55;
}
lean_ctor_set(x_56, 0, x_54);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_53);
return x_57;
}
}
else
{
uint8_t x_58;
lean_dec(x_47);
x_58 = !lean_is_exclusive(x_46);
if (x_58 == 0)
{
lean_object* x_59; lean_object* x_60;
x_59 = lean_ctor_get(x_46, 0);
lean_dec(x_59);
x_60 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_46, 0, x_60);
return x_46;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_61 = lean_ctor_get(x_46, 1);
lean_inc(x_61);
lean_dec(x_46);
x_62 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
else
{
uint8_t x_64;
x_64 = !lean_is_exclusive(x_46);
if (x_64 == 0)
{
return x_46;
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67;
x_65 = lean_ctor_get(x_46, 0);
x_66 = lean_ctor_get(x_46, 1);
lean_inc(x_66);
lean_inc(x_65);
lean_dec(x_46);
x_67 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_67, 0, x_65);
lean_ctor_set(x_67, 1, x_66);
return x_67;
}
}
}
default:
{
lean_object* x_68; lean_object* x_69;
lean_dec(x_4);
x_68 = lean_ctor_get(x_5, 0);
lean_inc(x_68);
lean_dec(x_5);
x_69 = l_Lean_IR_EmitLLVM_emitIsShared(x_1, x_2, x_3, x_68, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_69;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitVDecl___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitVDecl(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_declareVar___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("varx", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVar(size_t x_1, size_t 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_inc(x_6);
lean_inc(x_5);
x_8 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_4, x_5, x_6, 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)
{
uint8_t x_10;
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; size_t x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29;
x_20 = lean_ctor_get(x_8, 1);
lean_inc(x_20);
lean_dec(x_8);
x_21 = lean_ctor_get(x_9, 0);
lean_inc(x_21);
lean_dec(x_9);
x_22 = l_Lean_IR_EmitLLVM_declareVar___closed__1;
x_23 = lean_unbox_usize(x_21);
x_24 = lean_llvm_build_alloca(x_1, x_2, x_23, x_22, x_20);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_28 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_29 = l_Lean_IR_EmitLLVM_addVartoState(x_1, x_3, x_27, x_28, x_5, x_6, x_26);
lean_dec(x_6);
lean_dec(x_5);
return x_29;
}
}
else
{
uint8_t x_30;
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_30 = !lean_is_exclusive(x_8);
if (x_30 == 0)
{
return x_8;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_8, 0);
x_32 = lean_ctor_get(x_8, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_8);
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;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVar___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_declareVar(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___spec__1(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10;
x_10 = lean_usize_dec_lt(x_5, x_4);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_8);
lean_dec(x_7);
x_11 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_11, 0, x_6);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_9);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
lean_dec(x_6);
x_13 = lean_array_uget(x_3, x_5);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
lean_inc(x_8);
lean_inc(x_7);
x_16 = l_Lean_IR_EmitLLVM_declareVar(x_1, x_2, x_14, x_15, x_7, x_8, x_9);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17;
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
if (lean_obj_tag(x_17) == 0)
{
uint8_t x_18;
lean_dec(x_8);
lean_dec(x_7);
x_18 = !lean_is_exclusive(x_16);
if (x_18 == 0)
{
lean_object* x_19; uint8_t x_20;
x_19 = lean_ctor_get(x_16, 0);
lean_dec(x_19);
x_20 = !lean_is_exclusive(x_17);
if (x_20 == 0)
{
return x_16;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_17, 0);
lean_inc(x_21);
lean_dec(x_17);
x_22 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_16, 0, x_22);
return x_16;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_16, 1);
lean_inc(x_23);
lean_dec(x_16);
x_24 = lean_ctor_get(x_17, 0);
lean_inc(x_24);
if (lean_is_exclusive(x_17)) {
lean_ctor_release(x_17, 0);
x_25 = x_17;
} else {
lean_dec_ref(x_17);
x_25 = lean_box(0);
}
if (lean_is_scalar(x_25)) {
x_26 = lean_alloc_ctor(0, 1, 0);
} else {
x_26 = x_25;
}
lean_ctor_set(x_26, 0, x_24);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_23);
return x_27;
}
}
else
{
lean_object* x_28; size_t x_29; size_t x_30; lean_object* x_31;
lean_dec(x_17);
x_28 = lean_ctor_get(x_16, 1);
lean_inc(x_28);
lean_dec(x_16);
x_29 = 1;
x_30 = lean_usize_add(x_5, x_29);
x_31 = lean_box(0);
x_5 = x_30;
x_6 = x_31;
x_9 = x_28;
goto _start;
}
}
else
{
uint8_t x_33;
lean_dec(x_8);
lean_dec(x_7);
x_33 = !lean_is_exclusive(x_16);
if (x_33 == 0)
{
return x_16;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_16, 0);
x_35 = lean_ctor_get(x_16, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_16);
x_36 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVars(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
switch (lean_obj_tag(x_3)) {
case 0:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_7 = lean_ctor_get(x_3, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_3, 1);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 3);
lean_inc(x_9);
lean_dec(x_3);
lean_inc(x_5);
lean_inc(x_4);
x_10 = l_Lean_IR_EmitLLVM_declareVar(x_1, x_2, x_7, x_8, x_4, x_5, x_6);
if (lean_obj_tag(x_10) == 0)
{
lean_object* x_11;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_12;
lean_dec(x_9);
lean_dec(x_5);
lean_dec(x_4);
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_10, 0);
lean_dec(x_13);
x_14 = !lean_is_exclusive(x_11);
if (x_14 == 0)
{
return x_10;
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_10, 0, x_16);
return x_10;
}
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_17 = lean_ctor_get(x_10, 1);
lean_inc(x_17);
lean_dec(x_10);
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
if (lean_is_exclusive(x_11)) {
lean_ctor_release(x_11, 0);
x_19 = x_11;
} else {
lean_dec_ref(x_11);
x_19 = lean_box(0);
}
if (lean_is_scalar(x_19)) {
x_20 = lean_alloc_ctor(0, 1, 0);
} else {
x_20 = x_19;
}
lean_ctor_set(x_20, 0, x_18);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_17);
return x_21;
}
}
else
{
lean_object* x_22;
lean_dec(x_11);
x_22 = lean_ctor_get(x_10, 1);
lean_inc(x_22);
lean_dec(x_10);
x_3 = x_9;
x_6 = x_22;
goto _start;
}
}
else
{
uint8_t x_24;
lean_dec(x_9);
lean_dec(x_5);
lean_dec(x_4);
x_24 = !lean_is_exclusive(x_10);
if (x_24 == 0)
{
return x_10;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_25 = lean_ctor_get(x_10, 0);
x_26 = lean_ctor_get(x_10, 1);
lean_inc(x_26);
lean_inc(x_25);
lean_dec(x_10);
x_27 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_27, 0, x_25);
lean_ctor_set(x_27, 1, x_26);
return x_27;
}
}
}
case 1:
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; size_t x_32; lean_object* x_33; lean_object* x_34;
x_28 = lean_ctor_get(x_3, 1);
lean_inc(x_28);
x_29 = lean_ctor_get(x_3, 3);
lean_inc(x_29);
lean_dec(x_3);
x_30 = lean_array_get_size(x_28);
x_31 = lean_usize_of_nat(x_30);
lean_dec(x_30);
x_32 = 0;
x_33 = lean_box(0);
lean_inc(x_5);
lean_inc(x_4);
x_34 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___spec__1(x_1, x_2, x_28, x_31, x_32, x_33, x_4, x_5, x_6);
lean_dec(x_28);
if (lean_obj_tag(x_34) == 0)
{
lean_object* x_35;
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
if (lean_obj_tag(x_35) == 0)
{
uint8_t x_36;
lean_dec(x_29);
lean_dec(x_5);
lean_dec(x_4);
x_36 = !lean_is_exclusive(x_34);
if (x_36 == 0)
{
lean_object* x_37; uint8_t x_38;
x_37 = lean_ctor_get(x_34, 0);
lean_dec(x_37);
x_38 = !lean_is_exclusive(x_35);
if (x_38 == 0)
{
return x_34;
}
else
{
lean_object* x_39; lean_object* x_40;
x_39 = lean_ctor_get(x_35, 0);
lean_inc(x_39);
lean_dec(x_35);
x_40 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_34, 0, x_40);
return x_34;
}
}
else
{
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_34, 1);
lean_inc(x_41);
lean_dec(x_34);
x_42 = lean_ctor_get(x_35, 0);
lean_inc(x_42);
if (lean_is_exclusive(x_35)) {
lean_ctor_release(x_35, 0);
x_43 = x_35;
} else {
lean_dec_ref(x_35);
x_43 = lean_box(0);
}
if (lean_is_scalar(x_43)) {
x_44 = lean_alloc_ctor(0, 1, 0);
} else {
x_44 = x_43;
}
lean_ctor_set(x_44, 0, x_42);
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_41);
return x_45;
}
}
else
{
lean_object* x_46;
lean_dec(x_35);
x_46 = lean_ctor_get(x_34, 1);
lean_inc(x_46);
lean_dec(x_34);
x_3 = x_29;
x_6 = x_46;
goto _start;
}
}
else
{
uint8_t x_48;
lean_dec(x_29);
lean_dec(x_5);
lean_dec(x_4);
x_48 = !lean_is_exclusive(x_34);
if (x_48 == 0)
{
return x_34;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_34, 0);
x_50 = lean_ctor_get(x_34, 1);
lean_inc(x_50);
lean_inc(x_49);
lean_dec(x_34);
x_51 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_51, 0, x_49);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
}
default:
{
uint8_t x_52;
x_52 = l_Lean_IR_FnBody_isTerminal(x_3);
if (x_52 == 0)
{
lean_object* x_53;
x_53 = l_Lean_IR_FnBody_body(x_3);
lean_dec(x_3);
x_3 = x_53;
goto _start;
}
else
{
lean_object* x_55; lean_object* x_56;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_55 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_56 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_6);
return x_56;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___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, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_declareVars___spec__1(x_10, x_11, x_3, x_12, x_13, x_6, x_7, x_8, x_9);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_declareVars___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_declareVars(x_7, x_8, x_3, x_4, x_5, x_6);
return x_9;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitTag___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Do not know how to `emitTag` in general.", 40);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitTag___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitTag___closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTag(size_t x_1, size_t 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;
x_8 = l_Lean_IR_IRType_isObj(x_4);
if (x_8 == 0)
{
uint8_t x_9;
x_9 = l_Lean_IR_IRType_isScalar(x_4);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitTag___closed__2;
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_7);
return x_11;
}
else
{
lean_object* x_12; lean_object* x_13;
x_12 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_13 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_12, x_5, x_6, x_7);
return x_13;
}
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_15 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_14, x_5, x_6, x_7);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19;
x_18 = lean_ctor_get(x_15, 0);
lean_dec(x_18);
x_19 = !lean_is_exclusive(x_16);
if (x_19 == 0)
{
return x_15;
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_16, 0);
lean_inc(x_20);
lean_dec(x_16);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_15, 0, x_21);
return x_15;
}
}
else
{
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_15, 1);
lean_inc(x_22);
lean_dec(x_15);
x_23 = lean_ctor_get(x_16, 0);
lean_inc(x_23);
if (lean_is_exclusive(x_16)) {
lean_ctor_release(x_16, 0);
x_24 = x_16;
} else {
lean_dec_ref(x_16);
x_24 = lean_box(0);
}
if (lean_is_scalar(x_24)) {
x_25 = lean_alloc_ctor(0, 1, 0);
} else {
x_25 = x_24;
}
lean_ctor_set(x_25, 0, x_23);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_22);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; size_t x_29; lean_object* x_30;
x_27 = lean_ctor_get(x_15, 1);
lean_inc(x_27);
lean_dec(x_15);
x_28 = lean_ctor_get(x_16, 0);
lean_inc(x_28);
lean_dec(x_16);
x_29 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_30 = l_Lean_IR_EmitLLVM_callLeanObjTag(x_1, x_2, x_29, x_14, x_5, x_6, x_27);
return x_30;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTag___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitTag(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSet(size_t x_1, size_t 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; 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; size_t x_30; size_t x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36; size_t 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;
x_9 = lean_llvm_void_type_in_context(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_LLVM_voidPtrType(x_1, x_17);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_22 = lean_array_push(x_21, x_13);
x_23 = lean_array_push(x_22, x_16);
x_24 = lean_array_push(x_23, x_19);
x_25 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_20);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_ctor_get(x_26, 0);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1;
x_30 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_10);
x_32 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_30, x_31, x_29, x_24, x_6, x_7, x_27);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = 0;
x_37 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_38 = lean_llvm_function_type(x_1, x_37, x_24, x_36, x_34);
lean_dec(x_24);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_42 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_41, x_6, x_7, x_40);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
if (lean_obj_tag(x_43) == 0)
{
uint8_t x_44;
lean_dec(x_39);
lean_dec(x_35);
lean_dec(x_5);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
lean_object* x_45; uint8_t x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_dec(x_45);
x_46 = !lean_is_exclusive(x_43);
if (x_46 == 0)
{
return x_42;
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_43, 0);
lean_inc(x_47);
lean_dec(x_43);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_42, 0, x_48);
return x_42;
}
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_49 = lean_ctor_get(x_42, 1);
lean_inc(x_49);
lean_dec(x_42);
x_50 = lean_ctor_get(x_43, 0);
lean_inc(x_50);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
x_51 = x_43;
} else {
lean_dec_ref(x_43);
x_51 = lean_box(0);
}
if (lean_is_scalar(x_51)) {
x_52 = lean_alloc_ctor(0, 1, 0);
} else {
x_52 = x_51;
}
lean_ctor_set(x_52, 0, x_50);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_49);
return x_53;
}
}
else
{
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;
x_54 = lean_ctor_get(x_42, 1);
lean_inc(x_54);
lean_dec(x_42);
x_55 = lean_ctor_get(x_43, 0);
lean_inc(x_55);
lean_dec(x_43);
x_56 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_6, x_7, x_54);
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = lean_ctor_get(x_57, 0);
lean_inc(x_59);
lean_dec(x_57);
x_60 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_5, x_41, x_6, x_7, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
if (lean_obj_tag(x_61) == 0)
{
uint8_t x_62;
lean_dec(x_59);
lean_dec(x_55);
lean_dec(x_39);
lean_dec(x_35);
x_62 = !lean_is_exclusive(x_60);
if (x_62 == 0)
{
lean_object* x_63; uint8_t x_64;
x_63 = lean_ctor_get(x_60, 0);
lean_dec(x_63);
x_64 = !lean_is_exclusive(x_61);
if (x_64 == 0)
{
return x_60;
}
else
{
lean_object* x_65; lean_object* x_66;
x_65 = lean_ctor_get(x_61, 0);
lean_inc(x_65);
lean_dec(x_61);
x_66 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_60, 0, x_66);
return x_60;
}
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_67 = lean_ctor_get(x_60, 1);
lean_inc(x_67);
lean_dec(x_60);
x_68 = lean_ctor_get(x_61, 0);
lean_inc(x_68);
if (lean_is_exclusive(x_61)) {
lean_ctor_release(x_61, 0);
x_69 = x_61;
} else {
lean_dec_ref(x_61);
x_69 = lean_box(0);
}
if (lean_is_scalar(x_69)) {
x_70 = lean_alloc_ctor(0, 1, 0);
} else {
x_70 = x_69;
}
lean_ctor_set(x_70, 0, x_68);
x_71 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_71, 0, x_70);
lean_ctor_set(x_71, 1, x_67);
return x_71;
}
}
else
{
lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; size_t x_78; size_t x_79; lean_object* x_80; uint8_t x_81;
x_72 = lean_ctor_get(x_60, 1);
lean_inc(x_72);
lean_dec(x_60);
x_73 = lean_ctor_get(x_61, 0);
lean_inc(x_73);
lean_dec(x_61);
x_74 = lean_ctor_get(x_73, 1);
lean_inc(x_74);
lean_dec(x_73);
x_75 = lean_array_push(x_21, x_55);
x_76 = lean_array_push(x_75, x_59);
x_77 = lean_array_push(x_76, x_74);
x_78 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_79 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_80 = lean_llvm_build_call2(x_1, x_2, x_78, x_79, x_77, x_41, x_72);
lean_dec(x_77);
x_81 = !lean_is_exclusive(x_80);
if (x_81 == 0)
{
lean_object* x_82; lean_object* x_83;
x_82 = lean_ctor_get(x_80, 0);
lean_dec(x_82);
x_83 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_80, 0, x_83);
return x_80;
}
else
{
lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_84 = lean_ctor_get(x_80, 1);
lean_inc(x_84);
lean_dec(x_80);
x_85 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_86 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_86, 0, x_85);
lean_ctor_set(x_86, 1, x_84);
return x_86;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSet___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitSet(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitUSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_usize", 19);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUSet(size_t x_1, size_t 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; 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; size_t x_30; size_t x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; uint8_t x_36; size_t 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;
x_9 = lean_llvm_void_type_in_context(x_1, x_8);
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_LLVM_voidPtrType(x_1, x_11);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_LLVM_size__tType(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_Lean_IR_LLVM_size__tType(x_1, x_17);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_22 = lean_array_push(x_21, x_13);
x_23 = lean_array_push(x_22, x_16);
x_24 = lean_array_push(x_23, x_19);
x_25 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_20);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_ctor_get(x_26, 0);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_IR_EmitLLVM_emitUSet___closed__1;
x_30 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_10);
x_32 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_30, x_31, x_29, x_24, x_6, x_7, x_27);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = 0;
x_37 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_38 = lean_llvm_function_type(x_1, x_37, x_24, x_36, x_34);
lean_dec(x_24);
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_42 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_41, x_6, x_7, x_40);
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
if (lean_obj_tag(x_43) == 0)
{
uint8_t x_44;
lean_dec(x_39);
lean_dec(x_35);
lean_dec(x_5);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
lean_object* x_45; uint8_t x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_dec(x_45);
x_46 = !lean_is_exclusive(x_43);
if (x_46 == 0)
{
return x_42;
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_43, 0);
lean_inc(x_47);
lean_dec(x_43);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_42, 0, x_48);
return x_42;
}
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_49 = lean_ctor_get(x_42, 1);
lean_inc(x_49);
lean_dec(x_42);
x_50 = lean_ctor_get(x_43, 0);
lean_inc(x_50);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
x_51 = x_43;
} else {
lean_dec_ref(x_43);
x_51 = lean_box(0);
}
if (lean_is_scalar(x_51)) {
x_52 = lean_alloc_ctor(0, 1, 0);
} else {
x_52 = x_51;
}
lean_ctor_set(x_52, 0, x_50);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_49);
return x_53;
}
}
else
{
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;
x_54 = lean_ctor_get(x_42, 1);
lean_inc(x_54);
lean_dec(x_42);
x_55 = lean_ctor_get(x_43, 0);
lean_inc(x_55);
lean_dec(x_43);
x_56 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_6, x_7, x_54);
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = lean_ctor_get(x_57, 0);
lean_inc(x_59);
lean_dec(x_57);
x_60 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_5, x_41, x_6, x_7, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
if (lean_obj_tag(x_61) == 0)
{
uint8_t x_62;
lean_dec(x_59);
lean_dec(x_55);
lean_dec(x_39);
lean_dec(x_35);
x_62 = !lean_is_exclusive(x_60);
if (x_62 == 0)
{
lean_object* x_63; uint8_t x_64;
x_63 = lean_ctor_get(x_60, 0);
lean_dec(x_63);
x_64 = !lean_is_exclusive(x_61);
if (x_64 == 0)
{
return x_60;
}
else
{
lean_object* x_65; lean_object* x_66;
x_65 = lean_ctor_get(x_61, 0);
lean_inc(x_65);
lean_dec(x_61);
x_66 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_60, 0, x_66);
return x_60;
}
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_67 = lean_ctor_get(x_60, 1);
lean_inc(x_67);
lean_dec(x_60);
x_68 = lean_ctor_get(x_61, 0);
lean_inc(x_68);
if (lean_is_exclusive(x_61)) {
lean_ctor_release(x_61, 0);
x_69 = x_61;
} else {
lean_dec_ref(x_61);
x_69 = lean_box(0);
}
if (lean_is_scalar(x_69)) {
x_70 = lean_alloc_ctor(0, 1, 0);
} else {
x_70 = x_69;
}
lean_ctor_set(x_70, 0, x_68);
x_71 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_71, 0, x_70);
lean_ctor_set(x_71, 1, x_67);
return x_71;
}
}
else
{
lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; size_t x_77; size_t x_78; lean_object* x_79; uint8_t x_80;
x_72 = lean_ctor_get(x_60, 1);
lean_inc(x_72);
lean_dec(x_60);
x_73 = lean_ctor_get(x_61, 0);
lean_inc(x_73);
lean_dec(x_61);
x_74 = lean_array_push(x_21, x_55);
x_75 = lean_array_push(x_74, x_59);
x_76 = lean_array_push(x_75, x_73);
x_77 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_78 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_79 = lean_llvm_build_call2(x_1, x_2, x_77, x_78, x_76, x_41, x_72);
lean_dec(x_76);
x_80 = !lean_is_exclusive(x_79);
if (x_80 == 0)
{
lean_object* x_81; lean_object* x_82;
x_81 = lean_ctor_get(x_79, 0);
lean_dec(x_81);
x_82 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_79, 0, x_82);
return x_79;
}
else
{
lean_object* x_83; lean_object* x_84; lean_object* x_85;
x_83 = lean_ctor_get(x_79, 1);
lean_inc(x_83);
lean_dec(x_79);
x_84 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_85 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_85, 0, x_84);
lean_ctor_set(x_85, 1, x_83);
return x_85;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUSet___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitUSet(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitTailCall___spec__1(size_t x_1, size_t x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
uint8_t x_9;
x_9 = lean_usize_dec_lt(x_4, x_3);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_5);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_8);
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;
x_12 = lean_array_uget(x_5, x_4);
x_13 = lean_unsigned_to_nat(0u);
x_14 = lean_array_uset(x_5, x_4, x_13);
x_15 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_16 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_12, x_15, x_6, x_7, x_8);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
if (lean_obj_tag(x_17) == 0)
{
uint8_t x_18;
lean_dec(x_14);
x_18 = !lean_is_exclusive(x_16);
if (x_18 == 0)
{
lean_object* x_19; uint8_t x_20;
x_19 = lean_ctor_get(x_16, 0);
lean_dec(x_19);
x_20 = !lean_is_exclusive(x_17);
if (x_20 == 0)
{
return x_16;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_17, 0);
lean_inc(x_21);
lean_dec(x_17);
x_22 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_16, 0, x_22);
return x_16;
}
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_23 = lean_ctor_get(x_16, 1);
lean_inc(x_23);
lean_dec(x_16);
x_24 = lean_ctor_get(x_17, 0);
lean_inc(x_24);
if (lean_is_exclusive(x_17)) {
lean_ctor_release(x_17, 0);
x_25 = x_17;
} else {
lean_dec_ref(x_17);
x_25 = lean_box(0);
}
if (lean_is_scalar(x_25)) {
x_26 = lean_alloc_ctor(0, 1, 0);
} else {
x_26 = x_25;
}
lean_ctor_set(x_26, 0, x_24);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_23);
return x_27;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; size_t x_32; lean_object* x_33;
x_28 = lean_ctor_get(x_16, 1);
lean_inc(x_28);
lean_dec(x_16);
x_29 = lean_ctor_get(x_17, 0);
lean_inc(x_29);
lean_dec(x_17);
x_30 = lean_ctor_get(x_29, 1);
lean_inc(x_30);
lean_dec(x_29);
x_31 = 1;
x_32 = lean_usize_add(x_4, x_31);
x_33 = lean_array_uset(x_14, x_4, x_30);
x_4 = x_32;
x_5 = x_33;
x_8 = x_28;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___lambda__1(lean_object* x_1, size_t x_2, size_t 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; size_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13;
x_9 = lean_array_get_size(x_1);
x_10 = lean_usize_of_nat(x_9);
lean_dec(x_9);
x_11 = 0;
x_12 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitTailCall___spec__1(x_2, x_3, x_10, x_11, x_1, x_6, x_7, x_8);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_4);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
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; lean_object* x_30;
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_25 = lean_ctor_get(x_13, 0);
lean_inc(x_25);
lean_dec(x_13);
x_26 = l_Lean_IR_EmitLLVM_builderGetInsertionFn(x_2, x_3, x_6, x_7, x_24);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = l_Lean_IR_EmitLLVM_getFunIdTy(x_2, x_4, x_6, x_7, x_28);
if (lean_obj_tag(x_30) == 0)
{
lean_object* x_31;
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
if (lean_obj_tag(x_31) == 0)
{
uint8_t x_32;
lean_dec(x_29);
lean_dec(x_25);
x_32 = !lean_is_exclusive(x_30);
if (x_32 == 0)
{
lean_object* x_33; uint8_t x_34;
x_33 = lean_ctor_get(x_30, 0);
lean_dec(x_33);
x_34 = !lean_is_exclusive(x_31);
if (x_34 == 0)
{
return x_30;
}
else
{
lean_object* x_35; lean_object* x_36;
x_35 = lean_ctor_get(x_31, 0);
lean_inc(x_35);
lean_dec(x_31);
x_36 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_30, 0, x_36);
return x_30;
}
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41;
x_37 = lean_ctor_get(x_30, 1);
lean_inc(x_37);
lean_dec(x_30);
x_38 = lean_ctor_get(x_31, 0);
lean_inc(x_38);
if (lean_is_exclusive(x_31)) {
lean_ctor_release(x_31, 0);
x_39 = x_31;
} else {
lean_dec_ref(x_31);
x_39 = lean_box(0);
}
if (lean_is_scalar(x_39)) {
x_40 = lean_alloc_ctor(0, 1, 0);
} else {
x_40 = x_39;
}
lean_ctor_set(x_40, 0, x_38);
x_41 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_41, 0, x_40);
lean_ctor_set(x_41, 1, x_37);
return x_41;
}
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; size_t x_45; size_t x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; uint8_t x_50; size_t x_51; lean_object* x_52; lean_object* x_53; size_t x_54; lean_object* x_55; uint8_t x_56;
x_42 = lean_ctor_get(x_30, 1);
lean_inc(x_42);
lean_dec(x_30);
x_43 = lean_ctor_get(x_31, 0);
lean_inc(x_43);
lean_dec(x_31);
x_44 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_45 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_46 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_47 = lean_llvm_build_call2(x_2, x_3, x_45, x_46, x_25, x_44, x_42);
lean_dec(x_25);
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
lean_dec(x_47);
x_50 = 1;
x_51 = lean_unbox_usize(x_48);
x_52 = lean_llvm_set_tail_call(x_2, x_51, x_50, x_49);
x_53 = lean_ctor_get(x_52, 1);
lean_inc(x_53);
lean_dec(x_52);
x_54 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_55 = lean_llvm_build_ret(x_2, x_3, x_54, x_53);
x_56 = !lean_is_exclusive(x_55);
if (x_56 == 0)
{
lean_object* x_57; lean_object* x_58;
x_57 = lean_ctor_get(x_55, 0);
lean_dec(x_57);
x_58 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_55, 0, x_58);
return x_55;
}
else
{
lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_59 = lean_ctor_get(x_55, 1);
lean_inc(x_59);
lean_dec(x_55);
x_60 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_61 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_61, 1, x_59);
return x_61;
}
}
}
else
{
uint8_t x_62;
lean_dec(x_29);
lean_dec(x_25);
x_62 = !lean_is_exclusive(x_30);
if (x_62 == 0)
{
return x_30;
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65;
x_63 = lean_ctor_get(x_30, 0);
x_64 = lean_ctor_get(x_30, 1);
lean_inc(x_64);
lean_inc(x_63);
lean_dec(x_30);
x_65 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_65, 0, x_63);
lean_ctor_set(x_65, 1, x_64);
return x_65;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("EmitTailCall expects function application, found '", 50);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Invalid tail call. f:'", 22);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("' v:'", 5);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
if (lean_obj_tag(x_4) == 6)
{
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_4, 1);
lean_inc(x_8);
x_9 = lean_ctor_get(x_6, 4);
lean_inc(x_9);
x_10 = lean_array_get_size(x_9);
lean_dec(x_9);
x_11 = lean_array_get_size(x_8);
x_12 = lean_nat_dec_eq(x_10, x_11);
lean_dec(x_11);
lean_dec(x_10);
if (x_12 == 0)
{
uint8_t 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_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
x_13 = 1;
x_14 = l_Lean_Name_toString(x_3, x_13);
x_15 = l_Lean_IR_EmitLLVM_emitTailCall___closed__2;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitLLVM_emitTailCall___closed__3;
x_18 = lean_string_append(x_16, x_17);
x_19 = l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatExpr(x_4);
x_20 = l_Std_Format_defWidth;
x_21 = lean_format_pretty(x_19, x_20);
x_22 = lean_string_append(x_18, x_21);
lean_dec(x_21);
x_23 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_7);
return x_26;
}
else
{
lean_object* x_27; lean_object* x_28;
lean_dec(x_4);
x_27 = lean_box(0);
x_28 = l_Lean_IR_EmitLLVM_emitTailCall___lambda__1(x_8, x_1, x_2, x_3, x_27, x_5, x_6, x_7);
return x_28;
}
}
else
{
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_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
x_29 = l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatExpr(x_4);
x_30 = l_Std_Format_defWidth;
x_31 = lean_format_pretty(x_29, x_30);
x_32 = l_Lean_IR_EmitLLVM_emitTailCall___closed__1;
x_33 = lean_string_append(x_32, x_31);
lean_dec(x_31);
x_34 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_35 = lean_string_append(x_33, x_34);
x_36 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_36, 0, x_35);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_7);
return x_37;
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Array_mapMUnsafe_map___at_Lean_IR_EmitLLVM_emitTailCall___spec__1(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___lambda__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, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitTailCall___lambda__1(x_1, x_9, x_10, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_5);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitTailCall___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitTailCall(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitJmp___spec__1(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; uint8_t x_34;
x_34 = lean_usize_dec_lt(x_5, x_4);
if (x_34 == 0)
{
lean_object* x_35; lean_object* x_36;
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_6);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_35);
lean_ctor_set(x_36, 1, x_9);
return x_36;
}
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_dec(x_6);
x_37 = lean_array_uget(x_3, x_5);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_41 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_39, x_40, x_7, x_8, x_9);
x_42 = lean_ctor_get(x_41, 0);
lean_inc(x_42);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_43; uint8_t x_44;
lean_dec(x_38);
x_43 = lean_ctor_get(x_41, 1);
lean_inc(x_43);
lean_dec(x_41);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
x_10 = x_42;
x_11 = x_43;
goto block_33;
}
else
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_inc(x_45);
lean_dec(x_42);
x_46 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_46, 0, x_45);
x_10 = x_46;
x_11 = x_43;
goto block_33;
}
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; lean_object* x_52; lean_object* x_53;
x_47 = lean_ctor_get(x_42, 0);
lean_inc(x_47);
lean_dec(x_42);
x_48 = lean_ctor_get(x_41, 1);
lean_inc(x_48);
lean_dec(x_41);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
lean_dec(x_47);
x_50 = lean_ctor_get(x_38, 0);
lean_inc(x_50);
lean_dec(x_38);
x_51 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_52 = l_Lean_IR_EmitLLVM_emitLhsSlotStore(x_1, x_2, x_50, x_51, x_7, x_8, x_48);
x_53 = lean_ctor_get(x_52, 0);
lean_inc(x_53);
if (lean_obj_tag(x_53) == 0)
{
lean_object* x_54; uint8_t x_55;
x_54 = lean_ctor_get(x_52, 1);
lean_inc(x_54);
lean_dec(x_52);
x_55 = !lean_is_exclusive(x_53);
if (x_55 == 0)
{
x_10 = x_53;
x_11 = x_54;
goto block_33;
}
else
{
lean_object* x_56; lean_object* x_57;
x_56 = lean_ctor_get(x_53, 0);
lean_inc(x_56);
lean_dec(x_53);
x_57 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_57, 0, x_56);
x_10 = x_57;
x_11 = x_54;
goto block_33;
}
}
else
{
lean_object* x_58; lean_object* x_59;
lean_dec(x_53);
x_58 = lean_ctor_get(x_52, 1);
lean_inc(x_58);
lean_dec(x_52);
x_59 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_10 = x_59;
x_11 = x_58;
goto block_33;
}
}
}
block_33:
{
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_12;
x_12 = !lean_is_exclusive(x_10);
if (x_12 == 0)
{
lean_object* x_13;
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_10);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_10, 0);
lean_inc(x_14);
lean_dec(x_10);
x_15 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_15, 0, 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_11);
return x_16;
}
}
else
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_10);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_ctor_get(x_10, 0);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
lean_dec(x_18);
lean_ctor_set(x_10, 0, x_19);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_10);
lean_ctor_set(x_20, 1, x_11);
return x_20;
}
else
{
lean_object* x_21; size_t x_22; size_t x_23;
lean_free_object(x_10);
x_21 = lean_ctor_get(x_18, 0);
lean_inc(x_21);
lean_dec(x_18);
x_22 = 1;
x_23 = lean_usize_add(x_5, x_22);
x_5 = x_23;
x_6 = x_21;
x_9 = x_11;
goto _start;
}
}
else
{
lean_object* x_25;
x_25 = lean_ctor_get(x_10, 0);
lean_inc(x_25);
lean_dec(x_10);
if (lean_obj_tag(x_25) == 0)
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
lean_dec(x_25);
x_27 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_27, 0, 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_11);
return x_28;
}
else
{
lean_object* x_29; size_t x_30; size_t x_31;
x_29 = lean_ctor_get(x_25, 0);
lean_inc(x_29);
lean_dec(x_25);
x_30 = 1;
x_31 = lean_usize_add(x_5, x_30);
x_5 = x_31;
x_6 = x_29;
x_9 = x_11;
goto _start;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3(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_EXPORT lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__2(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; uint64_t x_5; size_t x_6; lean_object* x_7; lean_object* x_8;
x_3 = lean_ctor_get(x_1, 1);
lean_inc(x_3);
lean_dec(x_1);
x_4 = lean_array_get_size(x_3);
x_5 = lean_uint64_of_nat(x_2);
x_6 = lean_hashmap_mk_idx(x_4, x_5);
x_7 = lean_array_uget(x_3, x_6);
lean_dec(x_3);
x_8 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3(x_2, x_7);
lean_dec(x_7);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__1(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; size_t x_12; size_t x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_10 = l_Array_zip___rarg(x_1, x_2);
x_11 = lean_array_get_size(x_10);
x_12 = lean_usize_of_nat(x_11);
lean_dec(x_11);
x_13 = 0;
x_14 = lean_box(0);
x_15 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitJmp___spec__1(x_3, x_4, x_10, x_12, x_13, x_14, x_7, x_8, x_9);
lean_dec(x_10);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
if (lean_obj_tag(x_16) == 0)
{
uint8_t x_17;
lean_dec(x_5);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19;
x_18 = lean_ctor_get(x_15, 0);
lean_dec(x_18);
x_19 = !lean_is_exclusive(x_16);
if (x_19 == 0)
{
return x_15;
}
else
{
lean_object* x_20; lean_object* x_21;
x_20 = lean_ctor_get(x_16, 0);
lean_inc(x_20);
lean_dec(x_16);
x_21 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_15, 0, x_21);
return x_15;
}
}
else
{
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_15, 1);
lean_inc(x_22);
lean_dec(x_15);
x_23 = lean_ctor_get(x_16, 0);
lean_inc(x_23);
if (lean_is_exclusive(x_16)) {
lean_ctor_release(x_16, 0);
x_24 = x_16;
} else {
lean_dec_ref(x_16);
x_24 = lean_box(0);
}
if (lean_is_scalar(x_24)) {
x_25 = lean_alloc_ctor(0, 1, 0);
} else {
x_25 = x_24;
}
lean_ctor_set(x_25, 0, x_23);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_22);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
lean_dec(x_16);
x_27 = lean_ctor_get(x_15, 1);
lean_inc(x_27);
lean_dec(x_15);
x_28 = l_Lean_IR_EmitLLVM_emitJp(x_3, x_5, x_7, x_8, x_27);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
if (lean_obj_tag(x_29) == 0)
{
uint8_t x_30;
x_30 = !lean_is_exclusive(x_28);
if (x_30 == 0)
{
lean_object* x_31; uint8_t x_32;
x_31 = lean_ctor_get(x_28, 0);
lean_dec(x_31);
x_32 = !lean_is_exclusive(x_29);
if (x_32 == 0)
{
return x_28;
}
else
{
lean_object* x_33; lean_object* x_34;
x_33 = lean_ctor_get(x_29, 0);
lean_inc(x_33);
lean_dec(x_29);
x_34 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_34, 0, x_33);
lean_ctor_set(x_28, 0, x_34);
return x_28;
}
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_35 = lean_ctor_get(x_28, 1);
lean_inc(x_35);
lean_dec(x_28);
x_36 = lean_ctor_get(x_29, 0);
lean_inc(x_36);
if (lean_is_exclusive(x_29)) {
lean_ctor_release(x_29, 0);
x_37 = x_29;
} else {
lean_dec_ref(x_29);
x_37 = lean_box(0);
}
if (lean_is_scalar(x_37)) {
x_38 = lean_alloc_ctor(0, 1, 0);
} else {
x_38 = x_37;
}
lean_ctor_set(x_38, 0, x_36);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_35);
return x_39;
}
}
else
{
lean_object* x_40; lean_object* x_41; size_t x_42; lean_object* x_43; uint8_t x_44;
x_40 = lean_ctor_get(x_28, 1);
lean_inc(x_40);
lean_dec(x_28);
x_41 = lean_ctor_get(x_29, 0);
lean_inc(x_41);
lean_dec(x_29);
x_42 = lean_unbox_usize(x_41);
lean_dec(x_41);
x_43 = lean_llvm_build_br(x_3, x_4, x_42, x_40);
x_44 = !lean_is_exclusive(x_43);
if (x_44 == 0)
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_43, 0);
lean_dec(x_45);
x_46 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_43, 0, x_46);
return x_43;
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49;
x_47 = lean_ctor_get(x_43, 1);
lean_inc(x_47);
lean_dec(x_43);
x_48 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Invalid goto, mismatched sizes between arguments, formal parameters.", 68);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__2(lean_object* x_1, size_t x_2, size_t 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; uint8_t x_11;
x_9 = lean_array_get_size(x_1);
x_10 = lean_array_get_size(x_5);
x_11 = lean_nat_dec_eq(x_9, x_10);
lean_dec(x_10);
lean_dec(x_9);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_1);
x_12 = l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2;
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_8);
return x_13;
}
else
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_box(0);
x_15 = l_Lean_IR_EmitLLVM_emitJmp___lambda__1(x_5, x_1, x_2, x_3, x_4, x_14, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_1);
lean_dec(x_5);
return x_15;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJmp___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Unknown join point ", 19);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp(size_t x_1, size_t 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_9;
x_8 = lean_ctor_get(x_6, 2);
lean_inc(x_8);
lean_inc(x_3);
x_9 = l_Lean_HashMapImp_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__2(x_8, x_3);
if (lean_obj_tag(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_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_10 = l_Nat_repr(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitJp___closed__1;
x_12 = lean_string_append(x_11, x_10);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_emitJmp___closed__1;
x_14 = lean_string_append(x_13, x_12);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_16 = lean_string_append(x_14, x_15);
x_17 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_17, 0, 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_7);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_9, 0);
lean_inc(x_19);
lean_dec(x_9);
x_20 = l_Lean_IR_EmitLLVM_emitJmp___lambda__2(x_4, x_1, x_2, x_3, x_19, x_5, x_6, x_7);
return x_20;
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitJmp___spec__1(x_10, x_11, x_3, x_12, x_13, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_AssocList_find_x3f___at_Lean_IR_EmitLLVM_emitJmp___spec__3(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__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, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; lean_object* x_12;
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_emitJmp___lambda__1(x_1, x_2, x_10, x_11, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_2);
lean_dec(x_1);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___lambda__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, lean_object* x_7, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitJmp___lambda__2(x_1, x_9, x_10, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJmp___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitJmp(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet___lambda__1(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
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; size_t x_30; size_t 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;
x_11 = lean_ctor_get(x_7, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_7, 1);
lean_inc(x_12);
lean_dec(x_7);
x_13 = l_LLVM_voidPtrType(x_1, x_10);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_LLVM_size__tType(x_1, x_15);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1;
x_20 = lean_array_push(x_19, x_14);
x_21 = lean_array_push(x_20, x_17);
x_22 = lean_array_push(x_21, x_12);
x_23 = lean_llvm_void_type_in_context(x_1, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_9, x_25);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_31 = lean_unbox_usize(x_24);
x_32 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_30, x_31, x_11, x_22, x_8, x_9, x_28);
lean_dec(x_11);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_37 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_36, x_8, x_9, x_34);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
if (lean_obj_tag(x_38) == 0)
{
uint8_t x_39;
lean_dec(x_35);
lean_dec(x_24);
lean_dec(x_22);
lean_dec(x_6);
x_39 = !lean_is_exclusive(x_37);
if (x_39 == 0)
{
lean_object* x_40; uint8_t x_41;
x_40 = lean_ctor_get(x_37, 0);
lean_dec(x_40);
x_41 = !lean_is_exclusive(x_38);
if (x_41 == 0)
{
return x_37;
}
else
{
lean_object* x_42; lean_object* x_43;
x_42 = lean_ctor_get(x_38, 0);
lean_inc(x_42);
lean_dec(x_38);
x_43 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_37, 0, x_43);
return x_37;
}
}
else
{
lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_44 = lean_ctor_get(x_37, 1);
lean_inc(x_44);
lean_dec(x_37);
x_45 = lean_ctor_get(x_38, 0);
lean_inc(x_45);
if (lean_is_exclusive(x_38)) {
lean_ctor_release(x_38, 0);
x_46 = x_38;
} else {
lean_dec_ref(x_38);
x_46 = lean_box(0);
}
if (lean_is_scalar(x_46)) {
x_47 = lean_alloc_ctor(0, 1, 0);
} else {
x_47 = x_46;
}
lean_ctor_set(x_47, 0, x_45);
x_48 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_48, 1, x_44);
return x_48;
}
}
else
{
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;
x_49 = lean_ctor_get(x_37, 1);
lean_inc(x_49);
lean_dec(x_37);
x_50 = lean_ctor_get(x_38, 0);
lean_inc(x_50);
lean_dec(x_38);
x_51 = l_Lean_IR_EmitLLVM_emitOffset(x_1, x_2, x_4, x_5, x_8, x_9, x_49);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_ctor_get(x_52, 0);
lean_inc(x_54);
lean_dec(x_52);
x_55 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_6, x_36, x_8, x_9, x_53);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
if (lean_obj_tag(x_56) == 0)
{
uint8_t x_57;
lean_dec(x_54);
lean_dec(x_50);
lean_dec(x_35);
lean_dec(x_24);
lean_dec(x_22);
x_57 = !lean_is_exclusive(x_55);
if (x_57 == 0)
{
lean_object* x_58; uint8_t x_59;
x_58 = lean_ctor_get(x_55, 0);
lean_dec(x_58);
x_59 = !lean_is_exclusive(x_56);
if (x_59 == 0)
{
return x_55;
}
else
{
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_56, 0);
lean_inc(x_60);
lean_dec(x_56);
x_61 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_55, 0, x_61);
return x_55;
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_62 = lean_ctor_get(x_55, 1);
lean_inc(x_62);
lean_dec(x_55);
x_63 = lean_ctor_get(x_56, 0);
lean_inc(x_63);
if (lean_is_exclusive(x_56)) {
lean_ctor_release(x_56, 0);
x_64 = x_56;
} else {
lean_dec_ref(x_56);
x_64 = lean_box(0);
}
if (lean_is_scalar(x_64)) {
x_65 = lean_alloc_ctor(0, 1, 0);
} else {
x_65 = x_64;
}
lean_ctor_set(x_65, 0, x_63);
x_66 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_62);
return x_66;
}
}
else
{
lean_object* x_67; lean_object* x_68; uint8_t x_69; size_t 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; size_t x_77; size_t x_78; lean_object* x_79; uint8_t x_80;
x_67 = lean_ctor_get(x_55, 1);
lean_inc(x_67);
lean_dec(x_55);
x_68 = lean_ctor_get(x_56, 0);
lean_inc(x_68);
lean_dec(x_56);
x_69 = 0;
x_70 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_71 = lean_llvm_function_type(x_1, x_70, x_22, x_69, x_67);
lean_dec(x_22);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = lean_array_push(x_19, x_50);
x_75 = lean_array_push(x_74, x_54);
x_76 = lean_array_push(x_75, x_68);
x_77 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_78 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_79 = lean_llvm_build_call2(x_1, x_2, x_77, x_78, x_76, x_36, x_73);
lean_dec(x_76);
x_80 = !lean_is_exclusive(x_79);
if (x_80 == 0)
{
lean_object* x_81; lean_object* x_82;
x_81 = lean_ctor_get(x_79, 0);
lean_dec(x_81);
x_82 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_79, 0, x_82);
return x_79;
}
else
{
lean_object* x_83; lean_object* x_84; lean_object* x_85;
x_83 = lean_ctor_get(x_79, 1);
lean_inc(x_83);
lean_dec(x_79);
x_84 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_85 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_85, 0, x_84);
lean_ctor_set(x_85, 1, x_83);
return x_85;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_float", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_uint8", 19);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_uint16", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_uint32", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_ctor_set_uint64", 20);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitSSet___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("invalid type for 'lean_ctor_set': '", 35);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet(size_t x_1, size_t 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, lean_object* x_9, lean_object* x_10) {
_start:
{
switch (lean_obj_tag(x_7)) {
case 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;
x_11 = lean_llvm_double_type_in_context(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitSSet___closed__1;
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_12);
x_16 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_15, x_8, x_9, x_13);
return x_16;
}
case 1:
{
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_17 = l_LLVM_i8Type(x_1, x_10);
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_Lean_IR_EmitLLVM_emitSSet___closed__2;
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_18);
x_22 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_21, x_8, x_9, x_19);
return x_22;
}
case 2:
{
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_23 = l_LLVM_i16Type(x_1, x_10);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitSSet___closed__3;
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_24);
x_28 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_27, x_8, x_9, x_25);
return x_28;
}
case 3:
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_29 = l_LLVM_i32Type(x_1, x_10);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = l_Lean_IR_EmitLLVM_emitSSet___closed__4;
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_30);
x_34 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_33, x_8, x_9, x_31);
return x_34;
}
case 4:
{
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_35 = l_LLVM_i64Type(x_1, x_10);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = l_Lean_IR_EmitLLVM_emitSSet___closed__5;
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_36);
x_40 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_39, x_8, x_9, x_37);
return x_40;
}
default:
{
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_dec(x_6);
lean_dec(x_3);
x_41 = l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatIRType(x_7);
x_42 = l_Std_Format_defWidth;
x_43 = lean_format_pretty(x_41, x_42);
x_44 = l_Lean_IR_EmitLLVM_emitSSet___closed__6;
x_45 = lean_string_append(x_44, x_43);
lean_dec(x_43);
x_46 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_47 = lean_string_append(x_45, x_46);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
x_49 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_49, 1, x_10);
return x_49;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSSet___lambda__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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Lean_IR_EmitLLVM_emitSSet___lambda__1(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_5);
lean_dec(x_4);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; lean_object* x_13;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = l_Lean_IR_EmitLLVM_emitSSet(x_11, x_12, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_5);
lean_dec(x_4);
return x_13;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDel___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_free_object", 16);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDel(size_t x_1, size_t 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_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; size_t x_20; size_t 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_7 = l_LLVM_voidPtrType(x_1, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_11 = lean_array_push(x_10, x_8);
x_12 = lean_llvm_void_type_in_context(x_1, x_9);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_emitDel___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_13);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_11, x_4, x_5, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_26, x_4, x_5, x_24);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
if (lean_obj_tag(x_28) == 0)
{
uint8_t x_29;
lean_dec(x_25);
lean_dec(x_13);
lean_dec(x_11);
x_29 = !lean_is_exclusive(x_27);
if (x_29 == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = lean_ctor_get(x_27, 0);
lean_dec(x_30);
x_31 = !lean_is_exclusive(x_28);
if (x_31 == 0)
{
return x_27;
}
else
{
lean_object* x_32; lean_object* x_33;
x_32 = lean_ctor_get(x_28, 0);
lean_inc(x_32);
lean_dec(x_28);
x_33 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_27, 0, x_33);
return x_27;
}
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_34 = lean_ctor_get(x_27, 1);
lean_inc(x_34);
lean_dec(x_27);
x_35 = lean_ctor_get(x_28, 0);
lean_inc(x_35);
if (lean_is_exclusive(x_28)) {
lean_ctor_release(x_28, 0);
x_36 = x_28;
} else {
lean_dec_ref(x_28);
x_36 = lean_box(0);
}
if (lean_is_scalar(x_36)) {
x_37 = lean_alloc_ctor(0, 1, 0);
} else {
x_37 = x_36;
}
lean_ctor_set(x_37, 0, x_35);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_34);
return x_38;
}
}
else
{
lean_object* x_39; lean_object* x_40; uint8_t x_41; size_t x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; size_t x_47; size_t x_48; lean_object* x_49; uint8_t x_50;
x_39 = lean_ctor_get(x_27, 1);
lean_inc(x_39);
lean_dec(x_27);
x_40 = lean_ctor_get(x_28, 0);
lean_inc(x_40);
lean_dec(x_28);
x_41 = 0;
x_42 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_43 = lean_llvm_function_type(x_1, x_42, x_11, x_41, x_39);
lean_dec(x_11);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = lean_array_push(x_10, x_40);
x_47 = lean_unbox_usize(x_44);
lean_dec(x_44);
x_48 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_49 = lean_llvm_build_call2(x_1, x_2, x_47, x_48, x_46, x_26, x_45);
lean_dec(x_46);
x_50 = !lean_is_exclusive(x_49);
if (x_50 == 0)
{
lean_object* x_51; lean_object* x_52;
x_51 = lean_ctor_get(x_49, 0);
lean_dec(x_51);
x_52 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_49, 0, x_52);
return x_49;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_53 = lean_ctor_get(x_49, 1);
lean_inc(x_53);
lean_dec(x_49);
x_54 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDel___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_emitDel(x_7, x_8, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSetTag(size_t x_1, size_t 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_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; size_t x_25; size_t 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_LLVM_voidPtrType(x_1, x_7);
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 = l_Lean_IR_LLVM_size__tType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_15 = lean_array_push(x_14, x_9);
x_16 = lean_array_push(x_15, x_12);
x_17 = lean_llvm_void_type_in_context(x_1, x_13);
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_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_19);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
lean_dec(x_21);
x_24 = l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1;
x_25 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_18);
x_27 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_25, x_26, x_24, x_16, x_5, x_6, x_22);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_32 = l_Lean_IR_EmitLLVM_emitLhsVal(x_1, x_2, x_3, x_31, x_5, x_6, x_29);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
if (lean_obj_tag(x_33) == 0)
{
uint8_t x_34;
lean_dec(x_30);
lean_dec(x_18);
lean_dec(x_16);
x_34 = !lean_is_exclusive(x_32);
if (x_34 == 0)
{
lean_object* x_35; uint8_t x_36;
x_35 = lean_ctor_get(x_32, 0);
lean_dec(x_35);
x_36 = !lean_is_exclusive(x_33);
if (x_36 == 0)
{
return x_32;
}
else
{
lean_object* x_37; lean_object* x_38;
x_37 = lean_ctor_get(x_33, 0);
lean_inc(x_37);
lean_dec(x_33);
x_38 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_32, 0, x_38);
return x_32;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_39 = lean_ctor_get(x_32, 1);
lean_inc(x_39);
lean_dec(x_32);
x_40 = lean_ctor_get(x_33, 0);
lean_inc(x_40);
if (lean_is_exclusive(x_33)) {
lean_ctor_release(x_33, 0);
x_41 = x_33;
} else {
lean_dec_ref(x_33);
x_41 = lean_box(0);
}
if (lean_is_scalar(x_41)) {
x_42 = lean_alloc_ctor(0, 1, 0);
} else {
x_42 = x_41;
}
lean_ctor_set(x_42, 0, x_40);
x_43 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_39);
return x_43;
}
}
else
{
lean_object* x_44; lean_object* x_45; uint8_t x_46; size_t 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; lean_object* x_56; size_t x_57; size_t x_58; lean_object* x_59; uint8_t x_60;
x_44 = lean_ctor_get(x_32, 1);
lean_inc(x_44);
lean_dec(x_32);
x_45 = lean_ctor_get(x_33, 0);
lean_inc(x_45);
lean_dec(x_33);
x_46 = 0;
x_47 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_48 = lean_llvm_function_type(x_1, x_47, x_16, x_46, x_44);
lean_dec(x_16);
x_49 = lean_ctor_get(x_48, 0);
lean_inc(x_49);
x_50 = lean_ctor_get(x_48, 1);
lean_inc(x_50);
lean_dec(x_48);
x_51 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_4, x_5, x_6, x_50);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_ctor_get(x_52, 0);
lean_inc(x_54);
lean_dec(x_52);
x_55 = lean_array_push(x_14, x_45);
x_56 = lean_array_push(x_55, x_54);
x_57 = lean_unbox_usize(x_49);
lean_dec(x_49);
x_58 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_59 = lean_llvm_build_call2(x_1, x_2, x_57, x_58, x_56, x_31, x_53);
lean_dec(x_56);
x_60 = !lean_is_exclusive(x_59);
if (x_60 == 0)
{
lean_object* x_61; lean_object* x_62;
x_61 = lean_ctor_get(x_59, 0);
lean_dec(x_61);
x_62 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_59, 0, x_62);
return x_59;
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65;
x_63 = lean_ctor_get(x_59, 1);
lean_inc(x_63);
lean_dec(x_59);
x_64 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitSetTag___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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitSetTag(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_ensureHasDefault_x27(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(0u);
x_4 = lean_nat_dec_lt(x_3, x_2);
if (x_4 == 0)
{
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_dec(x_2);
x_5 = l_Lean_IR_instInhabitedAlt;
x_6 = l_Array_back___rarg(x_5, x_1);
x_7 = lean_array_pop(x_1);
x_8 = l_Lean_IR_AltCore_body(x_6);
lean_dec(x_6);
x_9 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_9, 0, x_8);
x_10 = lean_array_push(x_7, x_9);
return x_10;
}
else
{
uint8_t x_11;
x_11 = lean_nat_dec_le(x_2, x_2);
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_dec(x_2);
x_12 = l_Lean_IR_instInhabitedAlt;
x_13 = l_Array_back___rarg(x_12, x_1);
x_14 = lean_array_pop(x_1);
x_15 = l_Lean_IR_AltCore_body(x_13);
lean_dec(x_13);
x_16 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_16, 0, x_15);
x_17 = lean_array_push(x_14, x_16);
return x_17;
}
else
{
size_t x_18; size_t x_19; uint8_t x_20;
x_18 = 0;
x_19 = lean_usize_of_nat(x_2);
lean_dec(x_2);
x_20 = l_Array_anyMUnsafe_any___at_Lean_IR_ensureHasDefault___spec__1(x_1, x_18, x_19);
if (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 = l_Lean_IR_instInhabitedAlt;
x_22 = l_Array_back___rarg(x_21, x_1);
x_23 = lean_array_pop(x_1);
x_24 = l_Lean_IR_AltCore_body(x_22);
lean_dec(x_22);
x_25 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_array_push(x_23, x_25);
return x_26;
}
else
{
return x_1;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitUnreachable___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_internal_panic_unreachable", 31);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnreachable(size_t x_1, size_t 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; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t x_32;
x_6 = lean_llvm_void_type_in_context(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_EmitLLVM_getLLVMModule___rarg(x_4, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_emitUnreachable___closed__1;
x_14 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_15 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_16 = lean_unbox_usize(x_7);
x_17 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_15, x_16, x_13, x_14, x_3, x_4, x_11);
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 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = 0;
x_22 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_23 = lean_llvm_function_type(x_1, x_22, x_14, x_21, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_28 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_14, x_26, x_25);
x_30 = lean_ctor_get(x_29, 1);
lean_inc(x_30);
lean_dec(x_29);
x_31 = lean_llvm_build_unreachable(x_1, x_2, x_30);
x_32 = !lean_is_exclusive(x_31);
if (x_32 == 0)
{
lean_object* x_33; lean_object* x_34;
x_33 = lean_ctor_get(x_31, 0);
lean_dec(x_33);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_31, 0, x_34);
return x_31;
}
else
{
lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_35 = lean_ctor_get(x_31, 1);
lean_inc(x_35);
lean_dec(x_31);
x_36 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_35);
return x_37;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitUnreachable___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_emitUnreachable(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_", 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, size_t x_7, size_t x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14; uint8_t x_25;
x_25 = lean_usize_dec_eq(x_7, x_8);
if (x_25 == 0)
{
lean_object* x_26;
lean_dec(x_9);
x_26 = lean_array_uget(x_6, x_7);
if (lean_obj_tag(x_26) == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t 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; 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; size_t x_49; size_t x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1;
lean_inc(x_3);
x_30 = lean_string_append(x_3, x_29);
x_31 = lean_ctor_get(x_27, 0);
lean_inc(x_31);
x_32 = 1;
x_33 = l_Lean_Name_toString(x_31, x_32);
x_34 = lean_string_append(x_30, x_33);
lean_dec(x_33);
x_35 = lean_string_append(x_34, x_29);
x_36 = lean_ctor_get(x_27, 1);
lean_inc(x_36);
lean_dec(x_27);
lean_inc(x_36);
x_37 = l_Nat_repr(x_36);
x_38 = lean_string_append(x_35, x_37);
lean_dec(x_37);
x_39 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_40 = lean_string_append(x_38, x_39);
x_41 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_40, x_10, x_11, x_12);
lean_dec(x_40);
x_42 = lean_ctor_get(x_41, 0);
lean_inc(x_42);
x_43 = lean_ctor_get(x_41, 1);
lean_inc(x_43);
lean_dec(x_41);
x_44 = lean_ctor_get(x_42, 0);
lean_inc(x_44);
lean_dec(x_42);
x_45 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_36, x_10, x_11, x_43);
lean_dec(x_36);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_48 = lean_ctor_get(x_46, 0);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_50 = lean_unbox_usize(x_44);
x_51 = lean_llvm_add_case(x_1, x_5, x_49, x_50, x_47);
x_52 = lean_ctor_get(x_51, 1);
lean_inc(x_52);
lean_dec(x_51);
x_53 = lean_box_usize(x_1);
x_54 = lean_unbox_usize(x_44);
lean_dec(x_44);
x_55 = lean_llvm_position_builder_at_end(x_53, x_2, x_54, x_52);
x_56 = lean_ctor_get(x_55, 1);
lean_inc(x_56);
lean_dec(x_55);
lean_inc(x_11);
lean_inc(x_10);
x_57 = l_Lean_IR_EmitLLVM_emitFnBody(x_1, x_2, x_28, x_10, x_11, x_56);
if (lean_obj_tag(x_57) == 0)
{
lean_object* x_58; lean_object* x_59;
x_58 = lean_ctor_get(x_57, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_57, 1);
lean_inc(x_59);
lean_dec(x_57);
x_13 = x_58;
x_14 = x_59;
goto block_24;
}
else
{
uint8_t x_60;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_3);
x_60 = !lean_is_exclusive(x_57);
if (x_60 == 0)
{
return x_57;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_61 = lean_ctor_get(x_57, 0);
x_62 = lean_ctor_get(x_57, 1);
lean_inc(x_62);
lean_inc(x_61);
lean_dec(x_57);
x_63 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_63, 0, x_61);
lean_ctor_set(x_63, 1, x_62);
return x_63;
}
}
}
else
{
lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_64 = lean_ctor_get(x_26, 0);
lean_inc(x_64);
lean_dec(x_26);
x_65 = lean_box_usize(x_1);
x_66 = lean_llvm_position_builder_at_end(x_65, x_2, x_4, x_12);
x_67 = lean_ctor_get(x_66, 1);
lean_inc(x_67);
lean_dec(x_66);
lean_inc(x_11);
lean_inc(x_10);
x_68 = l_Lean_IR_EmitLLVM_emitFnBody(x_1, x_2, x_64, x_10, x_11, x_67);
if (lean_obj_tag(x_68) == 0)
{
lean_object* x_69; lean_object* x_70;
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
lean_dec(x_68);
x_13 = x_69;
x_14 = x_70;
goto block_24;
}
else
{
uint8_t x_71;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_3);
x_71 = !lean_is_exclusive(x_68);
if (x_71 == 0)
{
return x_68;
}
else
{
lean_object* x_72; lean_object* x_73; lean_object* x_74;
x_72 = lean_ctor_get(x_68, 0);
x_73 = lean_ctor_get(x_68, 1);
lean_inc(x_73);
lean_inc(x_72);
lean_dec(x_68);
x_74 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_74, 0, x_72);
lean_ctor_set(x_74, 1, x_73);
return x_74;
}
}
}
}
else
{
lean_object* x_75; lean_object* x_76;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_3);
x_75 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_75, 0, x_9);
x_76 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_76, 0, x_75);
lean_ctor_set(x_76, 1, x_12);
return x_76;
}
block_24:
{
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_15;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_3);
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16;
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_13);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
else
{
lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, 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_14);
return x_19;
}
}
else
{
lean_object* x_20; size_t x_21; size_t x_22;
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
lean_dec(x_13);
x_21 = 1;
x_22 = lean_usize_add(x_7, x_21);
x_7 = x_22;
x_9 = x_20;
x_12 = x_14;
goto _start;
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitCase___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("case_", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitCase___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_default", 8);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitCase(size_t x_1, size_t 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_46; lean_object* x_47;
x_9 = lean_box_usize(x_1);
x_10 = lean_llvm_get_insert_block(x_9, x_2, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
lean_ctor_release(x_10, 1);
x_13 = x_10;
} else {
lean_dec_ref(x_10);
x_13 = lean_box(0);
}
x_46 = l_Lean_IR_EmitLLVM_emitTag(x_1, x_2, x_3, x_4, x_6, x_7, x_12);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
uint8_t x_48;
lean_dec(x_13);
lean_dec(x_11);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_48 = !lean_is_exclusive(x_46);
if (x_48 == 0)
{
lean_object* x_49; uint8_t x_50;
x_49 = lean_ctor_get(x_46, 0);
lean_dec(x_49);
x_50 = !lean_is_exclusive(x_47);
if (x_50 == 0)
{
return x_46;
}
else
{
lean_object* x_51; lean_object* x_52;
x_51 = lean_ctor_get(x_47, 0);
lean_inc(x_51);
lean_dec(x_47);
x_52 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_46, 0, x_52);
return x_46;
}
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_53 = lean_ctor_get(x_46, 1);
lean_inc(x_53);
lean_dec(x_46);
x_54 = lean_ctor_get(x_47, 0);
lean_inc(x_54);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
x_55 = x_47;
} else {
lean_dec_ref(x_47);
x_55 = lean_box(0);
}
if (lean_is_scalar(x_55)) {
x_56 = lean_alloc_ctor(0, 1, 0);
} else {
x_56 = x_55;
}
lean_ctor_set(x_56, 0, x_54);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_53);
return x_57;
}
}
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; size_t x_64; size_t 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; lean_object* x_81; uint64_t x_82; size_t x_83; size_t x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; uint8_t x_89;
x_58 = lean_ctor_get(x_46, 1);
lean_inc(x_58);
lean_dec(x_46);
x_59 = lean_ctor_get(x_47, 0);
lean_inc(x_59);
lean_dec(x_47);
x_60 = l_LLVM_i64Type(x_1, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_64 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_65 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_66 = lean_llvm_build_zext(x_1, x_2, x_64, x_65, x_63, x_62);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_ctor_get(x_66, 1);
lean_inc(x_68);
lean_dec(x_66);
x_69 = l_Lean_IR_EmitLLVM_ensureHasDefault_x27(x_5);
x_70 = l___private_Lean_Compiler_IR_Format_0__Lean_IR_formatIRType(x_4);
x_71 = l_Std_Format_defWidth;
x_72 = lean_format_pretty(x_70, x_71);
x_73 = l_Lean_IR_EmitLLVM_emitCase___closed__1;
x_74 = lean_string_append(x_73, x_72);
lean_dec(x_72);
x_75 = l_Lean_IR_EmitLLVM_emitCase___closed__2;
lean_inc(x_74);
x_76 = lean_string_append(x_74, x_75);
x_77 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_76, x_6, x_7, x_68);
lean_dec(x_76);
x_78 = lean_ctor_get(x_77, 0);
lean_inc(x_78);
x_79 = lean_ctor_get(x_77, 1);
lean_inc(x_79);
lean_dec(x_77);
x_80 = lean_ctor_get(x_78, 0);
lean_inc(x_80);
lean_dec(x_78);
x_81 = lean_array_get_size(x_69);
x_82 = lean_uint64_of_nat(x_81);
x_83 = lean_unbox_usize(x_67);
lean_dec(x_67);
x_84 = lean_unbox_usize(x_80);
x_85 = lean_llvm_build_switch(x_1, x_2, x_83, x_84, x_82, x_79);
x_86 = lean_ctor_get(x_85, 0);
lean_inc(x_86);
x_87 = lean_ctor_get(x_85, 1);
lean_inc(x_87);
lean_dec(x_85);
x_88 = lean_unsigned_to_nat(0u);
x_89 = lean_nat_dec_lt(x_88, x_81);
if (x_89 == 0)
{
lean_object* x_90;
lean_dec(x_86);
lean_dec(x_81);
lean_dec(x_80);
lean_dec(x_74);
lean_dec(x_69);
lean_dec(x_7);
lean_dec(x_6);
x_90 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_14 = x_90;
x_15 = x_87;
goto block_45;
}
else
{
uint8_t x_91;
x_91 = lean_nat_dec_le(x_81, x_81);
if (x_91 == 0)
{
lean_object* x_92;
lean_dec(x_86);
lean_dec(x_81);
lean_dec(x_80);
lean_dec(x_74);
lean_dec(x_69);
lean_dec(x_7);
lean_dec(x_6);
x_92 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_14 = x_92;
x_15 = x_87;
goto block_45;
}
else
{
size_t x_93; size_t x_94; lean_object* x_95; size_t x_96; size_t x_97; lean_object* x_98;
x_93 = 0;
x_94 = lean_usize_of_nat(x_81);
lean_dec(x_81);
x_95 = lean_box(0);
x_96 = lean_unbox_usize(x_80);
lean_dec(x_80);
x_97 = lean_unbox_usize(x_86);
lean_dec(x_86);
x_98 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1(x_1, x_2, x_74, x_96, x_97, x_69, x_93, x_94, x_95, x_6, x_7, x_87);
lean_dec(x_69);
if (lean_obj_tag(x_98) == 0)
{
lean_object* x_99; lean_object* x_100;
x_99 = lean_ctor_get(x_98, 0);
lean_inc(x_99);
x_100 = lean_ctor_get(x_98, 1);
lean_inc(x_100);
lean_dec(x_98);
x_14 = x_99;
x_15 = x_100;
goto block_45;
}
else
{
uint8_t x_101;
lean_dec(x_13);
lean_dec(x_11);
x_101 = !lean_is_exclusive(x_98);
if (x_101 == 0)
{
return x_98;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_102 = lean_ctor_get(x_98, 0);
x_103 = lean_ctor_get(x_98, 1);
lean_inc(x_103);
lean_inc(x_102);
lean_dec(x_98);
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;
}
}
}
}
}
block_45:
{
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_16;
lean_dec(x_11);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17;
if (lean_is_scalar(x_13)) {
x_17 = lean_alloc_ctor(0, 2, 0);
} else {
x_17 = x_13;
}
lean_ctor_set(x_17, 0, x_14);
lean_ctor_set(x_17, 1, x_15);
return x_17;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
if (lean_is_scalar(x_13)) {
x_20 = lean_alloc_ctor(0, 2, 0);
} else {
x_20 = x_13;
}
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_15);
return x_20;
}
}
else
{
uint8_t x_21;
lean_dec(x_13);
x_21 = !lean_is_exclusive(x_14);
if (x_21 == 0)
{
lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; lean_object* x_28; uint8_t x_29;
x_22 = lean_ctor_get(x_14, 0);
lean_dec(x_22);
x_23 = lean_box_usize(x_1);
x_24 = lean_llvm_clear_insertion_position(x_23, x_2, x_15);
x_25 = lean_ctor_get(x_24, 1);
lean_inc(x_25);
lean_dec(x_24);
x_26 = lean_box_usize(x_1);
x_27 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_28 = lean_llvm_position_builder_at_end(x_26, x_2, x_27, x_25);
x_29 = !lean_is_exclusive(x_28);
if (x_29 == 0)
{
lean_object* x_30;
x_30 = lean_ctor_get(x_28, 0);
lean_ctor_set(x_14, 0, x_30);
lean_ctor_set(x_28, 0, x_14);
return x_28;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_28, 0);
x_32 = lean_ctor_get(x_28, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_28);
lean_ctor_set(x_14, 0, x_31);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_14);
lean_ctor_set(x_33, 1, x_32);
return x_33;
}
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t 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_dec(x_14);
x_34 = lean_box_usize(x_1);
x_35 = lean_llvm_clear_insertion_position(x_34, x_2, x_15);
x_36 = lean_ctor_get(x_35, 1);
lean_inc(x_36);
lean_dec(x_35);
x_37 = lean_box_usize(x_1);
x_38 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_39 = lean_llvm_position_builder_at_end(x_37, x_2, x_38, x_36);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
if (lean_is_exclusive(x_39)) {
lean_ctor_release(x_39, 0);
lean_ctor_release(x_39, 1);
x_42 = x_39;
} else {
lean_dec_ref(x_39);
x_42 = lean_box(0);
}
x_43 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_43, 0, x_40);
if (lean_is_scalar(x_42)) {
x_44 = lean_alloc_ctor(0, 2, 0);
} else {
x_44 = x_42;
}
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_41);
return x_44;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnBody(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
x_7 = l_Lean_IR_EmitLLVM_declareVars(x_1, x_2, x_3, x_4, x_5, x_6);
if (lean_obj_tag(x_7) == 0)
{
lean_object* x_8;
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
if (lean_obj_tag(x_8) == 0)
{
uint8_t x_9;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_9 = !lean_is_exclusive(x_7);
if (x_9 == 0)
{
lean_object* x_10; uint8_t x_11;
x_10 = lean_ctor_get(x_7, 0);
lean_dec(x_10);
x_11 = !lean_is_exclusive(x_8);
if (x_11 == 0)
{
return x_7;
}
else
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_8, 0);
lean_inc(x_12);
lean_dec(x_8);
x_13 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_7, 0, x_13);
return x_7;
}
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_14 = lean_ctor_get(x_7, 1);
lean_inc(x_14);
lean_dec(x_7);
x_15 = lean_ctor_get(x_8, 0);
lean_inc(x_15);
if (lean_is_exclusive(x_8)) {
lean_ctor_release(x_8, 0);
x_16 = x_8;
} else {
lean_dec_ref(x_8);
x_16 = lean_box(0);
}
if (lean_is_scalar(x_16)) {
x_17 = lean_alloc_ctor(0, 1, 0);
} else {
x_17 = x_16;
}
lean_ctor_set(x_17, 0, x_15);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_18, 1, x_14);
return x_18;
}
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_8);
x_19 = lean_ctor_get(x_7, 1);
lean_inc(x_19);
lean_dec(x_7);
x_20 = l_Lean_IR_EmitLLVM_emitBlock(x_1, x_2, x_3, x_4, x_5, x_19);
return x_20;
}
}
else
{
uint8_t x_21;
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_21 = !lean_is_exclusive(x_7);
if (x_21 == 0)
{
return x_7;
}
else
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_7, 0);
x_23 = lean_ctor_get(x_7, 1);
lean_inc(x_23);
lean_inc(x_22);
lean_dec(x_7);
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;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___lambda__1(size_t x_1, size_t 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_dec(x_4);
x_8 = l_Lean_IR_EmitLLVM_emitBlock(x_1, x_2, x_3, x_5, x_6, x_7);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitBlock___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("ret_val", 7);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
switch (lean_obj_tag(x_3)) {
case 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_3, 0);
lean_inc(x_7);
x_8 = lean_ctor_get(x_3, 1);
lean_inc(x_8);
x_9 = lean_ctor_get(x_3, 2);
lean_inc(x_9);
x_10 = lean_ctor_get(x_3, 3);
lean_inc(x_10);
x_11 = lean_ctor_get(x_5, 3);
lean_inc(x_11);
x_12 = l_Lean_IR_isTailCallTo(x_11, x_3);
lean_dec(x_3);
if (x_12 == 0)
{
lean_object* x_13;
lean_dec(x_11);
lean_inc(x_5);
lean_inc(x_4);
x_13 = l_Lean_IR_EmitLLVM_emitVDecl(x_1, x_2, x_7, x_8, x_9, x_4, x_5, x_6);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16; uint8_t x_17;
x_16 = lean_ctor_get(x_13, 0);
lean_dec(x_16);
x_17 = !lean_is_exclusive(x_14);
if (x_17 == 0)
{
return x_13;
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_13, 0, x_19);
return x_13;
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_20 = lean_ctor_get(x_13, 1);
lean_inc(x_20);
lean_dec(x_13);
x_21 = lean_ctor_get(x_14, 0);
lean_inc(x_21);
if (lean_is_exclusive(x_14)) {
lean_ctor_release(x_14, 0);
x_22 = x_14;
} else {
lean_dec_ref(x_14);
x_22 = lean_box(0);
}
if (lean_is_scalar(x_22)) {
x_23 = lean_alloc_ctor(0, 1, 0);
} else {
x_23 = x_22;
}
lean_ctor_set(x_23, 0, x_21);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_20);
return x_24;
}
}
else
{
lean_object* x_25;
lean_dec(x_14);
x_25 = lean_ctor_get(x_13, 1);
lean_inc(x_25);
lean_dec(x_13);
x_3 = x_10;
x_6 = x_25;
goto _start;
}
}
else
{
uint8_t x_27;
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_27 = !lean_is_exclusive(x_13);
if (x_27 == 0)
{
return x_13;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_13, 0);
x_29 = lean_ctor_get(x_13, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_13);
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_dec(x_10);
lean_dec(x_8);
lean_dec(x_7);
x_31 = l_Lean_IR_EmitLLVM_emitTailCall(x_1, x_2, x_11, x_9, x_4, x_5, x_6);
return x_31;
}
}
case 1:
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_32 = lean_ctor_get(x_3, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_3, 1);
lean_inc(x_33);
x_34 = lean_ctor_get(x_3, 2);
lean_inc(x_34);
x_35 = lean_ctor_get(x_3, 3);
lean_inc(x_35);
lean_dec(x_3);
lean_inc(x_5);
lean_inc(x_4);
x_36 = l_Lean_IR_EmitLLVM_emitJDecl(x_1, x_2, x_32, x_33, x_34, x_4, x_5, x_6);
lean_dec(x_33);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37;
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
if (lean_obj_tag(x_37) == 0)
{
uint8_t x_38;
lean_dec(x_35);
lean_dec(x_5);
lean_dec(x_4);
x_38 = !lean_is_exclusive(x_36);
if (x_38 == 0)
{
lean_object* x_39; uint8_t x_40;
x_39 = lean_ctor_get(x_36, 0);
lean_dec(x_39);
x_40 = !lean_is_exclusive(x_37);
if (x_40 == 0)
{
return x_36;
}
else
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_37, 0);
lean_inc(x_41);
lean_dec(x_37);
x_42 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_36, 0, x_42);
return x_36;
}
}
else
{
lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_43 = lean_ctor_get(x_36, 1);
lean_inc(x_43);
lean_dec(x_36);
x_44 = lean_ctor_get(x_37, 0);
lean_inc(x_44);
if (lean_is_exclusive(x_37)) {
lean_ctor_release(x_37, 0);
x_45 = x_37;
} else {
lean_dec_ref(x_37);
x_45 = lean_box(0);
}
if (lean_is_scalar(x_45)) {
x_46 = lean_alloc_ctor(0, 1, 0);
} else {
x_46 = x_45;
}
lean_ctor_set(x_46, 0, x_44);
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_43);
return x_47;
}
}
else
{
lean_object* x_48;
lean_dec(x_37);
x_48 = lean_ctor_get(x_36, 1);
lean_inc(x_48);
lean_dec(x_36);
x_3 = x_35;
x_6 = x_48;
goto _start;
}
}
else
{
uint8_t x_50;
lean_dec(x_35);
lean_dec(x_5);
lean_dec(x_4);
x_50 = !lean_is_exclusive(x_36);
if (x_50 == 0)
{
return x_36;
}
else
{
lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_51 = lean_ctor_get(x_36, 0);
x_52 = lean_ctor_get(x_36, 1);
lean_inc(x_52);
lean_inc(x_51);
lean_dec(x_36);
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 2:
{
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_3, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_3, 1);
lean_inc(x_55);
x_56 = lean_ctor_get(x_3, 2);
lean_inc(x_56);
x_57 = lean_ctor_get(x_3, 3);
lean_inc(x_57);
lean_dec(x_3);
x_58 = l_Lean_IR_EmitLLVM_emitSet(x_1, x_2, x_54, x_55, x_56, x_4, x_5, x_6);
lean_dec(x_55);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
if (lean_obj_tag(x_59) == 0)
{
uint8_t x_60;
lean_dec(x_57);
lean_dec(x_5);
lean_dec(x_4);
x_60 = !lean_is_exclusive(x_58);
if (x_60 == 0)
{
lean_object* x_61; uint8_t x_62;
x_61 = lean_ctor_get(x_58, 0);
lean_dec(x_61);
x_62 = !lean_is_exclusive(x_59);
if (x_62 == 0)
{
return x_58;
}
else
{
lean_object* x_63; lean_object* x_64;
x_63 = lean_ctor_get(x_59, 0);
lean_inc(x_63);
lean_dec(x_59);
x_64 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_64, 0, x_63);
lean_ctor_set(x_58, 0, x_64);
return x_58;
}
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69;
x_65 = lean_ctor_get(x_58, 1);
lean_inc(x_65);
lean_dec(x_58);
x_66 = lean_ctor_get(x_59, 0);
lean_inc(x_66);
if (lean_is_exclusive(x_59)) {
lean_ctor_release(x_59, 0);
x_67 = x_59;
} else {
lean_dec_ref(x_59);
x_67 = lean_box(0);
}
if (lean_is_scalar(x_67)) {
x_68 = lean_alloc_ctor(0, 1, 0);
} else {
x_68 = x_67;
}
lean_ctor_set(x_68, 0, x_66);
x_69 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_69, 0, x_68);
lean_ctor_set(x_69, 1, x_65);
return x_69;
}
}
else
{
lean_object* x_70;
lean_dec(x_59);
x_70 = lean_ctor_get(x_58, 1);
lean_inc(x_70);
lean_dec(x_58);
x_3 = x_57;
x_6 = x_70;
goto _start;
}
}
case 3:
{
lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76;
x_72 = lean_ctor_get(x_3, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_3, 1);
lean_inc(x_73);
x_74 = lean_ctor_get(x_3, 2);
lean_inc(x_74);
lean_dec(x_3);
x_75 = l_Lean_IR_EmitLLVM_emitSetTag(x_1, x_2, x_72, x_73, x_4, x_5, x_6);
lean_dec(x_73);
x_76 = lean_ctor_get(x_75, 0);
lean_inc(x_76);
if (lean_obj_tag(x_76) == 0)
{
uint8_t x_77;
lean_dec(x_74);
lean_dec(x_5);
lean_dec(x_4);
x_77 = !lean_is_exclusive(x_75);
if (x_77 == 0)
{
lean_object* x_78; uint8_t x_79;
x_78 = lean_ctor_get(x_75, 0);
lean_dec(x_78);
x_79 = !lean_is_exclusive(x_76);
if (x_79 == 0)
{
return x_75;
}
else
{
lean_object* x_80; lean_object* x_81;
x_80 = lean_ctor_get(x_76, 0);
lean_inc(x_80);
lean_dec(x_76);
x_81 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_81, 0, x_80);
lean_ctor_set(x_75, 0, x_81);
return x_75;
}
}
else
{
lean_object* x_82; lean_object* x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_82 = lean_ctor_get(x_75, 1);
lean_inc(x_82);
lean_dec(x_75);
x_83 = lean_ctor_get(x_76, 0);
lean_inc(x_83);
if (lean_is_exclusive(x_76)) {
lean_ctor_release(x_76, 0);
x_84 = x_76;
} else {
lean_dec_ref(x_76);
x_84 = lean_box(0);
}
if (lean_is_scalar(x_84)) {
x_85 = lean_alloc_ctor(0, 1, 0);
} else {
x_85 = x_84;
}
lean_ctor_set(x_85, 0, x_83);
x_86 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_86, 0, x_85);
lean_ctor_set(x_86, 1, x_82);
return x_86;
}
}
else
{
lean_object* x_87;
lean_dec(x_76);
x_87 = lean_ctor_get(x_75, 1);
lean_inc(x_87);
lean_dec(x_75);
x_3 = x_74;
x_6 = x_87;
goto _start;
}
}
case 4:
{
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_3, 0);
lean_inc(x_89);
x_90 = lean_ctor_get(x_3, 1);
lean_inc(x_90);
x_91 = lean_ctor_get(x_3, 2);
lean_inc(x_91);
x_92 = lean_ctor_get(x_3, 3);
lean_inc(x_92);
lean_dec(x_3);
x_93 = l_Lean_IR_EmitLLVM_emitUSet(x_1, x_2, x_89, x_90, x_91, x_4, x_5, x_6);
lean_dec(x_90);
x_94 = lean_ctor_get(x_93, 0);
lean_inc(x_94);
if (lean_obj_tag(x_94) == 0)
{
uint8_t x_95;
lean_dec(x_92);
lean_dec(x_5);
lean_dec(x_4);
x_95 = !lean_is_exclusive(x_93);
if (x_95 == 0)
{
lean_object* x_96; uint8_t x_97;
x_96 = lean_ctor_get(x_93, 0);
lean_dec(x_96);
x_97 = !lean_is_exclusive(x_94);
if (x_97 == 0)
{
return x_93;
}
else
{
lean_object* x_98; lean_object* x_99;
x_98 = lean_ctor_get(x_94, 0);
lean_inc(x_98);
lean_dec(x_94);
x_99 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_99, 0, x_98);
lean_ctor_set(x_93, 0, x_99);
return x_93;
}
}
else
{
lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_100 = lean_ctor_get(x_93, 1);
lean_inc(x_100);
lean_dec(x_93);
x_101 = lean_ctor_get(x_94, 0);
lean_inc(x_101);
if (lean_is_exclusive(x_94)) {
lean_ctor_release(x_94, 0);
x_102 = x_94;
} else {
lean_dec_ref(x_94);
x_102 = lean_box(0);
}
if (lean_is_scalar(x_102)) {
x_103 = lean_alloc_ctor(0, 1, 0);
} else {
x_103 = x_102;
}
lean_ctor_set(x_103, 0, x_101);
x_104 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_104, 0, x_103);
lean_ctor_set(x_104, 1, x_100);
return x_104;
}
}
else
{
lean_object* x_105;
lean_dec(x_94);
x_105 = lean_ctor_get(x_93, 1);
lean_inc(x_105);
lean_dec(x_93);
x_3 = x_92;
x_6 = x_105;
goto _start;
}
}
case 5:
{
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_object* x_113; lean_object* x_114;
x_107 = lean_ctor_get(x_3, 0);
lean_inc(x_107);
x_108 = lean_ctor_get(x_3, 1);
lean_inc(x_108);
x_109 = lean_ctor_get(x_3, 2);
lean_inc(x_109);
x_110 = lean_ctor_get(x_3, 3);
lean_inc(x_110);
x_111 = lean_ctor_get(x_3, 4);
lean_inc(x_111);
x_112 = lean_ctor_get(x_3, 5);
lean_inc(x_112);
lean_dec(x_3);
x_113 = l_Lean_IR_EmitLLVM_emitSSet(x_1, x_2, x_107, x_108, x_109, x_110, x_111, x_4, x_5, x_6);
lean_dec(x_109);
lean_dec(x_108);
x_114 = lean_ctor_get(x_113, 0);
lean_inc(x_114);
if (lean_obj_tag(x_114) == 0)
{
uint8_t x_115;
lean_dec(x_112);
lean_dec(x_5);
lean_dec(x_4);
x_115 = !lean_is_exclusive(x_113);
if (x_115 == 0)
{
lean_object* x_116; uint8_t x_117;
x_116 = lean_ctor_get(x_113, 0);
lean_dec(x_116);
x_117 = !lean_is_exclusive(x_114);
if (x_117 == 0)
{
return x_113;
}
else
{
lean_object* x_118; lean_object* x_119;
x_118 = lean_ctor_get(x_114, 0);
lean_inc(x_118);
lean_dec(x_114);
x_119 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_119, 0, x_118);
lean_ctor_set(x_113, 0, x_119);
return x_113;
}
}
else
{
lean_object* x_120; lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124;
x_120 = lean_ctor_get(x_113, 1);
lean_inc(x_120);
lean_dec(x_113);
x_121 = lean_ctor_get(x_114, 0);
lean_inc(x_121);
if (lean_is_exclusive(x_114)) {
lean_ctor_release(x_114, 0);
x_122 = x_114;
} else {
lean_dec_ref(x_114);
x_122 = lean_box(0);
}
if (lean_is_scalar(x_122)) {
x_123 = lean_alloc_ctor(0, 1, 0);
} else {
x_123 = x_122;
}
lean_ctor_set(x_123, 0, x_121);
x_124 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_124, 0, x_123);
lean_ctor_set(x_124, 1, x_120);
return x_124;
}
}
else
{
lean_object* x_125;
lean_dec(x_114);
x_125 = lean_ctor_get(x_113, 1);
lean_inc(x_125);
lean_dec(x_113);
x_3 = x_112;
x_6 = x_125;
goto _start;
}
}
case 6:
{
uint8_t x_127;
x_127 = lean_ctor_get_uint8(x_3, sizeof(void*)*3 + 1);
if (x_127 == 0)
{
lean_object* x_128; lean_object* x_129; uint8_t x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133;
x_128 = lean_ctor_get(x_3, 0);
lean_inc(x_128);
x_129 = lean_ctor_get(x_3, 1);
lean_inc(x_129);
x_130 = lean_ctor_get_uint8(x_3, sizeof(void*)*3);
x_131 = lean_ctor_get(x_3, 2);
lean_inc(x_131);
lean_dec(x_3);
x_132 = l_Lean_IR_EmitLLVM_emitInc(x_1, x_2, x_128, x_129, x_130, x_4, x_5, x_6);
lean_dec(x_129);
x_133 = lean_ctor_get(x_132, 0);
lean_inc(x_133);
if (lean_obj_tag(x_133) == 0)
{
uint8_t x_134;
lean_dec(x_131);
lean_dec(x_5);
lean_dec(x_4);
x_134 = !lean_is_exclusive(x_132);
if (x_134 == 0)
{
lean_object* x_135; uint8_t x_136;
x_135 = lean_ctor_get(x_132, 0);
lean_dec(x_135);
x_136 = !lean_is_exclusive(x_133);
if (x_136 == 0)
{
return x_132;
}
else
{
lean_object* x_137; lean_object* x_138;
x_137 = lean_ctor_get(x_133, 0);
lean_inc(x_137);
lean_dec(x_133);
x_138 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_138, 0, x_137);
lean_ctor_set(x_132, 0, x_138);
return x_132;
}
}
else
{
lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143;
x_139 = lean_ctor_get(x_132, 1);
lean_inc(x_139);
lean_dec(x_132);
x_140 = lean_ctor_get(x_133, 0);
lean_inc(x_140);
if (lean_is_exclusive(x_133)) {
lean_ctor_release(x_133, 0);
x_141 = x_133;
} else {
lean_dec_ref(x_133);
x_141 = lean_box(0);
}
if (lean_is_scalar(x_141)) {
x_142 = lean_alloc_ctor(0, 1, 0);
} else {
x_142 = x_141;
}
lean_ctor_set(x_142, 0, x_140);
x_143 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_143, 0, x_142);
lean_ctor_set(x_143, 1, x_139);
return x_143;
}
}
else
{
lean_object* x_144;
lean_dec(x_133);
x_144 = lean_ctor_get(x_132, 1);
lean_inc(x_144);
lean_dec(x_132);
x_3 = x_131;
x_6 = x_144;
goto _start;
}
}
else
{
lean_object* x_146;
x_146 = lean_ctor_get(x_3, 2);
lean_inc(x_146);
lean_dec(x_3);
x_3 = x_146;
goto _start;
}
}
case 7:
{
uint8_t x_148;
x_148 = lean_ctor_get_uint8(x_3, sizeof(void*)*3 + 1);
if (x_148 == 0)
{
lean_object* x_149; lean_object* x_150; uint8_t x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154;
x_149 = lean_ctor_get(x_3, 0);
lean_inc(x_149);
x_150 = lean_ctor_get(x_3, 1);
lean_inc(x_150);
x_151 = lean_ctor_get_uint8(x_3, sizeof(void*)*3);
x_152 = lean_ctor_get(x_3, 2);
lean_inc(x_152);
lean_dec(x_3);
x_153 = l_Lean_IR_EmitLLVM_emitDec(x_1, x_2, x_149, x_150, x_151, x_4, x_5, x_6);
lean_dec(x_150);
x_154 = lean_ctor_get(x_153, 0);
lean_inc(x_154);
if (lean_obj_tag(x_154) == 0)
{
uint8_t x_155;
lean_dec(x_152);
lean_dec(x_5);
lean_dec(x_4);
x_155 = !lean_is_exclusive(x_153);
if (x_155 == 0)
{
lean_object* x_156; uint8_t x_157;
x_156 = lean_ctor_get(x_153, 0);
lean_dec(x_156);
x_157 = !lean_is_exclusive(x_154);
if (x_157 == 0)
{
return x_153;
}
else
{
lean_object* x_158; lean_object* x_159;
x_158 = lean_ctor_get(x_154, 0);
lean_inc(x_158);
lean_dec(x_154);
x_159 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_159, 0, x_158);
lean_ctor_set(x_153, 0, x_159);
return x_153;
}
}
else
{
lean_object* x_160; lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164;
x_160 = lean_ctor_get(x_153, 1);
lean_inc(x_160);
lean_dec(x_153);
x_161 = lean_ctor_get(x_154, 0);
lean_inc(x_161);
if (lean_is_exclusive(x_154)) {
lean_ctor_release(x_154, 0);
x_162 = x_154;
} else {
lean_dec_ref(x_154);
x_162 = lean_box(0);
}
if (lean_is_scalar(x_162)) {
x_163 = lean_alloc_ctor(0, 1, 0);
} else {
x_163 = x_162;
}
lean_ctor_set(x_163, 0, x_161);
x_164 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_164, 0, x_163);
lean_ctor_set(x_164, 1, x_160);
return x_164;
}
}
else
{
lean_object* x_165;
lean_dec(x_154);
x_165 = lean_ctor_get(x_153, 1);
lean_inc(x_165);
lean_dec(x_153);
x_3 = x_152;
x_6 = x_165;
goto _start;
}
}
else
{
lean_object* x_167;
x_167 = lean_ctor_get(x_3, 2);
lean_inc(x_167);
lean_dec(x_3);
x_3 = x_167;
goto _start;
}
}
case 8:
{
lean_object* x_169; lean_object* x_170; lean_object* x_171; lean_object* x_172;
x_169 = lean_ctor_get(x_3, 0);
lean_inc(x_169);
x_170 = lean_ctor_get(x_3, 1);
lean_inc(x_170);
lean_dec(x_3);
x_171 = l_Lean_IR_EmitLLVM_emitDel(x_1, x_2, x_169, x_4, x_5, x_6);
x_172 = lean_ctor_get(x_171, 0);
lean_inc(x_172);
if (lean_obj_tag(x_172) == 0)
{
uint8_t x_173;
lean_dec(x_170);
lean_dec(x_5);
lean_dec(x_4);
x_173 = !lean_is_exclusive(x_171);
if (x_173 == 0)
{
lean_object* x_174; uint8_t x_175;
x_174 = lean_ctor_get(x_171, 0);
lean_dec(x_174);
x_175 = !lean_is_exclusive(x_172);
if (x_175 == 0)
{
return x_171;
}
else
{
lean_object* x_176; lean_object* x_177;
x_176 = lean_ctor_get(x_172, 0);
lean_inc(x_176);
lean_dec(x_172);
x_177 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_177, 0, x_176);
lean_ctor_set(x_171, 0, x_177);
return x_171;
}
}
else
{
lean_object* x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; lean_object* x_182;
x_178 = lean_ctor_get(x_171, 1);
lean_inc(x_178);
lean_dec(x_171);
x_179 = lean_ctor_get(x_172, 0);
lean_inc(x_179);
if (lean_is_exclusive(x_172)) {
lean_ctor_release(x_172, 0);
x_180 = x_172;
} else {
lean_dec_ref(x_172);
x_180 = lean_box(0);
}
if (lean_is_scalar(x_180)) {
x_181 = lean_alloc_ctor(0, 1, 0);
} else {
x_181 = x_180;
}
lean_ctor_set(x_181, 0, x_179);
x_182 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_182, 0, x_181);
lean_ctor_set(x_182, 1, x_178);
return x_182;
}
}
else
{
lean_object* x_183;
lean_dec(x_172);
x_183 = lean_ctor_get(x_171, 1);
lean_inc(x_183);
lean_dec(x_171);
x_3 = x_170;
x_6 = x_183;
goto _start;
}
}
case 9:
{
lean_object* x_185;
x_185 = lean_ctor_get(x_3, 1);
lean_inc(x_185);
lean_dec(x_3);
x_3 = x_185;
goto _start;
}
case 10:
{
lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190;
x_187 = lean_ctor_get(x_3, 1);
lean_inc(x_187);
x_188 = lean_ctor_get(x_3, 2);
lean_inc(x_188);
x_189 = lean_ctor_get(x_3, 3);
lean_inc(x_189);
lean_dec(x_3);
x_190 = l_Lean_IR_EmitLLVM_emitCase(x_1, x_2, x_187, x_188, x_189, x_4, x_5, x_6);
return x_190;
}
case 11:
{
lean_object* x_191; lean_object* x_192; lean_object* x_193; lean_object* x_194;
x_191 = lean_ctor_get(x_3, 0);
lean_inc(x_191);
lean_dec(x_3);
x_192 = l_Lean_IR_EmitLLVM_emitBlock___closed__1;
x_193 = l_Lean_IR_EmitLLVM_emitArgVal(x_1, x_2, x_191, x_192, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
x_194 = lean_ctor_get(x_193, 0);
lean_inc(x_194);
if (lean_obj_tag(x_194) == 0)
{
uint8_t x_195;
x_195 = !lean_is_exclusive(x_193);
if (x_195 == 0)
{
lean_object* x_196; uint8_t x_197;
x_196 = lean_ctor_get(x_193, 0);
lean_dec(x_196);
x_197 = !lean_is_exclusive(x_194);
if (x_197 == 0)
{
return x_193;
}
else
{
lean_object* x_198; lean_object* x_199;
x_198 = lean_ctor_get(x_194, 0);
lean_inc(x_198);
lean_dec(x_194);
x_199 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_199, 0, x_198);
lean_ctor_set(x_193, 0, x_199);
return x_193;
}
}
else
{
lean_object* x_200; lean_object* x_201; lean_object* x_202; lean_object* x_203; lean_object* x_204;
x_200 = lean_ctor_get(x_193, 1);
lean_inc(x_200);
lean_dec(x_193);
x_201 = lean_ctor_get(x_194, 0);
lean_inc(x_201);
if (lean_is_exclusive(x_194)) {
lean_ctor_release(x_194, 0);
x_202 = x_194;
} else {
lean_dec_ref(x_194);
x_202 = lean_box(0);
}
if (lean_is_scalar(x_202)) {
x_203 = lean_alloc_ctor(0, 1, 0);
} else {
x_203 = x_202;
}
lean_ctor_set(x_203, 0, x_201);
x_204 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_204, 0, x_203);
lean_ctor_set(x_204, 1, x_200);
return x_204;
}
}
else
{
lean_object* x_205; lean_object* x_206; lean_object* x_207; size_t x_208; lean_object* x_209; uint8_t x_210;
x_205 = lean_ctor_get(x_194, 0);
lean_inc(x_205);
lean_dec(x_194);
x_206 = lean_ctor_get(x_193, 1);
lean_inc(x_206);
lean_dec(x_193);
x_207 = lean_ctor_get(x_205, 1);
lean_inc(x_207);
lean_dec(x_205);
x_208 = lean_unbox_usize(x_207);
lean_dec(x_207);
x_209 = lean_llvm_build_ret(x_1, x_2, x_208, x_206);
x_210 = !lean_is_exclusive(x_209);
if (x_210 == 0)
{
lean_object* x_211; lean_object* x_212;
x_211 = lean_ctor_get(x_209, 0);
lean_dec(x_211);
x_212 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_209, 0, x_212);
return x_209;
}
else
{
lean_object* x_213; lean_object* x_214; lean_object* x_215;
x_213 = lean_ctor_get(x_209, 1);
lean_inc(x_213);
lean_dec(x_209);
x_214 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_215 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_215, 0, x_214);
lean_ctor_set(x_215, 1, x_213);
return x_215;
}
}
}
case 12:
{
lean_object* x_216; lean_object* x_217; lean_object* x_218;
x_216 = lean_ctor_get(x_3, 0);
lean_inc(x_216);
x_217 = lean_ctor_get(x_3, 1);
lean_inc(x_217);
lean_dec(x_3);
x_218 = l_Lean_IR_EmitLLVM_emitJmp(x_1, x_2, x_216, x_217, x_4, x_5, x_6);
return x_218;
}
default:
{
lean_object* x_219;
x_219 = l_Lean_IR_EmitLLVM_emitUnreachable(x_1, x_2, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_219;
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitJDecl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("jp_", 3);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJDecl(size_t x_1, size_t 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; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_9 = lean_box_usize(x_1);
x_10 = lean_llvm_get_insert_block(x_9, x_2, x_8);
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);
lean_inc(x_3);
x_13 = l_Nat_repr(x_3);
x_14 = l_Lean_IR_EmitLLVM_emitJDecl___closed__1;
x_15 = lean_string_append(x_14, x_13);
lean_dec(x_13);
x_16 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_17 = lean_string_append(x_15, x_16);
x_18 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_17, x_6, x_7, x_12);
lean_dec(x_17);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = lean_ctor_get(x_19, 0);
lean_inc(x_21);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_21);
x_23 = l_Lean_IR_EmitLLVM_addJpTostate(x_1, x_3, x_22, x_6, x_7, x_20);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = lean_box_usize(x_1);
x_26 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_27 = lean_llvm_position_builder_at_end(x_25, x_2, x_26, x_24);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
x_29 = l_Lean_IR_EmitLLVM_declareVars(x_1, x_2, x_5, x_6, x_7, x_28);
if (lean_obj_tag(x_29) == 0)
{
lean_object* x_30;
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
if (lean_obj_tag(x_30) == 0)
{
uint8_t x_31;
lean_dec(x_11);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_31 = !lean_is_exclusive(x_29);
if (x_31 == 0)
{
lean_object* x_32; uint8_t x_33;
x_32 = lean_ctor_get(x_29, 0);
lean_dec(x_32);
x_33 = !lean_is_exclusive(x_30);
if (x_33 == 0)
{
return x_29;
}
else
{
lean_object* x_34; lean_object* x_35;
x_34 = lean_ctor_get(x_30, 0);
lean_inc(x_34);
lean_dec(x_30);
x_35 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_35, 0, x_34);
lean_ctor_set(x_29, 0, x_35);
return x_29;
}
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_36 = lean_ctor_get(x_29, 1);
lean_inc(x_36);
lean_dec(x_29);
x_37 = lean_ctor_get(x_30, 0);
lean_inc(x_37);
if (lean_is_exclusive(x_30)) {
lean_ctor_release(x_30, 0);
x_38 = x_30;
} else {
lean_dec_ref(x_30);
x_38 = lean_box(0);
}
if (lean_is_scalar(x_38)) {
x_39 = lean_alloc_ctor(0, 1, 0);
} else {
x_39 = x_38;
}
lean_ctor_set(x_39, 0, x_37);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_39);
lean_ctor_set(x_40, 1, x_36);
return x_40;
}
}
else
{
lean_object* x_41; lean_object* x_42;
lean_dec(x_30);
x_41 = lean_ctor_get(x_29, 1);
lean_inc(x_41);
lean_dec(x_29);
x_42 = l_Lean_IR_EmitLLVM_emitBlock(x_1, x_2, x_5, x_6, x_7, x_41);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_43;
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
if (lean_obj_tag(x_43) == 0)
{
uint8_t x_44;
lean_dec(x_11);
x_44 = !lean_is_exclusive(x_42);
if (x_44 == 0)
{
lean_object* x_45; uint8_t x_46;
x_45 = lean_ctor_get(x_42, 0);
lean_dec(x_45);
x_46 = !lean_is_exclusive(x_43);
if (x_46 == 0)
{
return x_42;
}
else
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_43, 0);
lean_inc(x_47);
lean_dec(x_43);
x_48 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_48, 0, x_47);
lean_ctor_set(x_42, 0, x_48);
return x_42;
}
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53;
x_49 = lean_ctor_get(x_42, 1);
lean_inc(x_49);
lean_dec(x_42);
x_50 = lean_ctor_get(x_43, 0);
lean_inc(x_50);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
x_51 = x_43;
} else {
lean_dec_ref(x_43);
x_51 = lean_box(0);
}
if (lean_is_scalar(x_51)) {
x_52 = lean_alloc_ctor(0, 1, 0);
} else {
x_52 = x_51;
}
lean_ctor_set(x_52, 0, x_50);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_52);
lean_ctor_set(x_53, 1, x_49);
return x_53;
}
}
else
{
uint8_t x_54;
x_54 = !lean_is_exclusive(x_43);
if (x_54 == 0)
{
lean_object* x_55; lean_object* x_56; lean_object* x_57; size_t x_58; lean_object* x_59; uint8_t x_60;
x_55 = lean_ctor_get(x_43, 0);
lean_dec(x_55);
x_56 = lean_ctor_get(x_42, 1);
lean_inc(x_56);
lean_dec(x_42);
x_57 = lean_box_usize(x_1);
x_58 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_59 = lean_llvm_position_builder_at_end(x_57, x_2, x_58, x_56);
x_60 = !lean_is_exclusive(x_59);
if (x_60 == 0)
{
lean_object* x_61;
x_61 = lean_ctor_get(x_59, 0);
lean_ctor_set(x_43, 0, x_61);
lean_ctor_set(x_59, 0, x_43);
return x_59;
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_62 = lean_ctor_get(x_59, 0);
x_63 = lean_ctor_get(x_59, 1);
lean_inc(x_63);
lean_inc(x_62);
lean_dec(x_59);
lean_ctor_set(x_43, 0, x_62);
x_64 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_64, 0, x_43);
lean_ctor_set(x_64, 1, x_63);
return x_64;
}
}
else
{
lean_object* x_65; lean_object* x_66; size_t 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_dec(x_43);
x_65 = lean_ctor_get(x_42, 1);
lean_inc(x_65);
lean_dec(x_42);
x_66 = lean_box_usize(x_1);
x_67 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_68 = lean_llvm_position_builder_at_end(x_66, x_2, x_67, x_65);
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
if (lean_is_exclusive(x_68)) {
lean_ctor_release(x_68, 0);
lean_ctor_release(x_68, 1);
x_71 = x_68;
} else {
lean_dec_ref(x_68);
x_71 = lean_box(0);
}
x_72 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_72, 0, x_69);
if (lean_is_scalar(x_71)) {
x_73 = lean_alloc_ctor(0, 2, 0);
} else {
x_73 = x_71;
}
lean_ctor_set(x_73, 0, x_72);
lean_ctor_set(x_73, 1, x_70);
return x_73;
}
}
}
else
{
uint8_t x_74;
lean_dec(x_11);
x_74 = !lean_is_exclusive(x_42);
if (x_74 == 0)
{
return x_42;
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_42, 0);
x_76 = lean_ctor_get(x_42, 1);
lean_inc(x_76);
lean_inc(x_75);
lean_dec(x_42);
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
{
uint8_t x_78;
lean_dec(x_11);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_78 = !lean_is_exclusive(x_29);
if (x_78 == 0)
{
return x_29;
}
else
{
lean_object* x_79; lean_object* x_80; lean_object* x_81;
x_79 = lean_ctor_get(x_29, 0);
x_80 = lean_ctor_get(x_29, 1);
lean_inc(x_80);
lean_inc(x_79);
lean_dec(x_29);
x_81 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_81, 0, x_79);
lean_ctor_set(x_81, 1, x_80);
return x_81;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___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, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; size_t x_15; size_t x_16; size_t x_17; size_t x_18; lean_object* x_19;
x_13 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_14 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_15 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_16 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_17 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_18 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_19 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1(x_13, x_14, x_3, x_15, x_16, x_6, x_17, x_18, x_9, x_10, x_11, x_12);
lean_dec(x_6);
return x_19;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_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, lean_object* x_7, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitCase(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnBody___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_emitFnBody(x_7, x_8, x_3, x_4, x_5, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___lambda__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:
{
size_t x_8; size_t x_9; lean_object* x_10;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = l_Lean_IR_EmitLLVM_emitBlock___lambda__1(x_8, x_9, x_3, x_4, x_5, x_6, x_7);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitBlock___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:
{
size_t x_7; size_t x_8; lean_object* x_9;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = l_Lean_IR_EmitLLVM_emitBlock(x_7, x_8, x_3, x_4, x_5, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitJDecl___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:
{
size_t x_9; size_t x_10; lean_object* x_11;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = l_Lean_IR_EmitLLVM_emitJDecl(x_9, x_10, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_4);
return x_11;
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("arg_", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1(size_t x_1, size_t x_2, size_t 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) {
_start:
{
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_10; lean_object* x_11;
lean_dec(x_8);
lean_dec(x_7);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_6);
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_34; lean_object* x_72; uint8_t x_73;
lean_dec(x_6);
x_12 = lean_ctor_get(x_5, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_5, 1);
lean_inc(x_13);
lean_dec(x_5);
x_72 = lean_array_get_size(x_4);
x_73 = lean_nat_dec_lt(x_12, x_72);
lean_dec(x_72);
if (x_73 == 0)
{
lean_object* x_74; lean_object* x_75;
x_74 = l_Lean_IR_instInhabitedParam;
x_75 = l___private_Init_Util_0__outOfBounds___rarg(x_74);
x_34 = x_75;
goto block_71;
}
else
{
lean_object* x_76;
x_76 = lean_array_fget(x_4, x_12);
x_34 = x_76;
goto block_71;
}
block_33:
{
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_16;
lean_dec(x_13);
lean_dec(x_8);
lean_dec(x_7);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17;
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_14);
lean_ctor_set(x_17, 1, x_15);
return x_17;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_15);
return x_20;
}
}
else
{
uint8_t x_21;
x_21 = !lean_is_exclusive(x_14);
if (x_21 == 0)
{
lean_object* x_22;
x_22 = lean_ctor_get(x_14, 0);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23; lean_object* x_24;
lean_dec(x_13);
lean_dec(x_8);
lean_dec(x_7);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
lean_dec(x_22);
lean_ctor_set(x_14, 0, x_23);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_14);
lean_ctor_set(x_24, 1, x_15);
return x_24;
}
else
{
lean_object* x_25;
lean_free_object(x_14);
x_25 = lean_ctor_get(x_22, 0);
lean_inc(x_25);
lean_dec(x_22);
x_5 = x_13;
x_6 = x_25;
x_9 = x_15;
goto _start;
}
}
else
{
lean_object* x_27;
x_27 = lean_ctor_get(x_14, 0);
lean_inc(x_27);
lean_dec(x_14);
if (lean_obj_tag(x_27) == 0)
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
lean_dec(x_13);
lean_dec(x_8);
lean_dec(x_7);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
lean_dec(x_27);
x_29 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_29, 0, x_28);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_30, 1, x_15);
return x_30;
}
else
{
lean_object* x_31;
x_31 = lean_ctor_get(x_27, 0);
lean_inc(x_31);
lean_dec(x_27);
x_5 = x_13;
x_6 = x_31;
x_9 = x_15;
goto _start;
}
}
}
}
block_71:
{
lean_object* x_35; lean_object* x_36;
x_35 = lean_ctor_get(x_34, 1);
lean_inc(x_35);
lean_inc(x_8);
lean_inc(x_7);
x_36 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_35, x_7, x_8, x_9);
if (lean_obj_tag(x_36) == 0)
{
lean_object* x_37;
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
if (lean_obj_tag(x_37) == 0)
{
lean_object* x_38; uint8_t x_39;
lean_dec(x_34);
lean_dec(x_12);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = !lean_is_exclusive(x_37);
if (x_39 == 0)
{
x_14 = x_37;
x_15 = x_38;
goto block_33;
}
else
{
lean_object* x_40; lean_object* x_41;
x_40 = lean_ctor_get(x_37, 0);
lean_inc(x_40);
lean_dec(x_37);
x_41 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_41, 0, x_40);
x_14 = x_41;
x_15 = x_38;
goto block_33;
}
}
else
{
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; size_t x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; uint64_t x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; size_t x_57; size_t x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; size_t x_62; size_t x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_42 = lean_ctor_get(x_36, 1);
lean_inc(x_42);
lean_dec(x_36);
x_43 = lean_ctor_get(x_37, 0);
lean_inc(x_43);
lean_dec(x_37);
lean_inc(x_12);
x_44 = l_Nat_repr(x_12);
x_45 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1;
x_46 = lean_string_append(x_45, x_44);
lean_dec(x_44);
x_47 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_48 = lean_string_append(x_46, x_47);
x_49 = lean_unbox_usize(x_43);
x_50 = lean_llvm_build_alloca(x_1, x_2, x_49, x_48, x_42);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
lean_dec(x_50);
x_53 = lean_uint64_of_nat(x_12);
lean_dec(x_12);
x_54 = llvm_get_param(x_1, x_3, x_53, x_52);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
lean_dec(x_54);
x_57 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_58 = lean_unbox_usize(x_51);
x_59 = lean_llvm_build_store(x_1, x_2, x_57, x_58, x_56);
x_60 = lean_ctor_get(x_59, 1);
lean_inc(x_60);
lean_dec(x_59);
x_61 = lean_ctor_get(x_34, 0);
lean_inc(x_61);
lean_dec(x_34);
x_62 = lean_unbox_usize(x_51);
lean_dec(x_51);
x_63 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_64 = l_Lean_IR_EmitLLVM_addVartoState(x_1, x_61, x_62, x_63, x_7, x_8, x_60);
x_65 = lean_ctor_get(x_64, 1);
lean_inc(x_65);
lean_dec(x_64);
x_66 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_14 = x_66;
x_15 = x_65;
goto block_33;
}
}
else
{
uint8_t x_67;
lean_dec(x_34);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_8);
lean_dec(x_7);
x_67 = !lean_is_exclusive(x_36);
if (x_67 == 0)
{
return x_36;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_68 = lean_ctor_get(x_36, 0);
x_69 = lean_ctor_get(x_36, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_36);
x_70 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_70, 0, x_68);
lean_ctor_set(x_70, 1, x_69);
return x_70;
}
}
}
}
}
}
static lean_object* _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("packed_arg_", 11);
return x_1;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2(size_t x_1, size_t x_2, lean_object* x_3, size_t 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) {
_start:
{
if (lean_obj_tag(x_6) == 0)
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_9);
lean_dec(x_8);
x_11 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_11, 0, x_7);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_10);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_35; lean_object* x_36; lean_object* x_37;
lean_dec(x_7);
x_13 = lean_ctor_get(x_6, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_6, 1);
lean_inc(x_14);
lean_dec(x_6);
x_35 = lean_nat_dec_lt(x_13, x_5);
x_36 = l_LLVM_voidPtrType(x_1, x_10);
if (x_35 == 0)
{
lean_object* x_92; lean_object* x_93;
x_92 = l_Lean_IR_instInhabitedParam;
x_93 = l___private_Init_Util_0__outOfBounds___rarg(x_92);
x_37 = x_93;
goto block_91;
}
else
{
lean_object* x_94;
x_94 = lean_array_fget(x_3, x_13);
x_37 = x_94;
goto block_91;
}
block_34:
{
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_17;
lean_dec(x_14);
lean_dec(x_9);
lean_dec(x_8);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18;
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_15);
lean_ctor_set(x_18, 1, x_16);
return x_18;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_20);
lean_ctor_set(x_21, 1, x_16);
return x_21;
}
}
else
{
uint8_t x_22;
x_22 = !lean_is_exclusive(x_15);
if (x_22 == 0)
{
lean_object* x_23;
x_23 = lean_ctor_get(x_15, 0);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24; lean_object* x_25;
lean_dec(x_14);
lean_dec(x_9);
lean_dec(x_8);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
lean_dec(x_23);
lean_ctor_set(x_15, 0, x_24);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_15);
lean_ctor_set(x_25, 1, x_16);
return x_25;
}
else
{
lean_object* x_26;
lean_free_object(x_15);
x_26 = lean_ctor_get(x_23, 0);
lean_inc(x_26);
lean_dec(x_23);
x_6 = x_14;
x_7 = x_26;
x_10 = x_16;
goto _start;
}
}
else
{
lean_object* x_28;
x_28 = lean_ctor_get(x_15, 0);
lean_inc(x_28);
lean_dec(x_15);
if (lean_obj_tag(x_28) == 0)
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_14);
lean_dec(x_9);
lean_dec(x_8);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
lean_dec(x_28);
x_30 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_30, 0, x_29);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_16);
return x_31;
}
else
{
lean_object* x_32;
x_32 = lean_ctor_get(x_28, 0);
lean_inc(x_32);
lean_dec(x_28);
x_6 = x_14;
x_7 = x_32;
x_10 = x_16;
goto _start;
}
}
}
}
block_91:
{
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; size_t x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_38 = lean_ctor_get(x_36, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_36, 1);
lean_inc(x_39);
lean_dec(x_36);
x_40 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_13, x_8, x_9, x_39);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_ctor_get(x_41, 0);
lean_inc(x_43);
lean_dec(x_41);
x_44 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_45 = lean_array_push(x_44, x_43);
x_46 = l_Nat_repr(x_13);
x_47 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1;
x_48 = lean_string_append(x_47, x_46);
x_49 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2;
x_50 = lean_string_append(x_48, x_49);
x_51 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_52 = lean_llvm_build_gep2(x_1, x_2, x_51, x_4, x_45, x_50, x_42);
lean_dec(x_45);
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 = lean_ctor_get(x_37, 1);
lean_inc(x_55);
lean_inc(x_9);
lean_inc(x_8);
x_56 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_55, x_8, x_9, x_54);
if (lean_obj_tag(x_56) == 0)
{
lean_object* x_57;
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
if (lean_obj_tag(x_57) == 0)
{
lean_object* x_58; uint8_t x_59;
lean_dec(x_53);
lean_dec(x_46);
lean_dec(x_37);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = !lean_is_exclusive(x_57);
if (x_59 == 0)
{
x_15 = x_57;
x_16 = x_58;
goto block_34;
}
else
{
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_57, 0);
lean_inc(x_60);
lean_dec(x_57);
x_61 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_61, 0, x_60);
x_15 = x_61;
x_16 = x_58;
goto block_34;
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; size_t x_65; size_t 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; size_t x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; size_t x_77; size_t x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; size_t x_82; size_t x_83; lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_62 = lean_ctor_get(x_56, 1);
lean_inc(x_62);
lean_dec(x_56);
x_63 = lean_ctor_get(x_57, 0);
lean_inc(x_63);
lean_dec(x_57);
x_64 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_65 = lean_unbox_usize(x_63);
x_66 = lean_unbox_usize(x_53);
lean_dec(x_53);
x_67 = lean_llvm_build_load2(x_1, x_2, x_65, x_66, x_64, x_62);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
lean_dec(x_67);
x_70 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1;
x_71 = lean_string_append(x_70, x_46);
lean_dec(x_46);
x_72 = lean_string_append(x_71, x_64);
x_73 = lean_unbox_usize(x_63);
x_74 = lean_llvm_build_alloca(x_1, x_2, x_73, x_72, x_69);
x_75 = lean_ctor_get(x_74, 0);
lean_inc(x_75);
x_76 = lean_ctor_get(x_74, 1);
lean_inc(x_76);
lean_dec(x_74);
x_77 = lean_unbox_usize(x_68);
lean_dec(x_68);
x_78 = lean_unbox_usize(x_75);
x_79 = lean_llvm_build_store(x_1, x_2, x_77, x_78, x_76);
x_80 = lean_ctor_get(x_79, 1);
lean_inc(x_80);
lean_dec(x_79);
x_81 = lean_ctor_get(x_37, 0);
lean_inc(x_81);
lean_dec(x_37);
x_82 = lean_unbox_usize(x_75);
lean_dec(x_75);
x_83 = lean_unbox_usize(x_63);
lean_dec(x_63);
x_84 = l_Lean_IR_EmitLLVM_addVartoState(x_1, x_81, x_82, x_83, x_8, x_9, x_80);
x_85 = lean_ctor_get(x_84, 1);
lean_inc(x_85);
lean_dec(x_84);
x_86 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4;
x_15 = x_86;
x_16 = x_85;
goto block_34;
}
}
else
{
uint8_t x_87;
lean_dec(x_53);
lean_dec(x_46);
lean_dec(x_37);
lean_dec(x_14);
lean_dec(x_9);
lean_dec(x_8);
x_87 = !lean_is_exclusive(x_56);
if (x_87 == 0)
{
return x_56;
}
else
{
lean_object* x_88; lean_object* x_89; lean_object* x_90;
x_88 = lean_ctor_get(x_56, 0);
x_89 = lean_ctor_get(x_56, 1);
lean_inc(x_89);
lean_inc(x_88);
lean_dec(x_56);
x_90 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_90, 0, x_88);
lean_ctor_set(x_90, 1, x_89);
return x_90;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnArgs(size_t x_1, size_t x_2, uint8_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
if (x_3 == 0)
{
uint64_t x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_9 = llvm_count_params(x_1, x_4);
x_10 = lean_uint64_to_nat(x_9);
x_11 = l_List_range(x_10);
x_12 = lean_box(0);
x_13 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1(x_1, x_2, x_4, x_5, x_11, x_12, x_6, x_7, x_8);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_13);
if (x_15 == 0)
{
lean_object* x_16; uint8_t x_17;
x_16 = lean_ctor_get(x_13, 0);
lean_dec(x_16);
x_17 = !lean_is_exclusive(x_14);
if (x_17 == 0)
{
return x_13;
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_14, 0);
lean_inc(x_18);
lean_dec(x_14);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_13, 0, x_19);
return x_13;
}
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_20 = lean_ctor_get(x_13, 1);
lean_inc(x_20);
lean_dec(x_13);
x_21 = lean_ctor_get(x_14, 0);
lean_inc(x_21);
if (lean_is_exclusive(x_14)) {
lean_ctor_release(x_14, 0);
x_22 = x_14;
} else {
lean_dec_ref(x_14);
x_22 = lean_box(0);
}
if (lean_is_scalar(x_22)) {
x_23 = lean_alloc_ctor(0, 1, 0);
} else {
x_23 = x_22;
}
lean_ctor_set(x_23, 0, x_21);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_20);
return x_24;
}
}
else
{
uint8_t x_25;
lean_dec(x_14);
x_25 = !lean_is_exclusive(x_13);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_13, 0);
lean_dec(x_26);
x_27 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_13, 0, x_27);
return x_13;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_dec(x_13);
x_29 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
else
{
uint8_t x_31;
x_31 = !lean_is_exclusive(x_13);
if (x_31 == 0)
{
return x_13;
}
else
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
x_32 = lean_ctor_get(x_13, 0);
x_33 = lean_ctor_get(x_13, 1);
lean_inc(x_33);
lean_inc(x_32);
lean_dec(x_13);
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
{
uint64_t 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; size_t x_42; lean_object* x_43;
x_35 = 0;
x_36 = llvm_get_param(x_1, x_4, x_35, x_8);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = lean_array_get_size(x_5);
lean_inc(x_39);
x_40 = l_List_range(x_39);
x_41 = lean_box(0);
x_42 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_43 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2(x_1, x_2, x_5, x_42, x_39, x_40, x_41, x_6, x_7, x_38);
lean_dec(x_39);
if (lean_obj_tag(x_43) == 0)
{
lean_object* x_44;
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
if (lean_obj_tag(x_44) == 0)
{
uint8_t x_45;
x_45 = !lean_is_exclusive(x_43);
if (x_45 == 0)
{
lean_object* x_46; uint8_t x_47;
x_46 = lean_ctor_get(x_43, 0);
lean_dec(x_46);
x_47 = !lean_is_exclusive(x_44);
if (x_47 == 0)
{
return x_43;
}
else
{
lean_object* x_48; lean_object* x_49;
x_48 = lean_ctor_get(x_44, 0);
lean_inc(x_48);
lean_dec(x_44);
x_49 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_49, 0, x_48);
lean_ctor_set(x_43, 0, x_49);
return x_43;
}
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_50 = lean_ctor_get(x_43, 1);
lean_inc(x_50);
lean_dec(x_43);
x_51 = lean_ctor_get(x_44, 0);
lean_inc(x_51);
if (lean_is_exclusive(x_44)) {
lean_ctor_release(x_44, 0);
x_52 = x_44;
} else {
lean_dec_ref(x_44);
x_52 = lean_box(0);
}
if (lean_is_scalar(x_52)) {
x_53 = lean_alloc_ctor(0, 1, 0);
} else {
x_53 = x_52;
}
lean_ctor_set(x_53, 0, x_51);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_53);
lean_ctor_set(x_54, 1, x_50);
return x_54;
}
}
else
{
uint8_t x_55;
lean_dec(x_44);
x_55 = !lean_is_exclusive(x_43);
if (x_55 == 0)
{
lean_object* x_56; lean_object* x_57;
x_56 = lean_ctor_get(x_43, 0);
lean_dec(x_56);
x_57 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_43, 0, x_57);
return x_43;
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60;
x_58 = lean_ctor_get(x_43, 1);
lean_inc(x_58);
lean_dec(x_43);
x_59 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_60 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_60, 0, x_59);
lean_ctor_set(x_60, 1, x_58);
return x_60;
}
}
}
else
{
uint8_t x_61;
x_61 = !lean_is_exclusive(x_43);
if (x_61 == 0)
{
return x_43;
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_62 = lean_ctor_get(x_43, 0);
x_63 = lean_ctor_get(x_43, 1);
lean_inc(x_63);
lean_inc(x_62);
lean_dec(x_43);
x_64 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_64, 0, x_62);
lean_ctor_set(x_64, 1, x_63);
return x_64;
}
}
}
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___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, lean_object* x_8, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_13 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1(x_10, x_11, x_12, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_4);
return x_13;
}
}
LEAN_EXPORT lean_object* l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2(x_11, x_12, x_3, x_13, x_5, x_6, x_7, x_8, x_9, x_10);
lean_dec(x_5);
lean_dec(x_3);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFnArgs___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:
{
size_t x_9; size_t x_10; uint8_t x_11; size_t x_12; lean_object* x_13;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = l_Lean_IR_EmitLLVM_emitFnArgs(x_9, x_10, x_11, x_12, x_5, x_6, x_7, x_8);
lean_dec(x_5);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg___boxed), 1, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg___boxed), 1, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3(size_t x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
uint8_t x_9;
x_9 = lean_usize_dec_lt(x_4, x_3);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
lean_dec(x_7);
lean_dec(x_6);
x_10 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_10, 0, x_5);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_10);
lean_ctor_set(x_11, 1, x_8);
return x_11;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = lean_array_uget(x_2, x_4);
x_13 = lean_ctor_get(x_12, 1);
lean_inc(x_13);
lean_dec(x_12);
lean_inc(x_7);
lean_inc(x_6);
x_14 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_13, x_6, x_7, x_8);
if (lean_obj_tag(x_14) == 0)
{
lean_object* x_15;
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17; uint8_t x_18;
x_17 = lean_ctor_get(x_14, 0);
lean_dec(x_17);
x_18 = !lean_is_exclusive(x_15);
if (x_18 == 0)
{
return x_14;
}
else
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_15, 0);
lean_inc(x_19);
lean_dec(x_15);
x_20 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_14, 0, x_20);
return x_14;
}
}
else
{
lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_dec(x_14);
x_22 = lean_ctor_get(x_15, 0);
lean_inc(x_22);
if (lean_is_exclusive(x_15)) {
lean_ctor_release(x_15, 0);
x_23 = x_15;
} else {
lean_dec_ref(x_15);
x_23 = lean_box(0);
}
if (lean_is_scalar(x_23)) {
x_24 = lean_alloc_ctor(0, 1, 0);
} else {
x_24 = x_23;
}
lean_ctor_set(x_24, 0, x_22);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_21);
return x_25;
}
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; size_t x_29; size_t x_30;
x_26 = lean_ctor_get(x_14, 1);
lean_inc(x_26);
lean_dec(x_14);
x_27 = lean_ctor_get(x_15, 0);
lean_inc(x_27);
lean_dec(x_15);
x_28 = lean_array_push(x_5, x_27);
x_29 = 1;
x_30 = lean_usize_add(x_4, x_29);
x_4 = x_30;
x_5 = x_28;
x_8 = x_26;
goto _start;
}
}
else
{
uint8_t x_32;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
x_32 = !lean_is_exclusive(x_14);
if (x_32 == 0)
{
return x_14;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_14, 0);
x_34 = lean_ctor_get(x_14, 1);
lean_inc(x_34);
lean_inc(x_33);
lean_dec(x_14);
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;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("entry", 5);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1(size_t x_1, lean_object* x_2, lean_object* x_3, size_t x_4, size_t x_5, uint8_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
lean_object* x_12; lean_object* x_13; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_22 = lean_unsigned_to_nat(8u);
x_23 = l_Lean_mkHashMapImp___rarg(x_22);
lean_inc(x_23);
x_24 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_24, 0, x_23);
lean_ctor_set(x_24, 1, x_23);
x_25 = !lean_is_exclusive(x_10);
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; size_t x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_26 = lean_ctor_get(x_10, 4);
lean_dec(x_26);
x_27 = lean_ctor_get(x_10, 3);
lean_dec(x_27);
lean_inc(x_3);
lean_ctor_set(x_10, 4, x_3);
lean_ctor_set(x_10, 3, x_2);
x_28 = lean_st_ref_set(x_9, x_24, x_11);
x_29 = lean_ctor_get(x_28, 1);
lean_inc(x_29);
lean_dec(x_28);
x_30 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1;
x_31 = lean_llvm_append_basic_block_in_context(x_1, x_4, x_30, x_29);
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = lean_box_usize(x_1);
x_35 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_36 = lean_llvm_position_builder_at_end(x_34, x_5, x_35, x_33);
x_37 = lean_ctor_get(x_36, 1);
lean_inc(x_37);
lean_dec(x_36);
lean_inc(x_10);
lean_inc(x_9);
x_38 = l_Lean_IR_EmitLLVM_emitFnArgs(x_1, x_5, x_6, x_4, x_3, x_9, x_10, x_37);
lean_dec(x_3);
if (lean_obj_tag(x_38) == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_38, 0);
lean_inc(x_39);
if (lean_obj_tag(x_39) == 0)
{
lean_object* x_40; uint8_t x_41;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_7);
x_40 = lean_ctor_get(x_38, 1);
lean_inc(x_40);
lean_dec(x_38);
x_41 = !lean_is_exclusive(x_39);
if (x_41 == 0)
{
x_12 = x_39;
x_13 = x_40;
goto block_21;
}
else
{
lean_object* x_42; lean_object* x_43;
x_42 = lean_ctor_get(x_39, 0);
lean_inc(x_42);
lean_dec(x_39);
x_43 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_43, 0, x_42);
x_12 = x_43;
x_13 = x_40;
goto block_21;
}
}
else
{
lean_object* x_44; lean_object* x_45;
lean_dec(x_39);
x_44 = lean_ctor_get(x_38, 1);
lean_inc(x_44);
lean_dec(x_38);
x_45 = l_Lean_IR_EmitLLVM_emitFnBody(x_1, x_5, x_7, x_9, x_10, x_44);
if (lean_obj_tag(x_45) == 0)
{
lean_object* x_46; lean_object* x_47;
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_12 = x_46;
x_13 = x_47;
goto block_21;
}
else
{
uint8_t x_48;
x_48 = !lean_is_exclusive(x_45);
if (x_48 == 0)
{
return x_45;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_45, 0);
x_50 = lean_ctor_get(x_45, 1);
lean_inc(x_50);
lean_inc(x_49);
lean_dec(x_45);
x_51 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_51, 0, x_49);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
}
}
else
{
uint8_t x_52;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_7);
x_52 = !lean_is_exclusive(x_38);
if (x_52 == 0)
{
return x_38;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_53 = lean_ctor_get(x_38, 0);
x_54 = lean_ctor_get(x_38, 1);
lean_inc(x_54);
lean_inc(x_53);
lean_dec(x_38);
x_55 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_55, 0, x_53);
lean_ctor_set(x_55, 1, x_54);
return x_55;
}
}
}
else
{
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; size_t x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_56 = lean_ctor_get(x_10, 0);
x_57 = lean_ctor_get(x_10, 1);
x_58 = lean_ctor_get(x_10, 2);
x_59 = lean_ctor_get(x_10, 5);
lean_inc(x_59);
lean_inc(x_58);
lean_inc(x_57);
lean_inc(x_56);
lean_dec(x_10);
lean_inc(x_3);
x_60 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_60, 0, x_56);
lean_ctor_set(x_60, 1, x_57);
lean_ctor_set(x_60, 2, x_58);
lean_ctor_set(x_60, 3, x_2);
lean_ctor_set(x_60, 4, x_3);
lean_ctor_set(x_60, 5, x_59);
x_61 = lean_st_ref_set(x_9, x_24, x_11);
x_62 = lean_ctor_get(x_61, 1);
lean_inc(x_62);
lean_dec(x_61);
x_63 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1;
x_64 = lean_llvm_append_basic_block_in_context(x_1, x_4, x_63, x_62);
x_65 = lean_ctor_get(x_64, 0);
lean_inc(x_65);
x_66 = lean_ctor_get(x_64, 1);
lean_inc(x_66);
lean_dec(x_64);
x_67 = lean_box_usize(x_1);
x_68 = lean_unbox_usize(x_65);
lean_dec(x_65);
x_69 = lean_llvm_position_builder_at_end(x_67, x_5, x_68, x_66);
x_70 = lean_ctor_get(x_69, 1);
lean_inc(x_70);
lean_dec(x_69);
lean_inc(x_60);
lean_inc(x_9);
x_71 = l_Lean_IR_EmitLLVM_emitFnArgs(x_1, x_5, x_6, x_4, x_3, x_9, x_60, x_70);
lean_dec(x_3);
if (lean_obj_tag(x_71) == 0)
{
lean_object* x_72;
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
if (lean_obj_tag(x_72) == 0)
{
lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76;
lean_dec(x_60);
lean_dec(x_9);
lean_dec(x_7);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = lean_ctor_get(x_72, 0);
lean_inc(x_74);
if (lean_is_exclusive(x_72)) {
lean_ctor_release(x_72, 0);
x_75 = x_72;
} else {
lean_dec_ref(x_72);
x_75 = lean_box(0);
}
if (lean_is_scalar(x_75)) {
x_76 = lean_alloc_ctor(0, 1, 0);
} else {
x_76 = x_75;
}
lean_ctor_set(x_76, 0, x_74);
x_12 = x_76;
x_13 = x_73;
goto block_21;
}
else
{
lean_object* x_77; lean_object* x_78;
lean_dec(x_72);
x_77 = lean_ctor_get(x_71, 1);
lean_inc(x_77);
lean_dec(x_71);
x_78 = l_Lean_IR_EmitLLVM_emitFnBody(x_1, x_5, x_7, x_9, x_60, x_77);
if (lean_obj_tag(x_78) == 0)
{
lean_object* x_79; lean_object* x_80;
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_12 = x_79;
x_13 = x_80;
goto block_21;
}
else
{
lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_81 = lean_ctor_get(x_78, 0);
lean_inc(x_81);
x_82 = lean_ctor_get(x_78, 1);
lean_inc(x_82);
if (lean_is_exclusive(x_78)) {
lean_ctor_release(x_78, 0);
lean_ctor_release(x_78, 1);
x_83 = x_78;
} else {
lean_dec_ref(x_78);
x_83 = lean_box(0);
}
if (lean_is_scalar(x_83)) {
x_84 = lean_alloc_ctor(1, 2, 0);
} else {
x_84 = x_83;
}
lean_ctor_set(x_84, 0, x_81);
lean_ctor_set(x_84, 1, x_82);
return x_84;
}
}
}
else
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88;
lean_dec(x_60);
lean_dec(x_9);
lean_dec(x_7);
x_85 = lean_ctor_get(x_71, 0);
lean_inc(x_85);
x_86 = lean_ctor_get(x_71, 1);
lean_inc(x_86);
if (lean_is_exclusive(x_71)) {
lean_ctor_release(x_71, 0);
lean_ctor_release(x_71, 1);
x_87 = x_71;
} else {
lean_dec_ref(x_71);
x_87 = lean_box(0);
}
if (lean_is_scalar(x_87)) {
x_88 = lean_alloc_ctor(1, 2, 0);
} else {
x_88 = x_87;
}
lean_ctor_set(x_88, 0, x_85);
lean_ctor_set(x_88, 1, x_86);
return x_88;
}
}
block_21:
{
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_14;
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15;
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_12);
lean_ctor_set(x_15, 1, x_13);
return x_15;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_12, 0);
lean_inc(x_16);
lean_dec(x_12);
x_17 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_17, 0, 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_13);
return x_18;
}
}
else
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_12);
x_19 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_13);
return x_20;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, size_t x_7, uint8_t 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) {
_start:
{
uint8_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; size_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_16 = 0;
x_17 = lean_llvm_function_type(x_1, x_2, x_11, x_16, x_15);
lean_dec(x_11);
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 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = l_LLVM_getOrAddFunction(x_1, x_3, x_4, x_20, x_19);
lean_dec(x_4);
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 = lean_unsigned_to_nat(0u);
x_25 = lean_nat_dec_eq(x_10, x_24);
lean_dec(x_10);
if (x_25 == 0)
{
uint64_t x_26; size_t x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; lean_object* x_32;
x_26 = l_LLVM_DLLStorageClass_export;
x_27 = lean_unbox_usize(x_22);
x_28 = lean_llvm_set_dll_storage_class(x_1, x_27, x_26, x_23);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_32 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1(x_1, x_5, x_6, x_31, x_7, x_8, x_9, x_29, x_13, x_14, x_30);
lean_dec(x_29);
return x_32;
}
else
{
uint64_t x_33; size_t x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t x_38; lean_object* x_39;
x_33 = l_LLVM_Visibility_hidden;
x_34 = lean_unbox_usize(x_22);
x_35 = lean_llvm_set_visibility(x_1, x_34, x_33, x_23);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_39 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1(x_1, x_5, x_6, x_38, x_7, x_8, x_9, x_36, x_13, x_14, x_37);
lean_dec(x_36);
return x_39;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux(size_t x_1, size_t x_2, size_t 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_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; uint8_t x_16; uint8_t x_17;
x_8 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_6, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
if (lean_is_exclusive(x_8)) {
lean_ctor_release(x_8, 0);
lean_ctor_release(x_8, 1);
x_11 = x_8;
} else {
lean_dec_ref(x_8);
x_11 = lean_box(0);
}
x_12 = lean_ctor_get(x_9, 0);
lean_inc(x_12);
lean_dec(x_9);
lean_inc(x_4);
x_13 = l_Lean_IR_mkVarJPMaps(x_4);
x_14 = lean_ctor_get(x_13, 1);
lean_inc(x_14);
lean_dec(x_13);
x_15 = l_Lean_IR_Decl_name(x_4);
lean_inc(x_15);
x_16 = l_Lean_hasInitAttr(x_12, x_15);
if (x_16 == 0)
{
uint8_t x_196;
x_196 = 0;
x_17 = x_196;
goto block_195;
}
else
{
uint8_t x_197;
x_197 = 1;
x_17 = x_197;
goto block_195;
}
block_195:
{
if (x_17 == 0)
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22;
lean_dec(x_11);
x_18 = lean_ctor_get(x_4, 0);
lean_inc(x_18);
x_19 = lean_ctor_get(x_4, 1);
lean_inc(x_19);
x_20 = lean_ctor_get(x_4, 2);
lean_inc(x_20);
x_21 = lean_ctor_get(x_4, 3);
lean_inc(x_21);
lean_dec(x_4);
x_22 = !lean_is_exclusive(x_6);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_6, 2);
lean_dec(x_23);
lean_ctor_set(x_6, 2, x_14);
lean_inc(x_18);
x_24 = l_Lean_IR_EmitLLVM_toCName___rarg(x_18, x_5, x_6, x_10);
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
if (lean_obj_tag(x_25) == 0)
{
uint8_t x_26;
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_20);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28;
x_27 = lean_ctor_get(x_24, 0);
lean_dec(x_27);
x_28 = !lean_is_exclusive(x_25);
if (x_28 == 0)
{
return x_24;
}
else
{
lean_object* x_29; lean_object* x_30;
x_29 = lean_ctor_get(x_25, 0);
lean_inc(x_29);
lean_dec(x_25);
x_30 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_30, 0, x_29);
lean_ctor_set(x_24, 0, x_30);
return x_24;
}
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_31 = lean_ctor_get(x_24, 1);
lean_inc(x_31);
lean_dec(x_24);
x_32 = lean_ctor_get(x_25, 0);
lean_inc(x_32);
if (lean_is_exclusive(x_25)) {
lean_ctor_release(x_25, 0);
x_33 = x_25;
} else {
lean_dec_ref(x_25);
x_33 = lean_box(0);
}
if (lean_is_scalar(x_33)) {
x_34 = lean_alloc_ctor(0, 1, 0);
} else {
x_34 = x_33;
}
lean_ctor_set(x_34, 0, 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_31);
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_object* x_42; lean_object* x_92; uint8_t x_93; lean_object* x_94;
x_36 = lean_ctor_get(x_24, 1);
lean_inc(x_36);
if (lean_is_exclusive(x_24)) {
lean_ctor_release(x_24, 0);
lean_ctor_release(x_24, 1);
x_37 = x_24;
} else {
lean_dec_ref(x_24);
x_37 = lean_box(0);
}
x_38 = lean_ctor_get(x_25, 0);
lean_inc(x_38);
lean_dec(x_25);
x_39 = lean_array_get_size(x_19);
x_92 = lean_unsigned_to_nat(0u);
x_93 = lean_nat_dec_lt(x_92, x_39);
lean_inc(x_6);
lean_inc(x_5);
x_94 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_20, x_5, x_6, x_36);
if (x_93 == 0)
{
if (lean_obj_tag(x_94) == 0)
{
lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98;
x_95 = lean_ctor_get(x_94, 0);
lean_inc(x_95);
x_96 = lean_ctor_get(x_94, 1);
lean_inc(x_96);
lean_dec(x_94);
x_97 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_98 = lean_string_append(x_97, x_38);
lean_dec(x_38);
x_40 = x_98;
x_41 = x_95;
x_42 = x_96;
goto block_91;
}
else
{
uint8_t x_99;
lean_dec(x_39);
lean_dec(x_38);
lean_dec(x_37);
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_99 = !lean_is_exclusive(x_94);
if (x_99 == 0)
{
return x_94;
}
else
{
lean_object* x_100; lean_object* x_101; lean_object* x_102;
x_100 = lean_ctor_get(x_94, 0);
x_101 = lean_ctor_get(x_94, 1);
lean_inc(x_101);
lean_inc(x_100);
lean_dec(x_94);
x_102 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_102, 0, x_100);
lean_ctor_set(x_102, 1, x_101);
return x_102;
}
}
}
else
{
if (lean_obj_tag(x_94) == 0)
{
lean_object* x_103; lean_object* x_104;
x_103 = lean_ctor_get(x_94, 0);
lean_inc(x_103);
x_104 = lean_ctor_get(x_94, 1);
lean_inc(x_104);
lean_dec(x_94);
x_40 = x_38;
x_41 = x_103;
x_42 = x_104;
goto block_91;
}
else
{
uint8_t x_105;
lean_dec(x_39);
lean_dec(x_38);
lean_dec(x_37);
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_105 = !lean_is_exclusive(x_94);
if (x_105 == 0)
{
return x_94;
}
else
{
lean_object* x_106; lean_object* x_107; lean_object* x_108;
x_106 = lean_ctor_get(x_94, 0);
x_107 = lean_ctor_get(x_94, 1);
lean_inc(x_107);
lean_inc(x_106);
lean_dec(x_94);
x_108 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_108, 0, x_106);
lean_ctor_set(x_108, 1, x_107);
return x_108;
}
}
}
block_91:
{
if (lean_obj_tag(x_41) == 0)
{
uint8_t x_43;
lean_dec(x_40);
lean_dec(x_39);
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_43 = !lean_is_exclusive(x_41);
if (x_43 == 0)
{
lean_object* x_44;
if (lean_is_scalar(x_37)) {
x_44 = lean_alloc_ctor(0, 2, 0);
} else {
x_44 = x_37;
}
lean_ctor_set(x_44, 0, x_41);
lean_ctor_set(x_44, 1, x_42);
return x_44;
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_45 = lean_ctor_get(x_41, 0);
lean_inc(x_45);
lean_dec(x_41);
x_46 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_46, 0, x_45);
if (lean_is_scalar(x_37)) {
x_47 = lean_alloc_ctor(0, 2, 0);
} else {
x_47 = x_37;
}
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_42);
return x_47;
}
}
else
{
lean_object* x_48; uint8_t x_49; lean_object* x_87; uint8_t x_88;
lean_dec(x_37);
x_48 = lean_ctor_get(x_41, 0);
lean_inc(x_48);
lean_dec(x_41);
x_87 = l_Lean_closureMaxArgs;
x_88 = lean_nat_dec_lt(x_87, x_39);
if (x_88 == 0)
{
uint8_t x_89;
lean_dec(x_15);
x_89 = 0;
x_49 = x_89;
goto block_86;
}
else
{
uint8_t x_90;
x_90 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_15);
lean_dec(x_15);
x_49 = x_90;
goto block_86;
}
block_86:
{
if (x_49 == 0)
{
size_t x_50; size_t x_51; lean_object* x_52; lean_object* x_53;
x_50 = lean_usize_of_nat(x_39);
x_51 = 0;
x_52 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
lean_inc(x_6);
lean_inc(x_5);
x_53 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3(x_1, x_19, x_50, x_51, x_52, x_5, x_6, x_42);
if (lean_obj_tag(x_53) == 0)
{
lean_object* x_54;
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
if (lean_obj_tag(x_54) == 0)
{
uint8_t x_55;
lean_dec(x_48);
lean_dec(x_40);
lean_dec(x_39);
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_5);
x_55 = !lean_is_exclusive(x_53);
if (x_55 == 0)
{
lean_object* x_56; uint8_t x_57;
x_56 = lean_ctor_get(x_53, 0);
lean_dec(x_56);
x_57 = !lean_is_exclusive(x_54);
if (x_57 == 0)
{
return x_53;
}
else
{
lean_object* x_58; lean_object* x_59;
x_58 = lean_ctor_get(x_54, 0);
lean_inc(x_58);
lean_dec(x_54);
x_59 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_59, 0, x_58);
lean_ctor_set(x_53, 0, x_59);
return x_53;
}
}
else
{
lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_60 = lean_ctor_get(x_53, 1);
lean_inc(x_60);
lean_dec(x_53);
x_61 = lean_ctor_get(x_54, 0);
lean_inc(x_61);
if (lean_is_exclusive(x_54)) {
lean_ctor_release(x_54, 0);
x_62 = x_54;
} else {
lean_dec_ref(x_54);
x_62 = lean_box(0);
}
if (lean_is_scalar(x_62)) {
x_63 = lean_alloc_ctor(0, 1, 0);
} else {
x_63 = x_62;
}
lean_ctor_set(x_63, 0, x_61);
x_64 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_64, 0, x_63);
lean_ctor_set(x_64, 1, x_60);
return x_64;
}
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67; size_t x_68; lean_object* x_69;
x_65 = lean_ctor_get(x_53, 1);
lean_inc(x_65);
lean_dec(x_53);
x_66 = lean_ctor_get(x_54, 0);
lean_inc(x_66);
lean_dec(x_54);
x_67 = lean_box(0);
x_68 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_69 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(x_1, x_68, x_2, x_40, x_18, x_19, x_3, x_49, x_21, x_39, x_66, x_67, x_5, x_6, x_65);
return x_69;
}
}
else
{
uint8_t x_70;
lean_dec(x_48);
lean_dec(x_40);
lean_dec(x_39);
lean_dec(x_6);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_5);
x_70 = !lean_is_exclusive(x_53);
if (x_70 == 0)
{
return x_53;
}
else
{
lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_71 = lean_ctor_get(x_53, 0);
x_72 = lean_ctor_get(x_53, 1);
lean_inc(x_72);
lean_inc(x_71);
lean_dec(x_53);
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
{
lean_object* x_74; lean_object* x_75; lean_object* x_76; size_t x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; size_t x_84; lean_object* x_85;
x_74 = l_LLVM_voidPtrType(x_1, x_42);
x_75 = lean_ctor_get(x_74, 0);
lean_inc(x_75);
x_76 = lean_ctor_get(x_74, 1);
lean_inc(x_76);
lean_dec(x_74);
x_77 = lean_unbox_usize(x_75);
lean_dec(x_75);
x_78 = lean_llvm_pointer_type(x_1, x_77, x_76);
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_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_82 = lean_array_push(x_81, x_79);
x_83 = lean_box(0);
x_84 = lean_unbox_usize(x_48);
lean_dec(x_48);
x_85 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(x_1, x_84, x_2, x_40, x_18, x_19, x_3, x_49, x_21, x_39, x_82, x_83, x_5, x_6, x_80);
return x_85;
}
}
}
}
}
}
else
{
lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116;
x_109 = lean_ctor_get(x_6, 0);
x_110 = lean_ctor_get(x_6, 1);
x_111 = lean_ctor_get(x_6, 3);
x_112 = lean_ctor_get(x_6, 4);
x_113 = lean_ctor_get(x_6, 5);
lean_inc(x_113);
lean_inc(x_112);
lean_inc(x_111);
lean_inc(x_110);
lean_inc(x_109);
lean_dec(x_6);
x_114 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_114, 0, x_109);
lean_ctor_set(x_114, 1, x_110);
lean_ctor_set(x_114, 2, x_14);
lean_ctor_set(x_114, 3, x_111);
lean_ctor_set(x_114, 4, x_112);
lean_ctor_set(x_114, 5, x_113);
lean_inc(x_18);
x_115 = l_Lean_IR_EmitLLVM_toCName___rarg(x_18, x_5, x_114, x_10);
x_116 = lean_ctor_get(x_115, 0);
lean_inc(x_116);
if (lean_obj_tag(x_116) == 0)
{
lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122;
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_20);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_117 = lean_ctor_get(x_115, 1);
lean_inc(x_117);
if (lean_is_exclusive(x_115)) {
lean_ctor_release(x_115, 0);
lean_ctor_release(x_115, 1);
x_118 = x_115;
} else {
lean_dec_ref(x_115);
x_118 = lean_box(0);
}
x_119 = lean_ctor_get(x_116, 0);
lean_inc(x_119);
if (lean_is_exclusive(x_116)) {
lean_ctor_release(x_116, 0);
x_120 = x_116;
} else {
lean_dec_ref(x_116);
x_120 = lean_box(0);
}
if (lean_is_scalar(x_120)) {
x_121 = lean_alloc_ctor(0, 1, 0);
} else {
x_121 = x_120;
}
lean_ctor_set(x_121, 0, x_119);
if (lean_is_scalar(x_118)) {
x_122 = lean_alloc_ctor(0, 2, 0);
} else {
x_122 = x_118;
}
lean_ctor_set(x_122, 0, x_121);
lean_ctor_set(x_122, 1, x_117);
return x_122;
}
else
{
lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_174; uint8_t x_175; lean_object* x_176;
x_123 = lean_ctor_get(x_115, 1);
lean_inc(x_123);
if (lean_is_exclusive(x_115)) {
lean_ctor_release(x_115, 0);
lean_ctor_release(x_115, 1);
x_124 = x_115;
} else {
lean_dec_ref(x_115);
x_124 = lean_box(0);
}
x_125 = lean_ctor_get(x_116, 0);
lean_inc(x_125);
lean_dec(x_116);
x_126 = lean_array_get_size(x_19);
x_174 = lean_unsigned_to_nat(0u);
x_175 = lean_nat_dec_lt(x_174, x_126);
lean_inc(x_114);
lean_inc(x_5);
x_176 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_20, x_5, x_114, x_123);
if (x_175 == 0)
{
if (lean_obj_tag(x_176) == 0)
{
lean_object* x_177; lean_object* x_178; lean_object* x_179; lean_object* x_180;
x_177 = lean_ctor_get(x_176, 0);
lean_inc(x_177);
x_178 = lean_ctor_get(x_176, 1);
lean_inc(x_178);
lean_dec(x_176);
x_179 = l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1;
x_180 = lean_string_append(x_179, x_125);
lean_dec(x_125);
x_127 = x_180;
x_128 = x_177;
x_129 = x_178;
goto block_173;
}
else
{
lean_object* x_181; lean_object* x_182; lean_object* x_183; lean_object* x_184;
lean_dec(x_126);
lean_dec(x_125);
lean_dec(x_124);
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_181 = lean_ctor_get(x_176, 0);
lean_inc(x_181);
x_182 = lean_ctor_get(x_176, 1);
lean_inc(x_182);
if (lean_is_exclusive(x_176)) {
lean_ctor_release(x_176, 0);
lean_ctor_release(x_176, 1);
x_183 = x_176;
} else {
lean_dec_ref(x_176);
x_183 = lean_box(0);
}
if (lean_is_scalar(x_183)) {
x_184 = lean_alloc_ctor(1, 2, 0);
} else {
x_184 = x_183;
}
lean_ctor_set(x_184, 0, x_181);
lean_ctor_set(x_184, 1, x_182);
return x_184;
}
}
else
{
if (lean_obj_tag(x_176) == 0)
{
lean_object* x_185; lean_object* x_186;
x_185 = lean_ctor_get(x_176, 0);
lean_inc(x_185);
x_186 = lean_ctor_get(x_176, 1);
lean_inc(x_186);
lean_dec(x_176);
x_127 = x_125;
x_128 = x_185;
x_129 = x_186;
goto block_173;
}
else
{
lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190;
lean_dec(x_126);
lean_dec(x_125);
lean_dec(x_124);
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_187 = lean_ctor_get(x_176, 0);
lean_inc(x_187);
x_188 = lean_ctor_get(x_176, 1);
lean_inc(x_188);
if (lean_is_exclusive(x_176)) {
lean_ctor_release(x_176, 0);
lean_ctor_release(x_176, 1);
x_189 = x_176;
} else {
lean_dec_ref(x_176);
x_189 = lean_box(0);
}
if (lean_is_scalar(x_189)) {
x_190 = lean_alloc_ctor(1, 2, 0);
} else {
x_190 = x_189;
}
lean_ctor_set(x_190, 0, x_187);
lean_ctor_set(x_190, 1, x_188);
return x_190;
}
}
block_173:
{
if (lean_obj_tag(x_128) == 0)
{
lean_object* x_130; lean_object* x_131; lean_object* x_132; lean_object* x_133;
lean_dec(x_127);
lean_dec(x_126);
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_15);
lean_dec(x_5);
x_130 = lean_ctor_get(x_128, 0);
lean_inc(x_130);
if (lean_is_exclusive(x_128)) {
lean_ctor_release(x_128, 0);
x_131 = x_128;
} else {
lean_dec_ref(x_128);
x_131 = lean_box(0);
}
if (lean_is_scalar(x_131)) {
x_132 = lean_alloc_ctor(0, 1, 0);
} else {
x_132 = x_131;
}
lean_ctor_set(x_132, 0, x_130);
if (lean_is_scalar(x_124)) {
x_133 = lean_alloc_ctor(0, 2, 0);
} else {
x_133 = x_124;
}
lean_ctor_set(x_133, 0, x_132);
lean_ctor_set(x_133, 1, x_129);
return x_133;
}
else
{
lean_object* x_134; uint8_t x_135; lean_object* x_169; uint8_t x_170;
lean_dec(x_124);
x_134 = lean_ctor_get(x_128, 0);
lean_inc(x_134);
lean_dec(x_128);
x_169 = l_Lean_closureMaxArgs;
x_170 = lean_nat_dec_lt(x_169, x_126);
if (x_170 == 0)
{
uint8_t x_171;
lean_dec(x_15);
x_171 = 0;
x_135 = x_171;
goto block_168;
}
else
{
uint8_t x_172;
x_172 = l_Lean_IR_ExplicitBoxing_isBoxedName(x_15);
lean_dec(x_15);
x_135 = x_172;
goto block_168;
}
block_168:
{
if (x_135 == 0)
{
size_t x_136; size_t x_137; lean_object* x_138; lean_object* x_139;
x_136 = lean_usize_of_nat(x_126);
x_137 = 0;
x_138 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
lean_inc(x_114);
lean_inc(x_5);
x_139 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3(x_1, x_19, x_136, x_137, x_138, x_5, x_114, x_129);
if (lean_obj_tag(x_139) == 0)
{
lean_object* x_140;
x_140 = lean_ctor_get(x_139, 0);
lean_inc(x_140);
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_dec(x_134);
lean_dec(x_127);
lean_dec(x_126);
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_5);
x_141 = lean_ctor_get(x_139, 1);
lean_inc(x_141);
if (lean_is_exclusive(x_139)) {
lean_ctor_release(x_139, 0);
lean_ctor_release(x_139, 1);
x_142 = x_139;
} else {
lean_dec_ref(x_139);
x_142 = lean_box(0);
}
x_143 = lean_ctor_get(x_140, 0);
lean_inc(x_143);
if (lean_is_exclusive(x_140)) {
lean_ctor_release(x_140, 0);
x_144 = x_140;
} else {
lean_dec_ref(x_140);
x_144 = lean_box(0);
}
if (lean_is_scalar(x_144)) {
x_145 = lean_alloc_ctor(0, 1, 0);
} else {
x_145 = x_144;
}
lean_ctor_set(x_145, 0, x_143);
if (lean_is_scalar(x_142)) {
x_146 = lean_alloc_ctor(0, 2, 0);
} else {
x_146 = x_142;
}
lean_ctor_set(x_146, 0, x_145);
lean_ctor_set(x_146, 1, x_141);
return x_146;
}
else
{
lean_object* x_147; lean_object* x_148; lean_object* x_149; size_t x_150; lean_object* x_151;
x_147 = lean_ctor_get(x_139, 1);
lean_inc(x_147);
lean_dec(x_139);
x_148 = lean_ctor_get(x_140, 0);
lean_inc(x_148);
lean_dec(x_140);
x_149 = lean_box(0);
x_150 = lean_unbox_usize(x_134);
lean_dec(x_134);
x_151 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(x_1, x_150, x_2, x_127, x_18, x_19, x_3, x_135, x_21, x_126, x_148, x_149, x_5, x_114, x_147);
return x_151;
}
}
else
{
lean_object* x_152; lean_object* x_153; lean_object* x_154; lean_object* x_155;
lean_dec(x_134);
lean_dec(x_127);
lean_dec(x_126);
lean_dec(x_114);
lean_dec(x_21);
lean_dec(x_19);
lean_dec(x_18);
lean_dec(x_5);
x_152 = lean_ctor_get(x_139, 0);
lean_inc(x_152);
x_153 = lean_ctor_get(x_139, 1);
lean_inc(x_153);
if (lean_is_exclusive(x_139)) {
lean_ctor_release(x_139, 0);
lean_ctor_release(x_139, 1);
x_154 = x_139;
} else {
lean_dec_ref(x_139);
x_154 = lean_box(0);
}
if (lean_is_scalar(x_154)) {
x_155 = lean_alloc_ctor(1, 2, 0);
} else {
x_155 = x_154;
}
lean_ctor_set(x_155, 0, x_152);
lean_ctor_set(x_155, 1, x_153);
return x_155;
}
}
else
{
lean_object* x_156; lean_object* x_157; lean_object* x_158; size_t 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; size_t x_166; lean_object* x_167;
x_156 = l_LLVM_voidPtrType(x_1, x_129);
x_157 = lean_ctor_get(x_156, 0);
lean_inc(x_157);
x_158 = lean_ctor_get(x_156, 1);
lean_inc(x_158);
lean_dec(x_156);
x_159 = lean_unbox_usize(x_157);
lean_dec(x_157);
x_160 = lean_llvm_pointer_type(x_1, x_159, x_158);
x_161 = lean_ctor_get(x_160, 0);
lean_inc(x_161);
x_162 = lean_ctor_get(x_160, 1);
lean_inc(x_162);
lean_dec(x_160);
x_163 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_164 = lean_array_push(x_163, x_161);
x_165 = lean_box(0);
x_166 = lean_unbox_usize(x_134);
lean_dec(x_134);
x_167 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(x_1, x_166, x_2, x_127, x_18, x_19, x_3, x_135, x_21, x_126, x_164, x_165, x_5, x_114, x_162);
return x_167;
}
}
}
}
}
}
}
else
{
lean_object* x_191; lean_object* x_192;
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_191 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
if (lean_is_scalar(x_11)) {
x_192 = lean_alloc_ctor(0, 2, 0);
} else {
x_192 = x_11;
}
lean_ctor_set(x_192, 0, x_191);
lean_ctor_set(x_192, 1, x_10);
return x_192;
}
}
else
{
lean_object* x_193; lean_object* x_194;
lean_dec(x_15);
lean_dec(x_14);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_193 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
if (lean_is_scalar(x_11)) {
x_194 = lean_alloc_ctor(0, 2, 0);
} else {
x_194 = x_11;
}
lean_ctor_set(x_194, 0, x_193);
lean_ctor_set(x_194, 1, x_10);
return x_194;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___rarg(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__1(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___rarg(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_mkHashMap___at_Lean_IR_EmitLLVM_emitDeclAux___spec__2(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___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, lean_object* x_7, lean_object* x_8) {
_start:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Array_forInUnsafe_loop___at_Lean_IR_EmitLLVM_emitDeclAux___spec__3(x_9, x_2, x_10, x_11, x_5, x_6, x_7, x_8);
lean_dec(x_2);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__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, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
size_t x_12; size_t x_13; size_t x_14; uint8_t x_15; lean_object* x_16;
x_12 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = lean_unbox(x_6);
lean_dec(x_6);
x_16 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1(x_12, x_2, x_3, x_13, x_14, x_15, x_7, x_8, x_9, x_10, x_11);
lean_dec(x_8);
return x_16;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___lambda__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, 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) {
_start:
{
size_t x_16; size_t x_17; size_t x_18; size_t x_19; uint8_t x_20; lean_object* x_21;
x_16 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_17 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_18 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_19 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_20 = lean_unbox(x_8);
lean_dec(x_8);
x_21 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__2(x_16, x_17, x_18, x_4, x_5, x_6, x_19, x_20, x_9, x_10, x_11, x_12, x_13, x_14, x_15);
lean_dec(x_12);
return x_21;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclAux___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitDeclAux(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDecl___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("emitDecl:\ncompiling:\n", 21);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDecl___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\nerr:\n", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDecl___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\n", 1);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDecl(size_t x_1, size_t x_2, size_t 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_9;
x_8 = l_Lean_IR_Decl_normalizeIds(x_4);
lean_inc(x_8);
x_9 = l_Lean_IR_EmitLLVM_emitDeclAux(x_1, x_2, x_3, x_8, x_5, x_6, x_7);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10;
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_ctor_get(x_9, 0);
lean_dec(x_12);
x_13 = !lean_is_exclusive(x_10);
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; lean_object* x_21; lean_object* x_22;
x_14 = lean_ctor_get(x_10, 0);
x_15 = lean_ir_decl_to_string(x_8);
x_16 = l_Lean_IR_EmitLLVM_emitDecl___closed__1;
x_17 = lean_string_append(x_16, x_15);
lean_dec(x_15);
x_18 = l_Lean_IR_EmitLLVM_emitDecl___closed__2;
x_19 = lean_string_append(x_17, x_18);
x_20 = lean_string_append(x_19, x_14);
lean_dec(x_14);
x_21 = l_Lean_IR_EmitLLVM_emitDecl___closed__3;
x_22 = lean_string_append(x_20, x_21);
lean_ctor_set(x_10, 0, x_22);
return x_9;
}
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;
x_23 = lean_ctor_get(x_10, 0);
lean_inc(x_23);
lean_dec(x_10);
x_24 = lean_ir_decl_to_string(x_8);
x_25 = l_Lean_IR_EmitLLVM_emitDecl___closed__1;
x_26 = lean_string_append(x_25, x_24);
lean_dec(x_24);
x_27 = l_Lean_IR_EmitLLVM_emitDecl___closed__2;
x_28 = lean_string_append(x_26, x_27);
x_29 = lean_string_append(x_28, x_23);
lean_dec(x_23);
x_30 = l_Lean_IR_EmitLLVM_emitDecl___closed__3;
x_31 = lean_string_append(x_29, x_30);
x_32 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_32, 0, x_31);
lean_ctor_set(x_9, 0, x_32);
return x_9;
}
}
else
{
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; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45;
x_33 = lean_ctor_get(x_9, 1);
lean_inc(x_33);
lean_dec(x_9);
x_34 = lean_ctor_get(x_10, 0);
lean_inc(x_34);
if (lean_is_exclusive(x_10)) {
lean_ctor_release(x_10, 0);
x_35 = x_10;
} else {
lean_dec_ref(x_10);
x_35 = lean_box(0);
}
x_36 = lean_ir_decl_to_string(x_8);
x_37 = l_Lean_IR_EmitLLVM_emitDecl___closed__1;
x_38 = lean_string_append(x_37, x_36);
lean_dec(x_36);
x_39 = l_Lean_IR_EmitLLVM_emitDecl___closed__2;
x_40 = lean_string_append(x_38, x_39);
x_41 = lean_string_append(x_40, x_34);
lean_dec(x_34);
x_42 = l_Lean_IR_EmitLLVM_emitDecl___closed__3;
x_43 = lean_string_append(x_41, x_42);
if (lean_is_scalar(x_35)) {
x_44 = lean_alloc_ctor(0, 1, 0);
} else {
x_44 = x_35;
}
lean_ctor_set(x_44, 0, x_43);
x_45 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_33);
return x_45;
}
}
else
{
uint8_t x_46;
lean_dec(x_10);
lean_dec(x_8);
x_46 = !lean_is_exclusive(x_9);
if (x_46 == 0)
{
lean_object* x_47; lean_object* x_48;
x_47 = lean_ctor_get(x_9, 0);
lean_dec(x_47);
x_48 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_9, 0, x_48);
return x_9;
}
else
{
lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_49 = lean_ctor_get(x_9, 1);
lean_inc(x_49);
lean_dec(x_9);
x_50 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_51, 1, x_49);
return x_51;
}
}
}
else
{
uint8_t x_52;
lean_dec(x_8);
x_52 = !lean_is_exclusive(x_9);
if (x_52 == 0)
{
return x_9;
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_53 = lean_ctor_get(x_9, 0);
x_54 = lean_ctor_get(x_9, 1);
lean_inc(x_54);
lean_inc(x_53);
lean_dec(x_9);
x_55 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_55, 0, x_53);
lean_ctor_set(x_55, 1, x_54);
return x_55;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDecl___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitDecl(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitFns___spec__1(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_6);
lean_dec(x_5);
x_8 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_4, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitDecl(x_1, x_2, x_3, x_10, x_5, x_6, x_7);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
else
{
lean_object* x_24;
lean_dec(x_13);
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_4 = x_11;
x_7 = x_24;
goto _start;
}
}
else
{
uint8_t x_26;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_12);
if (x_26 == 0)
{
return x_12;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_12, 0);
x_28 = lean_ctor_get(x_12, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_12);
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFns(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
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;
x_7 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_ctor_get(x_8, 0);
lean_inc(x_10);
lean_dec(x_8);
x_11 = l_Lean_IR_getDecls(x_10);
lean_dec(x_10);
x_12 = l_List_reverse___rarg(x_11);
x_13 = l_List_forM___at_Lean_IR_EmitLLVM_emitFns___spec__1(x_1, x_2, x_3, x_12, x_4, x_5, x_9);
return x_13;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitFns___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_List_forM___at_Lean_IR_EmitLLVM_emitFns___spec__1(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitFns___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitFns(x_7, x_8, x_9, x_4, x_5, x_6);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callIODeclInitFn(size_t x_1, size_t x_2, lean_object* x_3, size_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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25;
x_8 = l_LLVM_voidPtrType(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_21 = lean_unbox_usize(x_9);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_3, x_15, x_5, x_6, x_18);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = !lean_is_exclusive(x_23);
if (x_25 == 0)
{
lean_object* x_26; uint8_t x_27; size_t 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; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_26 = lean_ctor_get(x_23, 0);
x_27 = 0;
x_28 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_29 = lean_llvm_function_type(x_1, x_28, x_15, x_27, x_24);
lean_dec(x_15);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_box_usize(x_4);
x_33 = lean_array_push(x_14, x_32);
x_34 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_35 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_36 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_33, x_34, x_31);
lean_dec(x_33);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_23, 0, x_39);
lean_ctor_set(x_37, 0, x_23);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_23, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_23);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t 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; size_t x_52; size_t 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;
x_43 = lean_ctor_get(x_23, 0);
lean_inc(x_43);
lean_dec(x_23);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_24);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_4);
x_50 = lean_array_push(x_14, x_49);
x_51 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_52 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_53 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_54 = lean_llvm_build_call2(x_1, x_2, x_52, x_53, x_50, x_51, x_48);
lean_dec(x_50);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
if (lean_is_exclusive(x_54)) {
lean_ctor_release(x_54, 0);
lean_ctor_release(x_54, 1);
x_57 = x_54;
} else {
lean_dec_ref(x_54);
x_57 = lean_box(0);
}
x_58 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_58, 0, x_55);
if (lean_is_scalar(x_57)) {
x_59 = lean_alloc_ctor(0, 2, 0);
} else {
x_59 = x_57;
}
lean_ctor_set(x_59, 0, x_58);
lean_ctor_set(x_59, 1, x_56);
return x_59;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callIODeclInitFn___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = l_Lean_IR_EmitLLVM_callIODeclInitFn(x_8, x_9, x_3, x_10, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callPureDeclInitFn(size_t x_1, size_t x_2, lean_object* x_3, size_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; size_t x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17;
x_8 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_7);
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, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_13 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_13, x_4, x_3, x_12, x_5, x_6, x_10);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = !lean_is_exclusive(x_15);
if (x_17 == 0)
{
lean_object* x_18; uint8_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; size_t x_24; size_t x_25; lean_object* x_26; uint8_t x_27;
x_18 = lean_ctor_get(x_15, 0);
x_19 = 0;
x_20 = lean_llvm_function_type(x_1, x_4, x_12, x_19, x_16);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_24 = lean_unbox_usize(x_21);
lean_dec(x_21);
x_25 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_26 = lean_llvm_build_call2(x_1, x_2, x_24, x_25, x_12, x_23, x_22);
x_27 = !lean_is_exclusive(x_26);
if (x_27 == 0)
{
lean_object* x_28;
x_28 = lean_ctor_get(x_26, 0);
lean_ctor_set(x_15, 0, x_28);
lean_ctor_set(x_26, 0, x_15);
return x_26;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = lean_ctor_get(x_26, 0);
x_30 = lean_ctor_get(x_26, 1);
lean_inc(x_30);
lean_inc(x_29);
lean_dec(x_26);
lean_ctor_set(x_15, 0, x_29);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_15);
lean_ctor_set(x_31, 1, x_30);
return x_31;
}
}
else
{
lean_object* x_32; uint8_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t x_38; size_t 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_32 = lean_ctor_get(x_15, 0);
lean_inc(x_32);
lean_dec(x_15);
x_33 = 0;
x_34 = lean_llvm_function_type(x_1, x_4, x_12, x_33, x_16);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_38 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_39 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_40 = lean_llvm_build_call2(x_1, x_2, x_38, x_39, x_12, x_37, x_36);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
if (lean_is_exclusive(x_40)) {
lean_ctor_release(x_40, 0);
lean_ctor_release(x_40, 1);
x_43 = x_40;
} else {
lean_dec_ref(x_40);
x_43 = lean_box(0);
}
x_44 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_44, 0, x_41);
if (lean_is_scalar(x_43)) {
x_45 = lean_alloc_ctor(0, 2, 0);
} else {
x_45 = x_43;
}
lean_ctor_set(x_45, 0, x_44);
lean_ctor_set(x_45, 1, x_42);
return x_45;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callPureDeclInitFn___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = l_Lean_IR_EmitLLVM_callPureDeclInitFn(x_8, x_9, x_3, x_10, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1() {
_start:
{
uint8_t x_1; lean_object* x_2; lean_object* x_3;
x_1 = 1;
x_2 = lean_box(x_1);
x_3 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_3, 0, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1(size_t x_1, size_t x_2, size_t 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_llvm_build_ret(x_1, x_3, x_2, x_6);
x_8 = !lean_is_exclusive(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_ctor_get(x_7, 0);
lean_dec(x_9);
x_10 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
lean_ctor_set(x_7, 0, x_10);
return x_7;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_7, 1);
lean_inc(x_11);
lean_dec(x_7);
x_12 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2(size_t x_1, size_t x_2, size_t 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_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_llvm_build_br(x_1, x_2, x_3, x_7);
x_9 = lean_ctor_get(x_8, 1);
lean_inc(x_9);
lean_dec(x_8);
x_10 = lean_box_usize(x_1);
x_11 = lean_llvm_position_builder_at_end(x_10, x_2, x_3, x_9);
x_12 = !lean_is_exclusive(x_11);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_11, 0);
x_14 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_11, 0, x_14);
return x_11;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
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, 1, 0);
lean_ctor_set(x_17, 0, x_15);
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;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_is_error", 9);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("init_", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_isError", 8);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_res", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, size_t x_6, lean_object* x_7, size_t x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
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_13 = lean_box_usize(x_1);
x_14 = lean_llvm_position_builder_at_end(x_13, x_2, x_3, x_12);
x_15 = lean_ctor_get(x_14, 1);
lean_inc(x_15);
lean_dec(x_14);
x_16 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_2, x_10, x_11, x_15);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_toCName___rarg(x_4, x_10, x_11, x_18);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
if (lean_obj_tag(x_21) == 0)
{
uint8_t x_22;
lean_dec(x_19);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_5);
x_22 = !lean_is_exclusive(x_20);
if (x_22 == 0)
{
lean_object* x_23; uint8_t x_24;
x_23 = lean_ctor_get(x_20, 0);
lean_dec(x_23);
x_24 = !lean_is_exclusive(x_21);
if (x_24 == 0)
{
return x_20;
}
else
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_21, 0);
lean_inc(x_25);
lean_dec(x_21);
x_26 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_20, 0, x_26);
return x_20;
}
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_27 = lean_ctor_get(x_20, 1);
lean_inc(x_27);
lean_dec(x_20);
x_28 = lean_ctor_get(x_21, 0);
lean_inc(x_28);
if (lean_is_exclusive(x_21)) {
lean_ctor_release(x_21, 0);
x_29 = x_21;
} else {
lean_dec_ref(x_21);
x_29 = lean_box(0);
}
if (lean_is_scalar(x_29)) {
x_30 = lean_alloc_ctor(0, 1, 0);
} else {
x_30 = x_29;
}
lean_ctor_set(x_30, 0, x_28);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_30);
lean_ctor_set(x_31, 1, x_27);
return x_31;
}
}
else
{
lean_object* x_32; lean_object* x_33; size_t 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; lean_object* x_42; size_t 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; size_t x_54; lean_object* x_55;
x_32 = lean_ctor_get(x_20, 1);
lean_inc(x_32);
lean_dec(x_20);
x_33 = lean_ctor_get(x_21, 0);
lean_inc(x_33);
lean_dec(x_21);
x_34 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_35 = l_Lean_IR_EmitLLVM_callIODeclInitFn(x_1, x_2, x_33, x_34, x_10, x_11, x_32);
lean_dec(x_33);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = lean_ctor_get(x_36, 0);
lean_inc(x_38);
lean_dec(x_36);
x_39 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_40 = lean_string_append(x_39, x_5);
x_41 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1;
lean_inc(x_40);
x_42 = lean_string_append(x_40, x_41);
x_43 = lean_unbox_usize(x_38);
x_44 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError(x_1, x_2, x_43, x_42, x_10, x_11, x_37);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = lean_ctor_get(x_45, 0);
lean_inc(x_47);
lean_dec(x_45);
x_48 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2;
x_49 = lean_string_append(x_48, x_5);
lean_dec(x_5);
x_50 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3;
x_51 = lean_string_append(x_49, x_50);
x_52 = lean_box_usize(x_1);
lean_inc(x_38);
x_53 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___boxed), 6, 2);
lean_closure_set(x_53, 0, x_52);
lean_closure_set(x_53, 1, x_38);
x_54 = lean_unbox_usize(x_47);
lean_dec(x_47);
lean_inc(x_11);
lean_inc(x_10);
x_55 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_2, x_51, x_54, x_53, x_10, x_11, x_46);
if (lean_obj_tag(x_55) == 0)
{
lean_object* x_56;
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
if (lean_obj_tag(x_56) == 0)
{
uint8_t x_57;
lean_dec(x_40);
lean_dec(x_38);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_7);
x_57 = !lean_is_exclusive(x_55);
if (x_57 == 0)
{
lean_object* x_58; uint8_t x_59;
x_58 = lean_ctor_get(x_55, 0);
lean_dec(x_58);
x_59 = !lean_is_exclusive(x_56);
if (x_59 == 0)
{
return x_55;
}
else
{
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_56, 0);
lean_inc(x_60);
lean_dec(x_56);
x_61 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_55, 0, x_61);
return x_55;
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
x_62 = lean_ctor_get(x_55, 1);
lean_inc(x_62);
lean_dec(x_55);
x_63 = lean_ctor_get(x_56, 0);
lean_inc(x_63);
if (lean_is_exclusive(x_56)) {
lean_ctor_release(x_56, 0);
x_64 = x_56;
} else {
lean_dec_ref(x_56);
x_64 = lean_box(0);
}
if (lean_is_scalar(x_64)) {
x_65 = lean_alloc_ctor(0, 1, 0);
} else {
x_65 = x_64;
}
lean_ctor_set(x_65, 0, x_63);
x_66 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_66, 0, x_65);
lean_ctor_set(x_66, 1, x_62);
return x_66;
}
}
else
{
lean_object* x_67; uint8_t x_68;
lean_dec(x_56);
x_67 = lean_ctor_get(x_55, 1);
lean_inc(x_67);
lean_dec(x_55);
x_68 = l_Lean_IR_IRType_isScalar(x_7);
if (x_68 == 0)
{
lean_object* x_69; lean_object* x_70; size_t x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; size_t x_76; lean_object* x_77; lean_object* x_78; size_t x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
lean_dec(x_7);
x_69 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4;
x_70 = lean_string_append(x_40, x_69);
x_71 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_72 = l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(x_1, x_2, x_71, x_70, x_10, x_11, x_67);
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
x_74 = lean_ctor_get(x_72, 1);
lean_inc(x_74);
lean_dec(x_72);
x_75 = lean_ctor_get(x_73, 0);
lean_inc(x_75);
lean_dec(x_73);
x_76 = lean_unbox_usize(x_75);
x_77 = lean_llvm_build_store(x_1, x_2, x_76, x_8, x_74);
x_78 = lean_ctor_get(x_77, 1);
lean_inc(x_78);
lean_dec(x_77);
x_79 = lean_unbox_usize(x_75);
lean_dec(x_75);
x_80 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(x_1, x_2, x_79, x_10, x_11, x_78);
x_81 = lean_ctor_get(x_80, 0);
lean_inc(x_81);
x_82 = lean_ctor_get(x_80, 1);
lean_inc(x_82);
lean_dec(x_80);
x_83 = lean_ctor_get(x_81, 0);
lean_inc(x_83);
lean_dec(x_81);
x_84 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2(x_1, x_2, x_6, x_83, x_10, x_11, x_82);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_83);
return x_84;
}
else
{
lean_object* x_85; lean_object* x_86; size_t x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; size_t x_92; lean_object* x_93;
x_85 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4;
x_86 = lean_string_append(x_40, x_85);
x_87 = lean_unbox_usize(x_38);
lean_dec(x_38);
x_88 = l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(x_1, x_2, x_87, x_86, x_10, x_11, x_67);
x_89 = lean_ctor_get(x_88, 0);
lean_inc(x_89);
x_90 = lean_ctor_get(x_88, 1);
lean_inc(x_90);
lean_dec(x_88);
x_91 = lean_ctor_get(x_89, 0);
lean_inc(x_91);
lean_dec(x_89);
x_92 = lean_unbox_usize(x_91);
lean_dec(x_91);
lean_inc(x_11);
lean_inc(x_10);
x_93 = l_Lean_IR_EmitLLVM_callUnboxForType(x_1, x_2, x_7, x_92, x_39, x_10, x_11, x_90);
if (lean_obj_tag(x_93) == 0)
{
lean_object* x_94;
x_94 = lean_ctor_get(x_93, 0);
lean_inc(x_94);
if (lean_obj_tag(x_94) == 0)
{
uint8_t x_95;
lean_dec(x_11);
lean_dec(x_10);
x_95 = !lean_is_exclusive(x_93);
if (x_95 == 0)
{
lean_object* x_96; uint8_t x_97;
x_96 = lean_ctor_get(x_93, 0);
lean_dec(x_96);
x_97 = !lean_is_exclusive(x_94);
if (x_97 == 0)
{
return x_93;
}
else
{
lean_object* x_98; lean_object* x_99;
x_98 = lean_ctor_get(x_94, 0);
lean_inc(x_98);
lean_dec(x_94);
x_99 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_99, 0, x_98);
lean_ctor_set(x_93, 0, x_99);
return x_93;
}
}
else
{
lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104;
x_100 = lean_ctor_get(x_93, 1);
lean_inc(x_100);
lean_dec(x_93);
x_101 = lean_ctor_get(x_94, 0);
lean_inc(x_101);
if (lean_is_exclusive(x_94)) {
lean_ctor_release(x_94, 0);
x_102 = x_94;
} else {
lean_dec_ref(x_94);
x_102 = lean_box(0);
}
if (lean_is_scalar(x_102)) {
x_103 = lean_alloc_ctor(0, 1, 0);
} else {
x_103 = x_102;
}
lean_ctor_set(x_103, 0, x_101);
x_104 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_104, 0, x_103);
lean_ctor_set(x_104, 1, x_100);
return x_104;
}
}
else
{
lean_object* x_105; lean_object* x_106; size_t x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111;
x_105 = lean_ctor_get(x_93, 1);
lean_inc(x_105);
lean_dec(x_93);
x_106 = lean_ctor_get(x_94, 0);
lean_inc(x_106);
lean_dec(x_94);
x_107 = lean_unbox_usize(x_106);
lean_dec(x_106);
x_108 = lean_llvm_build_store(x_1, x_2, x_107, x_8, x_105);
x_109 = lean_ctor_get(x_108, 0);
lean_inc(x_109);
x_110 = lean_ctor_get(x_108, 1);
lean_inc(x_110);
lean_dec(x_108);
x_111 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2(x_1, x_2, x_6, x_109, x_10, x_11, x_110);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_109);
return x_111;
}
}
else
{
uint8_t x_112;
lean_dec(x_11);
lean_dec(x_10);
x_112 = !lean_is_exclusive(x_93);
if (x_112 == 0)
{
return x_93;
}
else
{
lean_object* x_113; lean_object* x_114; lean_object* x_115;
x_113 = lean_ctor_get(x_93, 0);
x_114 = lean_ctor_get(x_93, 1);
lean_inc(x_114);
lean_inc(x_113);
lean_dec(x_93);
x_115 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_115, 0, x_113);
lean_ctor_set(x_115, 1, x_114);
return x_115;
}
}
}
}
}
else
{
uint8_t x_116;
lean_dec(x_40);
lean_dec(x_38);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_7);
x_116 = !lean_is_exclusive(x_55);
if (x_116 == 0)
{
return x_55;
}
else
{
lean_object* x_117; lean_object* x_118; lean_object* x_119;
x_117 = lean_ctor_get(x_55, 0);
x_118 = lean_ctor_get(x_55, 1);
lean_inc(x_118);
lean_inc(x_117);
lean_dec(x_55);
x_119 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_119, 0, x_117);
lean_ctor_set(x_119, 1, x_118);
return x_119;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("do_", 3);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_init", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("post_", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__4() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_builtinInitAttr;
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("is_builtin_true", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("is_error", 8);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; uint8_t x_9;
x_8 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_6, x_7);
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; uint8_t x_14;
x_10 = lean_ctor_get(x_8, 0);
x_11 = lean_ctor_get(x_8, 1);
x_12 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_Decl_name(x_4);
lean_inc(x_13);
lean_inc(x_12);
x_14 = l_Lean_isIOUnitInitFn(x_12, x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18;
x_15 = l_Lean_IR_Decl_params(x_4);
x_16 = lean_array_get_size(x_15);
lean_dec(x_15);
x_17 = lean_unsigned_to_nat(0u);
x_18 = lean_nat_dec_eq(x_16, x_17);
lean_dec(x_16);
if (x_18 == 0)
{
lean_object* x_19;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_19 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_8, 0, x_19);
return x_8;
}
else
{
lean_object* x_20;
lean_free_object(x_8);
lean_inc(x_13);
lean_inc(x_12);
x_20 = lean_get_init_fn_name_for(x_12, x_13);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; lean_object* x_22;
lean_dec(x_12);
x_21 = l_Lean_IR_Decl_resultType(x_4);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_21);
x_22 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_21, x_5, x_6, x_11);
if (lean_obj_tag(x_22) == 0)
{
lean_object* x_23;
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
if (lean_obj_tag(x_23) == 0)
{
uint8_t x_24;
lean_dec(x_21);
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_24 = !lean_is_exclusive(x_22);
if (x_24 == 0)
{
lean_object* x_25; uint8_t x_26;
x_25 = lean_ctor_get(x_22, 0);
lean_dec(x_25);
x_26 = !lean_is_exclusive(x_23);
if (x_26 == 0)
{
return x_22;
}
else
{
lean_object* x_27; lean_object* x_28;
x_27 = lean_ctor_get(x_23, 0);
lean_inc(x_27);
lean_dec(x_23);
x_28 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_28, 0, x_27);
lean_ctor_set(x_22, 0, x_28);
return x_22;
}
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_29 = lean_ctor_get(x_22, 1);
lean_inc(x_29);
lean_dec(x_22);
x_30 = lean_ctor_get(x_23, 0);
lean_inc(x_30);
if (lean_is_exclusive(x_23)) {
lean_ctor_release(x_23, 0);
x_31 = x_23;
} else {
lean_dec_ref(x_23);
x_31 = lean_box(0);
}
if (lean_is_scalar(x_31)) {
x_32 = lean_alloc_ctor(0, 1, 0);
} else {
x_32 = x_31;
}
lean_ctor_set(x_32, 0, x_30);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_33, 1, x_29);
return x_33;
}
}
else
{
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_34 = lean_ctor_get(x_22, 1);
lean_inc(x_34);
lean_dec(x_22);
x_35 = lean_ctor_get(x_23, 0);
lean_inc(x_35);
lean_dec(x_23);
x_36 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_34);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = lean_ctor_get(x_37, 0);
lean_inc(x_39);
lean_dec(x_37);
lean_inc(x_13);
x_40 = l_Lean_IR_EmitLLVM_toCName___rarg(x_13, x_5, x_6, x_38);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
if (lean_obj_tag(x_41) == 0)
{
uint8_t x_42;
lean_dec(x_39);
lean_dec(x_35);
lean_dec(x_21);
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_42 = !lean_is_exclusive(x_40);
if (x_42 == 0)
{
lean_object* x_43; uint8_t x_44;
x_43 = lean_ctor_get(x_40, 0);
lean_dec(x_43);
x_44 = !lean_is_exclusive(x_41);
if (x_44 == 0)
{
return x_40;
}
else
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_41, 0);
lean_inc(x_45);
lean_dec(x_41);
x_46 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_46, 0, x_45);
lean_ctor_set(x_40, 0, x_46);
return x_40;
}
}
else
{
lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51;
x_47 = lean_ctor_get(x_40, 1);
lean_inc(x_47);
lean_dec(x_40);
x_48 = lean_ctor_get(x_41, 0);
lean_inc(x_48);
if (lean_is_exclusive(x_41)) {
lean_ctor_release(x_41, 0);
x_49 = x_41;
} else {
lean_dec_ref(x_41);
x_49 = lean_box(0);
}
if (lean_is_scalar(x_49)) {
x_50 = lean_alloc_ctor(0, 1, 0);
} else {
x_50 = x_49;
}
lean_ctor_set(x_50, 0, x_48);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_50);
lean_ctor_set(x_51, 1, x_47);
return x_51;
}
}
else
{
lean_object* x_52; lean_object* x_53; size_t x_54; size_t x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; size_t x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; size_t x_63; size_t x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_52 = lean_ctor_get(x_40, 1);
lean_inc(x_52);
lean_dec(x_40);
x_53 = lean_ctor_get(x_41, 0);
lean_inc(x_53);
lean_dec(x_41);
x_54 = lean_unbox_usize(x_39);
lean_dec(x_39);
x_55 = lean_unbox_usize(x_35);
x_56 = l_LLVM_getOrAddGlobal(x_1, x_54, x_53, x_55, x_52);
lean_dec(x_53);
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_60 = lean_llvm_get_undef(x_1, x_59, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = lean_unbox_usize(x_57);
x_64 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_65 = lean_llvm_set_initializer(x_1, x_63, x_64, x_62);
x_66 = lean_ctor_get(x_65, 1);
lean_inc(x_66);
lean_dec(x_65);
x_67 = l_Lean_IR_EmitLLVM_toCInitName___rarg(x_13, x_5, x_6, x_66);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
if (lean_obj_tag(x_68) == 0)
{
uint8_t x_69;
lean_dec(x_57);
lean_dec(x_21);
lean_dec(x_6);
lean_dec(x_5);
x_69 = !lean_is_exclusive(x_67);
if (x_69 == 0)
{
lean_object* x_70; uint8_t x_71;
x_70 = lean_ctor_get(x_67, 0);
lean_dec(x_70);
x_71 = !lean_is_exclusive(x_68);
if (x_71 == 0)
{
return x_67;
}
else
{
lean_object* x_72; lean_object* x_73;
x_72 = lean_ctor_get(x_68, 0);
lean_inc(x_72);
lean_dec(x_68);
x_73 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_73, 0, x_72);
lean_ctor_set(x_67, 0, x_73);
return x_67;
}
}
else
{
lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78;
x_74 = lean_ctor_get(x_67, 1);
lean_inc(x_74);
lean_dec(x_67);
x_75 = lean_ctor_get(x_68, 0);
lean_inc(x_75);
if (lean_is_exclusive(x_68)) {
lean_ctor_release(x_68, 0);
x_76 = x_68;
} else {
lean_dec_ref(x_68);
x_76 = lean_box(0);
}
if (lean_is_scalar(x_76)) {
x_77 = lean_alloc_ctor(0, 1, 0);
} else {
x_77 = x_76;
}
lean_ctor_set(x_77, 0, x_75);
x_78 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_78, 0, x_77);
lean_ctor_set(x_78, 1, x_74);
return x_78;
}
}
else
{
lean_object* x_79; lean_object* x_80; lean_object* x_81;
x_79 = lean_ctor_get(x_67, 1);
lean_inc(x_79);
lean_dec(x_67);
x_80 = lean_ctor_get(x_68, 0);
lean_inc(x_80);
lean_dec(x_68);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_21);
x_81 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_21, x_5, x_6, x_79);
if (lean_obj_tag(x_81) == 0)
{
lean_object* x_82;
x_82 = lean_ctor_get(x_81, 0);
lean_inc(x_82);
if (lean_obj_tag(x_82) == 0)
{
uint8_t x_83;
lean_dec(x_80);
lean_dec(x_57);
lean_dec(x_21);
lean_dec(x_6);
lean_dec(x_5);
x_83 = !lean_is_exclusive(x_81);
if (x_83 == 0)
{
lean_object* x_84; uint8_t x_85;
x_84 = lean_ctor_get(x_81, 0);
lean_dec(x_84);
x_85 = !lean_is_exclusive(x_82);
if (x_85 == 0)
{
return x_81;
}
else
{
lean_object* x_86; lean_object* x_87;
x_86 = lean_ctor_get(x_82, 0);
lean_inc(x_86);
lean_dec(x_82);
x_87 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_87, 0, x_86);
lean_ctor_set(x_81, 0, x_87);
return x_81;
}
}
else
{
lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_88 = lean_ctor_get(x_81, 1);
lean_inc(x_88);
lean_dec(x_81);
x_89 = lean_ctor_get(x_82, 0);
lean_inc(x_89);
if (lean_is_exclusive(x_82)) {
lean_ctor_release(x_82, 0);
x_90 = x_82;
} else {
lean_dec_ref(x_82);
x_90 = lean_box(0);
}
if (lean_is_scalar(x_90)) {
x_91 = lean_alloc_ctor(0, 1, 0);
} else {
x_91 = x_90;
}
lean_ctor_set(x_91, 0, x_89);
x_92 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_92, 0, x_91);
lean_ctor_set(x_92, 1, x_88);
return x_92;
}
}
else
{
lean_object* x_93; lean_object* x_94; size_t x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; size_t x_100; size_t x_101; lean_object* x_102; uint8_t x_103;
x_93 = lean_ctor_get(x_81, 1);
lean_inc(x_93);
lean_dec(x_81);
x_94 = lean_ctor_get(x_82, 0);
lean_inc(x_94);
lean_dec(x_82);
x_95 = lean_unbox_usize(x_94);
lean_dec(x_94);
x_96 = l_Lean_IR_EmitLLVM_callPureDeclInitFn(x_1, x_2, x_80, x_95, x_5, x_6, x_93);
lean_dec(x_80);
x_97 = lean_ctor_get(x_96, 0);
lean_inc(x_97);
x_98 = lean_ctor_get(x_96, 1);
lean_inc(x_98);
lean_dec(x_96);
x_99 = lean_ctor_get(x_97, 0);
lean_inc(x_99);
lean_dec(x_97);
x_100 = lean_unbox_usize(x_99);
x_101 = lean_unbox_usize(x_57);
lean_dec(x_57);
x_102 = lean_llvm_build_store(x_1, x_2, x_100, x_101, x_98);
x_103 = !lean_is_exclusive(x_102);
if (x_103 == 0)
{
lean_object* x_104; lean_object* x_105; uint8_t x_106;
x_104 = lean_ctor_get(x_102, 1);
x_105 = lean_ctor_get(x_102, 0);
lean_dec(x_105);
x_106 = l_Lean_IR_IRType_isObj(x_21);
lean_dec(x_21);
if (x_106 == 0)
{
lean_object* x_107;
lean_dec(x_99);
lean_dec(x_6);
lean_dec(x_5);
x_107 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_102, 0, x_107);
return x_102;
}
else
{
size_t x_108; lean_object* x_109;
lean_free_object(x_102);
x_108 = lean_unbox_usize(x_99);
lean_dec(x_99);
x_109 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(x_1, x_2, x_108, x_5, x_6, x_104);
lean_dec(x_6);
lean_dec(x_5);
return x_109;
}
}
else
{
lean_object* x_110; uint8_t x_111;
x_110 = lean_ctor_get(x_102, 1);
lean_inc(x_110);
lean_dec(x_102);
x_111 = l_Lean_IR_IRType_isObj(x_21);
lean_dec(x_21);
if (x_111 == 0)
{
lean_object* x_112; lean_object* x_113;
lean_dec(x_99);
lean_dec(x_6);
lean_dec(x_5);
x_112 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_113 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_113, 0, x_112);
lean_ctor_set(x_113, 1, x_110);
return x_113;
}
else
{
size_t x_114; lean_object* x_115;
x_114 = lean_unbox_usize(x_99);
lean_dec(x_99);
x_115 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(x_1, x_2, x_114, x_5, x_6, x_110);
lean_dec(x_6);
lean_dec(x_5);
return x_115;
}
}
}
}
else
{
uint8_t x_116;
lean_dec(x_80);
lean_dec(x_57);
lean_dec(x_21);
lean_dec(x_6);
lean_dec(x_5);
x_116 = !lean_is_exclusive(x_81);
if (x_116 == 0)
{
return x_81;
}
else
{
lean_object* x_117; lean_object* x_118; lean_object* x_119;
x_117 = lean_ctor_get(x_81, 0);
x_118 = lean_ctor_get(x_81, 1);
lean_inc(x_118);
lean_inc(x_117);
lean_dec(x_81);
x_119 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_119, 0, x_117);
lean_ctor_set(x_119, 1, x_118);
return x_119;
}
}
}
}
}
}
else
{
uint8_t x_120;
lean_dec(x_21);
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_120 = !lean_is_exclusive(x_22);
if (x_120 == 0)
{
return x_22;
}
else
{
lean_object* x_121; lean_object* x_122; lean_object* x_123;
x_121 = lean_ctor_get(x_22, 0);
x_122 = lean_ctor_get(x_22, 1);
lean_inc(x_122);
lean_inc(x_121);
lean_dec(x_22);
x_123 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_123, 0, x_121);
lean_ctor_set(x_123, 1, x_122);
return x_123;
}
}
}
else
{
lean_object* x_124; lean_object* x_125; lean_object* x_126;
x_124 = lean_ctor_get(x_20, 0);
lean_inc(x_124);
lean_dec(x_20);
x_125 = l_Lean_IR_Decl_resultType(x_4);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_125);
x_126 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_125, x_5, x_6, x_11);
if (lean_obj_tag(x_126) == 0)
{
lean_object* x_127;
x_127 = lean_ctor_get(x_126, 0);
lean_inc(x_127);
if (lean_obj_tag(x_127) == 0)
{
uint8_t x_128;
lean_dec(x_125);
lean_dec(x_124);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_6);
lean_dec(x_5);
x_128 = !lean_is_exclusive(x_126);
if (x_128 == 0)
{
lean_object* x_129; uint8_t x_130;
x_129 = lean_ctor_get(x_126, 0);
lean_dec(x_129);
x_130 = !lean_is_exclusive(x_127);
if (x_130 == 0)
{
return x_126;
}
else
{
lean_object* x_131; lean_object* x_132;
x_131 = lean_ctor_get(x_127, 0);
lean_inc(x_131);
lean_dec(x_127);
x_132 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_132, 0, x_131);
lean_ctor_set(x_126, 0, x_132);
return x_126;
}
}
else
{
lean_object* x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137;
x_133 = lean_ctor_get(x_126, 1);
lean_inc(x_133);
lean_dec(x_126);
x_134 = lean_ctor_get(x_127, 0);
lean_inc(x_134);
if (lean_is_exclusive(x_127)) {
lean_ctor_release(x_127, 0);
x_135 = x_127;
} else {
lean_dec_ref(x_127);
x_135 = lean_box(0);
}
if (lean_is_scalar(x_135)) {
x_136 = lean_alloc_ctor(0, 1, 0);
} else {
x_136 = x_135;
}
lean_ctor_set(x_136, 0, x_134);
x_137 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_137, 0, x_136);
lean_ctor_set(x_137, 1, x_133);
return x_137;
}
}
else
{
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;
x_138 = lean_ctor_get(x_126, 1);
lean_inc(x_138);
lean_dec(x_126);
x_139 = lean_ctor_get(x_127, 0);
lean_inc(x_139);
lean_dec(x_127);
x_140 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_138);
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 = lean_ctor_get(x_141, 0);
lean_inc(x_143);
lean_dec(x_141);
lean_inc(x_13);
x_144 = l_Lean_IR_EmitLLVM_toCName___rarg(x_13, x_5, x_6, x_142);
x_145 = lean_ctor_get(x_144, 0);
lean_inc(x_145);
if (lean_obj_tag(x_145) == 0)
{
uint8_t x_146;
lean_dec(x_143);
lean_dec(x_139);
lean_dec(x_125);
lean_dec(x_124);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_6);
lean_dec(x_5);
x_146 = !lean_is_exclusive(x_144);
if (x_146 == 0)
{
lean_object* x_147; uint8_t x_148;
x_147 = lean_ctor_get(x_144, 0);
lean_dec(x_147);
x_148 = !lean_is_exclusive(x_145);
if (x_148 == 0)
{
return x_144;
}
else
{
lean_object* x_149; lean_object* x_150;
x_149 = lean_ctor_get(x_145, 0);
lean_inc(x_149);
lean_dec(x_145);
x_150 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_150, 0, x_149);
lean_ctor_set(x_144, 0, x_150);
return x_144;
}
}
else
{
lean_object* x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154; lean_object* x_155;
x_151 = lean_ctor_get(x_144, 1);
lean_inc(x_151);
lean_dec(x_144);
x_152 = lean_ctor_get(x_145, 0);
lean_inc(x_152);
if (lean_is_exclusive(x_145)) {
lean_ctor_release(x_145, 0);
x_153 = x_145;
} else {
lean_dec_ref(x_145);
x_153 = lean_box(0);
}
if (lean_is_scalar(x_153)) {
x_154 = lean_alloc_ctor(0, 1, 0);
} else {
x_154 = x_153;
}
lean_ctor_set(x_154, 0, x_152);
x_155 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_155, 0, x_154);
lean_ctor_set(x_155, 1, x_151);
return x_155;
}
}
else
{
lean_object* x_156; lean_object* x_157; size_t x_158; size_t x_159; lean_object* x_160; lean_object* x_161; lean_object* x_162; size_t x_163; lean_object* x_164; lean_object* x_165; lean_object* x_166; size_t x_167; size_t x_168; lean_object* x_169; lean_object* x_170; uint8_t 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; lean_object* x_186; lean_object* x_187; lean_object* x_188; lean_object* x_189;
x_156 = lean_ctor_get(x_144, 1);
lean_inc(x_156);
lean_dec(x_144);
x_157 = lean_ctor_get(x_145, 0);
lean_inc(x_157);
lean_dec(x_145);
x_158 = lean_unbox_usize(x_143);
lean_dec(x_143);
x_159 = lean_unbox_usize(x_139);
x_160 = l_LLVM_getOrAddGlobal(x_1, x_158, x_157, x_159, x_156);
lean_dec(x_157);
x_161 = lean_ctor_get(x_160, 0);
lean_inc(x_161);
x_162 = lean_ctor_get(x_160, 1);
lean_inc(x_162);
lean_dec(x_160);
x_163 = lean_unbox_usize(x_139);
lean_dec(x_139);
x_164 = lean_llvm_get_undef(x_1, x_163, x_162);
x_165 = lean_ctor_get(x_164, 0);
lean_inc(x_165);
x_166 = lean_ctor_get(x_164, 1);
lean_inc(x_166);
lean_dec(x_164);
x_167 = lean_unbox_usize(x_161);
x_168 = lean_unbox_usize(x_165);
lean_dec(x_165);
x_169 = lean_llvm_set_initializer(x_1, x_167, x_168, x_166);
x_170 = lean_ctor_get(x_169, 1);
lean_inc(x_170);
lean_dec(x_169);
x_171 = 1;
lean_inc(x_13);
x_172 = l_Lean_Name_toString(x_13, x_171);
x_173 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__1;
x_174 = lean_string_append(x_173, x_172);
x_175 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__2;
x_176 = lean_string_append(x_174, x_175);
x_177 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_176, x_5, x_6, x_170);
lean_dec(x_176);
x_178 = lean_ctor_get(x_177, 0);
lean_inc(x_178);
x_179 = lean_ctor_get(x_177, 1);
lean_inc(x_179);
lean_dec(x_177);
x_180 = lean_ctor_get(x_178, 0);
lean_inc(x_180);
lean_dec(x_178);
x_181 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__3;
x_182 = lean_string_append(x_181, x_172);
x_183 = lean_string_append(x_182, x_175);
x_184 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_183, x_5, x_6, x_179);
lean_dec(x_183);
x_185 = lean_ctor_get(x_184, 0);
lean_inc(x_185);
x_186 = lean_ctor_get(x_184, 1);
lean_inc(x_186);
lean_dec(x_184);
x_187 = lean_ctor_get(x_185, 0);
lean_inc(x_187);
lean_dec(x_185);
x_188 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__4;
x_189 = l_Lean_getInitFnNameForCore_x3f(x_12, x_188, x_13);
if (lean_obj_tag(x_189) == 0)
{
size_t x_190; lean_object* x_191; lean_object* x_192; lean_object* x_193; size_t x_194; size_t x_195; size_t x_196; lean_object* x_197;
x_190 = lean_unbox_usize(x_180);
x_191 = lean_llvm_build_br(x_1, x_2, x_190, x_186);
x_192 = lean_ctor_get(x_191, 1);
lean_inc(x_192);
lean_dec(x_191);
x_193 = lean_box(0);
x_194 = lean_unbox_usize(x_180);
lean_dec(x_180);
x_195 = lean_unbox_usize(x_187);
lean_dec(x_187);
x_196 = lean_unbox_usize(x_161);
lean_dec(x_161);
x_197 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(x_1, x_2, x_194, x_124, x_172, x_195, x_125, x_196, x_193, x_5, x_6, x_192);
return x_197;
}
else
{
uint64_t x_198; lean_object* x_199; lean_object* x_200; lean_object* x_201; lean_object* x_202; size_t x_203; lean_object* x_204; lean_object* x_205; lean_object* x_206; lean_object* x_207; size_t x_208; size_t x_209; size_t x_210; lean_object* x_211; lean_object* x_212; lean_object* x_213; size_t x_214; size_t x_215; size_t x_216; lean_object* x_217;
lean_dec(x_189);
x_198 = 0;
x_199 = llvm_get_param(x_1, x_3, x_198, x_186);
x_200 = lean_ctor_get(x_199, 0);
lean_inc(x_200);
x_201 = lean_ctor_get(x_199, 1);
lean_inc(x_201);
lean_dec(x_199);
x_202 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__5;
x_203 = lean_unbox_usize(x_200);
lean_dec(x_200);
x_204 = l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(x_1, x_2, x_203, x_202, x_5, x_6, x_201);
x_205 = lean_ctor_get(x_204, 0);
lean_inc(x_205);
x_206 = lean_ctor_get(x_204, 1);
lean_inc(x_206);
lean_dec(x_204);
x_207 = lean_ctor_get(x_205, 0);
lean_inc(x_207);
lean_dec(x_205);
x_208 = lean_unbox_usize(x_207);
lean_dec(x_207);
x_209 = lean_unbox_usize(x_180);
x_210 = lean_unbox_usize(x_187);
x_211 = lean_llvm_build_cond_br(x_1, x_2, x_208, x_209, x_210, x_206);
x_212 = lean_ctor_get(x_211, 1);
lean_inc(x_212);
lean_dec(x_211);
x_213 = lean_box(0);
x_214 = lean_unbox_usize(x_180);
lean_dec(x_180);
x_215 = lean_unbox_usize(x_187);
lean_dec(x_187);
x_216 = lean_unbox_usize(x_161);
lean_dec(x_161);
x_217 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(x_1, x_2, x_214, x_124, x_172, x_215, x_125, x_216, x_213, x_5, x_6, x_212);
return x_217;
}
}
}
}
else
{
uint8_t x_218;
lean_dec(x_125);
lean_dec(x_124);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_6);
lean_dec(x_5);
x_218 = !lean_is_exclusive(x_126);
if (x_218 == 0)
{
return x_126;
}
else
{
lean_object* x_219; lean_object* x_220; lean_object* x_221;
x_219 = lean_ctor_get(x_126, 0);
x_220 = lean_ctor_get(x_126, 1);
lean_inc(x_220);
lean_inc(x_219);
lean_dec(x_126);
x_221 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_221, 0, x_219);
lean_ctor_set(x_221, 1, x_220);
return x_221;
}
}
}
}
}
else
{
lean_object* x_222; lean_object* x_223; lean_object* x_224; lean_object* x_225; lean_object* x_226; lean_object* x_227;
lean_dec(x_12);
lean_free_object(x_8);
lean_dec(x_4);
x_222 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_2, x_5, x_6, x_11);
x_223 = lean_ctor_get(x_222, 0);
lean_inc(x_223);
x_224 = lean_ctor_get(x_222, 1);
lean_inc(x_224);
lean_dec(x_222);
x_225 = lean_ctor_get(x_223, 0);
lean_inc(x_225);
lean_dec(x_223);
lean_inc(x_13);
x_226 = l_Lean_IR_EmitLLVM_toCName___rarg(x_13, x_5, x_6, x_224);
x_227 = lean_ctor_get(x_226, 0);
lean_inc(x_227);
if (lean_obj_tag(x_227) == 0)
{
uint8_t x_228;
lean_dec(x_225);
lean_dec(x_13);
lean_dec(x_6);
lean_dec(x_5);
x_228 = !lean_is_exclusive(x_226);
if (x_228 == 0)
{
lean_object* x_229; uint8_t x_230;
x_229 = lean_ctor_get(x_226, 0);
lean_dec(x_229);
x_230 = !lean_is_exclusive(x_227);
if (x_230 == 0)
{
return x_226;
}
else
{
lean_object* x_231; lean_object* x_232;
x_231 = lean_ctor_get(x_227, 0);
lean_inc(x_231);
lean_dec(x_227);
x_232 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_232, 0, x_231);
lean_ctor_set(x_226, 0, x_232);
return x_226;
}
}
else
{
lean_object* x_233; lean_object* x_234; lean_object* x_235; lean_object* x_236; lean_object* x_237;
x_233 = lean_ctor_get(x_226, 1);
lean_inc(x_233);
lean_dec(x_226);
x_234 = lean_ctor_get(x_227, 0);
lean_inc(x_234);
if (lean_is_exclusive(x_227)) {
lean_ctor_release(x_227, 0);
x_235 = x_227;
} else {
lean_dec_ref(x_227);
x_235 = lean_box(0);
}
if (lean_is_scalar(x_235)) {
x_236 = lean_alloc_ctor(0, 1, 0);
} else {
x_236 = x_235;
}
lean_ctor_set(x_236, 0, x_234);
x_237 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_237, 0, x_236);
lean_ctor_set(x_237, 1, x_233);
return x_237;
}
}
else
{
lean_object* x_238; lean_object* x_239; size_t x_240; lean_object* x_241; lean_object* x_242; lean_object* x_243; lean_object* x_244; lean_object* x_245; size_t x_246; lean_object* x_247; lean_object* x_248; lean_object* x_249; lean_object* x_250; uint8_t x_251; lean_object* x_252; lean_object* x_253; lean_object* x_254; lean_object* x_255; lean_object* x_256; lean_object* x_257; lean_object* x_258; size_t x_259; lean_object* x_260;
x_238 = lean_ctor_get(x_226, 1);
lean_inc(x_238);
lean_dec(x_226);
x_239 = lean_ctor_get(x_227, 0);
lean_inc(x_239);
lean_dec(x_227);
x_240 = lean_unbox_usize(x_225);
lean_dec(x_225);
x_241 = l_Lean_IR_EmitLLVM_callIODeclInitFn(x_1, x_2, x_239, x_240, x_5, x_6, x_238);
lean_dec(x_239);
x_242 = lean_ctor_get(x_241, 0);
lean_inc(x_242);
x_243 = lean_ctor_get(x_241, 1);
lean_inc(x_243);
lean_dec(x_241);
x_244 = lean_ctor_get(x_242, 0);
lean_inc(x_244);
lean_dec(x_242);
x_245 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__6;
x_246 = lean_unbox_usize(x_244);
x_247 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError(x_1, x_2, x_246, x_245, x_5, x_6, x_243);
x_248 = lean_ctor_get(x_247, 0);
lean_inc(x_248);
x_249 = lean_ctor_get(x_247, 1);
lean_inc(x_249);
lean_dec(x_247);
x_250 = lean_ctor_get(x_248, 0);
lean_inc(x_250);
lean_dec(x_248);
x_251 = 1;
x_252 = l_Lean_Name_toString(x_13, x_251);
x_253 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2;
x_254 = lean_string_append(x_253, x_252);
lean_dec(x_252);
x_255 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3;
x_256 = lean_string_append(x_254, x_255);
x_257 = lean_box_usize(x_1);
x_258 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___boxed), 6, 2);
lean_closure_set(x_258, 0, x_257);
lean_closure_set(x_258, 1, x_244);
x_259 = lean_unbox_usize(x_250);
lean_dec(x_250);
x_260 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_2, x_256, x_259, x_258, x_5, x_6, x_249);
return x_260;
}
}
}
else
{
lean_object* x_261; lean_object* x_262; lean_object* x_263; lean_object* x_264; uint8_t x_265;
x_261 = lean_ctor_get(x_8, 0);
x_262 = lean_ctor_get(x_8, 1);
lean_inc(x_262);
lean_inc(x_261);
lean_dec(x_8);
x_263 = lean_ctor_get(x_261, 0);
lean_inc(x_263);
lean_dec(x_261);
x_264 = l_Lean_IR_Decl_name(x_4);
lean_inc(x_264);
lean_inc(x_263);
x_265 = l_Lean_isIOUnitInitFn(x_263, x_264);
if (x_265 == 0)
{
lean_object* x_266; lean_object* x_267; lean_object* x_268; uint8_t x_269;
x_266 = l_Lean_IR_Decl_params(x_4);
x_267 = lean_array_get_size(x_266);
lean_dec(x_266);
x_268 = lean_unsigned_to_nat(0u);
x_269 = lean_nat_dec_eq(x_267, x_268);
lean_dec(x_267);
if (x_269 == 0)
{
lean_object* x_270; lean_object* x_271;
lean_dec(x_264);
lean_dec(x_263);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_270 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_271 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_271, 0, x_270);
lean_ctor_set(x_271, 1, x_262);
return x_271;
}
else
{
lean_object* x_272;
lean_inc(x_264);
lean_inc(x_263);
x_272 = lean_get_init_fn_name_for(x_263, x_264);
if (lean_obj_tag(x_272) == 0)
{
lean_object* x_273; lean_object* x_274;
lean_dec(x_263);
x_273 = l_Lean_IR_Decl_resultType(x_4);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_273);
x_274 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_273, x_5, x_6, x_262);
if (lean_obj_tag(x_274) == 0)
{
lean_object* x_275;
x_275 = lean_ctor_get(x_274, 0);
lean_inc(x_275);
if (lean_obj_tag(x_275) == 0)
{
lean_object* x_276; lean_object* x_277; lean_object* x_278; lean_object* x_279; lean_object* x_280; lean_object* x_281;
lean_dec(x_273);
lean_dec(x_264);
lean_dec(x_6);
lean_dec(x_5);
x_276 = lean_ctor_get(x_274, 1);
lean_inc(x_276);
if (lean_is_exclusive(x_274)) {
lean_ctor_release(x_274, 0);
lean_ctor_release(x_274, 1);
x_277 = x_274;
} else {
lean_dec_ref(x_274);
x_277 = lean_box(0);
}
x_278 = lean_ctor_get(x_275, 0);
lean_inc(x_278);
if (lean_is_exclusive(x_275)) {
lean_ctor_release(x_275, 0);
x_279 = x_275;
} else {
lean_dec_ref(x_275);
x_279 = lean_box(0);
}
if (lean_is_scalar(x_279)) {
x_280 = lean_alloc_ctor(0, 1, 0);
} else {
x_280 = x_279;
}
lean_ctor_set(x_280, 0, x_278);
if (lean_is_scalar(x_277)) {
x_281 = lean_alloc_ctor(0, 2, 0);
} else {
x_281 = x_277;
}
lean_ctor_set(x_281, 0, x_280);
lean_ctor_set(x_281, 1, x_276);
return x_281;
}
else
{
lean_object* x_282; lean_object* x_283; lean_object* x_284; lean_object* x_285; lean_object* x_286; lean_object* x_287; lean_object* x_288; lean_object* x_289;
x_282 = lean_ctor_get(x_274, 1);
lean_inc(x_282);
lean_dec(x_274);
x_283 = lean_ctor_get(x_275, 0);
lean_inc(x_283);
lean_dec(x_275);
x_284 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_282);
x_285 = lean_ctor_get(x_284, 0);
lean_inc(x_285);
x_286 = lean_ctor_get(x_284, 1);
lean_inc(x_286);
lean_dec(x_284);
x_287 = lean_ctor_get(x_285, 0);
lean_inc(x_287);
lean_dec(x_285);
lean_inc(x_264);
x_288 = l_Lean_IR_EmitLLVM_toCName___rarg(x_264, x_5, x_6, x_286);
x_289 = lean_ctor_get(x_288, 0);
lean_inc(x_289);
if (lean_obj_tag(x_289) == 0)
{
lean_object* x_290; lean_object* x_291; lean_object* x_292; lean_object* x_293; lean_object* x_294; lean_object* x_295;
lean_dec(x_287);
lean_dec(x_283);
lean_dec(x_273);
lean_dec(x_264);
lean_dec(x_6);
lean_dec(x_5);
x_290 = lean_ctor_get(x_288, 1);
lean_inc(x_290);
if (lean_is_exclusive(x_288)) {
lean_ctor_release(x_288, 0);
lean_ctor_release(x_288, 1);
x_291 = x_288;
} else {
lean_dec_ref(x_288);
x_291 = lean_box(0);
}
x_292 = lean_ctor_get(x_289, 0);
lean_inc(x_292);
if (lean_is_exclusive(x_289)) {
lean_ctor_release(x_289, 0);
x_293 = x_289;
} else {
lean_dec_ref(x_289);
x_293 = lean_box(0);
}
if (lean_is_scalar(x_293)) {
x_294 = lean_alloc_ctor(0, 1, 0);
} else {
x_294 = x_293;
}
lean_ctor_set(x_294, 0, x_292);
if (lean_is_scalar(x_291)) {
x_295 = lean_alloc_ctor(0, 2, 0);
} else {
x_295 = x_291;
}
lean_ctor_set(x_295, 0, x_294);
lean_ctor_set(x_295, 1, x_290);
return x_295;
}
else
{
lean_object* x_296; lean_object* x_297; size_t x_298; size_t x_299; lean_object* x_300; lean_object* x_301; lean_object* x_302; size_t x_303; lean_object* x_304; lean_object* x_305; lean_object* x_306; size_t x_307; size_t x_308; lean_object* x_309; lean_object* x_310; lean_object* x_311; lean_object* x_312;
x_296 = lean_ctor_get(x_288, 1);
lean_inc(x_296);
lean_dec(x_288);
x_297 = lean_ctor_get(x_289, 0);
lean_inc(x_297);
lean_dec(x_289);
x_298 = lean_unbox_usize(x_287);
lean_dec(x_287);
x_299 = lean_unbox_usize(x_283);
x_300 = l_LLVM_getOrAddGlobal(x_1, x_298, x_297, x_299, x_296);
lean_dec(x_297);
x_301 = lean_ctor_get(x_300, 0);
lean_inc(x_301);
x_302 = lean_ctor_get(x_300, 1);
lean_inc(x_302);
lean_dec(x_300);
x_303 = lean_unbox_usize(x_283);
lean_dec(x_283);
x_304 = lean_llvm_get_undef(x_1, x_303, x_302);
x_305 = lean_ctor_get(x_304, 0);
lean_inc(x_305);
x_306 = lean_ctor_get(x_304, 1);
lean_inc(x_306);
lean_dec(x_304);
x_307 = lean_unbox_usize(x_301);
x_308 = lean_unbox_usize(x_305);
lean_dec(x_305);
x_309 = lean_llvm_set_initializer(x_1, x_307, x_308, x_306);
x_310 = lean_ctor_get(x_309, 1);
lean_inc(x_310);
lean_dec(x_309);
x_311 = l_Lean_IR_EmitLLVM_toCInitName___rarg(x_264, x_5, x_6, x_310);
x_312 = lean_ctor_get(x_311, 0);
lean_inc(x_312);
if (lean_obj_tag(x_312) == 0)
{
lean_object* x_313; lean_object* x_314; lean_object* x_315; lean_object* x_316; lean_object* x_317; lean_object* x_318;
lean_dec(x_301);
lean_dec(x_273);
lean_dec(x_6);
lean_dec(x_5);
x_313 = lean_ctor_get(x_311, 1);
lean_inc(x_313);
if (lean_is_exclusive(x_311)) {
lean_ctor_release(x_311, 0);
lean_ctor_release(x_311, 1);
x_314 = x_311;
} else {
lean_dec_ref(x_311);
x_314 = lean_box(0);
}
x_315 = lean_ctor_get(x_312, 0);
lean_inc(x_315);
if (lean_is_exclusive(x_312)) {
lean_ctor_release(x_312, 0);
x_316 = x_312;
} else {
lean_dec_ref(x_312);
x_316 = lean_box(0);
}
if (lean_is_scalar(x_316)) {
x_317 = lean_alloc_ctor(0, 1, 0);
} else {
x_317 = x_316;
}
lean_ctor_set(x_317, 0, x_315);
if (lean_is_scalar(x_314)) {
x_318 = lean_alloc_ctor(0, 2, 0);
} else {
x_318 = x_314;
}
lean_ctor_set(x_318, 0, x_317);
lean_ctor_set(x_318, 1, x_313);
return x_318;
}
else
{
lean_object* x_319; lean_object* x_320; lean_object* x_321;
x_319 = lean_ctor_get(x_311, 1);
lean_inc(x_319);
lean_dec(x_311);
x_320 = lean_ctor_get(x_312, 0);
lean_inc(x_320);
lean_dec(x_312);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_273);
x_321 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_273, x_5, x_6, x_319);
if (lean_obj_tag(x_321) == 0)
{
lean_object* x_322;
x_322 = lean_ctor_get(x_321, 0);
lean_inc(x_322);
if (lean_obj_tag(x_322) == 0)
{
lean_object* x_323; lean_object* x_324; lean_object* x_325; lean_object* x_326; lean_object* x_327; lean_object* x_328;
lean_dec(x_320);
lean_dec(x_301);
lean_dec(x_273);
lean_dec(x_6);
lean_dec(x_5);
x_323 = lean_ctor_get(x_321, 1);
lean_inc(x_323);
if (lean_is_exclusive(x_321)) {
lean_ctor_release(x_321, 0);
lean_ctor_release(x_321, 1);
x_324 = x_321;
} else {
lean_dec_ref(x_321);
x_324 = lean_box(0);
}
x_325 = lean_ctor_get(x_322, 0);
lean_inc(x_325);
if (lean_is_exclusive(x_322)) {
lean_ctor_release(x_322, 0);
x_326 = x_322;
} else {
lean_dec_ref(x_322);
x_326 = lean_box(0);
}
if (lean_is_scalar(x_326)) {
x_327 = lean_alloc_ctor(0, 1, 0);
} else {
x_327 = x_326;
}
lean_ctor_set(x_327, 0, x_325);
if (lean_is_scalar(x_324)) {
x_328 = lean_alloc_ctor(0, 2, 0);
} else {
x_328 = x_324;
}
lean_ctor_set(x_328, 0, x_327);
lean_ctor_set(x_328, 1, x_323);
return x_328;
}
else
{
lean_object* x_329; lean_object* x_330; size_t x_331; lean_object* x_332; lean_object* x_333; lean_object* x_334; lean_object* x_335; size_t x_336; size_t x_337; lean_object* x_338; lean_object* x_339; lean_object* x_340; uint8_t x_341;
x_329 = lean_ctor_get(x_321, 1);
lean_inc(x_329);
lean_dec(x_321);
x_330 = lean_ctor_get(x_322, 0);
lean_inc(x_330);
lean_dec(x_322);
x_331 = lean_unbox_usize(x_330);
lean_dec(x_330);
x_332 = l_Lean_IR_EmitLLVM_callPureDeclInitFn(x_1, x_2, x_320, x_331, x_5, x_6, x_329);
lean_dec(x_320);
x_333 = lean_ctor_get(x_332, 0);
lean_inc(x_333);
x_334 = lean_ctor_get(x_332, 1);
lean_inc(x_334);
lean_dec(x_332);
x_335 = lean_ctor_get(x_333, 0);
lean_inc(x_335);
lean_dec(x_333);
x_336 = lean_unbox_usize(x_335);
x_337 = lean_unbox_usize(x_301);
lean_dec(x_301);
x_338 = lean_llvm_build_store(x_1, x_2, x_336, x_337, x_334);
x_339 = lean_ctor_get(x_338, 1);
lean_inc(x_339);
if (lean_is_exclusive(x_338)) {
lean_ctor_release(x_338, 0);
lean_ctor_release(x_338, 1);
x_340 = x_338;
} else {
lean_dec_ref(x_338);
x_340 = lean_box(0);
}
x_341 = l_Lean_IR_IRType_isObj(x_273);
lean_dec(x_273);
if (x_341 == 0)
{
lean_object* x_342; lean_object* x_343;
lean_dec(x_335);
lean_dec(x_6);
lean_dec(x_5);
x_342 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
if (lean_is_scalar(x_340)) {
x_343 = lean_alloc_ctor(0, 2, 0);
} else {
x_343 = x_340;
}
lean_ctor_set(x_343, 0, x_342);
lean_ctor_set(x_343, 1, x_339);
return x_343;
}
else
{
size_t x_344; lean_object* x_345;
lean_dec(x_340);
x_344 = lean_unbox_usize(x_335);
lean_dec(x_335);
x_345 = l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn(x_1, x_2, x_344, x_5, x_6, x_339);
lean_dec(x_6);
lean_dec(x_5);
return x_345;
}
}
}
else
{
lean_object* x_346; lean_object* x_347; lean_object* x_348; lean_object* x_349;
lean_dec(x_320);
lean_dec(x_301);
lean_dec(x_273);
lean_dec(x_6);
lean_dec(x_5);
x_346 = lean_ctor_get(x_321, 0);
lean_inc(x_346);
x_347 = lean_ctor_get(x_321, 1);
lean_inc(x_347);
if (lean_is_exclusive(x_321)) {
lean_ctor_release(x_321, 0);
lean_ctor_release(x_321, 1);
x_348 = x_321;
} else {
lean_dec_ref(x_321);
x_348 = lean_box(0);
}
if (lean_is_scalar(x_348)) {
x_349 = lean_alloc_ctor(1, 2, 0);
} else {
x_349 = x_348;
}
lean_ctor_set(x_349, 0, x_346);
lean_ctor_set(x_349, 1, x_347);
return x_349;
}
}
}
}
}
else
{
lean_object* x_350; lean_object* x_351; lean_object* x_352; lean_object* x_353;
lean_dec(x_273);
lean_dec(x_264);
lean_dec(x_6);
lean_dec(x_5);
x_350 = lean_ctor_get(x_274, 0);
lean_inc(x_350);
x_351 = lean_ctor_get(x_274, 1);
lean_inc(x_351);
if (lean_is_exclusive(x_274)) {
lean_ctor_release(x_274, 0);
lean_ctor_release(x_274, 1);
x_352 = x_274;
} else {
lean_dec_ref(x_274);
x_352 = lean_box(0);
}
if (lean_is_scalar(x_352)) {
x_353 = lean_alloc_ctor(1, 2, 0);
} else {
x_353 = x_352;
}
lean_ctor_set(x_353, 0, x_350);
lean_ctor_set(x_353, 1, x_351);
return x_353;
}
}
else
{
lean_object* x_354; lean_object* x_355; lean_object* x_356;
x_354 = lean_ctor_get(x_272, 0);
lean_inc(x_354);
lean_dec(x_272);
x_355 = l_Lean_IR_Decl_resultType(x_4);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_355);
x_356 = l_Lean_IR_EmitLLVM_toLLVMType(x_1, x_355, x_5, x_6, x_262);
if (lean_obj_tag(x_356) == 0)
{
lean_object* x_357;
x_357 = lean_ctor_get(x_356, 0);
lean_inc(x_357);
if (lean_obj_tag(x_357) == 0)
{
lean_object* x_358; lean_object* x_359; lean_object* x_360; lean_object* x_361; lean_object* x_362; lean_object* x_363;
lean_dec(x_355);
lean_dec(x_354);
lean_dec(x_264);
lean_dec(x_263);
lean_dec(x_6);
lean_dec(x_5);
x_358 = lean_ctor_get(x_356, 1);
lean_inc(x_358);
if (lean_is_exclusive(x_356)) {
lean_ctor_release(x_356, 0);
lean_ctor_release(x_356, 1);
x_359 = x_356;
} else {
lean_dec_ref(x_356);
x_359 = lean_box(0);
}
x_360 = lean_ctor_get(x_357, 0);
lean_inc(x_360);
if (lean_is_exclusive(x_357)) {
lean_ctor_release(x_357, 0);
x_361 = x_357;
} else {
lean_dec_ref(x_357);
x_361 = lean_box(0);
}
if (lean_is_scalar(x_361)) {
x_362 = lean_alloc_ctor(0, 1, 0);
} else {
x_362 = x_361;
}
lean_ctor_set(x_362, 0, x_360);
if (lean_is_scalar(x_359)) {
x_363 = lean_alloc_ctor(0, 2, 0);
} else {
x_363 = x_359;
}
lean_ctor_set(x_363, 0, x_362);
lean_ctor_set(x_363, 1, x_358);
return x_363;
}
else
{
lean_object* x_364; lean_object* x_365; lean_object* x_366; lean_object* x_367; lean_object* x_368; lean_object* x_369; lean_object* x_370; lean_object* x_371;
x_364 = lean_ctor_get(x_356, 1);
lean_inc(x_364);
lean_dec(x_356);
x_365 = lean_ctor_get(x_357, 0);
lean_inc(x_365);
lean_dec(x_357);
x_366 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_364);
x_367 = lean_ctor_get(x_366, 0);
lean_inc(x_367);
x_368 = lean_ctor_get(x_366, 1);
lean_inc(x_368);
lean_dec(x_366);
x_369 = lean_ctor_get(x_367, 0);
lean_inc(x_369);
lean_dec(x_367);
lean_inc(x_264);
x_370 = l_Lean_IR_EmitLLVM_toCName___rarg(x_264, x_5, x_6, x_368);
x_371 = lean_ctor_get(x_370, 0);
lean_inc(x_371);
if (lean_obj_tag(x_371) == 0)
{
lean_object* x_372; lean_object* x_373; lean_object* x_374; lean_object* x_375; lean_object* x_376; lean_object* x_377;
lean_dec(x_369);
lean_dec(x_365);
lean_dec(x_355);
lean_dec(x_354);
lean_dec(x_264);
lean_dec(x_263);
lean_dec(x_6);
lean_dec(x_5);
x_372 = lean_ctor_get(x_370, 1);
lean_inc(x_372);
if (lean_is_exclusive(x_370)) {
lean_ctor_release(x_370, 0);
lean_ctor_release(x_370, 1);
x_373 = x_370;
} else {
lean_dec_ref(x_370);
x_373 = lean_box(0);
}
x_374 = lean_ctor_get(x_371, 0);
lean_inc(x_374);
if (lean_is_exclusive(x_371)) {
lean_ctor_release(x_371, 0);
x_375 = x_371;
} else {
lean_dec_ref(x_371);
x_375 = lean_box(0);
}
if (lean_is_scalar(x_375)) {
x_376 = lean_alloc_ctor(0, 1, 0);
} else {
x_376 = x_375;
}
lean_ctor_set(x_376, 0, x_374);
if (lean_is_scalar(x_373)) {
x_377 = lean_alloc_ctor(0, 2, 0);
} else {
x_377 = x_373;
}
lean_ctor_set(x_377, 0, x_376);
lean_ctor_set(x_377, 1, x_372);
return x_377;
}
else
{
lean_object* x_378; lean_object* x_379; size_t x_380; size_t x_381; lean_object* x_382; lean_object* x_383; lean_object* x_384; size_t x_385; lean_object* x_386; lean_object* x_387; lean_object* x_388; size_t x_389; size_t x_390; lean_object* x_391; lean_object* x_392; uint8_t x_393; lean_object* x_394; lean_object* x_395; lean_object* x_396; lean_object* x_397; lean_object* x_398; lean_object* x_399; lean_object* x_400; lean_object* x_401; lean_object* x_402; lean_object* x_403; lean_object* x_404; lean_object* x_405; lean_object* x_406; lean_object* x_407; lean_object* x_408; lean_object* x_409; lean_object* x_410; lean_object* x_411;
x_378 = lean_ctor_get(x_370, 1);
lean_inc(x_378);
lean_dec(x_370);
x_379 = lean_ctor_get(x_371, 0);
lean_inc(x_379);
lean_dec(x_371);
x_380 = lean_unbox_usize(x_369);
lean_dec(x_369);
x_381 = lean_unbox_usize(x_365);
x_382 = l_LLVM_getOrAddGlobal(x_1, x_380, x_379, x_381, x_378);
lean_dec(x_379);
x_383 = lean_ctor_get(x_382, 0);
lean_inc(x_383);
x_384 = lean_ctor_get(x_382, 1);
lean_inc(x_384);
lean_dec(x_382);
x_385 = lean_unbox_usize(x_365);
lean_dec(x_365);
x_386 = lean_llvm_get_undef(x_1, x_385, x_384);
x_387 = lean_ctor_get(x_386, 0);
lean_inc(x_387);
x_388 = lean_ctor_get(x_386, 1);
lean_inc(x_388);
lean_dec(x_386);
x_389 = lean_unbox_usize(x_383);
x_390 = lean_unbox_usize(x_387);
lean_dec(x_387);
x_391 = lean_llvm_set_initializer(x_1, x_389, x_390, x_388);
x_392 = lean_ctor_get(x_391, 1);
lean_inc(x_392);
lean_dec(x_391);
x_393 = 1;
lean_inc(x_264);
x_394 = l_Lean_Name_toString(x_264, x_393);
x_395 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__1;
x_396 = lean_string_append(x_395, x_394);
x_397 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__2;
x_398 = lean_string_append(x_396, x_397);
x_399 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_398, x_5, x_6, x_392);
lean_dec(x_398);
x_400 = lean_ctor_get(x_399, 0);
lean_inc(x_400);
x_401 = lean_ctor_get(x_399, 1);
lean_inc(x_401);
lean_dec(x_399);
x_402 = lean_ctor_get(x_400, 0);
lean_inc(x_402);
lean_dec(x_400);
x_403 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__3;
x_404 = lean_string_append(x_403, x_394);
x_405 = lean_string_append(x_404, x_397);
x_406 = l_Lean_IR_EmitLLVM_builderAppendBasicBlock(x_1, x_2, x_405, x_5, x_6, x_401);
lean_dec(x_405);
x_407 = lean_ctor_get(x_406, 0);
lean_inc(x_407);
x_408 = lean_ctor_get(x_406, 1);
lean_inc(x_408);
lean_dec(x_406);
x_409 = lean_ctor_get(x_407, 0);
lean_inc(x_409);
lean_dec(x_407);
x_410 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__4;
x_411 = l_Lean_getInitFnNameForCore_x3f(x_263, x_410, x_264);
if (lean_obj_tag(x_411) == 0)
{
size_t x_412; lean_object* x_413; lean_object* x_414; lean_object* x_415; size_t x_416; size_t x_417; size_t x_418; lean_object* x_419;
x_412 = lean_unbox_usize(x_402);
x_413 = lean_llvm_build_br(x_1, x_2, x_412, x_408);
x_414 = lean_ctor_get(x_413, 1);
lean_inc(x_414);
lean_dec(x_413);
x_415 = lean_box(0);
x_416 = lean_unbox_usize(x_402);
lean_dec(x_402);
x_417 = lean_unbox_usize(x_409);
lean_dec(x_409);
x_418 = lean_unbox_usize(x_383);
lean_dec(x_383);
x_419 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(x_1, x_2, x_416, x_354, x_394, x_417, x_355, x_418, x_415, x_5, x_6, x_414);
return x_419;
}
else
{
uint64_t x_420; lean_object* x_421; lean_object* x_422; lean_object* x_423; lean_object* x_424; size_t x_425; lean_object* x_426; lean_object* x_427; lean_object* x_428; lean_object* x_429; size_t x_430; size_t x_431; size_t x_432; lean_object* x_433; lean_object* x_434; lean_object* x_435; size_t x_436; size_t x_437; size_t x_438; lean_object* x_439;
lean_dec(x_411);
x_420 = 0;
x_421 = llvm_get_param(x_1, x_3, x_420, x_408);
x_422 = lean_ctor_get(x_421, 0);
lean_inc(x_422);
x_423 = lean_ctor_get(x_421, 1);
lean_inc(x_423);
lean_dec(x_421);
x_424 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__5;
x_425 = lean_unbox_usize(x_422);
lean_dec(x_422);
x_426 = l_Lean_IR_EmitLLVM_buildLeanBoolTrue_x3f(x_1, x_2, x_425, x_424, x_5, x_6, x_423);
x_427 = lean_ctor_get(x_426, 0);
lean_inc(x_427);
x_428 = lean_ctor_get(x_426, 1);
lean_inc(x_428);
lean_dec(x_426);
x_429 = lean_ctor_get(x_427, 0);
lean_inc(x_429);
lean_dec(x_427);
x_430 = lean_unbox_usize(x_429);
lean_dec(x_429);
x_431 = lean_unbox_usize(x_402);
x_432 = lean_unbox_usize(x_409);
x_433 = lean_llvm_build_cond_br(x_1, x_2, x_430, x_431, x_432, x_428);
x_434 = lean_ctor_get(x_433, 1);
lean_inc(x_434);
lean_dec(x_433);
x_435 = lean_box(0);
x_436 = lean_unbox_usize(x_402);
lean_dec(x_402);
x_437 = lean_unbox_usize(x_409);
lean_dec(x_409);
x_438 = lean_unbox_usize(x_383);
lean_dec(x_383);
x_439 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(x_1, x_2, x_436, x_354, x_394, x_437, x_355, x_438, x_435, x_5, x_6, x_434);
return x_439;
}
}
}
}
else
{
lean_object* x_440; lean_object* x_441; lean_object* x_442; lean_object* x_443;
lean_dec(x_355);
lean_dec(x_354);
lean_dec(x_264);
lean_dec(x_263);
lean_dec(x_6);
lean_dec(x_5);
x_440 = lean_ctor_get(x_356, 0);
lean_inc(x_440);
x_441 = lean_ctor_get(x_356, 1);
lean_inc(x_441);
if (lean_is_exclusive(x_356)) {
lean_ctor_release(x_356, 0);
lean_ctor_release(x_356, 1);
x_442 = x_356;
} else {
lean_dec_ref(x_356);
x_442 = lean_box(0);
}
if (lean_is_scalar(x_442)) {
x_443 = lean_alloc_ctor(1, 2, 0);
} else {
x_443 = x_442;
}
lean_ctor_set(x_443, 0, x_440);
lean_ctor_set(x_443, 1, x_441);
return x_443;
}
}
}
}
else
{
lean_object* x_444; lean_object* x_445; lean_object* x_446; lean_object* x_447; lean_object* x_448; lean_object* x_449;
lean_dec(x_263);
lean_dec(x_4);
x_444 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_2, x_5, x_6, x_262);
x_445 = lean_ctor_get(x_444, 0);
lean_inc(x_445);
x_446 = lean_ctor_get(x_444, 1);
lean_inc(x_446);
lean_dec(x_444);
x_447 = lean_ctor_get(x_445, 0);
lean_inc(x_447);
lean_dec(x_445);
lean_inc(x_264);
x_448 = l_Lean_IR_EmitLLVM_toCName___rarg(x_264, x_5, x_6, x_446);
x_449 = lean_ctor_get(x_448, 0);
lean_inc(x_449);
if (lean_obj_tag(x_449) == 0)
{
lean_object* x_450; lean_object* x_451; lean_object* x_452; lean_object* x_453; lean_object* x_454; lean_object* x_455;
lean_dec(x_447);
lean_dec(x_264);
lean_dec(x_6);
lean_dec(x_5);
x_450 = lean_ctor_get(x_448, 1);
lean_inc(x_450);
if (lean_is_exclusive(x_448)) {
lean_ctor_release(x_448, 0);
lean_ctor_release(x_448, 1);
x_451 = x_448;
} else {
lean_dec_ref(x_448);
x_451 = lean_box(0);
}
x_452 = lean_ctor_get(x_449, 0);
lean_inc(x_452);
if (lean_is_exclusive(x_449)) {
lean_ctor_release(x_449, 0);
x_453 = x_449;
} else {
lean_dec_ref(x_449);
x_453 = lean_box(0);
}
if (lean_is_scalar(x_453)) {
x_454 = lean_alloc_ctor(0, 1, 0);
} else {
x_454 = x_453;
}
lean_ctor_set(x_454, 0, x_452);
if (lean_is_scalar(x_451)) {
x_455 = lean_alloc_ctor(0, 2, 0);
} else {
x_455 = x_451;
}
lean_ctor_set(x_455, 0, x_454);
lean_ctor_set(x_455, 1, x_450);
return x_455;
}
else
{
lean_object* x_456; lean_object* x_457; size_t x_458; lean_object* x_459; lean_object* x_460; lean_object* x_461; lean_object* x_462; lean_object* x_463; size_t x_464; lean_object* x_465; lean_object* x_466; lean_object* x_467; lean_object* x_468; uint8_t x_469; lean_object* x_470; lean_object* x_471; lean_object* x_472; lean_object* x_473; lean_object* x_474; lean_object* x_475; lean_object* x_476; size_t x_477; lean_object* x_478;
x_456 = lean_ctor_get(x_448, 1);
lean_inc(x_456);
lean_dec(x_448);
x_457 = lean_ctor_get(x_449, 0);
lean_inc(x_457);
lean_dec(x_449);
x_458 = lean_unbox_usize(x_447);
lean_dec(x_447);
x_459 = l_Lean_IR_EmitLLVM_callIODeclInitFn(x_1, x_2, x_457, x_458, x_5, x_6, x_456);
lean_dec(x_457);
x_460 = lean_ctor_get(x_459, 0);
lean_inc(x_460);
x_461 = lean_ctor_get(x_459, 1);
lean_inc(x_461);
lean_dec(x_459);
x_462 = lean_ctor_get(x_460, 0);
lean_inc(x_462);
lean_dec(x_460);
x_463 = l_Lean_IR_EmitLLVM_emitDeclInit___closed__6;
x_464 = lean_unbox_usize(x_462);
x_465 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError(x_1, x_2, x_464, x_463, x_5, x_6, x_461);
x_466 = lean_ctor_get(x_465, 0);
lean_inc(x_466);
x_467 = lean_ctor_get(x_465, 1);
lean_inc(x_467);
lean_dec(x_465);
x_468 = lean_ctor_get(x_466, 0);
lean_inc(x_468);
lean_dec(x_466);
x_469 = 1;
x_470 = l_Lean_Name_toString(x_264, x_469);
x_471 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2;
x_472 = lean_string_append(x_471, x_470);
lean_dec(x_470);
x_473 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3;
x_474 = lean_string_append(x_472, x_473);
x_475 = lean_box_usize(x_1);
x_476 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___boxed), 6, 2);
lean_closure_set(x_476, 0, x_475);
lean_closure_set(x_476, 1, x_462);
x_477 = lean_unbox_usize(x_468);
lean_dec(x_468);
x_478 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_2, x_474, x_477, x_476, x_5, x_6, x_467);
return x_478;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1(x_7, x_8, x_9, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__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, lean_object* x_7) {
_start:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__2(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; size_t x_15; size_t x_16; size_t x_17; lean_object* x_18;
x_13 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_14 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_15 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_16 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_17 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_18 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3(x_13, x_14, x_15, x_4, x_5, x_16, x_7, x_17, x_9, x_10, x_11, x_12);
lean_dec(x_9);
return x_18;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitDeclInit___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_emitDeclInit(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callModInitFn(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
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; size_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; uint8_t x_32;
x_10 = lean_mk_module_initialization_function_name(x_3);
x_11 = l_LLVM_voidPtrType(x_1, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_LLVM_i8Type(x_1, x_13);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_LLVM_voidPtrType(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_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_21 = lean_array_push(x_20, x_15);
x_22 = lean_array_push(x_21, x_18);
x_23 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_8, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_ctor_get(x_24, 0);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_28 = lean_unbox_usize(x_12);
x_29 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_27, x_28, x_10, x_22, x_7, x_8, x_25);
lean_dec(x_10);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = !lean_is_exclusive(x_30);
if (x_32 == 0)
{
lean_object* x_33; uint8_t x_34; size_t 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; lean_object* x_42; size_t x_43; size_t x_44; lean_object* x_45; uint8_t x_46;
x_33 = lean_ctor_get(x_30, 0);
x_34 = 0;
x_35 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_36 = lean_llvm_function_type(x_1, x_35, x_22, x_34, x_31);
lean_dec(x_22);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = lean_box_usize(x_4);
x_40 = lean_array_push(x_20, x_39);
x_41 = lean_box_usize(x_5);
x_42 = lean_array_push(x_40, x_41);
x_43 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_44 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_45 = lean_llvm_build_call2(x_1, x_2, x_43, x_44, x_42, x_6, x_38);
lean_dec(x_42);
x_46 = !lean_is_exclusive(x_45);
if (x_46 == 0)
{
lean_object* x_47;
x_47 = lean_ctor_get(x_45, 0);
lean_ctor_set(x_30, 0, x_47);
lean_ctor_set(x_45, 0, x_30);
return x_45;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_48 = lean_ctor_get(x_45, 0);
x_49 = lean_ctor_get(x_45, 1);
lean_inc(x_49);
lean_inc(x_48);
lean_dec(x_45);
lean_ctor_set(x_30, 0, x_48);
x_50 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_50, 0, x_30);
lean_ctor_set(x_50, 1, x_49);
return x_50;
}
}
else
{
lean_object* x_51; uint8_t x_52; size_t 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; size_t x_61; size_t x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68;
x_51 = lean_ctor_get(x_30, 0);
lean_inc(x_51);
lean_dec(x_30);
x_52 = 0;
x_53 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_54 = lean_llvm_function_type(x_1, x_53, x_22, x_52, x_31);
lean_dec(x_22);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
lean_dec(x_54);
x_57 = lean_box_usize(x_4);
x_58 = lean_array_push(x_20, x_57);
x_59 = lean_box_usize(x_5);
x_60 = lean_array_push(x_58, x_59);
x_61 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_62 = lean_unbox_usize(x_51);
lean_dec(x_51);
x_63 = lean_llvm_build_call2(x_1, x_2, x_61, x_62, x_60, x_6, x_56);
lean_dec(x_60);
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
if (lean_is_exclusive(x_63)) {
lean_ctor_release(x_63, 0);
lean_ctor_release(x_63, 1);
x_66 = x_63;
} else {
lean_dec_ref(x_63);
x_66 = lean_box(0);
}
x_67 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_67, 0, x_64);
if (lean_is_scalar(x_66)) {
x_68 = lean_alloc_ctor(0, 2, 0);
} else {
x_68 = x_66;
}
lean_ctor_set(x_68, 0, x_67);
lean_ctor_set(x_68, 1, x_65);
return x_68;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callModInitFn___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; lean_object* x_14;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitLLVM_callModInitFn(x_10, x_11, x_3, x_12, x_13, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
return x_14;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__1(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_6);
lean_dec(x_5);
x_8 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_4, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitDeclInit(x_1, x_2, x_3, x_10, x_5, x_6, x_7);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
else
{
lean_object* x_24;
lean_dec(x_13);
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_4 = x_11;
x_7 = x_24;
goto _start;
}
}
else
{
uint8_t x_26;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_12);
if (x_26 == 0)
{
return x_12;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_12, 0);
x_28 = lean_ctor_get(x_12, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_12);
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_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__2(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_6);
lean_dec(x_5);
x_8 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_4, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitDeclInit(x_1, x_2, x_3, x_10, x_5, x_6, x_7);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
else
{
lean_object* x_24;
lean_dec(x_13);
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_4 = x_11;
x_7 = x_24;
goto _start;
}
}
else
{
uint8_t x_26;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_12);
if (x_26 == 0)
{
return x_12;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_12, 0);
x_28 = lean_ctor_get(x_12, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_12);
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;
}
}
}
}
}
static lean_object* _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("res_", 4);
return x_1;
}
}
static lean_object* _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("res_is_error_", 13);
return x_1;
}
}
static lean_object* _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("IsError", 7);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, size_t x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12; uint8_t x_23;
x_23 = lean_usize_dec_eq(x_5, x_6);
if (x_23 == 0)
{
lean_object* x_24; uint64_t 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; size_t x_38; size_t 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; size_t 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; size_t x_55; lean_object* x_56;
lean_dec(x_7);
x_24 = lean_array_uget(x_4, x_5);
x_25 = 0;
x_26 = llvm_get_param(x_1, x_3, x_25, x_10);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_2, x_8, x_9, x_28);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_ctor_get(x_30, 0);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_ctor_get(x_24, 0);
lean_inc(x_33);
lean_dec(x_24);
x_34 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
lean_inc(x_33);
x_35 = lean_name_mangle(x_33, x_34);
x_36 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1;
x_37 = lean_string_append(x_36, x_35);
x_38 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_39 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_40 = l_Lean_IR_EmitLLVM_callModInitFn(x_1, x_2, x_33, x_38, x_39, x_37, x_8, x_9, x_31);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_ctor_get(x_41, 0);
lean_inc(x_43);
lean_dec(x_41);
x_44 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2;
x_45 = lean_string_append(x_44, x_35);
x_46 = lean_unbox_usize(x_43);
x_47 = l_Lean_IR_EmitLLVM_callLeanIOResultIsError(x_1, x_2, x_46, x_45, x_8, x_9, x_42);
x_48 = lean_ctor_get(x_47, 0);
lean_inc(x_48);
x_49 = lean_ctor_get(x_47, 1);
lean_inc(x_49);
lean_dec(x_47);
x_50 = lean_ctor_get(x_48, 0);
lean_inc(x_50);
lean_dec(x_48);
x_51 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3;
x_52 = lean_string_append(x_51, x_35);
lean_dec(x_35);
x_53 = lean_box_usize(x_1);
lean_inc(x_43);
x_54 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___boxed), 6, 2);
lean_closure_set(x_54, 0, x_53);
lean_closure_set(x_54, 1, x_43);
x_55 = lean_unbox_usize(x_50);
lean_dec(x_50);
lean_inc(x_9);
lean_inc(x_8);
x_56 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_2, x_52, x_55, x_54, x_8, x_9, x_49);
if (lean_obj_tag(x_56) == 0)
{
lean_object* x_57;
x_57 = lean_ctor_get(x_56, 0);
lean_inc(x_57);
if (lean_obj_tag(x_57) == 0)
{
lean_object* x_58; uint8_t x_59;
lean_dec(x_43);
x_58 = lean_ctor_get(x_56, 1);
lean_inc(x_58);
lean_dec(x_56);
x_59 = !lean_is_exclusive(x_57);
if (x_59 == 0)
{
x_11 = x_57;
x_12 = x_58;
goto block_22;
}
else
{
lean_object* x_60; lean_object* x_61;
x_60 = lean_ctor_get(x_57, 0);
lean_inc(x_60);
lean_dec(x_57);
x_61 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_61, 0, x_60);
x_11 = x_61;
x_12 = x_58;
goto block_22;
}
}
else
{
lean_object* x_62; size_t x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66;
lean_dec(x_57);
x_62 = lean_ctor_get(x_56, 1);
lean_inc(x_62);
lean_dec(x_56);
x_63 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_64 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_1, x_2, x_63, x_8, x_9, x_62);
x_65 = lean_ctor_get(x_64, 0);
lean_inc(x_65);
x_66 = lean_ctor_get(x_64, 1);
lean_inc(x_66);
lean_dec(x_64);
x_11 = x_65;
x_12 = x_66;
goto block_22;
}
}
else
{
uint8_t x_67;
lean_dec(x_43);
lean_dec(x_9);
lean_dec(x_8);
x_67 = !lean_is_exclusive(x_56);
if (x_67 == 0)
{
return x_56;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_68 = lean_ctor_get(x_56, 0);
x_69 = lean_ctor_get(x_56, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_56);
x_70 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_70, 0, x_68);
lean_ctor_set(x_70, 1, x_69);
return x_70;
}
}
}
else
{
lean_object* x_71; lean_object* x_72;
lean_dec(x_9);
lean_dec(x_8);
x_71 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_71, 0, x_7);
x_72 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_72, 0, x_71);
lean_ctor_set(x_72, 1, x_10);
return x_72;
}
block_22:
{
if (lean_obj_tag(x_11) == 0)
{
uint8_t x_13;
lean_dec(x_9);
lean_dec(x_8);
x_13 = !lean_is_exclusive(x_11);
if (x_13 == 0)
{
lean_object* x_14;
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_11);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_11, 0);
lean_inc(x_15);
lean_dec(x_11);
x_16 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_16, 0, x_15);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_12);
return x_17;
}
}
else
{
lean_object* x_18; size_t x_19; size_t x_20;
x_18 = lean_ctor_get(x_11, 0);
lean_inc(x_18);
lean_dec(x_11);
x_19 = 1;
x_20 = lean_usize_add(x_5, x_19);
x_5 = x_20;
x_7 = x_18;
x_10 = x_12;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_8; lean_object* x_9;
lean_dec(x_6);
lean_dec(x_5);
x_8 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_4, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
lean_inc(x_6);
lean_inc(x_5);
x_12 = l_Lean_IR_EmitLLVM_emitDeclInit(x_1, x_2, x_3, x_10, x_5, x_6, x_7);
if (lean_obj_tag(x_12) == 0)
{
lean_object* x_13;
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_14 = !lean_is_exclusive(x_12);
if (x_14 == 0)
{
lean_object* x_15; uint8_t x_16;
x_15 = lean_ctor_get(x_12, 0);
lean_dec(x_15);
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
return x_12;
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_13, 0);
lean_inc(x_17);
lean_dec(x_13);
x_18 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_18, 0, x_17);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_dec(x_12);
x_20 = lean_ctor_get(x_13, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_13)) {
lean_ctor_release(x_13, 0);
x_21 = x_13;
} else {
lean_dec_ref(x_13);
x_21 = lean_box(0);
}
if (lean_is_scalar(x_21)) {
x_22 = lean_alloc_ctor(0, 1, 0);
} else {
x_22 = x_21;
}
lean_ctor_set(x_22, 0, x_20);
x_23 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_23, 0, x_22);
lean_ctor_set(x_23, 1, x_19);
return x_23;
}
}
else
{
lean_object* x_24;
lean_dec(x_13);
x_24 = lean_ctor_get(x_12, 1);
lean_inc(x_24);
lean_dec(x_12);
x_4 = x_11;
x_7 = x_24;
goto _start;
}
}
else
{
uint8_t x_26;
lean_dec(x_11);
lean_dec(x_6);
lean_dec(x_5);
x_26 = !lean_is_exclusive(x_12);
if (x_26 == 0)
{
return x_12;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_12, 0);
x_28 = lean_ctor_get(x_12, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_12);
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;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("retval", 6);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___lambda__1(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint64_t x_6; uint8_t x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; size_t x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; size_t x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; size_t x_23; lean_object* x_24; uint8_t x_25;
x_6 = 0;
x_7 = 0;
x_8 = l_LLVM_constIntUnsigned(x_1, x_6, x_7, x_5);
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 = l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
x_12 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_13 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_2, x_12, x_11, x_3, x_4, x_10);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1;
x_18 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(x_1, x_2, x_18, x_17, x_3, x_4, x_15);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = lean_ctor_get(x_20, 0);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_24 = lean_llvm_build_ret(x_1, x_2, x_23, x_21);
x_25 = !lean_is_exclusive(x_24);
if (x_25 == 0)
{
lean_object* x_26; lean_object* x_27;
x_26 = lean_ctor_get(x_24, 0);
lean_dec(x_26);
x_27 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
lean_ctor_set(x_24, 0, x_27);
return x_24;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_24, 1);
lean_inc(x_28);
lean_dec(x_24);
x_29 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
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;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_G_initialized", 14);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("init_v", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("isGInitialized", 14);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
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; uint8_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; size_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint64_t x_37; size_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; size_t x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; size_t 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; lean_object* x_56; size_t x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; uint64_t x_61; size_t x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; size_t x_68; size_t x_69; lean_object* x_70; lean_object* x_71; lean_object* x_72; size_t x_73; size_t 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; size_t x_81; lean_object* x_82;
x_7 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_ctor_get(x_8, 0);
lean_inc(x_10);
lean_dec(x_8);
x_11 = l_Lean_IR_EmitLLVM_getModName___rarg(x_5, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_ctor_get(x_12, 0);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_LLVM_voidPtrType(x_1, x_13);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = l_LLVM_i8Type(x_1, x_17);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = l_LLVM_voidPtrType(x_1, x_20);
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_EmitLLVM_callLeanRefcountFn___closed__2;
x_25 = lean_array_push(x_24, x_19);
x_26 = lean_array_push(x_25, x_22);
x_27 = 0;
x_28 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_29 = lean_llvm_function_type(x_1, x_28, x_26, x_27, x_23);
lean_dec(x_26);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
lean_inc(x_14);
x_32 = lean_mk_module_initialization_function_name(x_14);
x_33 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_34 = l_LLVM_getOrAddFunction(x_1, x_2, x_32, x_33, x_31);
lean_dec(x_32);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = l_LLVM_DLLStorageClass_export;
x_38 = lean_unbox_usize(x_35);
x_39 = lean_llvm_set_dll_storage_class(x_1, x_38, x_37, x_36);
x_40 = lean_ctor_get(x_39, 1);
lean_inc(x_40);
lean_dec(x_39);
x_41 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1;
x_42 = lean_unbox_usize(x_35);
x_43 = lean_llvm_append_basic_block_in_context(x_1, x_42, x_41, x_40);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = lean_box_usize(x_1);
x_47 = lean_unbox_usize(x_44);
lean_dec(x_44);
x_48 = lean_llvm_position_builder_at_end(x_46, x_3, x_47, x_45);
x_49 = lean_ctor_get(x_48, 1);
lean_inc(x_49);
lean_dec(x_48);
x_50 = l_LLVM_i1Type(x_1, x_49);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
lean_dec(x_50);
x_53 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__4;
x_54 = lean_name_mangle(x_14, x_53);
x_55 = l_Lean_IR_EmitLLVM_emitInitFn___closed__1;
x_56 = lean_string_append(x_54, x_55);
x_57 = lean_unbox_usize(x_51);
x_58 = l_LLVM_getOrAddGlobal(x_1, x_2, x_56, x_57, x_52);
lean_dec(x_56);
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = l_LLVM_Visibility_hidden;
x_62 = lean_unbox_usize(x_59);
x_63 = lean_llvm_set_visibility(x_1, x_62, x_61, x_60);
x_64 = lean_ctor_get(x_63, 1);
lean_inc(x_64);
lean_dec(x_63);
x_65 = l_LLVM_constFalse(x_1, x_64);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = lean_unbox_usize(x_59);
x_69 = lean_unbox_usize(x_66);
lean_dec(x_66);
x_70 = lean_llvm_set_initializer(x_1, x_68, x_69, x_67);
x_71 = lean_ctor_get(x_70, 1);
lean_inc(x_71);
lean_dec(x_70);
x_72 = l_Lean_IR_EmitLLVM_emitInitFn___closed__2;
x_73 = lean_unbox_usize(x_51);
lean_dec(x_51);
x_74 = lean_unbox_usize(x_59);
x_75 = lean_llvm_build_load2(x_1, x_3, x_73, x_74, x_72, x_71);
x_76 = lean_ctor_get(x_75, 0);
lean_inc(x_76);
x_77 = lean_ctor_get(x_75, 1);
lean_inc(x_77);
lean_dec(x_75);
x_78 = lean_box_usize(x_1);
x_79 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___boxed), 5, 1);
lean_closure_set(x_79, 0, x_78);
x_80 = l_Lean_IR_EmitLLVM_emitInitFn___closed__3;
x_81 = lean_unbox_usize(x_76);
lean_dec(x_76);
lean_inc(x_5);
lean_inc(x_4);
x_82 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_3, x_80, x_81, x_79, x_4, x_5, x_77);
if (lean_obj_tag(x_82) == 0)
{
lean_object* x_83;
x_83 = lean_ctor_get(x_82, 0);
lean_inc(x_83);
if (lean_obj_tag(x_83) == 0)
{
uint8_t x_84;
lean_dec(x_59);
lean_dec(x_35);
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_84 = !lean_is_exclusive(x_82);
if (x_84 == 0)
{
lean_object* x_85; uint8_t x_86;
x_85 = lean_ctor_get(x_82, 0);
lean_dec(x_85);
x_86 = !lean_is_exclusive(x_83);
if (x_86 == 0)
{
return x_82;
}
else
{
lean_object* x_87; lean_object* x_88;
x_87 = lean_ctor_get(x_83, 0);
lean_inc(x_87);
lean_dec(x_83);
x_88 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_88, 0, x_87);
lean_ctor_set(x_82, 0, x_88);
return x_82;
}
}
else
{
lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93;
x_89 = lean_ctor_get(x_82, 1);
lean_inc(x_89);
lean_dec(x_82);
x_90 = lean_ctor_get(x_83, 0);
lean_inc(x_90);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
x_91 = x_83;
} else {
lean_dec_ref(x_83);
x_91 = lean_box(0);
}
if (lean_is_scalar(x_91)) {
x_92 = lean_alloc_ctor(0, 1, 0);
} else {
x_92 = x_91;
}
lean_ctor_set(x_92, 0, x_90);
x_93 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_93, 0, x_92);
lean_ctor_set(x_93, 1, x_89);
return x_93;
}
}
else
{
lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; size_t x_98; size_t x_99; lean_object* x_100; lean_object* x_101; lean_object* x_102; lean_object* x_103; lean_object* x_104; uint8_t x_105;
lean_dec(x_83);
x_94 = lean_ctor_get(x_82, 1);
lean_inc(x_94);
lean_dec(x_82);
x_95 = l_LLVM_constTrue(x_1, x_94);
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_95, 1);
lean_inc(x_97);
lean_dec(x_95);
x_98 = lean_unbox_usize(x_96);
lean_dec(x_96);
x_99 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_100 = lean_llvm_build_store(x_1, x_3, x_98, x_99, x_97);
x_101 = lean_ctor_get(x_100, 1);
lean_inc(x_101);
lean_dec(x_100);
x_102 = l_Lean_Environment_imports(x_10);
x_103 = lean_array_get_size(x_102);
x_104 = lean_unsigned_to_nat(0u);
x_105 = lean_nat_dec_lt(x_104, x_103);
if (x_105 == 0)
{
lean_object* x_106; lean_object* x_107; size_t x_108; lean_object* x_109;
lean_dec(x_103);
lean_dec(x_102);
x_106 = l_Lean_IR_getDecls(x_10);
lean_dec(x_10);
x_107 = l_List_reverse___rarg(x_106);
x_108 = lean_unbox_usize(x_35);
lean_dec(x_35);
lean_inc(x_5);
lean_inc(x_4);
x_109 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__1(x_1, x_3, x_108, x_107, x_4, x_5, x_101);
if (lean_obj_tag(x_109) == 0)
{
lean_object* x_110;
x_110 = lean_ctor_get(x_109, 0);
lean_inc(x_110);
if (lean_obj_tag(x_110) == 0)
{
uint8_t x_111;
lean_dec(x_5);
lean_dec(x_4);
x_111 = !lean_is_exclusive(x_109);
if (x_111 == 0)
{
lean_object* x_112; uint8_t x_113;
x_112 = lean_ctor_get(x_109, 0);
lean_dec(x_112);
x_113 = !lean_is_exclusive(x_110);
if (x_113 == 0)
{
return x_109;
}
else
{
lean_object* x_114; lean_object* x_115;
x_114 = lean_ctor_get(x_110, 0);
lean_inc(x_114);
lean_dec(x_110);
x_115 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_115, 0, x_114);
lean_ctor_set(x_109, 0, x_115);
return x_109;
}
}
else
{
lean_object* x_116; lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120;
x_116 = lean_ctor_get(x_109, 1);
lean_inc(x_116);
lean_dec(x_109);
x_117 = lean_ctor_get(x_110, 0);
lean_inc(x_117);
if (lean_is_exclusive(x_110)) {
lean_ctor_release(x_110, 0);
x_118 = x_110;
} else {
lean_dec_ref(x_110);
x_118 = lean_box(0);
}
if (lean_is_scalar(x_118)) {
x_119 = lean_alloc_ctor(0, 1, 0);
} else {
x_119 = x_118;
}
lean_ctor_set(x_119, 0, x_117);
x_120 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_120, 0, x_119);
lean_ctor_set(x_120, 1, x_116);
return x_120;
}
}
else
{
lean_object* x_121; uint64_t x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; size_t x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; lean_object* x_132; size_t x_133; lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137; size_t x_138; lean_object* x_139; uint8_t x_140;
lean_dec(x_110);
x_121 = lean_ctor_get(x_109, 1);
lean_inc(x_121);
lean_dec(x_109);
x_122 = 0;
x_123 = l_LLVM_constIntUnsigned(x_1, x_122, x_27, x_121);
x_124 = lean_ctor_get(x_123, 0);
lean_inc(x_124);
x_125 = lean_ctor_get(x_123, 1);
lean_inc(x_125);
lean_dec(x_123);
x_126 = l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
x_127 = lean_unbox_usize(x_124);
lean_dec(x_124);
x_128 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_3, x_127, x_126, x_4, x_5, x_125);
x_129 = lean_ctor_get(x_128, 0);
lean_inc(x_129);
x_130 = lean_ctor_get(x_128, 1);
lean_inc(x_130);
lean_dec(x_128);
x_131 = lean_ctor_get(x_129, 0);
lean_inc(x_131);
lean_dec(x_129);
x_132 = l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1;
x_133 = lean_unbox_usize(x_131);
lean_dec(x_131);
x_134 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(x_1, x_3, x_133, x_132, x_4, x_5, x_130);
lean_dec(x_5);
lean_dec(x_4);
x_135 = lean_ctor_get(x_134, 0);
lean_inc(x_135);
x_136 = lean_ctor_get(x_134, 1);
lean_inc(x_136);
lean_dec(x_134);
x_137 = lean_ctor_get(x_135, 0);
lean_inc(x_137);
lean_dec(x_135);
x_138 = lean_unbox_usize(x_137);
lean_dec(x_137);
x_139 = lean_llvm_build_ret(x_1, x_3, x_138, x_136);
x_140 = !lean_is_exclusive(x_139);
if (x_140 == 0)
{
lean_object* x_141; lean_object* x_142;
x_141 = lean_ctor_get(x_139, 0);
lean_dec(x_141);
x_142 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_139, 0, x_142);
return x_139;
}
else
{
lean_object* x_143; lean_object* x_144; lean_object* x_145;
x_143 = lean_ctor_get(x_139, 1);
lean_inc(x_143);
lean_dec(x_139);
x_144 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_145 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_145, 0, x_144);
lean_ctor_set(x_145, 1, x_143);
return x_145;
}
}
}
else
{
uint8_t x_146;
lean_dec(x_5);
lean_dec(x_4);
x_146 = !lean_is_exclusive(x_109);
if (x_146 == 0)
{
return x_109;
}
else
{
lean_object* x_147; lean_object* x_148; lean_object* x_149;
x_147 = lean_ctor_get(x_109, 0);
x_148 = lean_ctor_get(x_109, 1);
lean_inc(x_148);
lean_inc(x_147);
lean_dec(x_109);
x_149 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_149, 0, x_147);
lean_ctor_set(x_149, 1, x_148);
return x_149;
}
}
}
else
{
uint8_t x_150;
x_150 = lean_nat_dec_le(x_103, x_103);
if (x_150 == 0)
{
lean_object* x_151; lean_object* x_152; size_t x_153; lean_object* x_154;
lean_dec(x_103);
lean_dec(x_102);
x_151 = l_Lean_IR_getDecls(x_10);
lean_dec(x_10);
x_152 = l_List_reverse___rarg(x_151);
x_153 = lean_unbox_usize(x_35);
lean_dec(x_35);
lean_inc(x_5);
lean_inc(x_4);
x_154 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__2(x_1, x_3, x_153, x_152, x_4, x_5, x_101);
if (lean_obj_tag(x_154) == 0)
{
lean_object* x_155;
x_155 = lean_ctor_get(x_154, 0);
lean_inc(x_155);
if (lean_obj_tag(x_155) == 0)
{
uint8_t x_156;
lean_dec(x_5);
lean_dec(x_4);
x_156 = !lean_is_exclusive(x_154);
if (x_156 == 0)
{
lean_object* x_157; uint8_t x_158;
x_157 = lean_ctor_get(x_154, 0);
lean_dec(x_157);
x_158 = !lean_is_exclusive(x_155);
if (x_158 == 0)
{
return x_154;
}
else
{
lean_object* x_159; lean_object* x_160;
x_159 = lean_ctor_get(x_155, 0);
lean_inc(x_159);
lean_dec(x_155);
x_160 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_160, 0, x_159);
lean_ctor_set(x_154, 0, x_160);
return x_154;
}
}
else
{
lean_object* x_161; lean_object* x_162; lean_object* x_163; lean_object* x_164; lean_object* x_165;
x_161 = lean_ctor_get(x_154, 1);
lean_inc(x_161);
lean_dec(x_154);
x_162 = lean_ctor_get(x_155, 0);
lean_inc(x_162);
if (lean_is_exclusive(x_155)) {
lean_ctor_release(x_155, 0);
x_163 = x_155;
} else {
lean_dec_ref(x_155);
x_163 = lean_box(0);
}
if (lean_is_scalar(x_163)) {
x_164 = lean_alloc_ctor(0, 1, 0);
} else {
x_164 = x_163;
}
lean_ctor_set(x_164, 0, x_162);
x_165 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_165, 0, x_164);
lean_ctor_set(x_165, 1, x_161);
return x_165;
}
}
else
{
lean_object* x_166; uint64_t x_167; lean_object* x_168; lean_object* x_169; lean_object* x_170; lean_object* x_171; size_t x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175; lean_object* x_176; lean_object* x_177; size_t x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; lean_object* x_182; size_t x_183; lean_object* x_184; uint8_t x_185;
lean_dec(x_155);
x_166 = lean_ctor_get(x_154, 1);
lean_inc(x_166);
lean_dec(x_154);
x_167 = 0;
x_168 = l_LLVM_constIntUnsigned(x_1, x_167, x_27, x_166);
x_169 = lean_ctor_get(x_168, 0);
lean_inc(x_169);
x_170 = lean_ctor_get(x_168, 1);
lean_inc(x_170);
lean_dec(x_168);
x_171 = l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
x_172 = lean_unbox_usize(x_169);
lean_dec(x_169);
x_173 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_3, x_172, x_171, x_4, x_5, x_170);
x_174 = lean_ctor_get(x_173, 0);
lean_inc(x_174);
x_175 = lean_ctor_get(x_173, 1);
lean_inc(x_175);
lean_dec(x_173);
x_176 = lean_ctor_get(x_174, 0);
lean_inc(x_176);
lean_dec(x_174);
x_177 = l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1;
x_178 = lean_unbox_usize(x_176);
lean_dec(x_176);
x_179 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(x_1, x_3, x_178, x_177, x_4, x_5, x_175);
lean_dec(x_5);
lean_dec(x_4);
x_180 = lean_ctor_get(x_179, 0);
lean_inc(x_180);
x_181 = lean_ctor_get(x_179, 1);
lean_inc(x_181);
lean_dec(x_179);
x_182 = lean_ctor_get(x_180, 0);
lean_inc(x_182);
lean_dec(x_180);
x_183 = lean_unbox_usize(x_182);
lean_dec(x_182);
x_184 = lean_llvm_build_ret(x_1, x_3, x_183, x_181);
x_185 = !lean_is_exclusive(x_184);
if (x_185 == 0)
{
lean_object* x_186; lean_object* x_187;
x_186 = lean_ctor_get(x_184, 0);
lean_dec(x_186);
x_187 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_184, 0, x_187);
return x_184;
}
else
{
lean_object* x_188; lean_object* x_189; lean_object* x_190;
x_188 = lean_ctor_get(x_184, 1);
lean_inc(x_188);
lean_dec(x_184);
x_189 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_190 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_190, 0, x_189);
lean_ctor_set(x_190, 1, x_188);
return x_190;
}
}
}
else
{
uint8_t x_191;
lean_dec(x_5);
lean_dec(x_4);
x_191 = !lean_is_exclusive(x_154);
if (x_191 == 0)
{
return x_154;
}
else
{
lean_object* x_192; lean_object* x_193; lean_object* x_194;
x_192 = lean_ctor_get(x_154, 0);
x_193 = lean_ctor_get(x_154, 1);
lean_inc(x_193);
lean_inc(x_192);
lean_dec(x_154);
x_194 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_194, 0, x_192);
lean_ctor_set(x_194, 1, x_193);
return x_194;
}
}
}
else
{
size_t x_195; size_t x_196; lean_object* x_197; size_t x_198; lean_object* x_199;
x_195 = 0;
x_196 = lean_usize_of_nat(x_103);
lean_dec(x_103);
x_197 = lean_box(0);
x_198 = lean_unbox_usize(x_35);
lean_inc(x_5);
lean_inc(x_4);
x_199 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3(x_1, x_3, x_198, x_102, x_195, x_196, x_197, x_4, x_5, x_101);
lean_dec(x_102);
if (lean_obj_tag(x_199) == 0)
{
lean_object* x_200;
x_200 = lean_ctor_get(x_199, 0);
lean_inc(x_200);
if (lean_obj_tag(x_200) == 0)
{
uint8_t x_201;
lean_dec(x_35);
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_201 = !lean_is_exclusive(x_199);
if (x_201 == 0)
{
lean_object* x_202; uint8_t x_203;
x_202 = lean_ctor_get(x_199, 0);
lean_dec(x_202);
x_203 = !lean_is_exclusive(x_200);
if (x_203 == 0)
{
return x_199;
}
else
{
lean_object* x_204; lean_object* x_205;
x_204 = lean_ctor_get(x_200, 0);
lean_inc(x_204);
lean_dec(x_200);
x_205 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_205, 0, x_204);
lean_ctor_set(x_199, 0, x_205);
return x_199;
}
}
else
{
lean_object* x_206; lean_object* x_207; lean_object* x_208; lean_object* x_209; lean_object* x_210;
x_206 = lean_ctor_get(x_199, 1);
lean_inc(x_206);
lean_dec(x_199);
x_207 = lean_ctor_get(x_200, 0);
lean_inc(x_207);
if (lean_is_exclusive(x_200)) {
lean_ctor_release(x_200, 0);
x_208 = x_200;
} else {
lean_dec_ref(x_200);
x_208 = lean_box(0);
}
if (lean_is_scalar(x_208)) {
x_209 = lean_alloc_ctor(0, 1, 0);
} else {
x_209 = x_208;
}
lean_ctor_set(x_209, 0, x_207);
x_210 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_210, 0, x_209);
lean_ctor_set(x_210, 1, x_206);
return x_210;
}
}
else
{
lean_object* x_211; lean_object* x_212; lean_object* x_213; size_t x_214; lean_object* x_215;
lean_dec(x_200);
x_211 = lean_ctor_get(x_199, 1);
lean_inc(x_211);
lean_dec(x_199);
x_212 = l_Lean_IR_getDecls(x_10);
lean_dec(x_10);
x_213 = l_List_reverse___rarg(x_212);
x_214 = lean_unbox_usize(x_35);
lean_dec(x_35);
lean_inc(x_5);
lean_inc(x_4);
x_215 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4(x_1, x_3, x_214, x_213, x_4, x_5, x_211);
if (lean_obj_tag(x_215) == 0)
{
lean_object* x_216;
x_216 = lean_ctor_get(x_215, 0);
lean_inc(x_216);
if (lean_obj_tag(x_216) == 0)
{
uint8_t x_217;
lean_dec(x_5);
lean_dec(x_4);
x_217 = !lean_is_exclusive(x_215);
if (x_217 == 0)
{
lean_object* x_218; uint8_t x_219;
x_218 = lean_ctor_get(x_215, 0);
lean_dec(x_218);
x_219 = !lean_is_exclusive(x_216);
if (x_219 == 0)
{
return x_215;
}
else
{
lean_object* x_220; lean_object* x_221;
x_220 = lean_ctor_get(x_216, 0);
lean_inc(x_220);
lean_dec(x_216);
x_221 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_221, 0, x_220);
lean_ctor_set(x_215, 0, x_221);
return x_215;
}
}
else
{
lean_object* x_222; lean_object* x_223; lean_object* x_224; lean_object* x_225; lean_object* x_226;
x_222 = lean_ctor_get(x_215, 1);
lean_inc(x_222);
lean_dec(x_215);
x_223 = lean_ctor_get(x_216, 0);
lean_inc(x_223);
if (lean_is_exclusive(x_216)) {
lean_ctor_release(x_216, 0);
x_224 = x_216;
} else {
lean_dec_ref(x_216);
x_224 = lean_box(0);
}
if (lean_is_scalar(x_224)) {
x_225 = lean_alloc_ctor(0, 1, 0);
} else {
x_225 = x_224;
}
lean_ctor_set(x_225, 0, x_223);
x_226 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_226, 0, x_225);
lean_ctor_set(x_226, 1, x_222);
return x_226;
}
}
else
{
lean_object* x_227; uint64_t x_228; lean_object* x_229; lean_object* x_230; lean_object* x_231; lean_object* x_232; size_t x_233; lean_object* x_234; lean_object* x_235; lean_object* x_236; lean_object* x_237; lean_object* x_238; size_t x_239; lean_object* x_240; lean_object* x_241; lean_object* x_242; lean_object* x_243; size_t x_244; lean_object* x_245; uint8_t x_246;
lean_dec(x_216);
x_227 = lean_ctor_get(x_215, 1);
lean_inc(x_227);
lean_dec(x_215);
x_228 = 0;
x_229 = l_LLVM_constIntUnsigned(x_1, x_228, x_27, x_227);
x_230 = lean_ctor_get(x_229, 0);
lean_inc(x_230);
x_231 = lean_ctor_get(x_229, 1);
lean_inc(x_231);
lean_dec(x_229);
x_232 = l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1;
x_233 = lean_unbox_usize(x_230);
lean_dec(x_230);
x_234 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_3, x_233, x_232, x_4, x_5, x_231);
x_235 = lean_ctor_get(x_234, 0);
lean_inc(x_235);
x_236 = lean_ctor_get(x_234, 1);
lean_inc(x_236);
lean_dec(x_234);
x_237 = lean_ctor_get(x_235, 0);
lean_inc(x_237);
lean_dec(x_235);
x_238 = l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1;
x_239 = lean_unbox_usize(x_237);
lean_dec(x_237);
x_240 = l_Lean_IR_EmitLLVM_callLeanIOResultMKOk(x_1, x_3, x_239, x_238, x_4, x_5, x_236);
lean_dec(x_5);
lean_dec(x_4);
x_241 = lean_ctor_get(x_240, 0);
lean_inc(x_241);
x_242 = lean_ctor_get(x_240, 1);
lean_inc(x_242);
lean_dec(x_240);
x_243 = lean_ctor_get(x_241, 0);
lean_inc(x_243);
lean_dec(x_241);
x_244 = lean_unbox_usize(x_243);
lean_dec(x_243);
x_245 = lean_llvm_build_ret(x_1, x_3, x_244, x_242);
x_246 = !lean_is_exclusive(x_245);
if (x_246 == 0)
{
lean_object* x_247; lean_object* x_248;
x_247 = lean_ctor_get(x_245, 0);
lean_dec(x_247);
x_248 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_245, 0, x_248);
return x_245;
}
else
{
lean_object* x_249; lean_object* x_250; lean_object* x_251;
x_249 = lean_ctor_get(x_245, 1);
lean_inc(x_249);
lean_dec(x_245);
x_250 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_251 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_251, 0, x_250);
lean_ctor_set(x_251, 1, x_249);
return x_251;
}
}
}
else
{
uint8_t x_252;
lean_dec(x_5);
lean_dec(x_4);
x_252 = !lean_is_exclusive(x_215);
if (x_252 == 0)
{
return x_215;
}
else
{
lean_object* x_253; lean_object* x_254; lean_object* x_255;
x_253 = lean_ctor_get(x_215, 0);
x_254 = lean_ctor_get(x_215, 1);
lean_inc(x_254);
lean_inc(x_253);
lean_dec(x_215);
x_255 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_255, 0, x_253);
lean_ctor_set(x_255, 1, x_254);
return x_255;
}
}
}
}
else
{
uint8_t x_256;
lean_dec(x_35);
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_256 = !lean_is_exclusive(x_199);
if (x_256 == 0)
{
return x_199;
}
else
{
lean_object* x_257; lean_object* x_258; lean_object* x_259;
x_257 = lean_ctor_get(x_199, 0);
x_258 = lean_ctor_get(x_199, 1);
lean_inc(x_258);
lean_inc(x_257);
lean_dec(x_199);
x_259 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_259, 0, x_257);
lean_ctor_set(x_259, 1, x_258);
return x_259;
}
}
}
}
}
}
else
{
uint8_t x_260;
lean_dec(x_59);
lean_dec(x_35);
lean_dec(x_10);
lean_dec(x_5);
lean_dec(x_4);
x_260 = !lean_is_exclusive(x_82);
if (x_260 == 0)
{
return x_82;
}
else
{
lean_object* x_261; lean_object* x_262; lean_object* x_263;
x_261 = lean_ctor_get(x_82, 0);
x_262 = lean_ctor_get(x_82, 1);
lean_inc(x_262);
lean_inc(x_261);
lean_dec(x_82);
x_263 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_263, 0, x_261);
lean_ctor_set(x_263, 1, x_262);
return x_263;
}
}
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__1(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___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, lean_object* x_7) {
_start:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__2(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; size_t x_14; size_t x_15; lean_object* x_16;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_16 = l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3(x_11, x_12, x_13, x_4, x_14, x_15, x_7, x_8, x_9, x_10);
lean_dec(x_4);
return x_16;
}
}
LEAN_EXPORT lean_object* l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_List_forM___at_Lean_IR_EmitLLVM_emitInitFn___spec__4(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_emitInitFn___lambda__1(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitInitFn___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitInitFn(x_7, x_8, x_9, x_4, x_5, x_6);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_initialize", 15);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitialize(size_t x_1, size_t 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; size_t 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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; uint8_t x_30;
x_6 = lean_llvm_void_type_in_context(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_EmitLLVM_Context_mainParams___default___closed__1;
x_10 = 0;
x_11 = lean_unbox_usize(x_7);
x_12 = lean_llvm_function_type(x_1, x_11, x_9, x_10, x_8);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_4, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_9, x_3, x_4, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_28 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_9, x_26, x_24);
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_29, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_29, 0, x_32);
return x_29;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_29, 1);
lean_inc(x_33);
lean_dec(x_29);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitialize___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanInitialize(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_initialize_runtime_module", 30);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule(size_t x_1, size_t 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; size_t 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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; uint8_t x_30;
x_6 = lean_llvm_void_type_in_context(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_EmitLLVM_Context_mainParams___default___closed__1;
x_10 = 0;
x_11 = lean_unbox_usize(x_7);
x_12 = lean_llvm_function_type(x_1, x_11, x_9, x_10, x_8);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_4, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_9, x_3, x_4, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_28 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_9, x_26, x_24);
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_29, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_29, 0, x_32);
return x_29;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_29, 1);
lean_inc(x_33);
lean_dec(x_29);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_set_panic_messages", 23);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanSetPanicMessages(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
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; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26; size_t 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; size_t x_34; size_t x_35; lean_object* x_36; uint8_t x_37;
x_7 = lean_llvm_void_type_in_context(x_1, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = l_LLVM_i1Type(x_1, x_9);
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_EmitLLVM_callLeanBox___closed__1;
x_14 = lean_array_push(x_13, x_11);
x_15 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_5, x_12);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_ctor_get(x_16, 0);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1;
x_20 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_unbox_usize(x_8);
x_22 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_20, x_21, x_19, x_14, x_4, x_5, x_17);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = 0;
x_27 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_28 = lean_llvm_function_type(x_1, x_27, x_14, x_26, x_24);
lean_dec(x_14);
x_29 = lean_ctor_get(x_28, 0);
lean_inc(x_29);
x_30 = lean_ctor_get(x_28, 1);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_box_usize(x_3);
x_32 = lean_array_push(x_13, x_31);
x_33 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_34 = lean_unbox_usize(x_29);
lean_dec(x_29);
x_35 = lean_unbox_usize(x_25);
lean_dec(x_25);
x_36 = lean_llvm_build_call2(x_1, x_2, x_34, x_35, x_32, x_33, x_30);
lean_dec(x_32);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_36, 0);
lean_dec(x_38);
x_39 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_36, 0, x_39);
return x_36;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_36, 1);
lean_inc(x_40);
lean_dec(x_36);
x_41 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_40);
return x_42;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_callLeanSetPanicMessages(x_7, x_8, x_9, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
return x_10;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_mark_end_initialization", 31);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization(size_t x_1, size_t 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; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; uint8_t x_30;
x_6 = lean_llvm_void_type_in_context(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_EmitLLVM_getLLVMModule___rarg(x_4, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1;
x_14 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_15 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_16 = lean_unbox_usize(x_7);
x_17 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_15, x_16, x_13, x_14, x_3, x_4, x_11);
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 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = 0;
x_22 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_23 = lean_llvm_function_type(x_1, x_22, x_14, x_21, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_28 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_14, x_26, x_25);
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_29, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_29, 0, x_32);
return x_29;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_29, 1);
lean_inc(x_33);
lean_dec(x_29);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_result_is_ok", 20);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsOk(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i1Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIOResultIsOk(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_init_task_manager", 22);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitTaskManager(size_t x_1, size_t 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; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; uint8_t x_30;
x_6 = lean_llvm_void_type_in_context(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_EmitLLVM_getLLVMModule___rarg(x_4, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1;
x_14 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_15 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_16 = lean_unbox_usize(x_7);
x_17 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_15, x_16, x_13, x_14, x_3, x_4, x_11);
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 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = 0;
x_22 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_23 = lean_llvm_function_type(x_1, x_22, x_14, x_21, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_28 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_14, x_26, x_25);
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_29, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_29, 0, x_32);
return x_29;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_29, 1);
lean_inc(x_33);
lean_dec(x_29);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanInitTaskManager___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanInitTaskManager(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_finalize_task_manager", 26);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager(size_t x_1, size_t 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; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20; uint8_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; size_t x_27; size_t x_28; lean_object* x_29; uint8_t x_30;
x_6 = l_LLVM_voidPtrType(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_EmitLLVM_getLLVMModule___rarg(x_4, x_8);
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 = lean_ctor_get(x_10, 0);
lean_inc(x_12);
lean_dec(x_10);
x_13 = l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1;
x_14 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_15 = lean_unbox_usize(x_12);
lean_dec(x_12);
x_16 = lean_unbox_usize(x_7);
x_17 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_15, x_16, x_13, x_14, x_3, x_4, x_11);
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 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = 0;
x_22 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_23 = lean_llvm_function_type(x_1, x_22, x_14, x_21, x_19);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_27 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_28 = lean_unbox_usize(x_20);
lean_dec(x_20);
x_29 = lean_llvm_build_call2(x_1, x_2, x_27, x_28, x_14, x_26, x_25);
x_30 = !lean_is_exclusive(x_29);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_ctor_get(x_29, 0);
lean_dec(x_31);
x_32 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_29, 0, x_32);
return x_29;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35;
x_33 = lean_ctor_get(x_29, 1);
lean_inc(x_33);
lean_dec(x_29);
x_34 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager(x_6, x_7, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnboxUint32(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; uint8_t x_26;
x_8 = l_LLVM_i32Type(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callUnboxForType___closed__3;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = !lean_is_exclusive(x_24);
if (x_26 == 0)
{
lean_object* x_27; uint8_t x_28; size_t x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; uint8_t x_38;
x_27 = lean_ctor_get(x_24, 0);
x_28 = 0;
x_29 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_30 = lean_llvm_function_type(x_1, x_29, x_15, x_28, x_25);
lean_dec(x_15);
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = lean_box_usize(x_3);
x_34 = lean_array_push(x_14, x_33);
x_35 = lean_unbox_usize(x_31);
lean_dec(x_31);
x_36 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_37 = lean_llvm_build_call2(x_1, x_2, x_35, x_36, x_34, x_4, x_32);
lean_dec(x_34);
x_38 = !lean_is_exclusive(x_37);
if (x_38 == 0)
{
lean_object* x_39;
x_39 = lean_ctor_get(x_37, 0);
lean_ctor_set(x_24, 0, x_39);
lean_ctor_set(x_37, 0, x_24);
return x_37;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_37, 0);
x_41 = lean_ctor_get(x_37, 1);
lean_inc(x_41);
lean_inc(x_40);
lean_dec(x_37);
lean_ctor_set(x_24, 0, x_40);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_24);
lean_ctor_set(x_42, 1, x_41);
return x_42;
}
}
else
{
lean_object* x_43; uint8_t x_44; size_t x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; lean_object* x_49; lean_object* x_50; size_t x_51; size_t 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;
x_43 = lean_ctor_get(x_24, 0);
lean_inc(x_43);
lean_dec(x_24);
x_44 = 0;
x_45 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_46 = lean_llvm_function_type(x_1, x_45, x_15, x_44, x_25);
lean_dec(x_15);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = lean_box_usize(x_3);
x_50 = lean_array_push(x_14, x_49);
x_51 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_52 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_53 = lean_llvm_build_call2(x_1, x_2, x_51, x_52, x_50, x_4, x_48);
lean_dec(x_50);
x_54 = lean_ctor_get(x_53, 0);
lean_inc(x_54);
x_55 = lean_ctor_get(x_53, 1);
lean_inc(x_55);
if (lean_is_exclusive(x_53)) {
lean_ctor_release(x_53, 0);
lean_ctor_release(x_53, 1);
x_56 = x_53;
} else {
lean_dec_ref(x_53);
x_56 = lean_box(0);
}
x_57 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_57, 0, x_54);
if (lean_is_scalar(x_56)) {
x_58 = lean_alloc_ctor(0, 2, 0);
} else {
x_58 = x_56;
}
lean_ctor_set(x_58, 0, x_57);
lean_ctor_set(x_58, 1, x_55);
return x_58;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanUnboxUint32___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanUnboxUint32(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean_io_result_show_error", 25);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultShowError(size_t x_1, size_t x_2, size_t 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_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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; uint8_t x_27; size_t x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; size_t x_34; size_t x_35; lean_object* x_36; uint8_t x_37;
x_8 = lean_llvm_void_type_in_context(x_1, x_7);
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 = l_LLVM_voidPtrType(x_1, x_10);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_15 = lean_array_push(x_14, x_12);
x_16 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_6, x_13);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1;
x_21 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_22 = lean_unbox_usize(x_9);
x_23 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_21, x_22, x_20, x_15, x_5, x_6, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_ctor_get(x_24, 0);
lean_inc(x_26);
lean_dec(x_24);
x_27 = 0;
x_28 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_29 = lean_llvm_function_type(x_1, x_28, x_15, x_27, x_25);
lean_dec(x_15);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = lean_box_usize(x_3);
x_33 = lean_array_push(x_14, x_32);
x_34 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_35 = lean_unbox_usize(x_26);
lean_dec(x_26);
x_36 = lean_llvm_build_call2(x_1, x_2, x_34, x_35, x_33, x_4, x_31);
lean_dec(x_33);
x_37 = !lean_is_exclusive(x_36);
if (x_37 == 0)
{
lean_object* x_38; lean_object* x_39;
x_38 = lean_ctor_get(x_36, 0);
lean_dec(x_38);
x_39 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_36, 0, x_39);
return x_36;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42;
x_40 = lean_ctor_get(x_36, 1);
lean_inc(x_40);
lean_dec(x_36);
x_41 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_41);
lean_ctor_set(x_42, 1, x_40);
return x_42;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanIOResultShowError___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:
{
size_t x_8; size_t x_9; size_t x_10; lean_object* x_11;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_callLeanIOResultShowError(x_8, x_9, x_10, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_11;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMainFn(size_t x_1, size_t x_2, lean_object* x_3, size_t 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_88; lean_object* x_89; lean_object* x_90; lean_object* x_91;
x_9 = l_LLVM_voidPtrType(x_1, x_8);
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_88 = l_LLVM_voidPtrType(x_1, x_11);
x_89 = lean_ctor_get(x_88, 0);
lean_inc(x_89);
x_90 = lean_ctor_get(x_88, 1);
lean_inc(x_90);
lean_dec(x_88);
x_91 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_7, x_90);
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95;
x_92 = lean_ctor_get(x_91, 0);
lean_inc(x_92);
x_93 = lean_ctor_get(x_91, 1);
lean_inc(x_93);
lean_dec(x_91);
x_94 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_95 = lean_array_push(x_94, x_89);
x_12 = x_95;
x_13 = x_92;
x_14 = x_93;
goto block_87;
}
else
{
lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100;
x_96 = lean_ctor_get(x_91, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_91, 1);
lean_inc(x_97);
lean_dec(x_91);
x_98 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
lean_inc(x_89);
x_99 = lean_array_push(x_98, x_89);
x_100 = lean_array_push(x_99, x_89);
x_12 = x_100;
x_13 = x_96;
x_14 = x_97;
goto block_87;
}
block_87:
{
lean_object* x_15; lean_object* x_16; size_t x_17; size_t x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22;
x_15 = lean_ctor_get(x_13, 0);
lean_inc(x_15);
lean_dec(x_13);
x_16 = l_Lean_IR_leanMainFn;
x_17 = lean_unbox_usize(x_15);
lean_dec(x_15);
x_18 = lean_unbox_usize(x_10);
x_19 = l_Lean_IR_EmitLLVM_getOrCreateFunctionPrototype(x_1, x_17, x_18, x_16, x_12, x_6, x_7, x_14);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = !lean_is_exclusive(x_20);
if (x_22 == 0)
{
lean_object* x_23; uint8_t x_24; size_t x_25; lean_object* x_26;
x_23 = lean_ctor_get(x_20, 0);
x_24 = 0;
x_25 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_26 = lean_llvm_function_type(x_1, x_25, x_12, x_24, x_21);
lean_dec(x_12);
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; size_t x_32; size_t x_33; lean_object* x_34; uint8_t x_35;
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_30 = lean_box_usize(x_4);
x_31 = lean_array_push(x_29, x_30);
x_32 = lean_unbox_usize(x_27);
lean_dec(x_27);
x_33 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_34 = lean_llvm_build_call2(x_1, x_2, x_32, x_33, x_31, x_5, x_28);
lean_dec(x_31);
x_35 = !lean_is_exclusive(x_34);
if (x_35 == 0)
{
lean_object* x_36;
x_36 = lean_ctor_get(x_34, 0);
lean_ctor_set(x_20, 0, x_36);
lean_ctor_set(x_34, 0, x_20);
return x_34;
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_37 = lean_ctor_get(x_34, 0);
x_38 = lean_ctor_get(x_34, 1);
lean_inc(x_38);
lean_inc(x_37);
lean_dec(x_34);
lean_ctor_set(x_20, 0, x_37);
x_39 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_39, 0, x_20);
lean_ctor_set(x_39, 1, x_38);
return x_39;
}
}
else
{
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; size_t x_47; size_t x_48; lean_object* x_49; uint8_t x_50;
x_40 = lean_ctor_get(x_26, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_26, 1);
lean_inc(x_41);
lean_dec(x_26);
x_42 = lean_ctor_get(x_3, 0);
lean_inc(x_42);
lean_dec(x_3);
x_43 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_44 = lean_array_push(x_43, x_42);
x_45 = lean_box_usize(x_4);
x_46 = lean_array_push(x_44, x_45);
x_47 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_48 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_49 = lean_llvm_build_call2(x_1, x_2, x_47, x_48, x_46, x_5, x_41);
lean_dec(x_46);
x_50 = !lean_is_exclusive(x_49);
if (x_50 == 0)
{
lean_object* x_51;
x_51 = lean_ctor_get(x_49, 0);
lean_ctor_set(x_20, 0, x_51);
lean_ctor_set(x_49, 0, x_20);
return x_49;
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_52 = lean_ctor_get(x_49, 0);
x_53 = lean_ctor_get(x_49, 1);
lean_inc(x_53);
lean_inc(x_52);
lean_dec(x_49);
lean_ctor_set(x_20, 0, x_52);
x_54 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_54, 0, x_20);
lean_ctor_set(x_54, 1, x_53);
return x_54;
}
}
}
else
{
lean_object* x_55; uint8_t x_56; size_t x_57; lean_object* x_58;
x_55 = lean_ctor_get(x_20, 0);
lean_inc(x_55);
lean_dec(x_20);
x_56 = 0;
x_57 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_58 = lean_llvm_function_type(x_1, x_57, x_12, x_56, x_21);
lean_dec(x_12);
if (lean_obj_tag(x_3) == 0)
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; size_t x_64; size_t 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;
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
x_60 = lean_ctor_get(x_58, 1);
lean_inc(x_60);
lean_dec(x_58);
x_61 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_62 = lean_box_usize(x_4);
x_63 = lean_array_push(x_61, x_62);
x_64 = lean_unbox_usize(x_59);
lean_dec(x_59);
x_65 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_66 = lean_llvm_build_call2(x_1, x_2, x_64, x_65, x_63, x_5, x_60);
lean_dec(x_63);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_ctor_get(x_66, 1);
lean_inc(x_68);
if (lean_is_exclusive(x_66)) {
lean_ctor_release(x_66, 0);
lean_ctor_release(x_66, 1);
x_69 = x_66;
} else {
lean_dec_ref(x_66);
x_69 = lean_box(0);
}
x_70 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_70, 0, x_67);
if (lean_is_scalar(x_69)) {
x_71 = lean_alloc_ctor(0, 2, 0);
} else {
x_71 = x_69;
}
lean_ctor_set(x_71, 0, x_70);
lean_ctor_set(x_71, 1, x_68);
return x_71;
}
else
{
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; size_t x_79; size_t 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;
x_72 = lean_ctor_get(x_58, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_58, 1);
lean_inc(x_73);
lean_dec(x_58);
x_74 = lean_ctor_get(x_3, 0);
lean_inc(x_74);
lean_dec(x_3);
x_75 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_76 = lean_array_push(x_75, x_74);
x_77 = lean_box_usize(x_4);
x_78 = lean_array_push(x_76, x_77);
x_79 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_80 = lean_unbox_usize(x_55);
lean_dec(x_55);
x_81 = lean_llvm_build_call2(x_1, x_2, x_79, x_80, x_78, x_5, x_73);
lean_dec(x_78);
x_82 = lean_ctor_get(x_81, 0);
lean_inc(x_82);
x_83 = lean_ctor_get(x_81, 1);
lean_inc(x_83);
if (lean_is_exclusive(x_81)) {
lean_ctor_release(x_81, 0);
lean_ctor_release(x_81, 1);
x_84 = x_81;
} else {
lean_dec_ref(x_81);
x_84 = lean_box(0);
}
x_85 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_85, 0, x_82);
if (lean_is_scalar(x_84)) {
x_86 = lean_alloc_ctor(0, 2, 0);
} else {
x_86 = x_84;
}
lean_ctor_set(x_86, 0, x_85);
lean_ctor_set(x_86, 1, x_83);
return x_86;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_callLeanMainFn___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:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_callLeanMainFn(x_9, x_10, x_3, x_11, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_12;
}
}
LEAN_EXPORT lean_object* l_panic___at_Lean_IR_EmitLLVM_emitMainFn___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2; lean_object* x_3;
x_2 = l_Lean_instInhabitedConstantInfo;
x_3 = lean_panic_fn(x_2, x_1);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("iv", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("i_gt_1", 6);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__1(size_t x_1, size_t x_2, size_t x_3, size_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; uint8_t x_16;
x_8 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1;
x_9 = lean_llvm_build_load2(x_1, x_4, x_2, x_3, x_8, x_7);
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 = lean_unsigned_to_nat(1u);
x_13 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_12, x_5, x_6, x_11);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17; uint64_t x_18; lean_object* x_19; size_t x_20; size_t x_21; lean_object* x_22; uint8_t x_23;
x_17 = lean_ctor_get(x_14, 0);
x_18 = l_LLVM_IntPredicate_UGT;
x_19 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2;
x_20 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_21 = lean_unbox_usize(x_17);
lean_dec(x_17);
x_22 = lean_llvm_build_icmp(x_1, x_4, x_18, x_20, x_21, x_19, x_15);
x_23 = !lean_is_exclusive(x_22);
if (x_23 == 0)
{
lean_object* x_24;
x_24 = lean_ctor_get(x_22, 0);
lean_ctor_set(x_14, 0, x_24);
lean_ctor_set(x_22, 0, x_14);
return x_22;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_25 = lean_ctor_get(x_22, 0);
x_26 = lean_ctor_get(x_22, 1);
lean_inc(x_26);
lean_inc(x_25);
lean_dec(x_22);
lean_ctor_set(x_14, 0, x_25);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_14);
lean_ctor_set(x_27, 1, x_26);
return x_27;
}
}
else
{
lean_object* x_28; uint64_t x_29; lean_object* x_30; size_t x_31; size_t 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_28 = lean_ctor_get(x_14, 0);
lean_inc(x_28);
lean_dec(x_14);
x_29 = l_LLVM_IntPredicate_UGT;
x_30 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2;
x_31 = lean_unbox_usize(x_10);
lean_dec(x_10);
x_32 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_33 = lean_llvm_build_icmp(x_1, x_4, x_29, x_31, x_32, x_30, x_15);
x_34 = lean_ctor_get(x_33, 0);
lean_inc(x_34);
x_35 = lean_ctor_get(x_33, 1);
lean_inc(x_35);
if (lean_is_exclusive(x_33)) {
lean_ctor_release(x_33, 0);
lean_ctor_release(x_33, 1);
x_36 = x_33;
} else {
lean_dec_ref(x_33);
x_36 = lean_box(0);
}
x_37 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_37, 0, x_34);
if (lean_is_scalar(x_36)) {
x_38 = lean_alloc_ctor(0, 2, 0);
} else {
x_38 = x_36;
}
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_35);
return x_38;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("iv.next", 7);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("nv", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("argv.i.next.slot", 16);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("argv.i.next.val", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("arg.i.next.val.str", 18);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("inv", 3);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__2(size_t x_1, size_t x_2, size_t x_3, size_t x_4, size_t x_5, size_t x_6, size_t x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
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; size_t x_21; size_t x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; size_t 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; size_t 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; size_t x_50; size_t x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; size_t 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; size_t x_65; size_t x_66; size_t 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; size_t x_78; size_t x_79; size_t x_80; lean_object* x_81; lean_object* x_82; uint8_t x_83;
x_11 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1;
x_12 = lean_llvm_build_load2(x_1, x_7, x_2, x_3, x_11, x_10);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = lean_unsigned_to_nat(1u);
x_16 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_15, x_8, x_9, x_14);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
x_20 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1;
x_21 = lean_unbox_usize(x_13);
lean_dec(x_13);
x_22 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_23 = lean_llvm_build_sub(x_1, x_7, x_21, x_22, x_20, x_18);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_24);
x_27 = lean_llvm_build_store(x_1, x_7, x_26, x_3, x_25);
x_28 = lean_ctor_get(x_27, 1);
lean_inc(x_28);
lean_dec(x_27);
x_29 = lean_unsigned_to_nat(2u);
x_30 = lean_unsigned_to_nat(0u);
x_31 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2;
x_32 = l_Lean_IR_EmitLLVM_callLeanAllocCtor(x_1, x_7, x_15, x_29, x_30, x_31, x_8, x_9, x_28);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_ctor_get(x_33, 0);
lean_inc(x_35);
lean_dec(x_33);
x_36 = l_LLVM_voidPtrType(x_1, x_34);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = l_Lean_IR_EmitLLVM_callLeanBox___closed__1;
x_40 = lean_array_push(x_39, x_24);
x_41 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3;
x_42 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_43 = lean_llvm_build_gep2(x_1, x_7, x_42, x_4, x_40, x_41, x_38);
lean_dec(x_40);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_ctor_get(x_43, 1);
lean_inc(x_45);
lean_dec(x_43);
x_46 = l_LLVM_voidPtrType(x_1, x_45);
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
x_48 = lean_ctor_get(x_46, 1);
lean_inc(x_48);
lean_dec(x_46);
x_49 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4;
x_50 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_51 = lean_unbox_usize(x_44);
lean_dec(x_44);
x_52 = lean_llvm_build_load2(x_1, x_7, x_50, x_51, x_49, x_48);
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_EmitLLVM_emitMainFn___lambda__2___closed__5;
x_56 = lean_unbox_usize(x_53);
lean_dec(x_53);
x_57 = l_Lean_IR_EmitLLVM_callLeanMkString(x_1, x_7, x_56, x_55, x_8, x_9, x_54);
x_58 = lean_ctor_get(x_57, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_57, 1);
lean_inc(x_59);
lean_dec(x_57);
x_60 = lean_ctor_get(x_58, 0);
lean_inc(x_60);
lean_dec(x_58);
x_61 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_30, x_8, x_9, x_59);
x_62 = lean_ctor_get(x_61, 0);
lean_inc(x_62);
x_63 = lean_ctor_get(x_61, 1);
lean_inc(x_63);
lean_dec(x_61);
x_64 = lean_ctor_get(x_62, 0);
lean_inc(x_64);
lean_dec(x_62);
x_65 = lean_unbox_usize(x_35);
x_66 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_67 = lean_unbox_usize(x_60);
lean_dec(x_60);
x_68 = l_Lean_IR_EmitLLVM_callLeanCtorSet(x_1, x_7, x_65, x_66, x_67, x_8, x_9, x_63);
x_69 = lean_ctor_get(x_68, 1);
lean_inc(x_69);
lean_dec(x_68);
x_70 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6;
x_71 = lean_llvm_build_load2(x_1, x_7, x_5, x_6, x_70, x_69);
x_72 = lean_ctor_get(x_71, 0);
lean_inc(x_72);
x_73 = lean_ctor_get(x_71, 1);
lean_inc(x_73);
lean_dec(x_71);
x_74 = l_Lean_IR_EmitLLVM_constIntUnsigned(x_1, x_15, x_8, x_9, x_73);
x_75 = lean_ctor_get(x_74, 0);
lean_inc(x_75);
x_76 = lean_ctor_get(x_74, 1);
lean_inc(x_76);
lean_dec(x_74);
x_77 = lean_ctor_get(x_75, 0);
lean_inc(x_77);
lean_dec(x_75);
x_78 = lean_unbox_usize(x_35);
x_79 = lean_unbox_usize(x_77);
lean_dec(x_77);
x_80 = lean_unbox_usize(x_72);
lean_dec(x_72);
x_81 = l_Lean_IR_EmitLLVM_callLeanCtorSet(x_1, x_7, x_78, x_79, x_80, x_8, x_9, x_76);
x_82 = lean_ctor_get(x_81, 0);
lean_inc(x_82);
x_83 = !lean_is_exclusive(x_82);
if (x_83 == 0)
{
lean_object* x_84; lean_object* x_85; size_t x_86; lean_object* x_87; uint8_t x_88;
x_84 = lean_ctor_get(x_82, 0);
lean_dec(x_84);
x_85 = lean_ctor_get(x_81, 1);
lean_inc(x_85);
lean_dec(x_81);
x_86 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_87 = lean_llvm_build_store(x_1, x_7, x_86, x_6, x_85);
x_88 = !lean_is_exclusive(x_87);
if (x_88 == 0)
{
lean_object* x_89;
x_89 = lean_ctor_get(x_87, 0);
lean_ctor_set(x_82, 0, x_89);
lean_ctor_set(x_87, 0, x_82);
return x_87;
}
else
{
lean_object* x_90; lean_object* x_91; lean_object* x_92;
x_90 = lean_ctor_get(x_87, 0);
x_91 = lean_ctor_get(x_87, 1);
lean_inc(x_91);
lean_inc(x_90);
lean_dec(x_87);
lean_ctor_set(x_82, 0, x_90);
x_92 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_92, 0, x_82);
lean_ctor_set(x_92, 1, x_91);
return x_92;
}
}
else
{
lean_object* x_93; size_t x_94; 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_dec(x_82);
x_93 = lean_ctor_get(x_81, 1);
lean_inc(x_93);
lean_dec(x_81);
x_94 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_95 = lean_llvm_build_store(x_1, x_7, x_94, x_6, x_93);
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_95, 1);
lean_inc(x_97);
if (lean_is_exclusive(x_95)) {
lean_ctor_release(x_95, 0);
lean_ctor_release(x_95, 1);
x_98 = x_95;
} else {
lean_dec_ref(x_95);
x_98 = lean_box(0);
}
x_99 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_99, 0, x_96);
if (lean_is_scalar(x_98)) {
x_100 = lean_alloc_ctor(0, 2, 0);
} else {
x_100 = x_98;
}
lean_ctor_set(x_100, 0, x_99);
lean_ctor_set(x_100, 1, x_97);
return x_100;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("resv", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("islot", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("argv", 4);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__3(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, size_t x_6, uint64_t x_7, size_t x_8, size_t x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_13 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_1, x_9, x_2, x_10, x_11, x_12);
x_14 = lean_ctor_get(x_13, 1);
lean_inc(x_14);
lean_dec(x_13);
x_15 = l_Lean_IR_EmitLLVM_callLeanInitTaskManager(x_1, x_9, x_10, x_11, x_14);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = lean_array_get_size(x_3);
x_18 = lean_unsigned_to_nat(2u);
x_19 = lean_nat_dec_eq(x_17, x_18);
lean_dec(x_17);
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; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; size_t x_31; lean_object* x_32; uint8_t x_33;
x_20 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_9, x_10, x_11, x_16);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = lean_ctor_get(x_21, 0);
lean_inc(x_23);
lean_dec(x_21);
x_24 = lean_box(0);
x_25 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
x_26 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_27 = l_Lean_IR_EmitLLVM_callLeanMainFn(x_1, x_9, x_24, x_26, x_25, x_10, x_11, x_22);
lean_dec(x_11);
lean_dec(x_10);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_32 = lean_llvm_build_store(x_1, x_9, x_31, x_4, x_29);
x_33 = !lean_is_exclusive(x_32);
if (x_33 == 0)
{
lean_object* x_34; lean_object* x_35;
x_34 = lean_ctor_get(x_32, 0);
lean_dec(x_34);
x_35 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
lean_ctor_set(x_32, 0, x_35);
return x_32;
}
else
{
lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_36 = lean_ctor_get(x_32, 1);
lean_inc(x_36);
lean_dec(x_32);
x_37 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
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; uint64_t x_42; uint8_t x_43; size_t x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; lean_object* x_48; size_t x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; size_t 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; size_t 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; lean_object* x_68; lean_object* x_69; lean_object* x_70; size_t x_71; size_t 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; lean_object* x_81; lean_object* x_82;
x_39 = l_Lean_IR_LLVM_size__tType(x_1, x_16);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
lean_dec(x_39);
x_42 = 0;
x_43 = 0;
x_44 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_45 = lean_llvm_const_int(x_1, x_44, x_42, x_43, x_41);
x_46 = lean_ctor_get(x_45, 0);
lean_inc(x_46);
x_47 = lean_ctor_get(x_45, 1);
lean_inc(x_47);
lean_dec(x_45);
x_48 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6;
x_49 = lean_unbox_usize(x_46);
lean_dec(x_46);
x_50 = l_Lean_IR_EmitLLVM_callLeanBox(x_1, x_9, x_49, x_48, x_10, x_11, x_47);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
lean_dec(x_50);
x_53 = lean_ctor_get(x_51, 0);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_unbox_usize(x_53);
lean_dec(x_53);
x_55 = lean_llvm_build_store(x_1, x_9, x_54, x_5, x_52);
x_56 = lean_ctor_get(x_55, 1);
lean_inc(x_56);
lean_dec(x_55);
x_57 = l_Lean_IR_LLVM_size__tType(x_1, x_56);
x_58 = lean_ctor_get(x_57, 0);
lean_inc(x_58);
x_59 = lean_ctor_get(x_57, 1);
lean_inc(x_59);
lean_dec(x_57);
x_60 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2;
x_61 = lean_unbox_usize(x_58);
x_62 = lean_llvm_build_alloca(x_1, x_9, x_61, x_60, x_59);
x_63 = lean_ctor_get(x_62, 0);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 1);
lean_inc(x_64);
lean_dec(x_62);
x_65 = llvm_get_param(x_1, x_6, x_42, x_64);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = llvm_get_param(x_1, x_6, x_7, x_67);
x_69 = lean_ctor_get(x_68, 0);
lean_inc(x_69);
x_70 = lean_ctor_get(x_68, 1);
lean_inc(x_70);
lean_dec(x_68);
x_71 = lean_unbox_usize(x_66);
lean_dec(x_66);
x_72 = lean_unbox_usize(x_63);
x_73 = lean_llvm_build_store(x_1, x_9, x_71, x_72, x_70);
x_74 = lean_ctor_get(x_73, 1);
lean_inc(x_74);
lean_dec(x_73);
x_75 = lean_box_usize(x_1);
lean_inc(x_63);
lean_inc(x_58);
x_76 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___boxed), 7, 3);
lean_closure_set(x_76, 0, x_75);
lean_closure_set(x_76, 1, x_58);
lean_closure_set(x_76, 2, x_63);
x_77 = lean_box_usize(x_1);
x_78 = lean_box_usize(x_8);
x_79 = lean_box_usize(x_5);
x_80 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___boxed), 10, 6);
lean_closure_set(x_80, 0, x_77);
lean_closure_set(x_80, 1, x_58);
lean_closure_set(x_80, 2, x_63);
lean_closure_set(x_80, 3, x_69);
lean_closure_set(x_80, 4, x_78);
lean_closure_set(x_80, 5, x_79);
x_81 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3;
lean_inc(x_11);
lean_inc(x_10);
x_82 = l_Lean_IR_EmitLLVM_buildWhile__(x_1, x_9, x_81, x_76, x_80, x_10, x_11, x_74);
if (lean_obj_tag(x_82) == 0)
{
lean_object* x_83;
x_83 = lean_ctor_get(x_82, 0);
lean_inc(x_83);
if (lean_obj_tag(x_83) == 0)
{
uint8_t x_84;
lean_dec(x_11);
lean_dec(x_10);
x_84 = !lean_is_exclusive(x_82);
if (x_84 == 0)
{
lean_object* x_85; uint8_t x_86;
x_85 = lean_ctor_get(x_82, 0);
lean_dec(x_85);
x_86 = !lean_is_exclusive(x_83);
if (x_86 == 0)
{
return x_82;
}
else
{
lean_object* x_87; lean_object* x_88;
x_87 = lean_ctor_get(x_83, 0);
lean_inc(x_87);
lean_dec(x_83);
x_88 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_88, 0, x_87);
lean_ctor_set(x_82, 0, x_88);
return x_82;
}
}
else
{
lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93;
x_89 = lean_ctor_get(x_82, 1);
lean_inc(x_89);
lean_dec(x_82);
x_90 = lean_ctor_get(x_83, 0);
lean_inc(x_90);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
x_91 = x_83;
} else {
lean_dec_ref(x_83);
x_91 = lean_box(0);
}
if (lean_is_scalar(x_91)) {
x_92 = lean_alloc_ctor(0, 1, 0);
} else {
x_92 = x_91;
}
lean_ctor_set(x_92, 0, x_90);
x_93 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_93, 0, x_92);
lean_ctor_set(x_93, 1, x_89);
return x_93;
}
}
else
{
lean_object* x_94; 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; size_t x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108; size_t x_109; lean_object* x_110; uint8_t x_111;
lean_dec(x_83);
x_94 = lean_ctor_get(x_82, 1);
lean_inc(x_94);
lean_dec(x_82);
x_95 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_9, x_10, x_11, x_94);
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_95, 1);
lean_inc(x_97);
lean_dec(x_95);
x_98 = lean_ctor_get(x_96, 0);
lean_inc(x_98);
lean_dec(x_96);
x_99 = lean_llvm_build_load2(x_1, x_9, x_8, x_5, x_48, x_97);
x_100 = lean_ctor_get(x_99, 0);
lean_inc(x_100);
x_101 = lean_ctor_get(x_99, 1);
lean_inc(x_101);
lean_dec(x_99);
x_102 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_102, 0, x_100);
x_103 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
x_104 = lean_unbox_usize(x_98);
lean_dec(x_98);
x_105 = l_Lean_IR_EmitLLVM_callLeanMainFn(x_1, x_9, x_102, x_104, x_103, x_10, x_11, x_101);
lean_dec(x_11);
lean_dec(x_10);
x_106 = lean_ctor_get(x_105, 0);
lean_inc(x_106);
x_107 = lean_ctor_get(x_105, 1);
lean_inc(x_107);
lean_dec(x_105);
x_108 = lean_ctor_get(x_106, 0);
lean_inc(x_108);
lean_dec(x_106);
x_109 = lean_unbox_usize(x_108);
lean_dec(x_108);
x_110 = lean_llvm_build_store(x_1, x_9, x_109, x_4, x_107);
x_111 = !lean_is_exclusive(x_110);
if (x_111 == 0)
{
lean_object* x_112; lean_object* x_113;
x_112 = lean_ctor_get(x_110, 0);
lean_dec(x_112);
x_113 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
lean_ctor_set(x_110, 0, x_113);
return x_110;
}
else
{
lean_object* x_114; lean_object* x_115; lean_object* x_116;
x_114 = lean_ctor_get(x_110, 1);
lean_inc(x_114);
lean_dec(x_110);
x_115 = l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1;
x_116 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_116, 0, x_115);
lean_ctor_set(x_116, 1, x_114);
return x_116;
}
}
}
else
{
uint8_t x_117;
lean_dec(x_11);
lean_dec(x_10);
x_117 = !lean_is_exclusive(x_82);
if (x_117 == 0)
{
return x_82;
}
else
{
lean_object* x_118; lean_object* x_119; lean_object* x_120;
x_118 = lean_ctor_get(x_82, 0);
x_119 = lean_ctor_get(x_82, 1);
lean_inc(x_119);
lean_inc(x_118);
lean_dec(x_82);
x_120 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_120, 0, x_118);
lean_ctor_set(x_120, 1, x_119);
return x_120;
}
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("UInt32", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2;
x_2 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("io_val", 6);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("retv", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("retv_sext", 9);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4(lean_object* x_1, size_t x_2, size_t x_3, size_t x_4, size_t x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_10 = l_Lean_Expr_constName_x3f(x_1);
x_11 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3;
x_12 = l___private_Init_Data_Option_Basic_0__beqOption____x40_Init_Data_Option_Basic___hyg_1116____at_Lean_IR_IRType_beq___spec__1(x_10, x_11);
lean_dec(x_10);
if (x_12 == 0)
{
lean_object* x_13; lean_object* x_14; uint64_t x_15; uint8_t x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; size_t x_20; lean_object* x_21; uint8_t x_22;
x_13 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_2, x_6, x_3, x_7, x_8, x_9);
x_14 = lean_ctor_get(x_13, 1);
lean_inc(x_14);
lean_dec(x_13);
x_15 = 0;
x_16 = 0;
x_17 = l_LLVM_constInt64(x_2, x_15, x_16, x_14);
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 = lean_unbox_usize(x_18);
lean_dec(x_18);
x_21 = lean_llvm_build_ret(x_2, x_6, x_20, x_19);
x_22 = !lean_is_exclusive(x_21);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24;
x_23 = lean_ctor_get(x_21, 0);
lean_dec(x_23);
x_24 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
lean_ctor_set(x_21, 0, x_24);
return x_21;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_25 = lean_ctor_get(x_21, 1);
lean_inc(x_25);
lean_dec(x_21);
x_26 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
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; size_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; size_t 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; size_t x_48; size_t x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; size_t x_53; lean_object* x_54; lean_object* x_55; size_t x_56; lean_object* x_57; uint8_t x_58;
x_28 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
x_29 = lean_llvm_build_load2(x_2, x_6, x_4, x_5, x_28, x_9);
x_30 = lean_ctor_get(x_29, 0);
lean_inc(x_30);
x_31 = lean_ctor_get(x_29, 1);
lean_inc(x_31);
lean_dec(x_29);
x_32 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4;
x_33 = lean_unbox_usize(x_30);
x_34 = l_Lean_IR_EmitLLVM_callLeanIOResultGetValue(x_2, x_6, x_33, x_32, x_7, x_8, x_31);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
lean_dec(x_35);
x_38 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5;
x_39 = lean_unbox_usize(x_37);
lean_dec(x_37);
x_40 = l_Lean_IR_EmitLLVM_callLeanUnboxUint32(x_2, x_6, x_39, x_38, x_7, x_8, x_36);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_ctor_get(x_41, 0);
lean_inc(x_43);
lean_dec(x_41);
x_44 = l_LLVM_i64Type(x_2, x_42);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6;
x_48 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_49 = lean_unbox_usize(x_45);
lean_dec(x_45);
x_50 = lean_llvm_build_sext(x_2, x_6, x_48, x_49, x_47, x_46);
x_51 = lean_ctor_get(x_50, 0);
lean_inc(x_51);
x_52 = lean_ctor_get(x_50, 1);
lean_inc(x_52);
lean_dec(x_50);
x_53 = lean_unbox_usize(x_30);
lean_dec(x_30);
x_54 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_2, x_6, x_53, x_7, x_8, x_52);
x_55 = lean_ctor_get(x_54, 1);
lean_inc(x_55);
lean_dec(x_54);
x_56 = lean_unbox_usize(x_51);
lean_dec(x_51);
x_57 = lean_llvm_build_ret(x_2, x_6, x_56, x_55);
x_58 = !lean_is_exclusive(x_57);
if (x_58 == 0)
{
lean_object* x_59; lean_object* x_60;
x_59 = lean_ctor_get(x_57, 0);
lean_dec(x_59);
x_60 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
lean_ctor_set(x_57, 0, x_60);
return x_57;
}
else
{
lean_object* x_61; lean_object* x_62; lean_object* x_63;
x_61 = lean_ctor_get(x_57, 1);
lean_inc(x_61);
lean_dec(x_57);
x_62 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__5(size_t x_1, size_t x_2, size_t x_3, uint64_t x_4, size_t 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; size_t x_14; lean_object* x_15; lean_object* x_16; size_t x_17; lean_object* x_18; lean_object* x_19; uint8_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; uint8_t x_26;
x_9 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
x_10 = lean_llvm_build_load2(x_1, x_5, x_2, x_3, x_9, x_8);
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_EmitLLVM_emitJp___closed__3;
x_14 = lean_unbox_usize(x_11);
x_15 = l_Lean_IR_EmitLLVM_callLeanIOResultShowError(x_1, x_5, x_14, x_13, x_6, x_7, x_12);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = lean_unbox_usize(x_11);
lean_dec(x_11);
x_18 = l_Lean_IR_EmitLLVM_callLeanDecRef(x_1, x_5, x_17, x_6, x_7, x_16);
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
x_20 = 0;
x_21 = l_LLVM_constInt64(x_1, x_4, x_20, x_19);
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 = lean_unbox_usize(x_22);
lean_dec(x_22);
x_25 = lean_llvm_build_ret(x_1, x_5, x_24, x_23);
x_26 = !lean_is_exclusive(x_25);
if (x_26 == 0)
{
lean_object* x_27; lean_object* x_28;
x_27 = lean_ctor_get(x_25, 0);
lean_dec(x_27);
x_28 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
lean_ctor_set(x_25, 0, x_28);
return x_25;
}
else
{
lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_29 = lean_ctor_get(x_25, 1);
lean_inc(x_29);
lean_dec(x_25);
x_30 = l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1;
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;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("_init_out", 9);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("res_is_ok", 9);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("resIsOkBranches", 15);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("res.is.ok", 9);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Init.Data.Option.BasicAux", 25);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Option.get!", 11);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("value is none", 13);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_1 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5;
x_2 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6;
x_3 = lean_unsigned_to_nat(16u);
x_4 = lean_unsigned_to_nat(14u);
x_5 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7;
x_6 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_4, x_5);
return x_6;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1() {
_start:
{
uint64_t x_1; lean_object* x_2;
x_1 = 1;
x_2 = lean_box_uint64(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6(size_t x_1, size_t x_2, size_t x_3, size_t x_4, lean_object* x_5, size_t x_6, size_t x_7, size_t 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) {
_start:
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; size_t 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; uint64_t x_29; uint8_t 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; uint8_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; size_t x_42; size_t x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; size_t x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; size_t 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; size_t x_64; 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; size_t x_77; lean_object* x_78;
x_15 = l_LLVM_constFalse(x_1, x_14);
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_unbox_usize(x_16);
lean_dec(x_16);
x_19 = l_Lean_IR_EmitLLVM_callLeanSetPanicMessages(x_1, x_2, x_18, x_12, x_13, x_17);
x_20 = lean_ctor_get(x_19, 1);
lean_inc(x_20);
lean_dec(x_19);
x_21 = l_Lean_IR_EmitLLVM_callLeanIOMkWorld(x_1, x_2, x_12, x_13, x_20);
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 = lean_ctor_get(x_22, 0);
lean_inc(x_24);
lean_dec(x_22);
x_25 = l_Lean_IR_EmitLLVM_getModName___rarg(x_13, x_23);
x_26 = lean_ctor_get(x_25, 0);
lean_inc(x_26);
x_27 = lean_ctor_get(x_25, 1);
lean_inc(x_27);
lean_dec(x_25);
x_28 = lean_ctor_get(x_26, 0);
lean_inc(x_28);
lean_dec(x_26);
x_29 = 1;
x_30 = 0;
x_31 = l_LLVM_constInt8(x_1, x_29, x_30, x_27);
x_32 = lean_ctor_get(x_31, 0);
lean_inc(x_32);
x_33 = lean_ctor_get(x_31, 1);
lean_inc(x_33);
lean_dec(x_31);
x_34 = l_Lean_IR_EmitLLVM_getModName___rarg(x_13, x_33);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = lean_ctor_get(x_35, 0);
lean_inc(x_37);
lean_dec(x_35);
x_38 = 1;
x_39 = l_Lean_Name_toString(x_37, x_38);
x_40 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1;
x_41 = lean_string_append(x_39, x_40);
x_42 = lean_unbox_usize(x_32);
lean_dec(x_32);
x_43 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_44 = l_Lean_IR_EmitLLVM_callModInitFn(x_1, x_2, x_28, x_42, x_43, x_41, x_12, x_13, x_36);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = lean_ctor_get(x_45, 0);
lean_inc(x_47);
lean_dec(x_45);
x_48 = lean_unbox_usize(x_47);
lean_dec(x_47);
x_49 = lean_llvm_build_store(x_1, x_2, x_48, x_3, x_46);
x_50 = lean_ctor_get(x_49, 1);
lean_inc(x_50);
lean_dec(x_49);
x_51 = l_LLVM_constTrue(x_1, x_50);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_55 = l_Lean_IR_EmitLLVM_callLeanSetPanicMessages(x_1, x_2, x_54, x_12, x_13, x_53);
x_56 = lean_ctor_get(x_55, 1);
lean_inc(x_56);
lean_dec(x_55);
x_57 = l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization(x_1, x_2, x_12, x_13, x_56);
x_58 = lean_ctor_get(x_57, 1);
lean_inc(x_58);
lean_dec(x_57);
x_59 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1;
x_60 = lean_llvm_build_load2(x_1, x_2, x_4, x_3, x_59, x_58);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2;
x_64 = lean_unbox_usize(x_61);
x_65 = l_Lean_IR_EmitLLVM_callLeanIOResultIsOk(x_1, x_2, x_64, x_63, x_12, x_13, x_62);
x_66 = lean_ctor_get(x_65, 0);
lean_inc(x_66);
x_67 = lean_ctor_get(x_65, 1);
lean_inc(x_67);
lean_dec(x_65);
x_68 = lean_ctor_get(x_66, 0);
lean_inc(x_68);
lean_dec(x_66);
x_69 = lean_box_usize(x_1);
x_70 = lean_box_usize(x_3);
x_71 = lean_box_usize(x_6);
x_72 = lean_box_usize(x_7);
x_73 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1;
x_74 = lean_box_usize(x_8);
x_75 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___boxed), 12, 8);
lean_closure_set(x_75, 0, x_69);
lean_closure_set(x_75, 1, x_61);
lean_closure_set(x_75, 2, x_5);
lean_closure_set(x_75, 3, x_70);
lean_closure_set(x_75, 4, x_71);
lean_closure_set(x_75, 5, x_72);
lean_closure_set(x_75, 6, x_73);
lean_closure_set(x_75, 7, x_74);
x_76 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3;
x_77 = lean_unbox_usize(x_68);
lean_dec(x_68);
lean_inc(x_13);
lean_inc(x_12);
x_78 = l_Lean_IR_EmitLLVM_buildIfThen__(x_1, x_2, x_76, x_77, x_75, x_12, x_13, x_67);
if (lean_obj_tag(x_78) == 0)
{
lean_object* x_79;
x_79 = lean_ctor_get(x_78, 0);
lean_inc(x_79);
if (lean_obj_tag(x_79) == 0)
{
uint8_t x_80;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
x_80 = !lean_is_exclusive(x_78);
if (x_80 == 0)
{
lean_object* x_81; uint8_t x_82;
x_81 = lean_ctor_get(x_78, 0);
lean_dec(x_81);
x_82 = !lean_is_exclusive(x_79);
if (x_82 == 0)
{
return x_78;
}
else
{
lean_object* x_83; lean_object* x_84;
x_83 = lean_ctor_get(x_79, 0);
lean_inc(x_83);
lean_dec(x_79);
x_84 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_84, 0, x_83);
lean_ctor_set(x_78, 0, x_84);
return x_78;
}
}
else
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89;
x_85 = lean_ctor_get(x_78, 1);
lean_inc(x_85);
lean_dec(x_78);
x_86 = lean_ctor_get(x_79, 0);
lean_inc(x_86);
if (lean_is_exclusive(x_79)) {
lean_ctor_release(x_79, 0);
x_87 = x_79;
} else {
lean_dec_ref(x_79);
x_87 = lean_box(0);
}
if (lean_is_scalar(x_87)) {
x_88 = lean_alloc_ctor(0, 1, 0);
} else {
x_88 = x_87;
}
lean_ctor_set(x_88, 0, x_86);
x_89 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_89, 0, x_88);
lean_ctor_set(x_89, 1, x_85);
return x_89;
}
}
else
{
lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93;
lean_dec(x_79);
x_90 = lean_ctor_get(x_78, 1);
lean_inc(x_90);
lean_dec(x_78);
x_91 = lean_environment_find(x_9, x_10);
x_92 = l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager(x_1, x_2, x_12, x_13, x_90);
if (lean_obj_tag(x_91) == 0)
{
lean_object* x_142; lean_object* x_143;
x_142 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8;
x_143 = l_panic___at_Lean_IR_EmitLLVM_emitMainFn___spec__1(x_142);
x_93 = x_143;
goto block_141;
}
else
{
lean_object* x_144;
x_144 = lean_ctor_get(x_91, 0);
lean_inc(x_144);
lean_dec(x_91);
x_93 = x_144;
goto block_141;
}
block_141:
{
lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; size_t 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; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; size_t x_116; lean_object* x_117;
x_94 = lean_ctor_get(x_92, 1);
lean_inc(x_94);
lean_dec(x_92);
x_95 = l_Lean_ConstantInfo_type(x_93);
lean_dec(x_93);
x_96 = l_Lean_Expr_getForallBody(x_95);
lean_dec(x_95);
x_97 = l_Lean_Expr_appArg_x21(x_96);
lean_dec(x_96);
x_98 = lean_llvm_build_load2(x_1, x_2, x_4, x_3, x_59, x_94);
x_99 = lean_ctor_get(x_98, 0);
lean_inc(x_99);
x_100 = lean_ctor_get(x_98, 1);
lean_inc(x_100);
lean_dec(x_98);
x_101 = lean_unbox_usize(x_99);
x_102 = l_Lean_IR_EmitLLVM_callLeanIOResultIsOk(x_1, x_2, x_101, x_63, x_12, x_13, x_100);
x_103 = lean_ctor_get(x_102, 0);
lean_inc(x_103);
x_104 = lean_ctor_get(x_102, 1);
lean_inc(x_104);
lean_dec(x_102);
x_105 = lean_ctor_get(x_103, 0);
lean_inc(x_105);
lean_dec(x_103);
x_106 = lean_box_usize(x_1);
x_107 = lean_box_usize(x_4);
x_108 = lean_box_usize(x_3);
x_109 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___boxed), 9, 5);
lean_closure_set(x_109, 0, x_97);
lean_closure_set(x_109, 1, x_106);
lean_closure_set(x_109, 2, x_99);
lean_closure_set(x_109, 3, x_107);
lean_closure_set(x_109, 4, x_108);
x_110 = lean_box_usize(x_1);
x_111 = lean_box_usize(x_4);
x_112 = lean_box_usize(x_3);
x_113 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1;
x_114 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_emitMainFn___lambda__5___boxed), 8, 4);
lean_closure_set(x_114, 0, x_110);
lean_closure_set(x_114, 1, x_111);
lean_closure_set(x_114, 2, x_112);
lean_closure_set(x_114, 3, x_113);
x_115 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4;
x_116 = lean_unbox_usize(x_105);
lean_dec(x_105);
x_117 = l_Lean_IR_EmitLLVM_buildIfThenElse__(x_1, x_2, x_115, x_116, x_109, x_114, x_12, x_13, x_104);
if (lean_obj_tag(x_117) == 0)
{
lean_object* x_118;
x_118 = lean_ctor_get(x_117, 0);
lean_inc(x_118);
if (lean_obj_tag(x_118) == 0)
{
uint8_t x_119;
x_119 = !lean_is_exclusive(x_117);
if (x_119 == 0)
{
lean_object* x_120; uint8_t x_121;
x_120 = lean_ctor_get(x_117, 0);
lean_dec(x_120);
x_121 = !lean_is_exclusive(x_118);
if (x_121 == 0)
{
return x_117;
}
else
{
lean_object* x_122; lean_object* x_123;
x_122 = lean_ctor_get(x_118, 0);
lean_inc(x_122);
lean_dec(x_118);
x_123 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_123, 0, x_122);
lean_ctor_set(x_117, 0, x_123);
return x_117;
}
}
else
{
lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128;
x_124 = lean_ctor_get(x_117, 1);
lean_inc(x_124);
lean_dec(x_117);
x_125 = lean_ctor_get(x_118, 0);
lean_inc(x_125);
if (lean_is_exclusive(x_118)) {
lean_ctor_release(x_118, 0);
x_126 = x_118;
} else {
lean_dec_ref(x_118);
x_126 = lean_box(0);
}
if (lean_is_scalar(x_126)) {
x_127 = lean_alloc_ctor(0, 1, 0);
} else {
x_127 = x_126;
}
lean_ctor_set(x_127, 0, x_125);
x_128 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_128, 0, x_127);
lean_ctor_set(x_128, 1, x_124);
return x_128;
}
}
else
{
lean_object* x_129; lean_object* x_130; uint8_t x_131;
lean_dec(x_118);
x_129 = lean_ctor_get(x_117, 1);
lean_inc(x_129);
lean_dec(x_117);
x_130 = lean_llvm_build_unreachable(x_1, x_2, x_129);
x_131 = !lean_is_exclusive(x_130);
if (x_131 == 0)
{
lean_object* x_132; lean_object* x_133;
x_132 = lean_ctor_get(x_130, 0);
lean_dec(x_132);
x_133 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_130, 0, x_133);
return x_130;
}
else
{
lean_object* x_134; lean_object* x_135; lean_object* x_136;
x_134 = lean_ctor_get(x_130, 1);
lean_inc(x_134);
lean_dec(x_130);
x_135 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
x_136 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_136, 0, x_135);
lean_ctor_set(x_136, 1, x_134);
return x_136;
}
}
}
else
{
uint8_t x_137;
x_137 = !lean_is_exclusive(x_117);
if (x_137 == 0)
{
return x_117;
}
else
{
lean_object* x_138; lean_object* x_139; lean_object* x_140;
x_138 = lean_ctor_get(x_117, 0);
x_139 = lean_ctor_get(x_117, 1);
lean_inc(x_139);
lean_inc(x_138);
lean_dec(x_117);
x_140 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_140, 0, x_138);
lean_ctor_set(x_140, 1, x_139);
return x_140;
}
}
}
}
}
else
{
uint8_t x_145;
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
x_145 = !lean_is_exclusive(x_78);
if (x_145 == 0)
{
return x_78;
}
else
{
lean_object* x_146; lean_object* x_147; lean_object* x_148;
x_146 = lean_ctor_get(x_78, 0);
x_147 = lean_ctor_get(x_78, 1);
lean_inc(x_147);
lean_inc(x_146);
lean_dec(x_78);
x_148 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_148, 0, x_146);
lean_ctor_set(x_148, 1, x_147);
return x_148;
}
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1;
x_3 = l_Lean_Name_str___override(x_1, x_2);
return x_3;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("in", 2);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("res", 3);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7(size_t x_1, size_t x_2, size_t 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) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t 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; size_t 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; uint8_t x_32; size_t x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; size_t x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47; size_t x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; size_t 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; size_t x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; size_t x_71; lean_object* x_72;
lean_dec(x_6);
x_10 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_8, x_9);
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, 0);
lean_inc(x_13);
lean_dec(x_11);
x_14 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2;
lean_inc(x_13);
x_15 = l_Lean_IR_usesModuleFrom(x_13, x_14);
x_16 = l_LLVM_i64Type(x_1, x_12);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = l_LLVM_i64Type(x_1, x_18);
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
x_21 = lean_ctor_get(x_19, 1);
lean_inc(x_21);
lean_dec(x_19);
x_22 = l_LLVM_voidPtrType(x_1, x_21);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_unbox_usize(x_23);
lean_dec(x_23);
x_26 = lean_llvm_pointer_type(x_1, x_25, x_24);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2;
x_30 = lean_array_push(x_29, x_20);
x_31 = lean_array_push(x_30, x_27);
x_32 = 0;
x_33 = lean_unbox_usize(x_17);
lean_dec(x_17);
x_34 = lean_llvm_function_type(x_1, x_33, x_31, x_32, x_28);
lean_dec(x_31);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__2;
x_38 = lean_unbox_usize(x_35);
lean_dec(x_35);
x_39 = l_LLVM_getOrAddFunction(x_1, x_2, x_37, x_38, x_36);
x_40 = lean_ctor_get(x_39, 0);
lean_inc(x_40);
x_41 = lean_ctor_get(x_39, 1);
lean_inc(x_41);
lean_dec(x_39);
x_42 = l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1;
x_43 = lean_unbox_usize(x_40);
x_44 = lean_llvm_append_basic_block_in_context(x_1, x_43, x_42, x_41);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = lean_box_usize(x_1);
x_48 = lean_unbox_usize(x_45);
lean_dec(x_45);
x_49 = lean_llvm_position_builder_at_end(x_47, x_3, x_48, x_46);
x_50 = lean_ctor_get(x_49, 1);
lean_inc(x_50);
lean_dec(x_49);
x_51 = l_LLVM_voidPtrType(x_1, x_50);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
x_54 = lean_unbox_usize(x_52);
x_55 = lean_llvm_pointer_type(x_1, x_54, x_53);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3;
x_59 = lean_unbox_usize(x_56);
lean_dec(x_56);
x_60 = lean_llvm_build_alloca(x_1, x_3, x_59, x_58, x_57);
x_61 = lean_ctor_get(x_60, 0);
lean_inc(x_61);
x_62 = lean_ctor_get(x_60, 1);
lean_inc(x_62);
lean_dec(x_60);
x_63 = l_LLVM_voidPtrType(x_1, x_62);
x_64 = lean_ctor_get(x_63, 0);
lean_inc(x_64);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_unbox_usize(x_64);
x_67 = lean_llvm_pointer_type(x_1, x_66, x_65);
x_68 = lean_ctor_get(x_67, 0);
lean_inc(x_68);
x_69 = lean_ctor_get(x_67, 1);
lean_inc(x_69);
lean_dec(x_67);
x_70 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4;
x_71 = lean_unbox_usize(x_68);
lean_dec(x_68);
x_72 = lean_llvm_build_alloca(x_1, x_3, x_71, x_70, x_69);
if (x_15 == 0)
{
lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; size_t x_79; size_t x_80; size_t x_81; size_t x_82; size_t x_83; lean_object* x_84;
x_73 = lean_ctor_get(x_72, 0);
lean_inc(x_73);
x_74 = lean_ctor_get(x_72, 1);
lean_inc(x_74);
lean_dec(x_72);
x_75 = l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule(x_1, x_3, x_7, x_8, x_74);
x_76 = lean_ctor_get(x_75, 0);
lean_inc(x_76);
x_77 = lean_ctor_get(x_75, 1);
lean_inc(x_77);
lean_dec(x_75);
x_78 = lean_ctor_get(x_76, 0);
lean_inc(x_78);
lean_dec(x_76);
x_79 = lean_unbox_usize(x_73);
lean_dec(x_73);
x_80 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_81 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_82 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_83 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_84 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6(x_1, x_3, x_79, x_80, x_4, x_81, x_82, x_83, x_13, x_5, x_78, x_7, x_8, x_77);
lean_dec(x_78);
return x_84;
}
else
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; size_t x_91; size_t x_92; size_t x_93; size_t x_94; size_t x_95; lean_object* x_96;
x_85 = lean_ctor_get(x_72, 0);
lean_inc(x_85);
x_86 = lean_ctor_get(x_72, 1);
lean_inc(x_86);
lean_dec(x_72);
x_87 = l_Lean_IR_EmitLLVM_callLeanInitialize(x_1, x_3, x_7, x_8, x_86);
x_88 = lean_ctor_get(x_87, 0);
lean_inc(x_88);
x_89 = lean_ctor_get(x_87, 1);
lean_inc(x_89);
lean_dec(x_87);
x_90 = lean_ctor_get(x_88, 0);
lean_inc(x_90);
lean_dec(x_88);
x_91 = lean_unbox_usize(x_85);
lean_dec(x_85);
x_92 = lean_unbox_usize(x_64);
lean_dec(x_64);
x_93 = lean_unbox_usize(x_61);
lean_dec(x_61);
x_94 = lean_unbox_usize(x_40);
lean_dec(x_40);
x_95 = lean_unbox_usize(x_52);
lean_dec(x_52);
x_96 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6(x_1, x_3, x_91, x_92, x_4, x_93, x_94, x_95, x_13, x_5, x_90, x_7, x_8, x_89);
lean_dec(x_90);
return x_96;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Invalid main function, main expected to have '2' or '1' arguments, found '", 74);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("' arguments", 11);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8(size_t x_1, size_t x_2, size_t 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; uint8_t x_11;
x_9 = lean_array_get_size(x_5);
x_10 = lean_unsigned_to_nat(2u);
x_11 = lean_nat_dec_eq(x_9, x_10);
if (x_11 == 0)
{
lean_object* x_12; uint8_t x_13;
x_12 = lean_unsigned_to_nat(1u);
x_13 = lean_nat_dec_eq(x_9, 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;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
x_14 = l_Nat_repr(x_9);
x_15 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1;
x_16 = lean_string_append(x_15, x_14);
lean_dec(x_14);
x_17 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_19, 0, x_18);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_8);
return x_20;
}
else
{
lean_object* x_21; lean_object* x_22;
lean_dec(x_9);
x_21 = lean_box(0);
x_22 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7(x_1, x_2, x_3, x_5, x_4, x_21, x_6, x_7, x_8);
return x_22;
}
}
else
{
lean_object* x_23; lean_object* x_24;
lean_dec(x_9);
x_23 = lean_box(0);
x_24 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7(x_1, x_2, x_3, x_5, x_4, x_23, x_6, x_7, x_8);
return x_24;
}
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Function declaration expected for 'main'", 40);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_EmitLLVM_emitMainFn___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_IR_EmitLLVM_emitMainFn___closed__1;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
x_8 = l_Lean_IR_EmitLLVM_getDecl___rarg(x_7, x_4, x_5, x_6);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
lean_dec(x_5);
lean_dec(x_4);
x_10 = !lean_is_exclusive(x_8);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12;
x_11 = lean_ctor_get(x_8, 0);
lean_dec(x_11);
x_12 = !lean_is_exclusive(x_9);
if (x_12 == 0)
{
return x_8;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_8, 0, x_14);
return x_8;
}
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19;
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_dec(x_8);
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
if (lean_is_exclusive(x_9)) {
lean_ctor_release(x_9, 0);
x_17 = x_9;
} else {
lean_dec_ref(x_9);
x_17 = lean_box(0);
}
if (lean_is_scalar(x_17)) {
x_18 = lean_alloc_ctor(0, 1, 0);
} else {
x_18 = x_17;
}
lean_ctor_set(x_18, 0, x_16);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
else
{
lean_object* x_20;
x_20 = lean_ctor_get(x_9, 0);
lean_inc(x_20);
lean_dec(x_9);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_21 = lean_ctor_get(x_8, 1);
lean_inc(x_21);
lean_dec(x_8);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__8(x_1, x_2, x_3, x_7, x_22, x_4, x_5, x_21);
return x_23;
}
else
{
uint8_t x_24;
lean_dec(x_20);
lean_dec(x_5);
lean_dec(x_4);
x_24 = !lean_is_exclusive(x_8);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_8, 0);
lean_dec(x_25);
x_26 = l_Lean_IR_EmitLLVM_emitMainFn___closed__2;
lean_ctor_set(x_8, 0, x_26);
return x_8;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_8, 1);
lean_inc(x_27);
lean_dec(x_8);
x_28 = l_Lean_IR_EmitLLVM_emitMainFn___closed__2;
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;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__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:
{
size_t x_8; size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_11 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_12 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__1(x_8, x_9, x_10, x_11, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
size_t x_11; size_t x_12; size_t x_13; size_t x_14; size_t x_15; size_t x_16; size_t x_17; lean_object* x_18;
x_11 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_12 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_13 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_14 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_15 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_16 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_17 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_18 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__2(x_11, x_12, x_13, x_14, x_15, x_16, x_17, x_8, x_9, x_10);
lean_dec(x_9);
lean_dec(x_8);
return x_18;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__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, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; size_t x_15; size_t x_16; size_t x_17; uint64_t x_18; size_t x_19; size_t x_20; lean_object* x_21;
x_13 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_14 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_15 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_16 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_17 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_18 = lean_unbox_uint64(x_7);
lean_dec(x_7);
x_19 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_20 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_21 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__3(x_13, x_14, x_3, x_15, x_16, x_17, x_18, x_19, x_20, x_10, x_11, x_12);
lean_dec(x_3);
return x_21;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; size_t x_13; size_t x_14; lean_object* x_15;
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_15 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__4(x_1, x_10, x_11, x_12, x_13, x_14, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_1);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__5___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:
{
size_t x_9; size_t x_10; size_t x_11; uint64_t x_12; size_t x_13; lean_object* x_14;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = lean_unbox_uint64(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__5(x_9, x_10, x_11, x_12, x_13, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___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, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13, lean_object* x_14) {
_start:
{
size_t x_15; size_t x_16; size_t x_17; size_t x_18; size_t x_19; size_t x_20; size_t x_21; lean_object* x_22;
x_15 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_16 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_17 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_18 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_19 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_20 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_21 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_22 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__6(x_15, x_16, x_17, x_18, x_5, x_19, x_20, x_21, x_9, x_10, x_11, x_12, x_13, x_14);
lean_dec(x_11);
return x_22;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___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, lean_object* x_9) {
_start:
{
size_t x_10; size_t x_11; size_t x_12; lean_object* x_13;
x_10 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_11 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_12 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_13 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__7(x_10, x_11, x_12, x_4, x_5, x_6, x_7, x_8, x_9);
return x_13;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___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:
{
size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_9 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_10 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_11 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_12 = l_Lean_IR_EmitLLVM_emitMainFn___lambda__8(x_9, x_10, x_11, x_4, x_5, x_6, x_7, x_8);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFn___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitMainFn(x_7, x_8, x_9, x_4, x_5, x_6);
return x_10;
}
}
LEAN_EXPORT uint8_t l_List_foldr___at_Lean_IR_EmitLLVM_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___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(x_1, x_4);
x_6 = l_Lean_IR_Decl_name(x_3);
x_7 = l_Lean_IR_EmitLLVM_toCName___rarg___closed__3;
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_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___rarg(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = l_Lean_IR_EmitLLVM_getEnv___rarg(x_1, x_2);
x_4 = !lean_is_exclusive(x_3);
if (x_4 == 0)
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_ctor_get(x_3, 0);
x_6 = !lean_is_exclusive(x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; uint8_t x_9; uint8_t x_10; lean_object* x_11;
x_7 = lean_ctor_get(x_5, 0);
x_8 = l_Lean_IR_getDecls(x_7);
lean_dec(x_7);
x_9 = 0;
x_10 = l_List_foldr___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(x_9, x_8);
lean_dec(x_8);
x_11 = lean_box(x_10);
lean_ctor_set(x_5, 0, x_11);
return x_3;
}
else
{
lean_object* x_12; lean_object* x_13; uint8_t x_14; uint8_t x_15; lean_object* x_16; lean_object* x_17;
x_12 = lean_ctor_get(x_5, 0);
lean_inc(x_12);
lean_dec(x_5);
x_13 = l_Lean_IR_getDecls(x_12);
lean_dec(x_12);
x_14 = 0;
x_15 = l_List_foldr___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(x_14, x_13);
lean_dec(x_13);
x_16 = lean_box(x_15);
x_17 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_3, 0, x_17);
return x_3;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23; uint8_t x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_18 = lean_ctor_get(x_3, 0);
x_19 = lean_ctor_get(x_3, 1);
lean_inc(x_19);
lean_inc(x_18);
lean_dec(x_3);
x_20 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
if (lean_is_exclusive(x_18)) {
lean_ctor_release(x_18, 0);
x_21 = x_18;
} else {
lean_dec_ref(x_18);
x_21 = lean_box(0);
}
x_22 = l_Lean_IR_getDecls(x_20);
lean_dec(x_20);
x_23 = 0;
x_24 = l_List_foldr___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(x_23, x_22);
lean_dec(x_22);
x_25 = lean_box(x_24);
if (lean_is_scalar(x_21)) {
x_26 = lean_alloc_ctor(1, 1, 0);
} else {
x_26 = x_21;
}
lean_ctor_set(x_26, 0, x_25);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_19);
return x_27;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn(size_t x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_IR_EmitLLVM_hasMainFn___rarg___boxed), 2, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_List_foldr___at_Lean_IR_EmitLLVM_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___at_Lean_IR_EmitLLVM_hasMainFn___spec__1(x_3, x_2);
lean_dec(x_2);
x_5 = lean_box(x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___rarg___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_IR_EmitLLVM_hasMainFn___rarg(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_hasMainFn___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
size_t x_3; lean_object* x_4;
x_3 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_4 = l_Lean_IR_EmitLLVM_hasMainFn(x_3, x_2);
lean_dec(x_2);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFnIfNeeded(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_7 = l_Lean_IR_EmitLLVM_hasMainFn___rarg(x_5, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
lean_dec(x_8);
x_10 = lean_unbox(x_9);
lean_dec(x_9);
if (x_10 == 0)
{
uint8_t x_11;
lean_dec(x_5);
lean_dec(x_4);
x_11 = !lean_is_exclusive(x_7);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13;
x_12 = lean_ctor_get(x_7, 0);
lean_dec(x_12);
x_13 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
lean_ctor_set(x_7, 0, x_13);
return x_7;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_7, 1);
lean_inc(x_14);
lean_dec(x_7);
x_15 = l_Lean_IR_EmitLLVM_addVartoState___closed__1;
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;
}
}
else
{
lean_object* x_17; lean_object* x_18;
x_17 = lean_ctor_get(x_7, 1);
lean_inc(x_17);
lean_dec(x_7);
x_18 = l_Lean_IR_EmitLLVM_emitMainFn(x_1, x_2, x_3, x_4, x_5, x_17);
return x_18;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_emitMainFnIfNeeded___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_9 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_10 = l_Lean_IR_EmitLLVM_emitMainFnIfNeeded(x_7, x_8, x_9, x_4, x_5, x_6);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_main(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5;
lean_inc(x_3);
lean_inc(x_2);
x_5 = l_Lean_IR_EmitLLVM_emitFnDecls(x_1, x_2, x_3, x_4);
if (lean_obj_tag(x_5) == 0)
{
lean_object* x_6;
x_6 = lean_ctor_get(x_5, 0);
lean_inc(x_6);
if (lean_obj_tag(x_6) == 0)
{
uint8_t x_7;
lean_dec(x_3);
lean_dec(x_2);
x_7 = !lean_is_exclusive(x_5);
if (x_7 == 0)
{
lean_object* x_8; uint8_t x_9;
x_8 = lean_ctor_get(x_5, 0);
lean_dec(x_8);
x_9 = !lean_is_exclusive(x_6);
if (x_9 == 0)
{
return x_5;
}
else
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_6, 0);
lean_inc(x_10);
lean_dec(x_6);
x_11 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_11, 0, 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;
x_12 = lean_ctor_get(x_5, 1);
lean_inc(x_12);
lean_dec(x_5);
x_13 = lean_ctor_get(x_6, 0);
lean_inc(x_13);
if (lean_is_exclusive(x_6)) {
lean_ctor_release(x_6, 0);
x_14 = x_6;
} else {
lean_dec_ref(x_6);
x_14 = lean_box(0);
}
if (lean_is_scalar(x_14)) {
x_15 = lean_alloc_ctor(0, 1, 0);
} else {
x_15 = x_14;
}
lean_ctor_set(x_15, 0, x_13);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_12);
return x_16;
}
}
else
{
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; size_t x_25; size_t x_26; lean_object* x_27;
lean_dec(x_6);
x_17 = lean_ctor_get(x_5, 1);
lean_inc(x_17);
lean_dec(x_5);
x_18 = lean_llvm_create_builder_in_context(x_1, x_17);
x_19 = lean_ctor_get(x_18, 0);
lean_inc(x_19);
x_20 = lean_ctor_get(x_18, 1);
lean_inc(x_20);
lean_dec(x_18);
x_21 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_3, x_20);
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 = lean_ctor_get(x_22, 0);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_unbox_usize(x_24);
lean_dec(x_24);
x_26 = lean_unbox_usize(x_19);
lean_inc(x_3);
lean_inc(x_2);
x_27 = l_Lean_IR_EmitLLVM_emitFns(x_1, x_25, x_26, x_2, x_3, x_23);
if (lean_obj_tag(x_27) == 0)
{
lean_object* x_28;
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
if (lean_obj_tag(x_28) == 0)
{
uint8_t x_29;
lean_dec(x_19);
lean_dec(x_3);
lean_dec(x_2);
x_29 = !lean_is_exclusive(x_27);
if (x_29 == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = lean_ctor_get(x_27, 0);
lean_dec(x_30);
x_31 = !lean_is_exclusive(x_28);
if (x_31 == 0)
{
return x_27;
}
else
{
lean_object* x_32; lean_object* x_33;
x_32 = lean_ctor_get(x_28, 0);
lean_inc(x_32);
lean_dec(x_28);
x_33 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_33, 0, x_32);
lean_ctor_set(x_27, 0, x_33);
return x_27;
}
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38;
x_34 = lean_ctor_get(x_27, 1);
lean_inc(x_34);
lean_dec(x_27);
x_35 = lean_ctor_get(x_28, 0);
lean_inc(x_35);
if (lean_is_exclusive(x_28)) {
lean_ctor_release(x_28, 0);
x_36 = x_28;
} else {
lean_dec_ref(x_28);
x_36 = lean_box(0);
}
if (lean_is_scalar(x_36)) {
x_37 = lean_alloc_ctor(0, 1, 0);
} else {
x_37 = x_36;
}
lean_ctor_set(x_37, 0, x_35);
x_38 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_38, 0, x_37);
lean_ctor_set(x_38, 1, x_34);
return x_38;
}
}
else
{
lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; size_t x_44; size_t x_45; lean_object* x_46;
lean_dec(x_28);
x_39 = lean_ctor_get(x_27, 1);
lean_inc(x_39);
lean_dec(x_27);
x_40 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_3, x_39);
x_41 = lean_ctor_get(x_40, 0);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 1);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_ctor_get(x_41, 0);
lean_inc(x_43);
lean_dec(x_41);
x_44 = lean_unbox_usize(x_43);
lean_dec(x_43);
x_45 = lean_unbox_usize(x_19);
lean_inc(x_3);
lean_inc(x_2);
x_46 = l_Lean_IR_EmitLLVM_emitInitFn(x_1, x_44, x_45, x_2, x_3, x_42);
if (lean_obj_tag(x_46) == 0)
{
lean_object* x_47;
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
uint8_t x_48;
lean_dec(x_19);
lean_dec(x_3);
lean_dec(x_2);
x_48 = !lean_is_exclusive(x_46);
if (x_48 == 0)
{
lean_object* x_49; uint8_t x_50;
x_49 = lean_ctor_get(x_46, 0);
lean_dec(x_49);
x_50 = !lean_is_exclusive(x_47);
if (x_50 == 0)
{
return x_46;
}
else
{
lean_object* x_51; lean_object* x_52;
x_51 = lean_ctor_get(x_47, 0);
lean_inc(x_51);
lean_dec(x_47);
x_52 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_52, 0, x_51);
lean_ctor_set(x_46, 0, x_52);
return x_46;
}
}
else
{
lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57;
x_53 = lean_ctor_get(x_46, 1);
lean_inc(x_53);
lean_dec(x_46);
x_54 = lean_ctor_get(x_47, 0);
lean_inc(x_54);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
x_55 = x_47;
} else {
lean_dec_ref(x_47);
x_55 = lean_box(0);
}
if (lean_is_scalar(x_55)) {
x_56 = lean_alloc_ctor(0, 1, 0);
} else {
x_56 = x_55;
}
lean_ctor_set(x_56, 0, x_54);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_53);
return x_57;
}
}
else
{
lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; size_t x_63; size_t x_64; lean_object* x_65;
lean_dec(x_47);
x_58 = lean_ctor_get(x_46, 1);
lean_inc(x_58);
lean_dec(x_46);
x_59 = l_Lean_IR_EmitLLVM_getLLVMModule___rarg(x_3, x_58);
x_60 = lean_ctor_get(x_59, 0);
lean_inc(x_60);
x_61 = lean_ctor_get(x_59, 1);
lean_inc(x_61);
lean_dec(x_59);
x_62 = lean_ctor_get(x_60, 0);
lean_inc(x_62);
lean_dec(x_60);
x_63 = lean_unbox_usize(x_62);
lean_dec(x_62);
x_64 = lean_unbox_usize(x_19);
lean_dec(x_19);
x_65 = l_Lean_IR_EmitLLVM_emitMainFnIfNeeded(x_1, x_63, x_64, x_2, x_3, x_61);
return x_65;
}
}
else
{
uint8_t x_66;
lean_dec(x_19);
lean_dec(x_3);
lean_dec(x_2);
x_66 = !lean_is_exclusive(x_46);
if (x_66 == 0)
{
return x_46;
}
else
{
lean_object* x_67; lean_object* x_68; lean_object* x_69;
x_67 = lean_ctor_get(x_46, 0);
x_68 = lean_ctor_get(x_46, 1);
lean_inc(x_68);
lean_inc(x_67);
lean_dec(x_46);
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_19);
lean_dec(x_3);
lean_dec(x_2);
x_70 = !lean_is_exclusive(x_27);
if (x_70 == 0)
{
return x_27;
}
else
{
lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_71 = lean_ctor_get(x_27, 0);
x_72 = lean_ctor_get(x_27, 1);
lean_inc(x_72);
lean_inc(x_71);
lean_dec(x_27);
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_3);
lean_dec(x_2);
x_74 = !lean_is_exclusive(x_5);
if (x_74 == 0)
{
return x_5;
}
else
{
lean_object* x_75; lean_object* x_76; lean_object* x_77;
x_75 = lean_ctor_get(x_5, 0);
x_76 = lean_ctor_get(x_5, 1);
lean_inc(x_76);
lean_inc(x_75);
lean_dec(x_5);
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;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_EmitLLVM_main___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; lean_object* x_6;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = l_Lean_IR_EmitLLVM_main(x_5, x_2, x_3, x_4);
return x_6;
}
}
static lean_object* _init_l_Lean_IR_getLeanHBcPath___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("lean.h.bc", 9);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getLeanHBcPath(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_get_prefix(x_1);
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = lean_ctor_get(x_2, 1);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_get_libdir(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;
x_7 = lean_ctor_get(x_5, 0);
x_8 = l_Lean_IR_getLeanHBcPath___closed__1;
x_9 = l_System_FilePath_join(x_7, x_8);
lean_ctor_set(x_5, 0, x_9);
return x_5;
}
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_5, 0);
x_11 = lean_ctor_get(x_5, 1);
lean_inc(x_11);
lean_inc(x_10);
lean_dec(x_5);
x_12 = l_Lean_IR_getLeanHBcPath___closed__1;
x_13 = l_System_FilePath_join(x_10, x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_11);
return x_14;
}
}
else
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_5);
if (x_15 == 0)
{
return x_5;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_5, 0);
x_17 = lean_ctor_get(x_5, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_5);
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;
}
}
}
else
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_2);
if (x_19 == 0)
{
return x_2;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_2, 0);
x_21 = lean_ctor_get(x_2, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_2);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_optimizeLLVMModule(size_t x_1, size_t 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; size_t x_11; lean_object* x_12; lean_object* x_13; size_t x_14; size_t x_15; lean_object* x_16; lean_object* x_17; size_t x_18; lean_object* x_19; lean_object* x_20; size_t x_21; lean_object* x_22; lean_object* x_23; size_t x_24; lean_object* x_25; uint8_t x_26;
x_4 = lean_llvm_create_pass_manager(x_1, 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);
lean_dec(x_4);
x_7 = lean_llvm_create_pass_manager_builder(x_1, x_6);
x_8 = lean_ctor_get(x_7, 0);
lean_inc(x_8);
x_9 = lean_ctor_get(x_7, 1);
lean_inc(x_9);
lean_dec(x_7);
x_10 = lean_unsigned_to_nat(3u);
x_11 = lean_unbox_usize(x_8);
x_12 = lean_llvm_pass_manager_builder_set_opt_level(x_1, x_11, x_10, x_9);
x_13 = lean_ctor_get(x_12, 1);
lean_inc(x_13);
lean_dec(x_12);
x_14 = lean_unbox_usize(x_8);
x_15 = lean_unbox_usize(x_5);
x_16 = lean_llvm_pass_manager_builder_populate_module_pass_manager(x_1, x_14, x_15, x_13);
x_17 = lean_ctor_get(x_16, 1);
lean_inc(x_17);
lean_dec(x_16);
x_18 = lean_unbox_usize(x_5);
x_19 = lean_llvm_run_pass_manager(x_1, x_18, x_2, x_17);
x_20 = lean_ctor_get(x_19, 1);
lean_inc(x_20);
lean_dec(x_19);
x_21 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_22 = lean_llvm_dispose_pass_manager(x_1, x_21, x_20);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_25 = lean_llvm_dispose_pass_manager_builder(x_1, x_24, x_23);
x_26 = !lean_is_exclusive(x_25);
if (x_26 == 0)
{
return x_25;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_25, 0);
x_28 = lean_ctor_get(x_25, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_25);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_optimizeLLVMModule___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; size_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_optimizeLLVMModule(x_4, x_5, x_3);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals_go(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_LLVM_Value_isNull___rarg(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; size_t x_11;
x_6 = lean_llvm_get_next_global(x_1, x_2, x_4);
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 = lean_box_usize(x_2);
x_10 = lean_array_push(x_3, x_9);
x_11 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_2 = x_11;
x_3 = x_10;
x_4 = x_8;
goto _start;
}
else
{
lean_object* x_13;
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_3);
lean_ctor_set(x_13, 1, x_4);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals_go___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_7 = l_Lean_IR_getModuleGlobals_go(x_5, x_6, x_3, x_4);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals(size_t x_1, size_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; size_t x_8; lean_object* x_9;
x_4 = lean_llvm_get_first_global(x_1, 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);
lean_dec(x_4);
x_7 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_8 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_9 = l_Lean_IR_getModuleGlobals_go(x_1, x_8, x_7, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleGlobals___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; size_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_getModuleGlobals(x_4, x_5, x_3);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions_go(size_t x_1, size_t x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = l_LLVM_Value_isNull___rarg(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; size_t x_11;
x_6 = lean_llvm_get_next_function(x_1, x_2, x_4);
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 = lean_box_usize(x_2);
x_10 = lean_array_push(x_3, x_9);
x_11 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_2 = x_11;
x_3 = x_10;
x_4 = x_8;
goto _start;
}
else
{
lean_object* x_13;
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_3);
lean_ctor_set(x_13, 1, x_4);
return x_13;
}
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions_go___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_6 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_7 = l_Lean_IR_getModuleFunctions_go(x_5, x_6, x_3, x_4);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions(size_t x_1, size_t x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; size_t x_8; lean_object* x_9;
x_4 = lean_llvm_get_first_function(x_1, 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);
lean_dec(x_4);
x_7 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_8 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_9 = l_Lean_IR_getModuleFunctions_go(x_1, x_8, x_7, x_6);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_IR_getModuleFunctions___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; size_t x_5; lean_object* x_6;
x_4 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = l_Lean_IR_getModuleFunctions(x_4, x_5, x_3);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1(size_t x_1, size_t x_2, size_t x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = lean_usize_dec_lt(x_3, x_2);
if (x_6 == 0)
{
lean_object* x_7;
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_4);
lean_ctor_set(x_7, 1, x_5);
return x_7;
}
else
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; size_t x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; size_t x_15; size_t x_16; lean_object* x_17;
x_8 = lean_array_uget(x_4, x_3);
x_9 = lean_unsigned_to_nat(0u);
x_10 = lean_array_uset(x_4, x_3, x_9);
x_11 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_12 = lean_llvm_get_value_name2(x_1, x_11, x_5);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
x_15 = 1;
x_16 = lean_usize_add(x_3, x_15);
x_17 = lean_array_uset(x_10, x_3, x_13);
x_3 = x_16;
x_4 = x_17;
x_5 = x_14;
goto _start;
}
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___spec__3(size_t x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
uint8_t x_7;
x_7 = lean_usize_dec_eq(x_3, x_4);
if (x_7 == 0)
{
lean_object* x_8; size_t x_9; lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_8 = lean_array_uget(x_2, x_3);
x_9 = lean_unbox_usize(x_8);
lean_dec(x_8);
x_10 = llvm_is_declaration(x_1, x_9, x_6);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_unbox(x_11);
lean_dec(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; size_t x_18; size_t x_19;
x_13 = lean_ctor_get(x_10, 1);
lean_inc(x_13);
lean_dec(x_10);
x_14 = lean_llvm_get_value_name2(x_1, x_9, x_13);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
lean_dec(x_14);
x_17 = lean_array_push(x_5, x_15);
x_18 = 1;
x_19 = lean_usize_add(x_3, x_18);
x_3 = x_19;
x_5 = x_17;
x_6 = x_16;
goto _start;
}
else
{
lean_object* x_21; size_t x_22; size_t x_23;
x_21 = lean_ctor_get(x_10, 1);
lean_inc(x_21);
lean_dec(x_10);
x_22 = 1;
x_23 = lean_usize_add(x_3, x_22);
x_3 = x_23;
x_6 = x_21;
goto _start;
}
}
else
{
lean_object* x_25;
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_5);
lean_ctor_set(x_25, 1, x_6);
return x_25;
}
}
}
LEAN_EXPORT lean_object* l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2(size_t x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = lean_nat_dec_lt(x_3, x_4);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8;
lean_dec(x_4);
lean_dec(x_3);
x_7 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_7);
lean_ctor_set(x_8, 1, x_5);
return x_8;
}
else
{
lean_object* x_9; uint8_t x_10;
x_9 = lean_array_get_size(x_2);
x_10 = lean_nat_dec_le(x_4, x_9);
lean_dec(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_4);
lean_dec(x_3);
x_11 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_5);
return x_12;
}
else
{
size_t x_13; size_t x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_usize_of_nat(x_3);
lean_dec(x_3);
x_14 = lean_usize_of_nat(x_4);
lean_dec(x_4);
x_15 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
x_16 = l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___spec__3(x_1, x_2, x_13, x_14, x_15, x_5);
return x_16;
}
}
}
}
static lean_object* _init_l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("ERROR: linked module must have global from runtime module: '", 60);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_lt(x_5, x_4);
if (x_8 == 0)
{
lean_object* x_9;
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_6);
lean_ctor_set(x_9, 1, x_7);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
lean_dec(x_6);
x_10 = lean_array_uget(x_3, x_5);
x_11 = lean_llvm_get_named_global(x_1, x_2, x_10, x_7);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_11);
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;
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1;
x_16 = lean_string_append(x_15, x_10);
lean_dec(x_10);
x_17 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set_tag(x_11, 1);
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_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1;
x_22 = lean_string_append(x_21, x_10);
lean_dec(x_10);
x_23 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_20);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; uint64_t x_29; size_t x_30; lean_object* x_31; lean_object* x_32; size_t x_33; size_t x_34; lean_object* x_35;
lean_dec(x_10);
x_27 = lean_ctor_get(x_11, 1);
lean_inc(x_27);
lean_dec(x_11);
x_28 = lean_ctor_get(x_12, 0);
lean_inc(x_28);
lean_dec(x_12);
x_29 = l_LLVM_Linkage_internal;
x_30 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_31 = lean_llvm_set_linkage(x_1, x_30, x_29, x_27);
x_32 = lean_ctor_get(x_31, 1);
lean_inc(x_32);
lean_dec(x_31);
x_33 = 1;
x_34 = lean_usize_add(x_5, x_33);
x_35 = lean_box(0);
x_5 = x_34;
x_6 = x_35;
x_7 = x_32;
goto _start;
}
}
}
}
static lean_object* _init_l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("ERROR: linked module must have function from runtime module: '", 62);
return x_1;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5(size_t x_1, size_t x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
uint8_t x_8;
x_8 = lean_usize_dec_lt(x_5, x_4);
if (x_8 == 0)
{
lean_object* x_9;
x_9 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_9, 0, x_6);
lean_ctor_set(x_9, 1, x_7);
return x_9;
}
else
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
lean_dec(x_6);
x_10 = lean_array_uget(x_3, x_5);
x_11 = lean_llvm_get_named_function(x_1, x_2, x_10, x_7);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_11);
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;
x_14 = lean_ctor_get(x_11, 0);
lean_dec(x_14);
x_15 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1;
x_16 = lean_string_append(x_15, x_10);
lean_dec(x_10);
x_17 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_18 = lean_string_append(x_16, x_17);
x_19 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set_tag(x_11, 1);
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_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1;
x_22 = lean_string_append(x_21, x_10);
lean_dec(x_10);
x_23 = l_Lean_IR_EmitLLVM_emitSProj___closed__7;
x_24 = lean_string_append(x_22, x_23);
x_25 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_25, 0, x_24);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_25);
lean_ctor_set(x_26, 1, x_20);
return x_26;
}
}
else
{
lean_object* x_27; lean_object* x_28; uint64_t x_29; size_t x_30; lean_object* x_31; lean_object* x_32; size_t x_33; size_t x_34; lean_object* x_35;
lean_dec(x_10);
x_27 = lean_ctor_get(x_11, 1);
lean_inc(x_27);
lean_dec(x_11);
x_28 = lean_ctor_get(x_12, 0);
lean_inc(x_28);
lean_dec(x_12);
x_29 = l_LLVM_Linkage_internal;
x_30 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_31 = lean_llvm_set_linkage(x_1, x_30, x_29, x_27);
x_32 = lean_ctor_get(x_31, 1);
lean_inc(x_32);
lean_dec(x_31);
x_33 = 1;
x_34 = lean_usize_add(x_5, x_33);
x_35 = lean_box(0);
x_5 = x_34;
x_6 = x_35;
x_7 = x_32;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg___boxed), 1, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7(size_t x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg___boxed), 1, 0);
return x_2;
}
}
static lean_object* _init_l_Lean_IR_emitLLVM___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("generic", 7);
return x_1;
}
}
static lean_object* _init_l_Lean_IR_emitLLVM___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(".o", 2);
return x_1;
}
}
LEAN_EXPORT lean_object* lean_ir_emit_llvm(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; uint8_t x_11; lean_object* x_12; size_t 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_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; size_t x_172; lean_object* x_173;
x_6 = lean_llvm_initialize_target_info(x_5);
x_7 = lean_ctor_get(x_6, 1);
lean_inc(x_7);
lean_dec(x_6);
x_8 = lean_llvm_create_context(x_7);
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 = 1;
lean_inc(x_2);
x_12 = l_Lean_Name_toString(x_2, x_11);
x_13 = lean_unbox_usize(x_9);
x_14 = lean_llvm_create_module(x_13, x_12, x_10);
lean_dec(x_12);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
x_16 = lean_ctor_get(x_14, 1);
lean_inc(x_16);
if (lean_is_exclusive(x_14)) {
lean_ctor_release(x_14, 0);
lean_ctor_release(x_14, 1);
x_17 = x_14;
} else {
lean_dec_ref(x_14);
x_17 = lean_box(0);
}
x_162 = l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1;
x_163 = lean_box(0);
x_164 = l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1;
lean_inc(x_15);
x_165 = lean_alloc_ctor(0, 6, 0);
lean_ctor_set(x_165, 0, x_1);
lean_ctor_set(x_165, 1, x_2);
lean_ctor_set(x_165, 2, x_162);
lean_ctor_set(x_165, 3, x_163);
lean_ctor_set(x_165, 4, x_164);
lean_ctor_set(x_165, 5, x_15);
x_166 = lean_unsigned_to_nat(8u);
x_167 = l_Lean_mkHashMapImp___rarg(x_166);
lean_inc(x_167);
x_168 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_168, 0, x_167);
lean_ctor_set(x_168, 1, x_167);
x_169 = lean_st_mk_ref(x_168, x_16);
x_170 = lean_ctor_get(x_169, 0);
lean_inc(x_170);
x_171 = lean_ctor_get(x_169, 1);
lean_inc(x_171);
lean_dec(x_169);
x_172 = lean_unbox_usize(x_9);
lean_inc(x_170);
x_173 = l_Lean_IR_EmitLLVM_main(x_172, x_170, x_165, x_171);
if (lean_obj_tag(x_173) == 0)
{
lean_object* x_174;
x_174 = lean_ctor_get(x_173, 0);
lean_inc(x_174);
if (lean_obj_tag(x_174) == 0)
{
lean_object* x_175; uint8_t x_176;
lean_dec(x_170);
x_175 = lean_ctor_get(x_173, 1);
lean_inc(x_175);
lean_dec(x_173);
x_176 = !lean_is_exclusive(x_174);
if (x_176 == 0)
{
x_18 = x_174;
x_19 = x_175;
goto block_161;
}
else
{
lean_object* x_177; lean_object* x_178;
x_177 = lean_ctor_get(x_174, 0);
lean_inc(x_177);
lean_dec(x_174);
x_178 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_178, 0, x_177);
x_18 = x_178;
x_19 = x_175;
goto block_161;
}
}
else
{
lean_object* x_179; uint8_t x_180;
x_179 = lean_ctor_get(x_173, 1);
lean_inc(x_179);
lean_dec(x_173);
x_180 = !lean_is_exclusive(x_174);
if (x_180 == 0)
{
lean_object* x_181; lean_object* x_182; lean_object* x_183; lean_object* x_184; lean_object* x_185;
x_181 = lean_ctor_get(x_174, 0);
x_182 = lean_st_ref_get(x_170, x_179);
lean_dec(x_170);
x_183 = lean_ctor_get(x_182, 0);
lean_inc(x_183);
x_184 = lean_ctor_get(x_182, 1);
lean_inc(x_184);
lean_dec(x_182);
x_185 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_185, 0, x_181);
lean_ctor_set(x_185, 1, x_183);
lean_ctor_set(x_174, 0, x_185);
x_18 = x_174;
x_19 = x_184;
goto block_161;
}
else
{
lean_object* x_186; lean_object* x_187; lean_object* x_188; lean_object* x_189; lean_object* x_190; lean_object* x_191;
x_186 = lean_ctor_get(x_174, 0);
lean_inc(x_186);
lean_dec(x_174);
x_187 = lean_st_ref_get(x_170, x_179);
lean_dec(x_170);
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 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_190, 0, x_186);
lean_ctor_set(x_190, 1, x_188);
x_191 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_191, 0, x_190);
x_18 = x_191;
x_19 = x_189;
goto block_161;
}
}
}
else
{
uint8_t x_192;
lean_dec(x_170);
lean_dec(x_17);
lean_dec(x_15);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_192 = !lean_is_exclusive(x_173);
if (x_192 == 0)
{
return x_173;
}
else
{
lean_object* x_193; lean_object* x_194; lean_object* x_195;
x_193 = lean_ctor_get(x_173, 0);
x_194 = lean_ctor_get(x_173, 1);
lean_inc(x_194);
lean_inc(x_193);
lean_dec(x_173);
x_195 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_195, 0, x_193);
lean_ctor_set(x_195, 1, x_194);
return x_195;
}
}
block_161:
{
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_dec(x_15);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_20 = lean_ctor_get(x_18, 0);
lean_inc(x_20);
lean_dec(x_18);
x_21 = lean_alloc_ctor(18, 1, 0);
lean_ctor_set(x_21, 0, x_20);
if (lean_is_scalar(x_17)) {
x_22 = lean_alloc_ctor(1, 2, 0);
} else {
x_22 = x_17;
lean_ctor_set_tag(x_22, 1);
}
lean_ctor_set(x_22, 0, x_21);
lean_ctor_set(x_22, 1, x_19);
return x_22;
}
else
{
lean_object* x_23;
lean_dec(x_18);
lean_dec(x_17);
x_23 = l_Lean_IR_getLeanHBcPath(x_19);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24; lean_object* x_25; size_t x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; size_t x_30; size_t x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; size_t x_35; size_t x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; size_t x_41; size_t x_42; size_t x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; size_t x_47; size_t x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; size_t x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; size_t x_58; size_t x_59; size_t x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; size_t x_64; lean_object* x_65; size_t x_66; size_t x_67; lean_object* x_68;
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
x_25 = lean_ctor_get(x_23, 1);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_unbox_usize(x_9);
x_27 = lean_llvm_create_memory_buffer_with_contents_of_file(x_26, x_24, x_25);
lean_dec(x_24);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_unbox_usize(x_9);
x_31 = lean_unbox_usize(x_28);
lean_dec(x_28);
x_32 = lean_llvm_parse_bitcode(x_30, x_31, x_29);
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_ctor_get(x_32, 1);
lean_inc(x_34);
lean_dec(x_32);
x_35 = lean_unbox_usize(x_9);
x_36 = lean_unbox_usize(x_33);
x_37 = l_Lean_IR_getModuleGlobals(x_35, x_36, x_34);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_37, 1);
lean_inc(x_39);
lean_dec(x_37);
x_40 = lean_array_get_size(x_38);
x_41 = lean_usize_of_nat(x_40);
lean_dec(x_40);
x_42 = 0;
x_43 = lean_unbox_usize(x_9);
x_44 = l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1(x_43, x_41, x_42, x_38, x_39);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = lean_unbox_usize(x_9);
x_48 = lean_unbox_usize(x_33);
x_49 = l_Lean_IR_getModuleFunctions(x_47, x_48, x_46);
x_50 = lean_ctor_get(x_49, 0);
lean_inc(x_50);
x_51 = lean_ctor_get(x_49, 1);
lean_inc(x_51);
lean_dec(x_49);
x_52 = lean_array_get_size(x_50);
x_53 = lean_unsigned_to_nat(0u);
x_54 = lean_unbox_usize(x_9);
x_55 = l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2(x_54, x_50, x_53, x_52, x_51);
lean_dec(x_50);
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_58 = lean_unbox_usize(x_9);
x_59 = lean_unbox_usize(x_15);
x_60 = lean_unbox_usize(x_33);
lean_dec(x_33);
x_61 = lean_llvm_link_modules(x_58, x_59, x_60, x_57);
x_62 = lean_ctor_get(x_61, 1);
lean_inc(x_62);
lean_dec(x_61);
x_63 = lean_array_get_size(x_45);
x_64 = lean_usize_of_nat(x_63);
lean_dec(x_63);
x_65 = lean_box(0);
x_66 = lean_unbox_usize(x_9);
x_67 = lean_unbox_usize(x_15);
x_68 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4(x_66, x_67, x_45, x_64, x_42, x_65, x_62);
lean_dec(x_45);
if (lean_obj_tag(x_68) == 0)
{
lean_object* x_69; lean_object* x_70; size_t x_71; size_t x_72; size_t x_73; lean_object* x_74;
x_69 = lean_ctor_get(x_68, 1);
lean_inc(x_69);
lean_dec(x_68);
x_70 = lean_array_get_size(x_56);
x_71 = lean_usize_of_nat(x_70);
lean_dec(x_70);
x_72 = lean_unbox_usize(x_9);
x_73 = lean_unbox_usize(x_15);
x_74 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5(x_72, x_73, x_56, x_71, x_42, x_65, x_69);
lean_dec(x_56);
if (lean_obj_tag(x_74) == 0)
{
lean_object* x_75; size_t x_76; size_t x_77; lean_object* x_78; lean_object* x_79; size_t x_80; size_t x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_75 = lean_ctor_get(x_74, 1);
lean_inc(x_75);
lean_dec(x_74);
x_76 = lean_unbox_usize(x_9);
x_77 = lean_unbox_usize(x_15);
x_78 = l_Lean_IR_optimizeLLVMModule(x_76, x_77, x_75);
x_79 = lean_ctor_get(x_78, 1);
lean_inc(x_79);
lean_dec(x_78);
x_80 = lean_unbox_usize(x_9);
x_81 = lean_unbox_usize(x_15);
x_82 = lean_llvm_write_bitcode_to_file(x_80, x_81, x_3, x_79);
x_83 = lean_ctor_get(x_82, 1);
lean_inc(x_83);
lean_dec(x_82);
x_84 = lean_llvm_get_default_target_triple(x_83);
if (lean_obj_tag(x_4) == 0)
{
lean_object* x_85; lean_object* x_86; size_t x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; size_t x_93; size_t x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; uint64_t x_100; size_t x_101; size_t x_102; size_t x_103; lean_object* x_104; lean_object* x_105; size_t x_106; size_t x_107; lean_object* x_108; lean_object* x_109; size_t x_110; size_t x_111; lean_object* x_112; uint8_t x_113;
x_85 = lean_ctor_get(x_84, 0);
lean_inc(x_85);
x_86 = lean_ctor_get(x_84, 1);
lean_inc(x_86);
lean_dec(x_84);
x_87 = lean_unbox_usize(x_9);
x_88 = lean_llvm_get_target_from_triple(x_87, x_85, x_86);
x_89 = lean_ctor_get(x_88, 0);
lean_inc(x_89);
x_90 = lean_ctor_get(x_88, 1);
lean_inc(x_90);
lean_dec(x_88);
x_91 = l_Lean_IR_emitLLVM___closed__1;
x_92 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_93 = lean_unbox_usize(x_9);
x_94 = lean_unbox_usize(x_89);
lean_dec(x_89);
x_95 = lean_llvm_create_target_machine(x_93, x_94, x_85, x_91, x_92, x_90);
lean_dec(x_85);
x_96 = lean_ctor_get(x_95, 0);
lean_inc(x_96);
x_97 = lean_ctor_get(x_95, 1);
lean_inc(x_97);
lean_dec(x_95);
x_98 = l_Lean_IR_emitLLVM___closed__2;
x_99 = lean_string_append(x_3, x_98);
x_100 = l_LLVM_CodegenFileType_ObjectFile;
x_101 = lean_unbox_usize(x_9);
x_102 = lean_unbox_usize(x_96);
x_103 = lean_unbox_usize(x_15);
x_104 = lean_llvm_target_machine_emit_to_file(x_101, x_102, x_103, x_99, x_100, x_97);
lean_dec(x_99);
x_105 = lean_ctor_get(x_104, 1);
lean_inc(x_105);
lean_dec(x_104);
x_106 = lean_unbox_usize(x_9);
x_107 = lean_unbox_usize(x_15);
lean_dec(x_15);
x_108 = lean_llvm_dispose_module(x_106, x_107, x_105);
x_109 = lean_ctor_get(x_108, 1);
lean_inc(x_109);
lean_dec(x_108);
x_110 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_111 = lean_unbox_usize(x_96);
lean_dec(x_96);
x_112 = lean_llvm_dispose_target_machine(x_110, x_111, x_109);
x_113 = !lean_is_exclusive(x_112);
if (x_113 == 0)
{
return x_112;
}
else
{
lean_object* x_114; lean_object* x_115; lean_object* x_116;
x_114 = lean_ctor_get(x_112, 0);
x_115 = lean_ctor_get(x_112, 1);
lean_inc(x_115);
lean_inc(x_114);
lean_dec(x_112);
x_116 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_116, 0, x_114);
lean_ctor_set(x_116, 1, x_115);
return x_116;
}
}
else
{
lean_object* x_117; lean_object* x_118; size_t x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; size_t x_125; size_t x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129; lean_object* x_130; lean_object* x_131; uint64_t x_132; size_t x_133; size_t x_134; size_t x_135; lean_object* x_136; lean_object* x_137; size_t x_138; size_t x_139; lean_object* x_140; lean_object* x_141; size_t x_142; size_t x_143; lean_object* x_144; uint8_t x_145;
x_117 = lean_ctor_get(x_84, 1);
lean_inc(x_117);
lean_dec(x_84);
x_118 = lean_ctor_get(x_4, 0);
lean_inc(x_118);
lean_dec(x_4);
x_119 = lean_unbox_usize(x_9);
x_120 = lean_llvm_get_target_from_triple(x_119, x_118, x_117);
x_121 = lean_ctor_get(x_120, 0);
lean_inc(x_121);
x_122 = lean_ctor_get(x_120, 1);
lean_inc(x_122);
lean_dec(x_120);
x_123 = l_Lean_IR_emitLLVM___closed__1;
x_124 = l_Lean_IR_EmitLLVM_emitJp___closed__3;
x_125 = lean_unbox_usize(x_9);
x_126 = lean_unbox_usize(x_121);
lean_dec(x_121);
x_127 = lean_llvm_create_target_machine(x_125, x_126, x_118, x_123, x_124, x_122);
lean_dec(x_118);
x_128 = lean_ctor_get(x_127, 0);
lean_inc(x_128);
x_129 = lean_ctor_get(x_127, 1);
lean_inc(x_129);
lean_dec(x_127);
x_130 = l_Lean_IR_emitLLVM___closed__2;
x_131 = lean_string_append(x_3, x_130);
x_132 = l_LLVM_CodegenFileType_ObjectFile;
x_133 = lean_unbox_usize(x_9);
x_134 = lean_unbox_usize(x_128);
x_135 = lean_unbox_usize(x_15);
x_136 = lean_llvm_target_machine_emit_to_file(x_133, x_134, x_135, x_131, x_132, x_129);
lean_dec(x_131);
x_137 = lean_ctor_get(x_136, 1);
lean_inc(x_137);
lean_dec(x_136);
x_138 = lean_unbox_usize(x_9);
x_139 = lean_unbox_usize(x_15);
lean_dec(x_15);
x_140 = lean_llvm_dispose_module(x_138, x_139, x_137);
x_141 = lean_ctor_get(x_140, 1);
lean_inc(x_141);
lean_dec(x_140);
x_142 = lean_unbox_usize(x_9);
lean_dec(x_9);
x_143 = lean_unbox_usize(x_128);
lean_dec(x_128);
x_144 = lean_llvm_dispose_target_machine(x_142, x_143, x_141);
x_145 = !lean_is_exclusive(x_144);
if (x_145 == 0)
{
return x_144;
}
else
{
lean_object* x_146; lean_object* x_147; lean_object* x_148;
x_146 = lean_ctor_get(x_144, 0);
x_147 = lean_ctor_get(x_144, 1);
lean_inc(x_147);
lean_inc(x_146);
lean_dec(x_144);
x_148 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_148, 0, x_146);
lean_ctor_set(x_148, 1, x_147);
return x_148;
}
}
}
else
{
uint8_t x_149;
lean_dec(x_15);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_149 = !lean_is_exclusive(x_74);
if (x_149 == 0)
{
return x_74;
}
else
{
lean_object* x_150; lean_object* x_151; lean_object* x_152;
x_150 = lean_ctor_get(x_74, 0);
x_151 = lean_ctor_get(x_74, 1);
lean_inc(x_151);
lean_inc(x_150);
lean_dec(x_74);
x_152 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_152, 0, x_150);
lean_ctor_set(x_152, 1, x_151);
return x_152;
}
}
}
else
{
uint8_t x_153;
lean_dec(x_56);
lean_dec(x_15);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_153 = !lean_is_exclusive(x_68);
if (x_153 == 0)
{
return x_68;
}
else
{
lean_object* x_154; lean_object* x_155; lean_object* x_156;
x_154 = lean_ctor_get(x_68, 0);
x_155 = lean_ctor_get(x_68, 1);
lean_inc(x_155);
lean_inc(x_154);
lean_dec(x_68);
x_156 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_156, 0, x_154);
lean_ctor_set(x_156, 1, x_155);
return x_156;
}
}
}
else
{
uint8_t x_157;
lean_dec(x_15);
lean_dec(x_9);
lean_dec(x_4);
lean_dec(x_3);
x_157 = !lean_is_exclusive(x_23);
if (x_157 == 0)
{
return x_23;
}
else
{
lean_object* x_158; lean_object* x_159; lean_object* x_160;
x_158 = lean_ctor_get(x_23, 0);
x_159 = lean_ctor_get(x_23, 1);
lean_inc(x_159);
lean_inc(x_158);
lean_dec(x_23);
x_160 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_160, 0, x_158);
lean_ctor_set(x_160, 1, x_159);
return x_160;
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; size_t x_8; lean_object* x_9;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_8 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_9 = l_Array_mapMUnsafe_map___at_Lean_IR_emitLLVM___spec__1(x_6, x_7, x_8, x_4, x_5);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___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:
{
size_t x_7; size_t x_8; size_t x_9; lean_object* x_10;
x_7 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_8 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_9 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_10 = l_Array_foldlMUnsafe_fold___at_Lean_IR_emitLLVM___spec__3(x_7, x_2, x_8, x_9, x_5, x_6);
lean_dec(x_2);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; lean_object* x_7;
x_6 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_7 = l_Array_filterMapM___at_Lean_IR_emitLLVM___spec__2(x_6, x_2, x_3, x_4, x_5);
lean_dec(x_2);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___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:
{
size_t x_8; size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_12 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4(x_8, x_9, x_3, x_10, x_11, x_6, x_7);
lean_dec(x_3);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___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:
{
size_t x_8; size_t x_9; size_t x_10; size_t x_11; lean_object* x_12;
x_8 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_9 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_10 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_11 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_12 = l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5(x_8, x_9, x_3, x_10, x_11, x_6, x_7);
lean_dec(x_3);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___rarg(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__6(x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg___boxed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___rarg(x_1);
lean_dec(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7___boxed(lean_object* x_1) {
_start:
{
size_t x_2; lean_object* x_3;
x_2 = lean_unbox_usize(x_1);
lean_dec(x_1);
x_3 = l_Lean_mkHashMap___at_Lean_IR_emitLLVM___spec__7(x_2);
return x_3;
}
}
lean_object* initialize_Init(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Data_HashMap(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Runtime(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_NameMangling(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_ExportAttr(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_InitAttr(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_CompilerM(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_EmitUtil(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_NormIds(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_SimpCase(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_Boxing(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_ResetReuse(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Compiler_IR_LLVMBindings(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lean_Compiler_IR_EmitLLVM(uint8_t builtin, lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Data_HashMap(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Runtime(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_NameMangling(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_ExportAttr(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_InitAttr(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_CompilerM(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_EmitUtil(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_NormIds(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_SimpCase(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_Boxing(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_ResetReuse(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Compiler_IR_LLVMBindings(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_IR_leanMainFn___closed__1 = _init_l_Lean_IR_leanMainFn___closed__1();
lean_mark_persistent(l_Lean_IR_leanMainFn___closed__1);
l_Lean_IR_leanMainFn = _init_l_Lean_IR_leanMainFn();
lean_mark_persistent(l_Lean_IR_leanMainFn);
l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1 = _init_l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_Context_jpMap___default___closed__1);
l_Lean_IR_EmitLLVM_Context_jpMap___default = _init_l_Lean_IR_EmitLLVM_Context_jpMap___default();
lean_mark_persistent(l_Lean_IR_EmitLLVM_Context_jpMap___default);
l_Lean_IR_EmitLLVM_Context_mainFn___default = _init_l_Lean_IR_EmitLLVM_Context_mainFn___default();
lean_mark_persistent(l_Lean_IR_EmitLLVM_Context_mainFn___default);
l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1 = _init_l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_Context_mainParams___default___closed__1);
l_Lean_IR_EmitLLVM_Context_mainParams___default = _init_l_Lean_IR_EmitLLVM_Context_mainParams___default();
lean_mark_persistent(l_Lean_IR_EmitLLVM_Context_mainParams___default);
l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__1);
l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2 = _init_l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_instInhabitedM___rarg___closed__2);
l_Lean_IR_EmitLLVM_addVartoState___closed__1 = _init_l_Lean_IR_EmitLLVM_addVartoState___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_addVartoState___closed__1);
l_Lean_IR_EmitLLVM_emitJp___closed__1 = _init_l_Lean_IR_EmitLLVM_emitJp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJp___closed__1);
l_Lean_IR_EmitLLVM_emitJp___closed__2 = _init_l_Lean_IR_EmitLLVM_emitJp___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJp___closed__2);
l_Lean_IR_EmitLLVM_emitJp___closed__3 = _init_l_Lean_IR_EmitLLVM_emitJp___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJp___closed__3);
l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_getDecl___rarg___closed__1);
l_Lean_IR_EmitLLVM_callLeanBox___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanBox___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanBox___closed__1);
l_Lean_IR_EmitLLVM_callLeanBox___closed__2 = _init_l_Lean_IR_EmitLLVM_callLeanBox___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanBox___closed__2);
l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanMarkPersistentFn___closed__1);
l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_RefcountKind_noConfusion___rarg___closed__1);
l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1 = _init_l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__1);
l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2 = _init_l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_instToStringRefcountKind___closed__2);
l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2 = _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__2);
l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3 = _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__3);
l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4 = _init_l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanRefcountFn___closed__4);
l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanDecRef___closed__1);
l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanUnsignedToNatFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanMkStringFromBytesFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanMkString___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanMkString___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanMkString___closed__1);
l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCStrToNatFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2 = _init_l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOMkWorld___closed__2);
l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOResultIsError___closed__1);
l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__1);
l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2 = _init_l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanAllocCtor___closed__2);
l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCtorSet___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOResultMKOk___closed__1);
l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanAllocClosureFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanClosureSetFn___closed__1);
l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanObjTag___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOResultGetValue___closed__1);
l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCtorRelease___closed__1);
l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCtorSetTag___closed__1);
l_Lean_IR_EmitLLVM_toLLVMType___closed__1 = _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toLLVMType___closed__1);
l_Lean_IR_EmitLLVM_toLLVMType___closed__2 = _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toLLVMType___closed__2);
l_Lean_IR_EmitLLVM_toLLVMType___closed__3 = _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toLLVMType___closed__3);
l_Lean_IR_EmitLLVM_toLLVMType___closed__4 = _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toLLVMType___closed__4);
l_Lean_IR_EmitLLVM_toLLVMType___closed__5 = _init_l_Lean_IR_EmitLLVM_toLLVMType___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toLLVMType___closed__5);
l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_throwInvalidExportName___rarg___closed__1);
l_Lean_IR_EmitLLVM_toCName___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCName___rarg___closed__1);
l_Lean_IR_EmitLLVM_toCName___rarg___closed__2 = _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCName___rarg___closed__2);
l_Lean_IR_EmitLLVM_toCName___rarg___closed__3 = _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCName___rarg___closed__3);
l_Lean_IR_EmitLLVM_toCName___rarg___closed__4 = _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCName___rarg___closed__4);
l_Lean_IR_EmitLLVM_toCName___rarg___closed__5 = _init_l_Lean_IR_EmitLLVM_toCName___rarg___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCName___rarg___closed__5);
l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1 = _init_l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_toCInitName___rarg___closed__1);
l_Lean_IR_EmitLLVM_buildWhile_____closed__1 = _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildWhile_____closed__1);
l_Lean_IR_EmitLLVM_buildWhile_____closed__2 = _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildWhile_____closed__2);
l_Lean_IR_EmitLLVM_buildWhile_____closed__3 = _init_l_Lean_IR_EmitLLVM_buildWhile_____closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildWhile_____closed__3);
l_Lean_IR_EmitLLVM_buildIfThen_____closed__1 = _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildIfThen_____closed__1);
l_Lean_IR_EmitLLVM_buildIfThen_____closed__2 = _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildIfThen_____closed__2);
l_Lean_IR_EmitLLVM_buildIfThen_____closed__3 = _init_l_Lean_IR_EmitLLVM_buildIfThen_____closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_buildIfThen_____closed__3);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__1);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__2);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__3);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnDecls___spec__5___closed__4);
l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1 = _init_l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__1);
l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2 = _init_l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitLhsSlot_____closed__2);
l_Lean_IR_EmitLLVM_emitArgSlot_____closed__1 = _init_l_Lean_IR_EmitLLVM_emitArgSlot_____closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitArgSlot_____closed__1);
l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2 = _init_l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitArgSlot_____closed__2);
l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1 = _init_l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitAllocCtor___closed__1);
l_Lean_IR_EmitLLVM_emitCtor___closed__1 = _init_l_Lean_IR_EmitLLVM_emitCtor___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitCtor___closed__1);
l_Lean_IR_EmitLLVM_emitDec___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDec___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDec___closed__1);
l_Lean_IR_EmitLLVM_emitDec___closed__2 = _init_l_Lean_IR_EmitLLVM_emitDec___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDec___closed__2);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__1);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__2);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__3);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__4);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__5);
l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6 = _init_l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6();
lean_mark_persistent(l_String_foldlAux___at_Lean_IR_EmitLLVM_quoteString___spec__1___closed__6);
l_Lean_IR_EmitLLVM_quoteString___closed__1 = _init_l_Lean_IR_EmitLLVM_quoteString___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_quoteString___closed__1);
l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1 = _init_l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSimpleExternalCall___closed__1);
l_Lean_IR_EmitLLVM_emitExternCall___closed__1 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__1);
l_Lean_IR_EmitLLVM_emitExternCall___closed__2 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__2);
l_Lean_IR_EmitLLVM_emitExternCall___closed__3 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__3);
l_Lean_IR_EmitLLVM_emitExternCall___closed__4 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__4);
l_Lean_IR_EmitLLVM_emitExternCall___closed__5 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__5);
l_Lean_IR_EmitLLVM_emitExternCall___closed__6 = _init_l_Lean_IR_EmitLLVM_emitExternCall___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitExternCall___closed__6);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__1);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitApp___spec__2___closed__2);
l_Lean_IR_EmitLLVM_emitApp___closed__1 = _init_l_Lean_IR_EmitLLVM_emitApp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitApp___closed__1);
l_Lean_IR_EmitLLVM_emitApp___closed__2 = _init_l_Lean_IR_EmitLLVM_emitApp___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitApp___closed__2);
l_Lean_IR_EmitLLVM_emitApp___closed__3 = _init_l_Lean_IR_EmitLLVM_emitApp___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitApp___closed__3);
l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCtorGet___closed__1);
l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanCtorGetUsize___closed__1);
l_Lean_IR_EmitLLVM_emitSProj___closed__1 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__1);
l_Lean_IR_EmitLLVM_emitSProj___closed__2 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__2);
l_Lean_IR_EmitLLVM_emitSProj___closed__3 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__3);
l_Lean_IR_EmitLLVM_emitSProj___closed__4 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__4);
l_Lean_IR_EmitLLVM_emitSProj___closed__5 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__5);
l_Lean_IR_EmitLLVM_emitSProj___closed__6 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__6);
l_Lean_IR_EmitLLVM_emitSProj___closed__7 = _init_l_Lean_IR_EmitLLVM_emitSProj___closed__7();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSProj___closed__7);
l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIsExclusive___closed__1);
l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIsScalar___closed__1);
l_Lean_IR_EmitLLVM_emitBox___closed__1 = _init_l_Lean_IR_EmitLLVM_emitBox___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitBox___closed__1);
l_Lean_IR_EmitLLVM_emitBox___closed__2 = _init_l_Lean_IR_EmitLLVM_emitBox___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitBox___closed__2);
l_Lean_IR_EmitLLVM_emitBox___closed__3 = _init_l_Lean_IR_EmitLLVM_emitBox___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitBox___closed__3);
l_Lean_IR_EmitLLVM_emitBox___closed__4 = _init_l_Lean_IR_EmitLLVM_emitBox___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitBox___closed__4);
l_Lean_IR_EmitLLVM_callUnboxForType___closed__1 = _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callUnboxForType___closed__1);
l_Lean_IR_EmitLLVM_callUnboxForType___closed__2 = _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callUnboxForType___closed__2);
l_Lean_IR_EmitLLVM_callUnboxForType___closed__3 = _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callUnboxForType___closed__3);
l_Lean_IR_EmitLLVM_callUnboxForType___closed__4 = _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callUnboxForType___closed__4);
l_Lean_IR_EmitLLVM_callUnboxForType___closed__5 = _init_l_Lean_IR_EmitLLVM_callUnboxForType___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callUnboxForType___closed__5);
l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1 = _init_l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitReset___lambda__1___closed__1);
l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1 = _init_l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitReset___lambda__2___closed__1);
l_Lean_IR_EmitLLVM_emitReset___closed__1 = _init_l_Lean_IR_EmitLLVM_emitReset___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitReset___closed__1);
l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1 = _init_l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitReuse___lambda__3___closed__1);
l_Lean_IR_EmitLLVM_emitReuse___closed__1 = _init_l_Lean_IR_EmitLLVM_emitReuse___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitReuse___closed__1);
l_Lean_IR_EmitLLVM_declareVar___closed__1 = _init_l_Lean_IR_EmitLLVM_declareVar___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_declareVar___closed__1);
l_Lean_IR_EmitLLVM_emitTag___closed__1 = _init_l_Lean_IR_EmitLLVM_emitTag___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitTag___closed__1);
l_Lean_IR_EmitLLVM_emitTag___closed__2 = _init_l_Lean_IR_EmitLLVM_emitTag___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitTag___closed__2);
l_Lean_IR_EmitLLVM_emitUSet___closed__1 = _init_l_Lean_IR_EmitLLVM_emitUSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitUSet___closed__1);
l_Lean_IR_EmitLLVM_emitTailCall___closed__1 = _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitTailCall___closed__1);
l_Lean_IR_EmitLLVM_emitTailCall___closed__2 = _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitTailCall___closed__2);
l_Lean_IR_EmitLLVM_emitTailCall___closed__3 = _init_l_Lean_IR_EmitLLVM_emitTailCall___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitTailCall___closed__3);
l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1 = _init_l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__1);
l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2 = _init_l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJmp___lambda__2___closed__2);
l_Lean_IR_EmitLLVM_emitJmp___closed__1 = _init_l_Lean_IR_EmitLLVM_emitJmp___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJmp___closed__1);
l_Lean_IR_EmitLLVM_emitSSet___closed__1 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__1);
l_Lean_IR_EmitLLVM_emitSSet___closed__2 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__2);
l_Lean_IR_EmitLLVM_emitSSet___closed__3 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__3);
l_Lean_IR_EmitLLVM_emitSSet___closed__4 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__4);
l_Lean_IR_EmitLLVM_emitSSet___closed__5 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__5);
l_Lean_IR_EmitLLVM_emitSSet___closed__6 = _init_l_Lean_IR_EmitLLVM_emitSSet___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitSSet___closed__6);
l_Lean_IR_EmitLLVM_emitDel___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDel___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDel___closed__1);
l_Lean_IR_EmitLLVM_emitUnreachable___closed__1 = _init_l_Lean_IR_EmitLLVM_emitUnreachable___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitUnreachable___closed__1);
l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1 = _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1();
lean_mark_persistent(l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitCase___spec__1___closed__1);
l_Lean_IR_EmitLLVM_emitCase___closed__1 = _init_l_Lean_IR_EmitLLVM_emitCase___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitCase___closed__1);
l_Lean_IR_EmitLLVM_emitCase___closed__2 = _init_l_Lean_IR_EmitLLVM_emitCase___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitCase___closed__2);
l_Lean_IR_EmitLLVM_emitBlock___closed__1 = _init_l_Lean_IR_EmitLLVM_emitBlock___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitBlock___closed__1);
l_Lean_IR_EmitLLVM_emitJDecl___closed__1 = _init_l_Lean_IR_EmitLLVM_emitJDecl___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitJDecl___closed__1);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__1___closed__1);
l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1 = _init_l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1();
lean_mark_persistent(l_List_forIn_loop___at_Lean_IR_EmitLLVM_emitFnArgs___spec__2___closed__1);
l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclAux___lambda__1___closed__1);
l_Lean_IR_EmitLLVM_emitDecl___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDecl___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDecl___closed__1);
l_Lean_IR_EmitLLVM_emitDecl___closed__2 = _init_l_Lean_IR_EmitLLVM_emitDecl___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDecl___closed__2);
l_Lean_IR_EmitLLVM_emitDecl___closed__3 = _init_l_Lean_IR_EmitLLVM_emitDecl___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDecl___closed__3);
l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__1___closed__1);
l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__1);
l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__2);
l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__3);
l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___lambda__3___closed__4);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__1 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__1);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__2 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__2);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__3 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__3);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__4 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__4);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__5 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__5);
l_Lean_IR_EmitLLVM_emitDeclInit___closed__6 = _init_l_Lean_IR_EmitLLVM_emitDeclInit___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitDeclInit___closed__6);
l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1 = _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1();
lean_mark_persistent(l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__1);
l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2 = _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2();
lean_mark_persistent(l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__2);
l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3 = _init_l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3();
lean_mark_persistent(l_Array_foldlMUnsafe_fold___at_Lean_IR_EmitLLVM_emitInitFn___spec__3___closed__3);
l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1 = _init_l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitInitFn___lambda__1___closed__1);
l_Lean_IR_EmitLLVM_emitInitFn___closed__1 = _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitInitFn___closed__1);
l_Lean_IR_EmitLLVM_emitInitFn___closed__2 = _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitInitFn___closed__2);
l_Lean_IR_EmitLLVM_emitInitFn___closed__3 = _init_l_Lean_IR_EmitLLVM_emitInitFn___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitInitFn___closed__3);
l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanInitialize___closed__1);
l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanInitializeRuntimeModule___closed__1);
l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanSetPanicMessages___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOMarkEndInitialization___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOResultIsOk___closed__1);
l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanInitTaskManager___closed__1);
l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanFinalizeTaskManager___closed__1);
l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1 = _init_l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_callLeanIOResultShowError___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__1___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__3);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__4);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__5 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__5);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__2___closed__6);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__3___closed__3);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__3);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__4);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__5);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__4___closed__6);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__3);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__4);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__5);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__6);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__7);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___closed__8);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__6___boxed__const__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__3);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__7___closed__4);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___lambda__8___closed__2);
l_Lean_IR_EmitLLVM_emitMainFn___closed__1 = _init_l_Lean_IR_EmitLLVM_emitMainFn___closed__1();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___closed__1);
l_Lean_IR_EmitLLVM_emitMainFn___closed__2 = _init_l_Lean_IR_EmitLLVM_emitMainFn___closed__2();
lean_mark_persistent(l_Lean_IR_EmitLLVM_emitMainFn___closed__2);
l_Lean_IR_getLeanHBcPath___closed__1 = _init_l_Lean_IR_getLeanHBcPath___closed__1();
lean_mark_persistent(l_Lean_IR_getLeanHBcPath___closed__1);
l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1 = _init_l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1();
lean_mark_persistent(l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__4___closed__1);
l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1 = _init_l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1();
lean_mark_persistent(l_Array_forInUnsafe_loop___at_Lean_IR_emitLLVM___spec__5___closed__1);
l_Lean_IR_emitLLVM___closed__1 = _init_l_Lean_IR_emitLLVM___closed__1();
lean_mark_persistent(l_Lean_IR_emitLLVM___closed__1);
l_Lean_IR_emitLLVM___closed__2 = _init_l_Lean_IR_emitLLVM___closed__2();
lean_mark_persistent(l_Lean_IR_emitLLVM___closed__2);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.