Skip to content

Instantly share code, notes, and snippets.

@Leporacanthicus
Created August 17, 2015 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leporacanthicus/b1f12005ef0c46582d39 to your computer and use it in GitHub Desktop.
Save Leporacanthicus/b1f12005ef0c46582d39 to your computer and use it in GitHub Desktop.
; ModuleID = 'TheModule'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%0 = type { i32, i8*, i32, i1 }
%1 = type { [8000 x i32] }
@input = global %0 { i32 0, i8* null, i32 1, i1 true }, align 8
@output = global %0 { i32 0, i8* null, i32 1, i1 true }, align 8
@b = internal global %1 zeroinitializer, align 8
@i = internal global i32 0, align 4
@UnitIniList = constant [1 x i8*] zeroinitializer
define void @P.p1(%1* byval) {
entry:
%y = alloca %1, align 8
%1 = bitcast %1* %y to i8*
%2 = bitcast %1* %0 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 32000, i32 8, i1 false)
%valueindex = getelementptr %1, %1* %y, i32 0, i32 0
%valueindex1 = getelementptr [8000 x i32], [8000 x i32]* %valueindex, i32 0, i32 1
%3 = load i32, i32* %valueindex1
call void @__write_int(%0* @output, i32 %3, i32 1)
call void @__write_nl(%0* @output)
ret void
}
; Function Attrs: nounwind
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
declare void @__write_int(%0*, i32, i32)
declare void @__write_nl(%0*)
define void @P.p2(%1* byval) {
entry:
%tmp = alloca %1, align 8
%y = alloca %1, align 8
%1 = bitcast %1* %y to i8*
%2 = bitcast %1* %0 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 32000, i32 8, i1 false)
%3 = bitcast %1* %tmp to i8*
%4 = bitcast %1* %y to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %4, i64 32000, i32 8, i1 false)
call void @P.p1(%1* byval %tmp)
ret void
}
define void @P.p3(%1* byval) {
entry:
%tmp = alloca %1, align 8
%y = alloca %1, align 8
%1 = bitcast %1* %y to i8*
%2 = bitcast %1* %0 to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 32000, i32 8, i1 false)
%3 = bitcast %1* %tmp to i8*
%4 = bitcast %1* %y to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %4, i64 32000, i32 8, i1 false)
call void @P.p2(%1* byval %tmp)
ret void
}
define void @__PascalMain() {
entry:
%tmp = alloca %1, align 8
store i32 1, i32* @i
%i = load i32, i32* @i
%loopcond = icmp sle i32 %i, 8000
br i1 %loopcond, label %loop, label %afterloop
loop: ; preds = %loop, %entry
%0 = load i32, i32* @i
%1 = sub i32 %0, 1
%valueindex = getelementptr [8000 x i32], [8000 x i32]* getelementptr inbounds (%1, %1* @b, i32 0, i32 0), i32 0, i32 %1
%2 = load i32, i32* @i
store i32 %2, i32* %valueindex
%i1 = load i32, i32* @i
%loopcond2 = icmp slt i32 %i1, 8000
%nextvar = add i32 %i1, 1
store i32 %nextvar, i32* @i
br i1 %loopcond2, label %loop, label %afterloop
afterloop: ; preds = %loop, %entry
%3 = bitcast %1* %tmp to i8*
%4 = bitcast %1* @b to i8*
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %4, i64 32000, i32 8, i1 false)
call void @P.p3(%1* byval %tmp)
ret void
}
attributes #0 = { nounwind }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment