xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ writememw65816(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ zeropage();
void stzZp16(void) { writememw65816(zeropage(), 0); }


x86 assembly (clang, -O0):
<stzZp16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <zeropage@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <writememw65816@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<stzZp16>:
push   %rax
xor    %eax,%eax
call   1030 <zeropage@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <writememw65816@plt>

LLVM IR (-O0):
define void @stzZp16() {
%1 = call i32 (...) @zeropage()
%2 = call i32 @writememw65816(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @stzZp16() {
%1 = tail call i32 (...) @zeropage()
%2 = tail call i32 @writememw65816(i32 %1, i32 0)
ret void
}
int charToDigit(char c) {
  if ((c >= '0') && (c <= '9')) {
    return c - '0';
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<charToDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <charToDigit+0x33>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <charToDigit+0x33>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <charToDigit+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<charToDigit>:
lea    -0x30(%rdi),%ecx
lea    -0x30(%rdi),%edx
xor    %eax,%eax
cmp    $0xa,%cl
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @charToDigit(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %16
15: ; preds = %7, %1
store i32 0, i32* %2
br label %16
16: ; preds = %15, %11
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @charToDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -48
%6 = select i1 %3, i32 %5, i32 0
ret i32 %6
}
void rop3_187_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = *D | stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_187_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_187_0_1>:
mov    %esi,%eax
not    %eax
movzbl (%rdi),%r8d
mov    %r8d,%ecx
or     %eax,%ecx
and    %ecx,%esi
and    %edx,%eax
not    %edx
and    %ecx,%edx
and    %r8d,%eax
or     %esi,%eax
or     %edx,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_187_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = zext i8 %20 to i32
%22 = load i8, i8* %5
%23 = zext i8 %22 to i32
%24 = and i32 %21, %23
%25 = load i8, i8* %7
%26 = zext i8 %25 to i32
%27 = load i8, i8* %6
%28 = zext i8 %27 to i32
%29 = xor i32 %28, -1
%30 = and i32 %26, %29
%31 = or i32 %24, %30
%32 = load i8, i8* %6
%33 = zext i8 %32 to i32
%34 = load i8, i8* %5
%35 = zext i8 %34 to i32
%36 = xor i32 %35, -1
%37 = and i32 %33, %36
%38 = load i8*, i8** %4
%39 = load i8, i8* %38
%40 = zext i8 %39 to i32
%41 = and i32 %37, %40
%42 = or i32 %31, %41
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
store i8 %43, i8* %44
ret void
}

LLVM IR (-O2):
define void @rop3_187_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %1 to i32
%5 = xor i32 %4, -1
%6 = load i8, i8* %0
%7 = zext i8 %6 to i32
%8 = trunc i32 %5 to i8
%9 = or i8 %6, %8
%10 = zext i8 %9 to i32
%11 = and i8 %9, %1
%12 = zext i8 %11 to i32
%13 = zext i8 %2 to i32
%14 = xor i32 %13, -1
%15 = and i32 %10, %14
%16 = and i32 %13, %5
%17 = and i32 %16, %7
%18 = or i32 %17, %12
%19 = or i32 %18, %15
%20 = trunc i32 %19 to i8
store i8 %20, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AttitudeActualHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void AttitudeActualUpdated() { UAVObjUpdated(AttitudeActualHandle()); }


x86 assembly (clang, -O0):
<AttitudeActualUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <AttitudeActualHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<AttitudeActualUpdated>:
push   %rax
xor    %eax,%eax
call   1040 <AttitudeActualHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @AttitudeActualUpdated() {
%1 = call i32 (...) @AttitudeActualHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @AttitudeActualUpdated() {
%1 = tail call i32 (...) @AttitudeActualHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
int menor(int x, int y) {
  if (x < y)
    return x;
  return y;
}


x86 assembly (clang, -O0):
<menor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <menor+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <menor+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<menor>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @menor(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
f() {
  struct A {
    int i;
  };
  struct A;
  struct A yo;
  yo.i = 3;
}


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

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

LLVM IR (-O0):
%struct.A = type { i32 }
define i32 @f() {
%1 = alloca i32
%2 = alloca %struct.A
%3 = getelementptr inbounds %struct.A, %struct.A* %2, i32 0, i32 0
store i32 3, i32* %3
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @f() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void CloseComport(int comport_number) { close(comport_number); }


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

x86 assembly (clang, -O2):
<CloseComport>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @CloseComport(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ CERTIFICATEPOLICIES;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ CERTIFICATEPOLICIES_it;
CERTIFICATEPOLICIES *CERTIFICATEPOLICIES_new(void) {
  return (CERTIFICATEPOLICIES *)ASN1_item_new(&CERTIFICATEPOLICIES_it);
}


x86 assembly (clang, -O0):
<CERTIFICATEPOLICIES_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CERTIFICATEPOLICIES_new>:
mov    0x2ec9(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@CERTIFICATEPOLICIES_it = global i32 0
define i32* @CERTIFICATEPOLICIES_new() {
%1 = call i64 @ASN1_item_new(i32* @CERTIFICATEPOLICIES_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@CERTIFICATEPOLICIES_it = global i32 0
define i32* @CERTIFICATEPOLICIES_new() {
%1 = tail call i64 @ASN1_item_new(i32* @CERTIFICATEPOLICIES_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main() {
  int a;
  char b;
  b = getchar();
  if (b >= 'a' && b <= 'z') {
    a = 122 - b;
    b = 97 + a;
  }
  printf("%c\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x61,%eax
jl     116a <main+0x4a>
movsbl -0x9(%rbp),%eax
cmp    $0x7a,%eax
jg     116a <main+0x4a>
movsbl -0x9(%rbp),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x61,%eax
mov    %al,-0x9(%rbp)
lea    0xe8f(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
lea    -0x61(%rax),%ecx
mov    $0xdb,%dl
sub    %al,%dl
cmp    $0x1a,%cl
movzbl %dl,%ecx
movzbl %al,%eax
cmovb  %ecx,%eax
movsbl %al,%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = icmp sge i32 %6, 97
br i1 %7, label %8, label %19
8: ; preds = %0
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp sle i32 %10, 122
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = sub nsw i32 122, %14
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = add nsw i32 97, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
br label %19
19: ; preds = %12, %8, %0
%20 = load i8, i8* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = add i8 %1, -97
%3 = icmp ult i8 %2, 26
%4 = sub i8 -37, %1
%5 = select i1 %3, i8 %4, i8 %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR85_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


x86 assembly (clang, -O0):
<U_WMR85_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <U_WMRNOTIMPLEMENTED_swap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMR85_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

LLVM IR (-O0):
define void @U_WMR85_swap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_WMR85_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
void av_buffer_allocz() {}


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

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

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

LLVM IR (-O2):
define void @av_buffer_allocz() {
ret void
}
int func1(int argc, char *argv[]) {
  int i, j;
  i = argc - 4;
  j = i++;
  j = i <= 5;
  return j;
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    %eax,-0x18(%rbp)
cmpl   $0x5,-0x14(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
xor    %eax,%eax
cmp    $0x9,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @func1(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 4
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
store i32 %9, i32* %6
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 5
%13 = zext i1 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
ret i32 %14
}

LLVM IR (-O2):
define i32 @func1(i32 %0, i8** nocapture readnone %1) {
%3 = icmp slt i32 %0, 9
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned short count_styles;
};
typedef TYPE_1__ XIMStyles;

/* Variables and functions */
void set_XIMStyles_count_styles(void *_p, unsigned short _v) {
  ((XIMStyles *)_p)->count_styles = (unsigned short)_v;
}


x86 assembly (clang, -O0):
<set_XIMStyles_count_styles>:
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_XIMStyles_count_styles>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i16 }
define void @set_XIMStyles_count_styles(i8* %0, i16 zeroext %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_XIMStyles_count_styles(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128InterruptPinP__6__Irq__clear();
void Atm128GpioInterruptC__0__Atm128Interrupt__clear(void) {
  HplAtm128InterruptPinP__6__Irq__clear();
}


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

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

LLVM IR (-O0):
define void @Atm128GpioInterruptC__0__Atm128Interrupt__clear() {
%1 = call i32 (...) @HplAtm128InterruptPinP__6__Irq__clear()
ret void
}

LLVM IR (-O2):
define void @Atm128GpioInterruptC__0__Atm128Interrupt__clear() {
%1 = tail call i32 (...) @HplAtm128InterruptPinP__6__Irq__clear()
ret void
}
xmalloc(size) int size;
{
  register int value = malloc(size);
  if (value == 0)
    fatal("Virtual memory full.");
  return value;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
call   1030 <malloc@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114f <xmalloc+0x2f>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <fatal@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
movslq %edi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %ebx,%ebx
jne    113e <xmalloc+0x1e>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <fatal@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Virtual memory full.\00"
define i32 @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
%7 = ptrtoint i8* %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [21 x i8] c"Virtual memory full.\00"
define i32 @xmalloc(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ thingo();
int main() {
  printf("Yo!\n");
  thingo();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <thingo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <thingo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Yo!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @thingo()
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"Yo!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @thingo()
ret i32 0
}
void copy_plan(int *ndst, int *dst, float *time_dst, int nsrc, int *src,
               float *time_src) {
  *ndst = nsrc;
  memcpy(dst, src, sizeof(int) * nsrc);
  memcpy(time_dst, time_src, sizeof(float) * nsrc);
}


x86 assembly (clang, -O0):
<copy_plan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
movslq -0x1c(%rbp),%rdx
shl    $0x2,%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0x1c(%rbp),%rdx
shl    $0x2,%rdx
call   1030 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_plan>:
push   %r15
push   %r14
push   %rbx
mov    %r9,%r14
mov    %rdx,%r15
mov    %ecx,(%rdi)
movslq %ecx,%rbx
shl    $0x2,%rbx
mov    %rsi,%rdi
mov    %r8,%rsi
mov    %rbx,%rdx
call   1030 <memcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @copy_plan(i32* %0, i32* %1, float* %2, i32 %3, i32* %4, float* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca float*
%10 = alloca i32
%11 = alloca i32*
%12 = alloca float*
store i32* %0, i32** %7
store i32* %1, i32** %8
store float* %2, float** %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store float* %5, float** %12
%13 = load i32, i32* %10
%14 = load i32*, i32** %7
store i32 %13, i32* %14
%15 = load i32*, i32** %8
%16 = bitcast i32* %15 to i8*
%17 = load i32*, i32** %11
%18 = bitcast i32* %17 to i8*
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = mul i64 4, %20
%22 = load float*, float** %9
%23 = bitcast float* %22 to i8*
%24 = load float*, float** %12
%25 = bitcast float* %24 to i8*
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = mul i64 4, %27
ret void
}

LLVM IR (-O2):
define void @copy_plan(i32* nocapture writeonly %0, i32* nocapture writeonly %1, float* nocapture writeonly %2, i32 %3, i32* nocapture %4, float* nocapture %5) {
store i32 %3, i32* %0
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %4 to i8*
%9 = sext i32 %3 to i64
%10 = shl nsw i64 %9, 2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %7, i8* align 4 %8, i64 %10, i1 false)
%11 = bitcast float* %2 to i8*
%12 = bitcast float* %5 to i8*
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %11, i8* align 4 %12, i64 %10, i1 false)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t backtrace(void **, int);
int /*<<< orphan*/ backtrace_symbols_fd(void **, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
void log_backtrace(FILE *log) {
  void *buf[4000];
  size_t len;
  len = backtrace(buf, 4000);
  backtrace_symbols_fd(buf, len, fileno(log));
}


x86 assembly (clang, -O0):
<log_backtrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7d30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x7d10(%rbp),%rdi
mov    $0xfa0,%esi
call   1040 <backtrace@plt>
mov    %rax,-0x7d18(%rbp)
lea    -0x7d10(%rbp),%rax
mov    %rax,-0x7d28(%rbp)
mov    -0x7d18(%rbp),%rax
mov    %rax,-0x7d20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <fileno@plt>
mov    -0x7d28(%rbp),%rdi
mov    -0x7d20(%rbp),%rsi
mov    %eax,%edx
call   1030 <backtrace_symbols_fd@plt>
add    $0x7d30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_backtrace>:
push   %r15
push   %r14
push   %rbx
sub    $0x7d00,%rsp
mov    %rdi,%r15
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xfa0,%esi
call   1040 <backtrace@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1050 <fileno@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <backtrace_symbols_fd@plt>
add    $0x7d00,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @log_backtrace(i32* %0) {
%2 = alloca i32*
%3 = alloca [4000 x i8*]
%4 = alloca i64
store i32* %0, i32** %2
%5 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %3, i64 0, i64 0
%6 = call i64 @backtrace(i8** %5, i32 4000)
store i64 %6, i64* %4
%7 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %3, i64 0, i64 0
%8 = load i64, i64* %4
%9 = load i32*, i32** %2
%10 = call i32 @fileno(i32* %9)
%11 = call i32 @backtrace_symbols_fd(i8** %7, i64 %8, i32 %10)
ret void
}

LLVM IR (-O2):
define void @log_backtrace(i32* nocapture %0) {
%2 = alloca [4000 x i8*]
%3 = bitcast [4000 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4000 x i8*], [4000 x i8*]* %2, i64 0, i64 0
%5 = call i64 @backtrace(i8** %4, i32 4000)
%6 = call i32 @fileno(i32* %0)
%7 = call i32 @backtrace_symbols_fd(i8** %4, i64 %5, i32 %6)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t imd_read_le32(void *_ptr) {
  uint8_t *ptr = _ptr;
  return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24);
}


x86 assembly (clang, -O0):
<imd_read_le32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0xc(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imd_read_le32>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%edx
shl    $0x8,%ecx
or     (%rdi),%ecx
shl    $0x10,%edx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @imd_read_le32(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = shl i32 %11, 8
%13 = or i32 %8, %12
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = shl i32 %16, 16
%18 = or i32 %13, %17
%19 = load i32*, i32** %3
%20 = getelementptr inbounds i32, i32* %19, i64 3
%21 = load i32, i32* %20
%22 = shl i32 %21, 24
%23 = or i32 %18, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @imd_read_le32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 8
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = shl i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 12
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = shl i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
/* Variables and functions */
size_t AlignSize(const size_t size, const size_t align) {
  return (size + (align - 1)) & -align;
}


x86 assembly (clang, -O0):
<AlignSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
add    %rcx,%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AlignSize>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rsi
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @AlignSize(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 = load i64, i64* %4
%7 = sub i64 %6, 1
%8 = add i64 %5, %7
%9 = load i64, i64* %4
%10 = sub i64 0, %9
%11 = and i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @AlignSize(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %1
%6 = and i64 %4, %5
ret i64 %6
}
void free(void *p) { asm("int $0x40" ::"a"(68), "b"(13), "c"(p)); }


x86 assembly (clang, -O0):
<free>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x44,%eax
mov    $0xd,%ebx
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<free>:
push   %rbx
mov    %rdi,%rcx
mov    $0x44,%eax
mov    $0xd,%ebx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define void @free(i8* %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 68, i32 13, i8* %0)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ free(char *);
char *line_reading(int);
int /*<<< orphan*/ printf(char *, ...);
char *remove_repeating_chars(char *);
int main() {
  printf("Enter string\n");
  char *line = line_reading(50);
  char *lineCopy = remove_repeating_chars(line);
  printf("%s", lineCopy);
  free(line);
  free(lineCopy);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x32,%edi
call   1060 <line_reading@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <remove_repeating_chars@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x32,%edi
call   1070 <line_reading@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <remove_repeating_chars@plt>
mov    %rax,%rbx
lea    0xe81(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Enter string\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%5 = call i8* @line_reading(i32 50)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @remove_repeating_chars(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"Enter string\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i8* @line_reading(i32 50)
%3 = tail call i8* @remove_repeating_chars(i8* %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = tail call i32 @free(i8* %2)
%6 = tail call i32 @free(i8* %3)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ notify_pvcall(char *);
long pvGetBoardID(char byBoardNum) {
  notify_pvcall("f");
  return (0);
}


x86 assembly (clang, -O0):
<pvGetBoardID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pvGetBoardID>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <notify_pvcall@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"f\00"
define i64 @pvGetBoardID(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i64 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
define i64 @pvGetBoardID(i8 signext %0) {
%2 = tail call i32 @notify_pvcall(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i64 0
}
/* Variables and functions */
unsigned long __builtin_wasm_grow_memory(unsigned long);
long unsigned int f2(long unsigned int delta) {
  return __builtin_wasm_grow_memory(delta);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__builtin_wasm_grow_memory@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
jmp    1030 <__builtin_wasm_grow_memory@plt>

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

LLVM IR (-O2):
define i64 @f2(i64 %0) {
%2 = tail call i64 @__builtin_wasm_grow_memory(i64 %0)
ret i64 %2
}
char *strcpy(char *dest, const char *src) {
  char *cc;
  cc = dest;
  do
    *dest++ = *src;
  while (*src++);
  return cc;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
cmpb   $0x0,(%rsi,%rcx,1)
lea    0x1(%rcx),%rcx
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %12, %2
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8 %9, i8* %10
br label %12
12: ; preds = %7
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
%15 = load i8, i8* %13
%16 = icmp ne i8 %15, 0
br i1 %16, label %7, label %17
17: ; preds = %12
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %8, %3 ]
%5 = phi i8* [ %0, %2 ], [ %7, %3 ]
%6 = load i8, i8* %4
%7 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %6, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = load i8, i8* %4
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3
ret i8* %0
}
int vergleich(int wert1, int wert2, int wert3) {
  if (wert1 < wert2) {
    if (wert1 < wert3) {
      return wert1;
    } else {
      return wert3;
    }
  } else {
    if (wert2 < wert3) {
      return wert2;
    } else {
      return wert3;
    }
  }
}


x86 assembly (clang, -O0):
<vergleich>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <vergleich+0x3b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1130 <vergleich+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <vergleich+0x58>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <vergleich+0x58>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1152 <vergleich+0x52>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <vergleich+0x58>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vergleich>:
mov    %edx,%eax
cmp    %edx,%edi
cmovl  %edi,%eax
cmp    %esi,%eax
cmovge %esi,%eax
ret

LLVM IR (-O0):
define i32 @vergleich(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %19
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* %5
store i32 %16, i32* %4
br label %27
17: ; preds = %11
%18 = load i32, i32* %7
store i32 %18, i32* %4
br label %27
19: ; preds = %3
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %6
store i32 %24, i32* %4
br label %27
25: ; preds = %19
%26 = load i32, i32* %7
store i32 %26, i32* %4
br label %27
27: ; preds = %25, %23, %17, %15
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @vergleich(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %2
%5 = select i1 %4, i32 %0, i32 %2
%6 = icmp slt i32 %5, %1
%7 = select i1 %6, i32 %5, i32 %1
ret i32 %7
}
int sum(int a[], int n) {
  int sum;
  int i;
  sum = 0;
  for (i = 0; i < n; i++) {
    sum += i;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <sum+0x3c>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1119 <sum+0x19>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %esi,%esi
jle    1118 <sum+0x18>
lea    -0x1(%rsi),%eax
lea    -0x2(%rsi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rsi,1),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32* nocapture readnone %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %1, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %11, %1
%13 = add i32 %12, -1
br label %14
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %13, %4 ]
ret i32 %15
}
void prostokat(szer, wys) {
  for (szer = 0; szer <= 5; szer++) {
    putchar("*");
  }
}


x86 assembly (clang, -O0):
<prostokat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jg     114b <prostokat+0x3b>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1125 <prostokat+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prostokat>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <putchar@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
define void @prostokat(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %10, %2
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 5
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %5
13: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"*\00"
define void @prostokat(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @putchar to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long long __blsic_u64(unsigned long long);
unsigned long long func_blsic64(unsigned long long X) { return __blsic_u64(X); }


x86 assembly (clang, -O0):
<func_blsic64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__blsic_u64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_blsic64>:
jmp    1030 <__blsic_u64@plt>

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

LLVM IR (-O2):
define i64 @func_blsic64(i64 %0) {
%2 = tail call i64 @__blsic_u64(i64 %0)
ret i64 %2
}
int fs_unlink(const char *path) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fs_unlink(i8* nocapture readnone %0) {
ret i32 0
}
void lh_retrieve(void) {}


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

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

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

LLVM IR (-O2):
define void @lh_retrieve() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int clear_3d_facets(void) {
  int fail, *a, *b;
  double *c;
  fail = _ada_use_c2phc(584, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<clear_3d_facets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x248,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_3d_facets>:
mov    $0x248,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @clear_3d_facets() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca double*
%5 = load i32*, i32** %2
%6 = load i32*, i32** %3
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 584, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_3d_facets() {
%1 = tail call i32 @_ada_use_c2phc(i32 584, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *thread_func(void *arg) {
  int id = *((int *)arg);
  printf("Hello Thread!!! id = %d\n", id);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"Hello Thread!!! id = %d\0A\00"
define i8* @thread_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i8* null
}

LLVM IR (-O2):
@.str = [25 x i8] c"Hello Thread!!! id = %d\0A\00"
define noalias i8* @thread_func(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* null
}
void bar6(void) {}


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

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

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

LLVM IR (-O2):
define void @bar6() {
ret void
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void SSIDataPut(uint32_t ui32Base, uint32_t ui32Data) {
  ;

  ;
  while (
      !((*((volatile unsigned long *)(ui32Base + 0x0000000C))) & 0x00000002)) {
  }
  (*((volatile unsigned long *)(ui32Base + 0x00000008))) = ui32Data;
}


x86 assembly (clang, -O0):
<SSIDataPut>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112e <SSIDataPut+0x2e>
jmp    1133 <SSIDataPut+0x33>
jmp    110c <SSIDataPut+0xc>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIDataPut>:
testq  $0x2,0xc(%rdi)
je     1100 <SSIDataPut>
mov    %rsi,0x8(%rdi)
ret

LLVM IR (-O0):
define void @SSIDataPut(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
br label %5
5: ; preds = %13, %2
%6 = load i64, i64* %3
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, 2
%11 = icmp ne i64 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %14
13: ; preds = %5
br label %5
14: ; preds = %5
%15 = load i64, i64* %4
%16 = load i64, i64* %3
%17 = add i64 %16, 8
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
ret void
}

LLVM IR (-O2):
define void @SSIDataPut(i64 %0, i64 %1) {
%3 = add i64 %0, 12
%4 = inttoptr i64 %3 to i64*
br label %5
5: ; preds = %5, %2
%6 = load volatile i64, i64* %4
%7 = and i64 %6, 2
%8 = icmp eq i64 %7, 0
br i1 %8, label %5, label %9
9: ; preds = %5
%10 = add i64 %0, 8
%11 = inttoptr i64 %10 to i64*
store volatile i64 %1, i64* %11
ret void
}
char *find_and_null_eq(char *s) {
  while (*s) {
    if (*s == '=') {
      *s = 0;
      return s + 1;
    }
    ++s;
  }
  return 0;
}


x86 assembly (clang, -O0):
<find_and_null_eq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <find_and_null_eq+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    113d <find_and_null_eq+0x3d>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <find_and_null_eq+0x56>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <find_and_null_eq+0x8>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_and_null_eq>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
test   %cl,%cl
je     1126 <find_and_null_eq+0x26>
cmp    $0x3d,%cl
jne    1110 <find_and_null_eq+0x10>
movb   $0x0,-0x1(%rax)
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @find_and_null_eq(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 61
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i8*, i8** %3
store i8 0, i8* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %2
br label %21
17: ; preds = %8
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %4
20: ; preds = %4
store i8* null, i8** %2
br label %21
21: ; preds = %20, %13
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @find_and_null_eq(i8* %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %8, %7 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 0, label %9
i8 61, label %5
]
5: ; preds = %2
store i8 0, i8* %3
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %9
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
9: ; preds = %2, %5
%10 = phi i8* [ %6, %5 ], [ null, %2 ]
ret i8* %10
}