Skip to content

Instantly share code, notes, and snippets.

@sharth
Last active August 29, 2015 14:07
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 sharth/691452010c1e935bf384 to your computer and use it in GitHub Desktop.
Save sharth/691452010c1e935bf384 to your computer and use it in GitHub Desktop.
; Function Attrs: nounwind ssp uwtable
define i32 @main() #0 {
%1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([3 x i8]* @.str, i64 0, i64 0), double 3.500000e+00) #3
ret i32 0
}
LCPI0_0:
.quad 4615063718147915776 ## double 3.5
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 4, 0x90
_main: ## @main
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp2:
.cfi_def_cfa_offset 16
Ltmp3:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp4:
.cfi_def_cfa_register %rbp
leaq L_.str(%rip), %rdi
movsd LCPI0_0(%rip), %xmm0
movb $1, %al
callq _printf
xorl %eax, %eax
popq %rbp
retq
#include <stdio.h>
float mid(float a, float b);
int main() {
printf("%f", mid(2.0, 5.0));
return 0;
}
float mid(float a, float b) {
return (a + b)*0.5;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment