xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t, char const *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *malloc_check(const char *what, size_t n) {
  void *p = malloc(n);
  if (p == NULL) {
    fprintf(stderr, "Cannot allocate %zu bytes to %s\n", n, what);
    exit(2);
  }
  return p;
}


x86 assembly (clang, -O0):
<malloc_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117f <malloc_check+0x4f>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_check>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     114f <malloc_check+0x1f>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Cannot allocate %zu bytes to %s\0A\00"
define i8* @malloc_check(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i64, i64* %4
%13 = load i8*, i8** %3
%14 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %12, i8* %13)
%15 = call i32 @exit(i32 2)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Cannot allocate %zu bytes to %s\0A\00"
define noalias i8* @malloc_check(i8* %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %1, i8* %0)
%8 = tail call i32 @exit(i32 2)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void unload_mod3() { printf("unload mod3\n"); }


x86 assembly (clang, -O0):
<unload_mod3>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unload_mod3>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"unload mod3\0A\00"
define void @unload_mod3() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"unload mod3\00"
define void @unload_mod3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ wNotYet(char *);
char *wPopString();
void wBasMkDir() {
  char *name;
  name = wPopString();
  wNotYet("MkDir");
  free(name);
}


x86 assembly (clang, -O0):
<wBasMkDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <wPopString@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1050 <wNotYet@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasMkDir>:
push   %rbx
xor    %eax,%eax
call   1040 <wPopString@plt>
mov    %rax,%rbx
lea    0xebe(%rip),%rdi
call   1050 <wNotYet@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"MkDir\00"
define void @wBasMkDir() {
%1 = alloca i8*
%2 = call i8* (...) @wPopString()
store i8* %2, i8** %1
%3 = call i32 @wNotYet(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = call i32 @free(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"MkDir\00"
define void @wBasMkDir() {
%1 = tail call i8* (...) @wPopString()
%2 = tail call i32 @wNotYet(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int print_insn_spu(unsigned long insn, unsigned long memaddr) {
  printf("%.8x", insn);
  return 0;
}


x86 assembly (clang, -O0):
<print_insn_spu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_insn_spu>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.8x\00"
define i32 @print_insn_spu(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.8x\00"
define i32 @print_insn_spu(i64 %0, i64 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %0)
ret i32 0
}
void SpanishLightGun_Reset(void) {}


x86 assembly (clang, -O0):
<SpanishLightGun_Reset>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SpanishLightGun_Reset>:
ret

LLVM IR (-O0):
define void @SpanishLightGun_Reset() {
ret void
}

LLVM IR (-O2):
define void @SpanishLightGun_Reset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: look [-df] [-t char] string [file]\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"usage: look [-df] [-t char] string [file]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"usage: look [-df] [-t char] string [file]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 2)
unreachable
}
void foobar(int a, int b) {}


x86 assembly (clang, -O0):
<foobar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foobar>:
ret

LLVM IR (-O0):
define void @foobar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @foobar(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
scalar_t__ malloc(unsigned char);
unsigned char *auc1d(unsigned char X) {
  unsigned char *A = (unsigned char *)malloc(X * sizeof(unsigned char *));
  return A;
}


x86 assembly (clang, -O0):
<auc1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x3,%rax
movzbl %al,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<auc1d>:
shl    $0x3,%dil
movzbl %dil,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @auc1d(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i64
%6 = mul i64 %5, 8
%7 = trunc i64 %6 to i8
%8 = call i64 @malloc(i8 zeroext %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define i8* @auc1d(i8 zeroext %0) {
%2 = shl i8 %0, 3
%3 = tail call i64 @malloc(i8 zeroext %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ errAbort(char *);
void usage() {
  errAbort("dyStringTest - check for dyString\n"
           "usage:\n"
           "   dyStringTest\n"
           "\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <errAbort@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <errAbort@plt>

LLVM IR (-O0):
@.str = [59 x i8] c"dyStringTest - check for dyString\0Ausage:\0A dyStringTest\0A\0A\00"
define void @usage() {
%1 = call i32 @errAbort(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [59 x i8] c"dyStringTest - check for dyString\0Ausage:\0A dyStringTest\0A\0A\00"
define void @usage() {
%1 = tail call i32 @errAbort(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void COEX_Handler() { default_isr(); }


x86 assembly (clang, -O0):
<COEX_Handler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <default_isr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<COEX_Handler>:
xor    %eax,%eax
jmp    1030 <default_isr@plt>

LLVM IR (-O0):
define weak void @COEX_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @COEX_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int grantpt(int fd __attribute__((unused))) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<grantpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grantpt>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @grantpt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENOSYS
%4 = call i32 @__set_errno(i32 %3)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @grantpt(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i32 -1
}
int main() {
  int a = 1.1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned int frameidx_to_addr(int frameidx) { return frameidx * 0x1000; }


x86 assembly (clang, -O0):
<frameidx_to_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<frameidx_to_addr>:
mov    %edi,%eax
shl    $0xc,%eax
ret

LLVM IR (-O0):
define i32 @frameidx_to_addr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4096
ret i32 %4
}

LLVM IR (-O2):
define i32 @frameidx_to_addr(i32 %0) {
%2 = shl nsw i32 %0, 12
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ HAL_IncTick();
int /*<<< orphan*/ HAL_SYSTICK_IRQHandler();
void SysTick_Handler(void) {
  HAL_IncTick();
  HAL_SYSTICK_IRQHandler();
}


x86 assembly (clang, -O0):
<SysTick_Handler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <HAL_IncTick@plt>
mov    $0x0,%al
call   1030 <HAL_SYSTICK_IRQHandler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysTick_Handler>:
push   %rax
xor    %eax,%eax
call   1040 <HAL_IncTick@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <HAL_SYSTICK_IRQHandler@plt>

LLVM IR (-O0):
define void @SysTick_Handler() {
%1 = call i32 (...) @HAL_IncTick()
%2 = call i32 (...) @HAL_SYSTICK_IRQHandler()
ret void
}

LLVM IR (-O2):
define void @SysTick_Handler() {
%1 = tail call i32 (...) @HAL_IncTick()
%2 = tail call i32 (...) @HAL_SYSTICK_IRQHandler()
ret void
}
int gt(int l, int r) { return l > r; }


x86 assembly (clang, -O0):
<gt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt>:
xor    %eax,%eax
cmp    %esi,%edi
setg   %al
ret

LLVM IR (-O0):
define i32 @gt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @gt(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
__typeof__(realloc(1, 1)) test_realloc_105(void) { return realloc(1, 1); }


x86 assembly (clang, -O0):
<test_realloc_105>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
mov    %rsi,%rdi
call   1030 <realloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_realloc_105>:
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @test_realloc_105() {
%1 = call i8* @realloc(i8* inttoptr (i64 1 to i8*), i64 1)
ret i8* %1
}

LLVM IR (-O2):
define noalias i8* @test_realloc_105() {
%1 = tail call dereferenceable_or_null(1) i8* @realloc(i8* inttoptr (i64 1 to i8*), i64 1)
ret i8* %1
}
int test_imm_C8uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xC8 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C8uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0xc8,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C8uint64_midword_reg>:
test   $0xc80000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C8uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 200
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_C8uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 13107200
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void html_begin(char *title) {
  printf("<html> <head>\n");
  printf("<title>%s</title>\n", title);
  printf("</head>\n\n");
  printf("<body>\n");
}


x86 assembly (clang, -O0):
<html_begin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_begin>:
push   %rbx
mov    %rdi,%rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"<html> <head>\0A\00"
@.str.1 = [19 x i8] c"<title>%s</title>\0A\00"
@.str.2 = [10 x i8] c"</head>\0A\0A\00"
@.str.3 = [8 x i8] c"<body>\0A\00"
define void @html_begin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"<title>%s</title>\0A\00"
@str = [14 x i8] c"<html> <head>\00"
@str.4 = [9 x i8] c"</head>\0A\00"
@str.5 = [7 x i8] c"<body>\00"
define void @html_begin(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int diminuto_ipc6_close(int);
int diminuto_ping6_close(int fd) { return diminuto_ipc6_close(fd); }


x86 assembly (clang, -O0):
<diminuto_ping6_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <diminuto_ipc6_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diminuto_ping6_close>:
jmp    1030 <diminuto_ipc6_close@plt>

LLVM IR (-O0):
define i32 @diminuto_ping6_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @diminuto_ipc6_close(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @diminuto_ping6_close(i32 %0) {
%2 = tail call i32 @diminuto_ipc6_close(i32 %0)
ret i32 %2
}
/* Variables and functions */
unsigned char *big_array();
void use_big_array_bad() {
  unsigned char *b = big_array();
  b[999999999] = 'Y';
}


x86 assembly (clang, -O0):
<use_big_array_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <big_array@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x59,0x3b9ac9ff(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_big_array_bad>:
push   %rax
xor    %eax,%eax
call   1030 <big_array@plt>
movb   $0x59,0x3b9ac9ff(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @use_big_array_bad() {
%1 = alloca i8*
%2 = call i8* (...) @big_array()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 999999999
store i8 89, i8* %4
ret void
}

LLVM IR (-O2):
define void @use_big_array_bad() {
%1 = tail call i8* (...) @big_array()
%2 = getelementptr inbounds i8, i8* %1, i64 999999999
store i8 89, i8* %2
ret void
}
int x86_perf_get_lbr(struct x86_pmu_lbr *lbr) { return -1; }


x86 assembly (clang, -O0):
<x86_perf_get_lbr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<x86_perf_get_lbr>:
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.x86_pmu_lbr = type opaque
define i32 @x86_perf_get_lbr(%struct.x86_pmu_lbr* %0) {
%2 = alloca %struct.x86_pmu_lbr*
store %struct.x86_pmu_lbr* %0, %struct.x86_pmu_lbr** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.x86_pmu_lbr = type opaque
define i32 @x86_perf_get_lbr(%struct.x86_pmu_lbr* nocapture readnone %0) {
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *display;
};
typedef TYPE_1__ XFocusInEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XFocusInEvent_display(void *_p, void *_v) {
  ((XFocusInEvent *)_p)->display = (Display *)_v;
}


x86 assembly (clang, -O0):
<set_XFocusInEvent_display>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFocusInEvent_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XFocusInEvent_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XFocusInEvent_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ecore_evas_shutdown();
int /*<<< orphan*/ tet_infoline(char *);
void cleanup(void) {
  tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
  ecore_evas_shutdown();
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <tet_infoline@plt>
mov    $0x0,%al
call   1040 <ecore_evas_shutdown@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <tet_infoline@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ecore_evas_shutdown@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"[[ TET_MSG ]]:: ============ Cleanup ============ \00"
define void @cleanup() {
%1 = call i32 @tet_infoline(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @ecore_evas_shutdown()
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"[[ TET_MSG ]]:: ============ Cleanup ============ \00"
define void @cleanup() {
%1 = tail call i32 @tet_infoline(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @ecore_evas_shutdown()
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void ssdp_wait_random(int s) {
  if (!s)
    return;
  srand(time(NULL));
  sleep(rand() % s);
}


x86 assembly (clang, -O0):
<ssdp_wait_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115a <ssdp_wait_random+0x1a>
jmp    117c <ssdp_wait_random+0x3c>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%edi
call   1050 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssdp_wait_random>:
test   %edi,%edi
je     1167 <ssdp_wait_random+0x27>
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%edi
pop    %rbx
jmp    1050 <sleep@plt>
ret

LLVM IR (-O0):
define void @ssdp_wait_random(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
br label %13
6: ; preds = %1
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
%9 = call i32 (...) @rand()
%10 = load i32, i32* %2
%11 = srem i32 %9, %10
%12 = call i32 @sleep(i32 %11)
br label %13
13: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @ssdp_wait_random(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i32 @time(i32* null)
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, %0
%8 = tail call i32 @sleep(i32 %7)
br label %9
9: ; preds = %1, %3
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int _compare_strings(const void *v1, const void *v2) {
  const char *s1 = (const char *)v1;
  const char *s2 = (const char *)v2;
  int retval = strcmp(s1, s2);
  return retval == 0 ? 0 : retval * -1;
}


x86 assembly (clang, -O0):
<_compare_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1154 <_compare_strings+0x44>
xor    %eax,%eax
mov    %eax,-0x28(%rbp)
jmp    115b <_compare_strings+0x4b>
imul   $0xffffffff,-0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_compare_strings>:
push   %rax
call   1030 <strcmp@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_compare_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
store i8* %8, i8** %5
%9 = load i8*, i8** %4
store i8* %9, i8** %6
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @strcmp(i8* %10, i8* %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %2
br label %19
16: ; preds = %2
%17 = load i32, i32* %7
%18 = mul nsw i32 %17, -1
br label %19
19: ; preds = %16, %15
%20 = phi i32 [ 0, %15 ], [ %18, %16 ]
ret i32 %20
}

LLVM IR (-O2):
define i32 @_compare_strings(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
int BGBDT_MsImaAdpcm_MonoSamplesFromBlockSize(int sz) { return ((sz - 4) * 2); }


x86 assembly (clang, -O0):
<BGBDT_MsImaAdpcm_MonoSamplesFromBlockSize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x4,%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BGBDT_MsImaAdpcm_MonoSamplesFromBlockSize>:
lea    (%rdi,%rdi,1),%eax
add    $0xfffffff8,%eax
ret

LLVM IR (-O0):
define i32 @BGBDT_MsImaAdpcm_MonoSamplesFromBlockSize(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 4
%5 = mul nsw i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @BGBDT_MsImaAdpcm_MonoSamplesFromBlockSize(i32 %0) {
%2 = shl i32 %0, 1
%3 = add i32 %2, -8
ret i32 %3
}
__attribute__((gnu_)) int carmen_trunc(double X) { return (int)(X); }


x86 assembly (clang, -O0):
<carmen_trunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<carmen_trunc>:
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @carmen_trunc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @carmen_trunc(double %0) {
%2 = fptosi double %0 to i32
ret i32 %2
}
void g_block_mark(void *val) {}


x86 assembly (clang, -O0):
<g_block_mark>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_block_mark>:
ret

LLVM IR (-O0):
define void @g_block_mark(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @g_block_mark(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XEvent;

/* Variables and functions */
extern int shapeEvent(XEvent *ev) { return 0; }


x86 assembly (clang, -O0):
<shapeEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<shapeEvent>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @shapeEvent(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @shapeEvent(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ActivateTask(int);
int /*<<< orphan*/ SetRelAlarm(int);
int /*<<< orphan*/ WaitEvent(int);
int main(int argc, char *argv[]) {
  WaitEvent(0x01u);
  WaitEvent(0x02u);
  WaitEvent(0x04u);
  ActivateTask(0);
  ActivateTask(1);
  ActivateTask(2);
  SetRelAlarm(0);
  SetRelAlarm(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <WaitEvent@plt>
mov    $0x2,%edi
call   1050 <WaitEvent@plt>
mov    $0x4,%edi
call   1050 <WaitEvent@plt>
xor    %edi,%edi
call   1040 <ActivateTask@plt>
mov    $0x1,%edi
call   1040 <ActivateTask@plt>
mov    $0x2,%edi
call   1040 <ActivateTask@plt>
xor    %edi,%edi
call   1030 <SetRelAlarm@plt>
mov    $0x1,%edi
call   1030 <SetRelAlarm@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1050 <WaitEvent@plt>
mov    $0x2,%edi
call   1050 <WaitEvent@plt>
mov    $0x4,%edi
call   1050 <WaitEvent@plt>
xor    %edi,%edi
call   1040 <ActivateTask@plt>
mov    $0x1,%edi
call   1040 <ActivateTask@plt>
mov    $0x2,%edi
call   1040 <ActivateTask@plt>
xor    %edi,%edi
call   1030 <SetRelAlarm@plt>
mov    $0x1,%edi
call   1030 <SetRelAlarm@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @WaitEvent(i32 1)
%7 = call i32 @WaitEvent(i32 2)
%8 = call i32 @WaitEvent(i32 4)
%9 = call i32 @ActivateTask(i32 0)
%10 = call i32 @ActivateTask(i32 1)
%11 = call i32 @ActivateTask(i32 2)
%12 = call i32 @SetRelAlarm(i32 0)
%13 = call i32 @SetRelAlarm(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @WaitEvent(i32 1)
%4 = tail call i32 @WaitEvent(i32 2)
%5 = tail call i32 @WaitEvent(i32 4)
%6 = tail call i32 @ActivateTask(i32 0)
%7 = tail call i32 @ActivateTask(i32 1)
%8 = tail call i32 @ActivateTask(i32 2)
%9 = tail call i32 @SetRelAlarm(i32 0)
%10 = tail call i32 @SetRelAlarm(i32 1)
ret i32 0
}
void RTLogLogger(void) {}


x86 assembly (clang, -O0):
<RTLogLogger>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTLogLogger>:
ret

LLVM IR (-O0):
define void @RTLogLogger() {
ret void
}

LLVM IR (-O2):
define void @RTLogLogger() {
ret void
}
void INT_TM04(void) {}


x86 assembly (clang, -O0):
<INT_TM04>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_TM04>:
ret

LLVM IR (-O0):
define void @INT_TM04() {
ret void
}

LLVM IR (-O2):
define void @INT_TM04() {
ret void
}
int towupper(int c) { return (c >= 'a') && (c <= 'z') ? c - 'a' + 'A' : c; }


x86 assembly (clang, -O0):
<towupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     112c <towupper+0x2c>
cmpl   $0x7a,-0x4(%rbp)
jg     112c <towupper+0x2c>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <towupper+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<towupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @towupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 97
%11 = add nsw i32 %10, 65
br label %14
12: ; preds = %5, %1
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %11, %8 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @towupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int arith_div(int, int);
int arith_ceiling(int x, int y) { return arith_div(x, y) + (0 != x % y); }


x86 assembly (clang, -O0):
<arith_ceiling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <arith_div@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%eax
xor    %ecx,%ecx
cmp    %edx,%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arith_ceiling>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <arith_div@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ebx
cmp    $0x1,%edx
sbb    $0xffffffff,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @arith_ceiling(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @arith_div(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = srem i32 %8, %9
%11 = icmp ne i32 0, %10
%12 = zext i1 %11 to i32
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @arith_ceiling(i32 %0, i32 %1) {
%3 = tail call i32 @arith_div(i32 %0, i32 %1)
%4 = srem i32 %0, %1
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %3, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ udp_send(float *, int);
int /*<<< orphan*/ usleep(int);
int main(void) {
  float euler[] = {0, 0, 0};
  while (1) {
    euler[0] += 1.0 / 180.0 * 3.14159;
    udp_send(euler, 3);
    usleep(100000);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1030 <memset@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <udp_send@plt>
mov    $0x186a0,%edi
call   1050 <usleep@plt>
jmp    114f <main+0x1f>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
cvtss2sd %xmm0,%xmm0
addsd  0xeb4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <udp_send@plt>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
movss  0x4(%rsp),%xmm0
jmp    1140 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x float]
store i32 0, i32* %1
%3 = bitcast [3 x float]* %2 to i8*
br label %4
4: ; preds = %0, %4
%5 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%6 = load float, float* %5
%7 = fpext float %6 to double
%8 = fadd double %7, 0x3F91DF45A50DE271
%9 = fptrunc double %8 to float
store float %9, float* %5
%10 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
%11 = call i32 @udp_send(float* %10, i32 3)
%12 = call i32 @usleep(i32 100000)
br label %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [3 x float]
%2 = bitcast [3 x float]* %1 to i8*
%3 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 1
%4 = bitcast float* %3 to i64*
store i64 0, i64* %4
%5 = getelementptr inbounds [3 x float], [3 x float]* %1, i64 0, i64 0
br label %6
6: ; preds = %6, %0
%7 = phi float [ %13, %6 ], [ 0.000000e+00, %0 ]
%8 = fpext float %7 to double
%9 = fadd double %8, 0x3F91DF45A50DE271
%10 = fptrunc double %9 to float
store float %10, float* %5
%11 = call i32 @udp_send(float* %5, i32 3)
%12 = call i32 @usleep(i32 100000)
%13 = load float, float* %5
br label %6
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  short y1;
};
typedef TYPE_1__ XSegment;

/* Variables and functions */
void set_XSegment_y1(void *_p, short _v) { ((XSegment *)_p)->y1 = (short)_v; }


x86 assembly (clang, -O0):
<set_XSegment_y1>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XSegment_y1>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i16 }
define void @set_XSegment_y1(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i16 %5, i16* %8
ret void
}

LLVM IR (-O2):
define void @set_XSegment_y1(i8* nocapture writeonly %0, i16 signext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cleanup_char(char **x) {
  if (x == NULL)
    return;
  free(*x);
}


x86 assembly (clang, -O0):
<cleanup_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <cleanup_char+0x1c>
jmp    1138 <cleanup_char+0x28>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_char>:
test   %rdi,%rdi
je     111d <cleanup_char+0xd>
mov    (%rdi),%rdi
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @cleanup_char(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = icmp eq i8** %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %10
6: ; preds = %1
%7 = load i8**, i8*** %2
%8 = load i8*, i8** %7
%9 = call i32 @free(i8* %8)
br label %10
10: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @cleanup_char(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = tail call i32 @free(i8* %4)
br label %6
6: ; preds = %1, %3
ret void
}
int mylib2_fct1() { printf("enter %s\n", __func__); }


x86 assembly (clang, -O0):
<mylib2_fct1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mylib2_fct1>:
lea    0xee9(%rip),%rdi
lea    0xeec(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"enter %s\0A\00"
@__func__.mylib2_fct1 = [12 x i8] c"mylib2_fct1\00"
define i32 @mylib2_fct1() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.mylib2_fct1, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [10 x i8] c"enter %s\0A\00"
@__func__.mylib2_fct1 = [12 x i8] c"mylib2_fct1\00"
define i32 @mylib2_fct1() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.mylib2_fct1, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void writelines(char *lineptr[], int nlines, char *cache, int cache_size) {
  int i;
  for (i = 0; i < nlines; i++)
    printf("%s", *lineptr++);
}


x86 assembly (clang, -O0):
<writelines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1167 <writelines+0x57>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    112d <writelines+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writelines>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <writelines+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1130 <writelines+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @writelines(i8** %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %20, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %6
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
%17 = load i8*, i8** %15
%18 = ptrtoint i8* %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %14
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 1
store i32 %22, i32* %9
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @writelines(i8** nocapture %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %16
6: ; preds = %4, %6
%7 = phi i32 [ %14, %6 ], [ 0, %4 ]
%8 = phi i8** [ %9, %6 ], [ %0, %4 ]
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %8
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, %1
br i1 %15, label %16, label %6
16: ; preds = %6, %4
ret void
}
int some_work(int sum) {
  int i;
  for (i = 0; i < 10; i++)
    sum += i;
  return sum;
}


x86 assembly (clang, -O0):
<some_work>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    112f <some_work+0x2f>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <some_work+0xe>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<some_work>:
lea    0x2d(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @some_work(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = add nsw i32 %9, %8
store i32 %10, i32* %2
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @some_work(i32 %0) {
%2 = add i32 %0, 45
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ lcd_control_init();
int /*<<< orphan*/ lcd_port_init();
void lcd_init(void) {
  lcd_port_init();
  lcd_control_init();
}


x86 assembly (clang, -O0):
<lcd_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <lcd_port_init@plt>
mov    $0x0,%al
call   1030 <lcd_control_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_init>:
push   %rax
xor    %eax,%eax
call   1040 <lcd_port_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <lcd_control_init@plt>

LLVM IR (-O0):
define void @lcd_init() {
%1 = call i32 (...) @lcd_port_init()
%2 = call i32 (...) @lcd_control_init()
ret void
}

LLVM IR (-O2):
define void @lcd_init() {
%1 = tail call i32 (...) @lcd_port_init()
%2 = tail call i32 (...) @lcd_control_init()
ret void
}
/* Variables and functions */
int read(int, unsigned char *, int);
unsigned char read_char(int fd) {
  unsigned char c;
  int result;
  do {
    result = read(fd, &c, 1);
  } while (result <= 0);
  return c;
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    111b <read_char+0xb>
movzbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x7(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %eax,%eax
jle    1120 <read_char+0x10>
mov    0x7(%rsp),%al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define zeroext i8 @read_char(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* %2
%7 = call i32 @read(i32 %6, i8* %3, i32 1)
store i32 %7, i32* %4
br label %8
8: ; preds = %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %8
%12 = load i8, i8* %3
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @read_char(i32 %0) {
%2 = alloca i8
br label %3
3: ; preds = %3, %1
%4 = call i32 @read(i32 %0, i8* %2, i32 1)
%5 = icmp slt i32 %4, 1
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = load i8, i8* %2
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ LPSPI1_DriverIRQHandler();
__attribute__((weak)) void LPSPI1_IRQHandler(void) {
  LPSPI1_DriverIRQHandler();
}


x86 assembly (clang, -O0):
<LPSPI1_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <LPSPI1_DriverIRQHandler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPSPI1_IRQHandler>:
xor    %eax,%eax
jmp    1030 <LPSPI1_DriverIRQHandler@plt>

LLVM IR (-O0):
define weak void @LPSPI1_IRQHandler() {
%1 = call i32 (...) @LPSPI1_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @LPSPI1_IRQHandler() {
%1 = tail call i32 (...) @LPSPI1_DriverIRQHandler()
ret void
}
void gtk_notebook_popup_disable() {}


x86 assembly (clang, -O0):
<gtk_notebook_popup_disable>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtk_notebook_popup_disable>:
ret

LLVM IR (-O0):
define void @gtk_notebook_popup_disable() {
ret void
}

LLVM IR (-O2):
define void @gtk_notebook_popup_disable() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  char name[] = "Zed";
  int areas[] = {10, 12, 13, 14, 20, name[2]};
  printf("5th element: %ld.\n", areas[5]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0xa,-0x20(%rbp)
movl   $0xc,-0x1c(%rbp)
movl   $0xd,-0x18(%rbp)
movl   $0xe,-0x14(%rbp)
movl   $0x14,-0x10(%rbp)
movsbl -0x6(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x64,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.name = [4 x i8] c"Zed\00"
@.str = [19 x i8] c"5th element: %ld.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [6 x i32]
store i32 0, i32* %1
%4 = bitcast [4 x i8]* %2 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
store i32 10, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 12, i32* %6
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32 13, i32* %7
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 14, i32* %8
%9 = getelementptr inbounds i32, i32* %8, i64 1
store i32 20, i32* %9
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
store i32 %13, i32* %10
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 5
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"5th element: %ld.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 100)
ret i32 0
}