xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t retrieveRegisterValue(uint32_t *reg, int bitPos, int bitWidth) {
  uint32_t mask;
  mask = 1;
  mask = ~(((mask << bitWidth) - 1) << bitPos);
  mask &= *reg;
  mask >>= bitPos;
  return (uint16_t)mask;
}


x86 assembly (clang, -O0):
<retrieveRegisterValue>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
sub    $0x1,%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<retrieveRegisterValue>:
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
mov    %esi,%ecx
shl    %cl,%eax
not    %eax
and    (%rdi),%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @retrieveRegisterValue(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 1, i32* %7
%8 = load i32, i32* %7
%9 = load i32, i32* %6
%10 = shl i32 %8, %9
%11 = sub nsw i32 %10, 1
%12 = load i32, i32* %5
%13 = shl i32 %11, %12
%14 = xor i32 %13, -1
store i32 %14, i32* %7
%15 = load i32*, i32** %4
%16 = load i32, i32* %15
%17 = load i32, i32* %7
%18 = and i32 %17, %16
store i32 %18, i32* %7
%19 = load i32, i32* %5
%20 = load i32, i32* %7
%21 = ashr i32 %20, %19
store i32 %21, i32* %7
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @retrieveRegisterValue(i32* nocapture %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = shl i32 %5, %1
%7 = xor i32 %6, -1
%8 = load i32, i32* %0
%9 = and i32 %8, %7
%10 = ashr i32 %9, %1
ret i32 %10
}
long double func_p3(long double x) { return x; }


x86 assembly (clang, -O0):
<func_p3>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_p3>:
fldt   0x8(%rsp)
ret

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

LLVM IR (-O2):
define x86_fp80 @func_p3(x86_fp80 returned %0) {
ret x86_fp80 %0
}
int test_imm_35uint8_reg(unsigned char val) {
  return ((val) & (0x35 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_35uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x35,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_35uint8_reg>:
test   $0x35,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_35uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 53
%6 = icmp ne i32 %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_35uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 53
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ displayString();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ starBar();
int /*<<< orphan*/ stringConstant();
void test() {
  displayString();
  stringConstant();
  return;
  char p[] = "zhangwenhua";
  char *p2 = "zhangwenhua";
  printf("%p\n", "zhangwenhua");
  printf("%p\n", "zhangwenhua");
  printf("%p\n", p);
  printf("%p\n", p2);
  printf("%p\n", "zhangwenhua");
  starBar();
  char *p3 = "fenglin";
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <displayString@plt>
mov    $0x0,%al
call   1040 <stringConstant@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test() {
%1 = alloca [12 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = call i32 (...) @displayString()
%5 = call i32 (...) @stringConstant()
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 (...) @displayString()
%2 = tail call i32 (...) @stringConstant()
ret void
}
void iommu_detach_group(struct iommu_domain *domain,
                        struct iommu_group *group) {}


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

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

LLVM IR (-O0):
%struct.iommu_domain = type opaque
%struct.iommu_group = type opaque
define void @iommu_detach_group(%struct.iommu_domain* %0, %struct.iommu_group* %1) {
%3 = alloca %struct.iommu_domain*
%4 = alloca %struct.iommu_group*
store %struct.iommu_domain* %0, %struct.iommu_domain** %3
store %struct.iommu_group* %1, %struct.iommu_group** %4
ret void
}

LLVM IR (-O2):
%struct.iommu_domain = type opaque
%struct.iommu_group = type opaque
define void @iommu_detach_group(%struct.iommu_domain* nocapture %0, %struct.iommu_group* nocapture %1) {
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char *get_plain_text(void) {
  char *plain_text = malloc(sizeof(char));
  printf("input plain text: ");
  scanf("%s", plain_text);
  return plain_text;
}


x86 assembly (clang, -O0):
<get_plain_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_plain_text>:
push   %rbx
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"input plain text: \00"
@.str.1 = [3 x i8] c"%s\00"
define i8* @get_plain_text() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1)
store i8* %2, i8** %1
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %1
ret i8* %6
}

LLVM IR (-O2):
@.str = [19 x i8] c"input plain text: \00"
@.str.1 = [3 x i8] c"%s\00"
define i8* @get_plain_text() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i8* %1
}
int BPQSerialSetDebugMask(unsigned int hDevice, int DebugMask) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @BPQSerialSetDebugMask(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int port_in(unsigned int);
int /*<<< orphan*/ timing_uPause(int);
int stv5730_is_mute(unsigned int port) {
  timing_uPause(400);
  return ((port_in(port + 1) & 0x80) ? 0 : 1);
}


x86 assembly (clang, -O0):
<stv5730_is_mute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x190,%edi
call   1030 <timing_uPause@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <port_in@plt>
mov    %eax,%edx
and    $0x80,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stv5730_is_mute>:
push   %rbx
mov    %edi,%ebx
mov    $0x190,%edi
call   1030 <timing_uPause@plt>
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <port_in@plt>
xor    %ecx,%ecx
test   $0x80,%al
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @stv5730_is_mute(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @timing_uPause(i32 400)
%4 = load i32, i32* %2
%5 = add i32 %4, 1
%6 = call i32 @port_in(i32 %5)
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @stv5730_is_mute(i32 %0) {
%2 = tail call i32 @timing_uPause(i32 400)
%3 = add i32 %0, 1
%4 = tail call i32 @port_in(i32 %3)
%5 = lshr i32 %4, 7
%6 = and i32 %5, 1
%7 = xor i32 %6, 1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ kmp(char *, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char const *argv[]) {
  kmp("barfoothefoobarman", strlen("barfoothefoobarman"), "bar", 3);
  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)
lea    0xec3(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
lea    0xec1(%rip),%rdx
mov    $0x3,%ecx
call   1040 <kmp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xedc(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x3,%ecx
call   1040 <kmp@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"barfoothefoobarman\00"
@.str.1 = [4 x i8] c"bar\00"
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 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @kmp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"barfoothefoobarman\00"
@.str.1 = [4 x i8] c"bar\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @kmp(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret i32 0
}
/* Variables and functions */
double log(double);
double log2(double x) { return log(x) / log(2.0); }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
call   1030 <log@plt>
divsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log(double %3)
%5 = call double @log(double 2.000000e+00)
%6 = fdiv double %4, %5
ret double %6
}

LLVM IR (-O2):
define double @log2(double %0) {
%2 = tail call double @log(double %0)
%3 = fdiv double %2, 0x3FE62E42FEFA39EF
ret double %3
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *bgbmid_malloc(int sz) {
  void *ptr;
  ptr = malloc(sz);
  memset(ptr, 0, sz);
  return (ptr);
}


x86 assembly (clang, -O0):
<bgbmid_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bgbmid_malloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @bgbmid_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i32, i32* %2
%8 = call i32 @memset(i8* %6, i32 0, i32 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @bgbmid_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ __fd_m_add(int, int);
int __genwqe_dev_open(int, int);
int __m_open_add(int card_no, int mode) {
  int fd;
  fd = __genwqe_dev_open(card_no, mode);
  if (-1 != fd) {
    __fd_m_add(fd, card_no);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<__m_open_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <__genwqe_dev_open@plt>
mov    %eax,-0x10(%rbp)
mov    $0xffffffff,%eax
cmp    -0x10(%rbp),%eax
je     1161 <__m_open_add+0x41>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <__fd_m_add@plt>
movl   $0x1,-0x4(%rbp)
jmp    1168 <__m_open_add+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__m_open_add>:
push   %rbx
mov    %edi,%ebx
call   1040 <__genwqe_dev_open@plt>
cmp    $0xffffffff,%eax
je     113d <__m_open_add+0x1d>
mov    %eax,%edi
mov    %ebx,%esi
call   1030 <__fd_m_add@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @__m_open_add(i32 %0, i32 %1) {
%3 = tail call i32 @__genwqe_dev_open(i32 %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @__fd_m_add(i32 %3, i32 %0)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ USE(int *);
__attribute__((no)) void FUNC() {
  int x[4];
  USE(&x[0]);
}


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

x86 assembly (clang, -O2):
<FUNC>:
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1030 <USE@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @FUNC() {
%1 = alloca [4 x i32]
%2 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%3 = call i32 @USE(i32* %2)
ret void
}

LLVM IR (-O2):
define void @FUNC() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @USE(i32* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ backtrace(void **, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  void *buffer[32];
  (void)argc;
  (void)argv;
  backtrace(buffer, 32);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    $0x20,%esi
call   1030 <backtrace@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x108,%rsp
mov    %rsp,%rdi
mov    $0x20,%esi
call   1030 <backtrace@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds [32 x i8*], [32 x i8*]* %6, i64 0, i64 0
%10 = call i32 @backtrace(i8** %9, i32 32)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8*]
%4 = bitcast [32 x i8*]* %3 to i8*
%5 = getelementptr inbounds [32 x i8*], [32 x i8*]* %3, i64 0, i64 0
%6 = call i32 @backtrace(i8** %5, i32 32)
%7 = call i32 @exit(i32 0)
unreachable
}
int window() { return 0; }


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

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

LLVM IR (-O0):
define i32 @window() {
ret i32 0
}

LLVM IR (-O2):
define i32 @window() {
ret i32 0
}
int sgn(int val) { return (0 < val) - (val < 0); }


x86 assembly (clang, -O0):
<sgn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x4(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgn>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
sar    $0x1f,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @sgn(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 0, %3
%5 = zext i1 %4 to i32
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
%8 = zext i1 %7 to i32
%9 = sub nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @sgn(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = ashr i32 %0, 31
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ stderr;
DIR *getDirectoryFromString(char *dir) {
  DIR *directory;
  if ((directory = opendir(dir)) == NULL) {
    fprintf(stderr, "Can't open %s\n", dir);
    return 0;
  }
  return directory;
}


x86 assembly (clang, -O0):
<getDirectoryFromString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1169 <getDirectoryFromString+0x49>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xea9(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1171 <getDirectoryFromString+0x51>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDirectoryFromString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <opendir@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114c <getDirectoryFromString+0x2c>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"Can't open %s\0A\00"
define i32* @getDirectoryFromString(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @opendir(i8* %5)
store i32* %6, i32** %4
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %10)
store i32* null, i32** %2
br label %14
12: ; preds = %1
%13 = load i32*, i32** %4
store i32* %13, i32** %2
br label %14
14: ; preds = %12, %8
%15 = load i32*, i32** %2
ret i32* %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"Can't open %s\0A\00"
define noalias i32* @getDirectoryFromString(i8* %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %1, %4
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ doExit(int);
int /*<<< orphan*/ tnlShutdown(int);
int cmdExit(int argc, char *argv[]) {
  tnlShutdown(2);
  doExit(1);
  return (0);
}


x86 assembly (clang, -O0):
<cmdExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%edi
call   1040 <tnlShutdown@plt>
mov    $0x1,%edi
call   1030 <doExit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdExit>:
push   %rax
mov    $0x2,%edi
call   1040 <tnlShutdown@plt>
mov    $0x1,%edi
call   1030 <doExit@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cmdExit(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @tnlShutdown(i32 2)
%6 = call i32 @doExit(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @cmdExit(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @tnlShutdown(i32 2)
%4 = tail call i32 @doExit(i32 1)
ret i32 0
}
char *mlt_version_get_string() { return "0.9.9"; }


x86 assembly (clang, -O0):
<mlt_version_get_string>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlt_version_get_string>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"0.9.9\00"
define i8* @mlt_version_get_string() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"0.9.9\00"
define i8* @mlt_version_get_string() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ put_field(int /*<<< orphan*/, int);
int main() {
  put_field(0, 1);
  abort();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <put_field@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <put_field@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @put_field(i32 0, i32 1)
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @put_field(i32 0, i32 1)
%2 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ print_code_position(char *, int);
int /*<<< orphan*/ print_current_state(char *, char *, int);
int /*<<< orphan*/ stderr;
void deal_with_error(char *prog_code, int code_index, char *prog_array,
                     char *ptr) {
  fprintf(stderr, "Current BRAINFUCK stack:\n");
  print_current_state(prog_array, ptr, 30000);
  print_code_position(prog_code, code_index);
}


x86 assembly (clang, -O0):
<deal_with_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x7530,%edx
call   1030 <print_current_state@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <print_code_position@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deal_with_error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%rbp
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7530,%edx
call   1030 <print_current_state@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <print_code_position@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"Current BRAINFUCK stack:\0A\00"
define void @deal_with_error(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i32 @print_current_state(i8* %11, i8* %12, i32 30000)
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = call i32 @print_code_position(i8* %14, i32 %15)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"Current BRAINFUCK stack:\0A\00"
define void @deal_with_error(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @print_current_state(i8* %2, i8* %3, i32 30000)
%8 = tail call i32 @print_code_position(i8* %0, i32 %1)
ret void
}
int ft_strclen(char *s, char c) {
  char *tmp;
  tmp = s;
  if (s == 0)
    return (0);
  while (*tmp && *tmp != c)
    ++tmp;
  return (tmp - s);
}


x86 assembly (clang, -O0):
<ft_strclen>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112d <ft_strclen+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1189 <ft_strclen+0x89>
jmp    1132 <ft_strclen+0x32>
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     115a <ft_strclen+0x5a>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    116a <ft_strclen+0x6a>
jmp    117b <ft_strclen+0x7b>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1132 <ft_strclen+0x32>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclen>:
test   %rdi,%rdi
je     1124 <ft_strclen+0x24>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%ecx
add    $0x1,%eax
test   %cl,%cl
je     1123 <ft_strclen+0x23>
add    $0x1,%rdi
cmp    %sil,%cl
jne    1110 <ft_strclen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ft_strclen(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8*
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
store i8* %7, i8** %6
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %36
11: ; preds = %2
br label %12
12: ; preds = %26, %11
%13 = load i8*, i8** %6
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %12
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %20, %22
br label %24
24: ; preds = %17, %12
%25 = phi i1 [ false, %12 ], [ %23, %17 ]
br i1 %25, label %26, label %29
26: ; preds = %24
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
br label %12
29: ; preds = %24
%30 = load i8*, i8** %6
%31 = load i8*, i8** %4
%32 = ptrtoint i8* %30 to i64
%33 = ptrtoint i8* %31 to i64
%34 = sub i64 %32, %33
%35 = trunc i64 %34 to i32
store i32 %35, i32* %3
br label %36
36: ; preds = %29, %10
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @ft_strclen(i8* %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %16, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = icmp eq i8 %6, %1
%9 = or i1 %7, %8
%10 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %9, label %11, label %4
11: ; preds = %4
%12 = ptrtoint i8* %5 to i64
%13 = ptrtoint i8* %0 to i64
%14 = sub i64 %12, %13
%15 = trunc i64 %14 to i32
br label %16
16: ; preds = %2, %11
%17 = phi i32 [ %15, %11 ], [ 0, %2 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ hook(char *);
void init(void) { hook("init() called inside missing-export."); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"init() called inside missing-export.\00"
define void @init() {
%1 = call i32 @hook(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"init() called inside missing-export.\00"
define void @init() {
%1 = tail call i32 @hook(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printFalse() { printf("false\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"false\00"
define void @printFalse() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
short int CiBoardGetSerial(unsigned char brdnum, char *sbuf,
                           unsigned short int bufsize) {
  if (brdnum >= 8)
    return -6;
  return -8;
}


x86 assembly (clang, -O0):
<CiBoardGetSerial>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %dil,%cl
mov    %cl,-0x3(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x8,%eax
jl     112d <CiBoardGetSerial+0x2d>
movw   $0xfffa,-0x2(%rbp)
jmp    1133 <CiBoardGetSerial+0x33>
movw   $0xfff8,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CiBoardGetSerial>:
xor    %eax,%eax
cmp    $0x8,%dil
setae  %al
add    %eax,%eax
or     $0xfff8,%eax
ret

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

LLVM IR (-O2):
define signext i16 @CiBoardGetSerial(i8 zeroext %0, i8* nocapture readnone %1, i16 zeroext %2) {
%4 = icmp ugt i8 %0, 7
%5 = select i1 %4, i16 -6, i16 -8
ret i16 %5
}
void pgdat_resize_unlock(struct pglist_data *p, unsigned long *f) {}


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

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

LLVM IR (-O0):
%struct.pglist_data = type opaque
define void @pgdat_resize_unlock(%struct.pglist_data* %0, i64* %1) {
%3 = alloca %struct.pglist_data*
%4 = alloca i64*
store %struct.pglist_data* %0, %struct.pglist_data** %3
store i64* %1, i64** %4
ret void
}

LLVM IR (-O2):
%struct.pglist_data = type opaque
define void @pgdat_resize_unlock(%struct.pglist_data* nocapture %0, i64* nocapture %1) {
ret void
}
void I2C_set_slave_addr(int mask, int addr) {
  if (mask & 0x01)
    ((volatile unsigned char *)0xE001C000)[0x0C] = addr;
  if (mask & 0x02)
    ((volatile unsigned char *)0xE005C000)[0x0C] = addr;
}


x86 assembly (clang, -O0):
<I2C_set_slave_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1126 <I2C_set_slave_addr+0x26>
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    $0xe001c000,%eax
mov    %cl,0xc(%rax)
mov    -0x4(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1142 <I2C_set_slave_addr+0x42>
mov    -0x8(%rbp),%eax
mov    %al,%cl
mov    $0xe005c000,%eax
mov    %cl,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_set_slave_addr>:
mov    $0xe001c00c,%eax
test   $0x1,%dil
jne    1112 <I2C_set_slave_addr+0x12>
test   $0x2,%dil
jne    111b <I2C_set_slave_addr+0x1b>
ret
mov    %sil,(%rax)
test   $0x2,%dil
je     1111 <I2C_set_slave_addr+0x11>
mov    %sil,0x40000(%rax)
ret

LLVM IR (-O0):
define void @I2C_set_slave_addr(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 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %4
%10 = trunc i32 %9 to i8
store volatile i8 %10, i8* getelementptr inbounds (i8, i8* inttoptr (i64 3758211072 to i8*), i64 12)
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %3
%13 = and i32 %12, 2
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i32, i32* %4
%17 = trunc i32 %16 to i8
store volatile i8 %17, i8* getelementptr inbounds (i8, i8* inttoptr (i64 3758473216 to i8*), i64 12)
br label %18
18: ; preds = %15, %11
ret void
}

LLVM IR (-O2):
define void @I2C_set_slave_addr(i32 %0, i32 %1) {
%3 = and i32 %0, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = trunc i32 %1 to i8
store volatile i8 %6, i8* inttoptr (i64 3758211084 to i8*)
br label %7
7: ; preds = %5, %2
%8 = and i32 %0, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = trunc i32 %1 to i8
store volatile i8 %11, i8* inttoptr (i64 3758473228 to i8*)
br label %12
12: ; preds = %10, %7
ret void
}
void ff_hevc_put_hevc_uni_epel_v64_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_v64_12_sse4() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
char *square_to_coord(short);
int /*<<< orphan*/ strcpy(char *, char *);
char *en_passant_to_s(short int en_passant) {
  char *s = (char *)malloc(3);
  if (en_passant == -1)
    strcpy(s, "-");
  else
    strcpy(s, square_to_coord(en_passant));
  return s;
}


x86 assembly (clang, -O0):
<en_passant_to_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0xffffffff,%eax
jne    116f <en_passant_to_s+0x3f>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    118c <en_passant_to_s+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movswl -0x2(%rbp),%edi
call   1040 <square_to_coord@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<en_passant_to_s>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
cmp    $0xffff,%bp
je     1155 <en_passant_to_s+0x25>
movswl %bp,%edi
call   1040 <square_to_coord@plt>
mov    %rax,%rsi
jmp    115c <en_passant_to_s+0x2c>
lea    0xea4(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
define i8* @en_passant_to_s(i16 signext %0) {
%2 = alloca i16
%3 = alloca i8*
store i16 %0, i16* %2
%4 = call i64 @malloc(i32 3)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i16, i16* %2
%7 = sext i16 %6 to i32
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = load i16, i16* %2
%15 = call i8* @square_to_coord(i16 signext %14)
%16 = call i32 @strcpy(i8* %13, i8* %15)
br label %17
17: ; preds = %12, %9
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
define i8* @en_passant_to_s(i16 signext %0) {
%2 = tail call i64 @malloc(i32 3)
%3 = inttoptr i64 %2 to i8*
%4 = icmp eq i16 %0, -1
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i8* @square_to_coord(i16 signext %0)
br label %7
7: ; preds = %1, %5
%8 = phi i8* [ %6, %5 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %1 ]
%9 = tail call i32 @strcpy(i8* %3, i8* %8)
ret i8* %3
}
/* Variables and functions */
int android_sensors_get(int, float *, float *, float *);
int sensor_get(int sensorId, float *a, float *b, float *c) {
  return android_sensors_get(sensorId, a, b, c);
}


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

x86 assembly (clang, -O2):
<sensor_get>:
jmp    1030 <android_sensors_get@plt>

LLVM IR (-O0):
define i32 @sensor_get(i32 %0, float* %1, float* %2, float* %3) {
%5 = alloca i32
%6 = alloca float*
%7 = alloca float*
%8 = alloca float*
store i32 %0, i32* %5
store float* %1, float** %6
store float* %2, float** %7
store float* %3, float** %8
%9 = load i32, i32* %5
%10 = load float*, float** %6
%11 = load float*, float** %7
%12 = load float*, float** %8
%13 = call i32 @android_sensors_get(i32 %9, float* %10, float* %11, float* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @sensor_get(i32 %0, float* %1, float* %2, float* %3) {
%5 = tail call i32 @android_sensors_get(i32 %0, float* %1, float* %2, float* %3)
ret i32 %5
}
/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int get_time_ms() {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) == 1) {
    return 0;
  }
  return (int)tv.tv_sec * 1000 + tv.tv_usec / 1000;
}


x86 assembly (clang, -O0):
<get_time_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x1,%eax
jne    113a <get_time_ms+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    115c <get_time_ms+0x4c>
mov    -0x10(%rbp),%rax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_ms>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0x1,%eax
je     1148 <get_time_ms+0x38>
imul   $0x3e8,0x8(%rsp),%eax
movslq (%rsp),%rcx
imul   $0x10624dd3,%rcx,%rbx
mov    %rbx,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rbx
add    %ecx,%ebx
add    %eax,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i32 @get_time_ms() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %15
6: ; preds = %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = mul nsw i32 %9, 1000
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%12 = load i32, i32* %11
%13 = sdiv i32 %12, 1000
%14 = add nsw i32 %10, %13
store i32 %14, i32* %1
br label %15
15: ; preds = %6, %5
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i32 @get_time_ms() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 1
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%11 = load i32, i32* %10
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %9, %12
br label %14
14: ; preds = %0, %5
%15 = phi i32 [ %13, %5 ], [ 0, %0 ]
ret i32 %15
}
void loop_mapnik_tiles(double lat_lt, double lon_lt, double lat_cn,
                       double lon_cn, double lat_rb, double lon_rb,
                       int mapnik_zoom, const char *basedir,
                       struct displaylist *display_list) {}


x86 assembly (clang, -O0):
<loop_mapnik_tiles>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
mov    %edi,-0x34(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x48(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.displaylist = type opaque
define void @loop_mapnik_tiles(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i8* %7, %struct.displaylist* %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
%17 = alloca i8*
%18 = alloca %struct.displaylist*
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store i32 %6, i32* %16
store i8* %7, i8** %17
store %struct.displaylist* %8, %struct.displaylist** %18
ret void
}

LLVM IR (-O2):
%struct.displaylist = type opaque
define void @loop_mapnik_tiles(double %0, double %1, double %2, double %3, double %4, double %5, i32 %6, i8* nocapture %7, %struct.displaylist* nocapture %8) {
ret void
}
void gtk_text_buffer_copy_clipboard() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_buffer_copy_clipboard() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int strlen(char const *);
int write(int, char const *, int);
int serialport_write(int fd, const char *str) {
  int len = strlen(str);
  int n = write(fd, str, len);
  if (n != len) {
    perror("serialport_write: Couldn't write whole string\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<serialport_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1181 <serialport_write+0x51>
lea    0xe90(%rip),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <serialport_write+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport_write>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebp,%ecx
jne    115e <serialport_write+0x2e>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe9b(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
jmp    1159 <serialport_write+0x29>

LLVM IR (-O0):
@.str = [47 x i8] c"serialport_write: Couldn't write whole string\0A\00"
define i32 @serialport_write(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @write(i32 %10, i8* %11, i32 %12)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %2
%18 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [47 x i8] c"serialport_write: Couldn't write whole string\0A\00"
define i32 @serialport_write(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, %3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
void invlpg(void *address) {
  asm volatile("invlpg (%0)" : : "b"(address) : "memory");
}


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

x86 assembly (clang, -O2):
<invlpg>:
push   %rbx
mov    %rdi,%rbx
invlpg (%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @invlpg(i8* %0) {
tail call void asm sideeffect "invlpg ($0)", "{bx},~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Type definitions */
struct sigaction {
  void *sa_handler;
};
typedef int /*<<< orphan*/ action;

/* Variables and functions */
int /*<<< orphan*/ memset(struct sigaction *, int /*<<< orphan*/, int);
int sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
int sig(int signum, void *func) {
  struct sigaction action;
  memset(&action, 0, sizeof(action));
  action.sa_handler = func;
  return sigaction(signum, &action, NULL);
}


x86 assembly (clang, -O0):
<sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x8(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <memset@plt>
mov    %rbx,0x8(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.sigaction = type { i8* }
define i32 @sig(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = call i32 @memset(%struct.sigaction* %5, i32 0, i32 8)
%7 = load i8*, i8** %4
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store i8* %7, i8** %8
%9 = load i32, i32* %3
%10 = call i32 @sigaction(i32 %9, %struct.sigaction* %5, i32* null)
ret i32 %10
}

LLVM IR (-O2):
%struct.sigaction = type { i8* }
define i32 @sig(i32 %0, i8* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = call i32 @memset(%struct.sigaction* %3, i32 0, i32 8)
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store i8* %1, i8** %6
%7 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32* null)
ret i32 %7
}