-
Notifications
You must be signed in to change notification settings - Fork 1
Comparison
Nicky Nickell edited this page Aug 10, 2018
·
3 revisions
Please note that this page contains code that no self-respecting programmer would ever allow into something with their name on it. It was written to highlight cases where the other papyrus compilers produce inferior code. None of the assembly has been hand modified.
int function simple_if (bool a)
if a
return 1
else
return 2
endif
endfunction
JUMPF a label220
RETURN 1
JUMP label219
label220:
RETURN 2
label219:
JUMPF a label0
RETURN 1
JUMP label1
label0:
RETURN 2
label1:
JUMPF A label526
RETURN 1
label526:
RETURN 2
int function nested_if (bool a, bool b, bool c, bool d, bool e, bool f)
if a
if b
if c
if d
if e
if f
return 1
endif
endif
endif
endif
endif
endif
return 2
endfunction
JUMPF a label218
JUMPF b label217
JUMPF c label216
JUMPF d label215
JUMPF e label214
JUMPF f label213
RETURN 1
JUMP label212
label213:
label212:
JUMP label211
label214:
label211:
JUMP label210
label215:
label210:
JUMP label209
label216:
label209:
JUMP label208
label217:
label208:
JUMP label207
label218:
label207:
RETURN 2
JUMPF a label0
JUMPF b label1
JUMPF c label2
JUMPF d label3
JUMPF e label4
JUMPF f label5
RETURN 1
JUMP label5
label5:
JUMP label4
label4:
JUMP label3
label3:
JUMP label2
label2:
JUMP label1
label1:
JUMP label0
label0:
RETURN 2
JUMPF A label528
JUMPF B label528
JUMPF C label528
JUMPF D label528
JUMPF E label528
JUMPF F label528
RETURN 1
label528:
RETURN 2
int function nested_if_else (bool a, bool b, bool c, bool d, bool e, bool f)
if a
if b
if c
if d
if e
if f
return 1
else
return 2
endif
else
return 3
endif
else
return 4
endif
else
return 5
endif
else
return 6
endif
else
return 7
endif
endfunction
JUMPF a label232
JUMPF b label231
JUMPF c label230
JUMPF d label229
JUMPF e label228
JUMPF f label227
RETURN 1
JUMP label226
label227:
RETURN 2
label226:
JUMP label225
label228:
RETURN 3
label225:
JUMP label224
label229:
RETURN 4
label224:
JUMP label223
label230:
RETURN 5
label223:
JUMP label222
label231:
RETURN 6
label222:
JUMP label221
label232:
RETURN 7
label221:
JUMPF a label0
JUMPF b label1
JUMPF c label2
JUMPF d label3
JUMPF e label4
JUMPF f label5
RETURN 1
JUMP label6
label5:
RETURN 2
label6:
JUMP label7
label4:
RETURN 3
label7:
JUMP label8
label3:
RETURN 4
label8:
JUMP label9
label2:
RETURN 5
label9:
JUMP label10
label1:
RETURN 6
label10:
JUMP label11
label0:
RETURN 7
label11:
JUMPF A label508
JUMPF B label510
JUMPF C label512
JUMPF D label514
JUMPF E label516
JUMPF F label518
RETURN 1
label518:
RETURN 2
label516:
RETURN 3
label514:
RETURN 4
label512:
RETURN 5
label510:
RETURN 6
label508:
RETURN 7
bool function chained_and (bool a, bool b, bool c, bool d, bool e, bool f)
return a && b && c && d && e && f
endfunction
CAST ::temp248 a
JUMPF ::temp248 label164
CAST ::temp248 b
label164:
CAST ::temp249 ::temp248
JUMPF ::temp249 label165
CAST ::temp249 c
label165:
CAST ::temp250 ::temp249
JUMPF ::temp250 label166
CAST ::temp250 d
label166:
CAST ::temp251 ::temp250
JUMPF ::temp251 label167
CAST ::temp251 e
label167:
CAST ::temp252 ::temp251
JUMPF ::temp252 label168
CAST ::temp252 f
label168:
RETURN ::temp252
ASSIGN ::temp0 a
JUMPF ::temp0 label0
ASSIGN ::temp0 b
label0:
JUMPF ::temp0 label1
ASSIGN ::temp0 c
label1:
JUMPF ::temp0 label2
ASSIGN ::temp0 d
label2:
JUMPF ::temp0 label3
ASSIGN ::temp0 e
label3:
JUMPF ::temp0 label4
ASSIGN ::temp0 f
label4:
RETURN ::temp0
ASSIGN ::BOOL555 A
JUMPF ::BOOL555 label554
ASSIGN ::BOOL555 B
JUMPF ::BOOL555 label554
ASSIGN ::BOOL555 C
JUMPF ::BOOL555 label554
ASSIGN ::BOOL555 D
JUMPF ::BOOL555 label554
ASSIGN ::BOOL555 E
JUMPF ::BOOL555 label554
ASSIGN ::BOOL555 F
label554:
RETURN ::BOOL555
bool function and_constant1 (bool a)
return false && a
endfunction
RETURN false
ASSIGN ::temp0 False
JUMPF ::temp0 label0
ASSIGN ::temp0 a
label0:
RETURN ::temp0
RETURN FALSE
bool function and_constant2 (bool a)
return a && false
endfunction
CAST ::temp266 a
JUMPF ::temp266 label230
CAST ::temp266 false
label230:
RETURN ::temp266
ASSIGN ::temp0 a
JUMPF ::temp0 label0
ASSIGN ::temp0 False
label0:
RETURN ::temp0
RETURN FALSE
bool function complex_optimization (bool a, bool b)
return (a || true) && (b || true)
endfunction
CAST ::temp267 a
JUMPT ::temp267 label231
CAST ::temp267 true
label231:
CAST ::temp269 ::temp267
JUMPF ::temp269 label233
CAST ::temp268 b
JUMPT ::temp268 label232
CAST ::temp268 true
label232:
CAST ::temp269 ::temp268
label233:
RETURN ::temp269
ASSIGN ::temp0 a
JUMPT ::temp0 label0
ASSIGN ::temp0 True
label0:
JUMPF ::temp0 label1
ASSIGN ::temp0 b
JUMPT ::temp0 label1
ASSIGN ::temp0 True
label1:
RETURN ::temp0
RETURN TRUE