xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char, unsigned char,
                           unsigned char, unsigned char);
char *ip2str(const unsigned long int addr) {
  static char ret[((4 * 3 + 3 + 1) * sizeof(char))];
  unsigned char *i = (unsigned char *)&addr;
  sprintf(ret, "%i.%i.%i.%i", i[0], i[1], i[2], i[3]);
  return ret;
}


x86 assembly (clang, -O0):
<ip2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%r8b
mov    -0x10(%rbp),%rax
lea    0x2efc(%rip),%rdi
lea    0xeb5(%rip),%rsi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl 0x3(%rax),%r9d
call   1030 <sprintf@plt>
lea    0x2eda(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip2str>:
push   %rbx
mov    %rdi,%rbx
mov    %ebx,%eax
shr    $0x18,%eax
movzbl %bl,%edx
movzbl %bh,%ecx
shr    $0x10,%ebx
movzbl %bl,%r8d
lea    0x2f13(%rip),%rbx
lea    0xecc(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%r9d
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@ip2str.ret = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%i.%i.%i.%i\00"
define i8* @ip2str(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = bitcast i64* %2 to i8*
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 2
%13 = load i8, i8* %12
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 3
%16 = load i8, i8* %15
%17 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @ip2str.ret, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %7, i8 zeroext %10, i8 zeroext %13, i8 zeroext %16)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @ip2str.ret, i64 0, i64 0)
}

LLVM IR (-O2):
@ip2str.ret = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%i.%i.%i.%i\00"
define i8* @ip2str(i64 %0) {
%2 = trunc i64 %0 to i8
%3 = lshr i64 %0, 8
%4 = trunc i64 %3 to i8
%5 = lshr i64 %0, 16
%6 = trunc i64 %5 to i8
%7 = lshr i64 %0, 24
%8 = trunc i64 %7 to i8
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @ip2str.ret, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 zeroext %2, i8 zeroext %4, i8 zeroext %6, i8 zeroext %8)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @ip2str.ret, i64 0, i64 0)
}
/* Variables and functions */
int test_createFileInfo();
int test_getTmpDir();
int main(void) {
  int err = 0;
  if ((err = test_getTmpDir()))
    return err;
  if ((err = test_createFileInfo()))
    return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_getTmpDir@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1154 <main+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116d <main+0x4d>
mov    $0x0,%al
call   1030 <test_createFileInfo@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     116d <main+0x4d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_getTmpDir@plt>
test   %eax,%eax
je     112e <main+0xe>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_createFileInfo@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_getTmpDir()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @test_createFileInfo()
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ %1, %0 ], [ %4, %3 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ GL_BLEND;
int /*<<< orphan*/ GL_FLAT;
int /*<<< orphan*/ GL_ONE_MINUS_SRC_ALPHA;
int /*<<< orphan*/ GL_SRC_ALPHA;
int /*<<< orphan*/ glBlendFunc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glShadeModel(int /*<<< orphan*/);
void init(void) {
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glShadeModel(GL_FLAT);
  glClearColor(0.0, 0.0, 0.0, 0.0);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1060 <glShadeModel@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1050 <glClearColor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <glEnable@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1060 <glShadeModel@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
pop    %rax
jmp    1050 <glClearColor@plt>

LLVM IR (-O0):
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_FLAT = global i32 0
define void @init() {
%1 = load i32, i32* @GL_BLEND
%2 = call i32 @glEnable(i32 %1)
%3 = load i32, i32* @GL_SRC_ALPHA
%4 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%5 = call i32 @glBlendFunc(i32 %3, i32 %4)
%6 = load i32, i32* @GL_FLAT
%7 = call i32 @glShadeModel(i32 %6)
%8 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_FLAT = global i32 0
define void @init() {
%1 = load i32, i32* @GL_BLEND
%2 = tail call i32 @glEnable(i32 %1)
%3 = load i32, i32* @GL_SRC_ALPHA
%4 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%5 = tail call i32 @glBlendFunc(i32 %3, i32 %4)
%6 = load i32, i32* @GL_FLAT
%7 = tail call i32 @glShadeModel(i32 %6)
%8 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
ret void
}
void foo(char *x, const char *y, ...) {}


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

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

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

LLVM IR (-O2):
define void @foo(i8* nocapture %0, i8* nocapture %1, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rand();
void frand() {
  while (true) {
    rand();
  }
}


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <frand+0x9>
mov    $0x0,%al
call   1030 <rand@plt>
jmp    1119 <frand+0x9>

x86 assembly (clang, -O2):
<frand>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
jmp    1120 <frand+0x10>

LLVM IR (-O0):
define void @frand() {
br label %1
1: ; preds = %0, %1
%2 = call i32 (...) @rand()
br label %1
}

LLVM IR (-O2):
define void @frand() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @rand()
br label %1
}
int uberflate(void *const_in, int const_insz, void *const_out, int const_outsz,
              int zlib) {
  return (-1);
}


x86 assembly (clang, -O0):
<uberflate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @uberflate(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 -1
}

LLVM IR (-O2):
define i32 @uberflate(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3, i32 %4) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ err(int /*<<< orphan*/, int /*<<< orphan*/ *);
void *realloc(void *, size_t);
void *xrealloc(void *p, size_t size) {
  void *q;
  q = realloc(p, size);
  if (q == NULL)
    err(EXIT_FAILURE, NULL);
  return q;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115e <xrealloc+0x3e>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <err@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113e <xrealloc+0x1e>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1030 <err@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @err(i32 %12, i32* null)
br label %14
14: ; preds = %11, %2
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @err(i32 %6, i32* null)
br label %8
8: ; preds = %5, %2
ret i8* %3
}
f(int i) { return 2 * i; }


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

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint8_t;

/* Variables and functions */
void pin_change(volatile uint8_t *reg, uint8_t mask, bool state) {
  if (state)
    *reg |= mask;
  else
    *reg &= ~mask;
}


x86 assembly (clang, -O0):
<pin_change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     112a <pin_change+0x2a>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
jmp    113a <pin_change+0x3a>
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pin_change>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
test   %edx,%edx
je     1111 <pin_change+0x11>
or     (%rdi),%eax
mov    %eax,(%rdi)
ret
not    %eax
and    (%rdi),%eax
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define void @pin_change(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
store volatile i32 %1, i32* %4
%5 = icmp eq i32 %2, 0
%6 = load volatile i32, i32* %4
br i1 %5, label %10, label %7
7: ; preds = %3
%8 = load volatile i32, i32* %0
%9 = or i32 %8, %6
br label %14
10: ; preds = %3
%11 = xor i32 %6, -1
%12 = load volatile i32, i32* %0
%13 = and i32 %12, %11
br label %14
14: ; preds = %10, %7
%15 = phi i32 [ %13, %10 ], [ %9, %7 ]
store volatile i32 %15, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void ArrayFunction(int *buffer) {
  int temp = buffer[0];
  printf("%d\n", temp);
}


x86 assembly (clang, -O0):
<ArrayFunction>:
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>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ArrayFunction>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @ArrayFunction(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int time_diff(struct timeval *tr_start, struct timeval *tr_end) {
  return ((tr_end->tv_sec - tr_start->tv_sec) * 1000000 + tr_end->tv_usec -
          tr_start->tv_usec + 500) /
         1000;
}


x86 assembly (clang, -O0):
<time_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
imul   $0xf4240,%eax,%eax
mov    -0x10(%rbp),%rcx
add    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
sub    0x4(%rcx),%eax
add    $0x1f4,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_diff>:
mov    (%rsi),%eax
sub    (%rdi),%eax
imul   $0xf4240,%eax,%eax
add    0x4(%rsi),%eax
sub    0x4(%rdi),%eax
add    $0x1f4,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @time_diff(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load %struct.timeval*, %struct.timeval** %3
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
%12 = mul nsw i32 %11, 1000000
%13 = load %struct.timeval*, %struct.timeval** %4
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = add nsw i32 %12, %15
%17 = load %struct.timeval*, %struct.timeval** %3
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 1
%19 = load i32, i32* %18
%20 = sub nsw i32 %16, %19
%21 = add nsw i32 %20, 500
%22 = sdiv i32 %21, 1000
ret i32 %22
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @time_diff(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
%8 = mul nsw i32 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%12 = load i32, i32* %11
%13 = add i32 %10, 500
%14 = add i32 %13, %8
%15 = sub i32 %14, %12
%16 = sdiv i32 %15, 1000
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  float f, c;
  printf("Enter fahrenheit temperture: ");
  scanf("%f", &f);
  c = (f - 32.0f) * (5.0f / 9.0f);
  printf("Celsius equivalent: %.2f\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xeaa(%rip),%xmm1
subss  %xmm1,%xmm0
movss  0xe9a(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
addss  0xeb2(%rip),%xmm0
mulss  0xeae(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Enter fahrenheit temperture: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Celsius equivalent: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = fsub float %6, 3.200000e+01
%8 = fmul float %7, 0x3FE1C71C80000000
store float %8, float* %3
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Enter fahrenheit temperture: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"Celsius equivalent: %.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fadd float %5, -3.200000e+01
%7 = fmul float %6, 0x3FE1C71C80000000
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %8)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void put_le16_ptr(uint8_t *p, uint16_t v) {
  p[0] = (v & 0xFF);
  p[1] = (v >> 8);
}


x86 assembly (clang, -O0):
<put_le16_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_le16_ptr>:
movzbl %sil,%eax
mov    %eax,(%rdi)
sar    $0x8,%esi
mov    %esi,0x4(%rdi)
ret

LLVM IR (-O0):
define void @put_le16_ptr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 255
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @put_le16_ptr(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
store i32 %3, i32* %0
%4 = ashr i32 %1, 8
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LC_NUMERIC;
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main(void) {
  float x = 66.6666;
  printf("%-8.2e\n", x);
  setlocale(LC_NUMERIC, "pl_PL");
  printf("%6.0f\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1040 <setlocale@plt>
movss  -0x8(%rbp),%xmm0
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xec1(%rip),%rdi
movss  0xea7(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%-8.2e\0A\00"
@LC_NUMERIC = global i32 0
@.str.1 = [6 x i8] c"pl_PL\00"
@.str.2 = [7 x i8] c"%6.0f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
store float 0x4050AAA9A0000000, float* %2
%3 = load float, float* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float %3)
%5 = load i32, i32* @LC_NUMERIC
%6 = call i32 @setlocale(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = load float, float* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%-8.2e\0A\00"
@LC_NUMERIC = global i32 0
@.str.1 = [6 x i8] c"pl_PL\00"
@.str.2 = [7 x i8] c"%6.0f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), float 0x4050AAA9A0000000)
%2 = load i32, i32* @LC_NUMERIC
%3 = tail call i32 @setlocale(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float 0x4050AAA9A0000000)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
float atof(char *);
float strToReal(uint32_t *env) { return atof(*(char **)(env + 1)); }


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

x86 assembly (clang, -O2):
<strToReal>:
mov    0x4(%rdi),%rdi
jmp    1030 <atof@plt>

LLVM IR (-O0):
define float @strToReal(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = bitcast i32* %4 to i8**
%6 = load i8*, i8** %5
%7 = call float @atof(i8* %6)
ret float %7
}

LLVM IR (-O2):
define float @strToReal(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = bitcast i32* %2 to i8**
%4 = load i8*, i8** %3
%5 = tail call float @atof(i8* %4)
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/ *, char const *,
                            int /*<<< orphan*/);
void common(FILE *file, const char *prefix, const char *format, va_list args) {
  fprintf(file, "%s \"", prefix);
  vfprintf(file, format, args);
  fprintf(file, "\"\n");
  return;
}


x86 assembly (clang, -O0):
<common>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <vfprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<common>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rbp
lea    0xeb9(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1040 <vfprintf@plt>
lea    0xea2(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fwrite@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s \22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
define void @common(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i8*, i8** %6
%11 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32*, i32** %5
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @vfprintf(i32* %12, i8* %13, i32 %14)
%16 = load i32*, i32** %5
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s \22\00"
@.str.1 = [3 x i8] c"\22\0A\00"
define void @common(i32* nocapture %0, i8* %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = tail call i32 @vfprintf(i32* %0, i8* %2, i32 %3)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %0)
ret void
}
const char *Int_Name(void) { return "Int"; }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"Int\00"
define i8* @Int_Name() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
__attribute__((no, noclone)) unsigned char f8(unsigned char x) {
  unsigned char r = (unsigned char)-2 + x;
  if (r <= (unsigned char)-2)
    foo(0);
  return r;
}


x86 assembly (clang, -O0):
<f8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0xfe,%eax
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0xfe,%eax
jg     1140 <f8+0x30>
xor    %edi,%edi
call   1030 <foo@plt>
movzbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f8>:
push   %rbx
mov    %edi,%ebx
add    $0xfe,%bl
cmp    $0xff,%bl
je     1122 <f8+0x12>
xor    %edi,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @f8(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = add nsw i32 254, %5
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = icmp sle i32 %9, 254
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @foo(i32 0)
br label %13
13: ; preds = %11, %1
%14 = load i8, i8* %3
ret i8 %14
}

LLVM IR (-O2):
define zeroext i8 @f8(i8 zeroext %0) {
%2 = add i8 %0, -2
%3 = icmp eq i8 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @foo(i32 0)
br label %6
6: ; preds = %4, %1
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *, void *);
int my_node_func(void *key, void *data, void *param) {
  printf("my_node_func: %d, %d\n", key, data);
  return (0);
}


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

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

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

LLVM IR (-O2):
@.str = [22 x i8] c"my_node_func: %d, %d\0A\00"
define i32 @my_node_func(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i32 0
}
/* Variables and functions */
scalar_t__ bproc_libdel(char *);
int /*<<< orphan*/ perror(char *);
void remove_lib(char *libname) {
  if (bproc_libdel(libname)) {
    perror(libname);
  }
}


x86 assembly (clang, -O0):
<remove_lib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <bproc_libdel@plt>
cmp    $0x0,%rax
je     1148 <remove_lib+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_lib>:
push   %rbx
mov    %rdi,%rbx
call   1040 <bproc_libdel@plt>
test   %rax,%rax
jne    1130 <remove_lib+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <perror@plt>

LLVM IR (-O0):
define void @remove_lib(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @bproc_libdel(i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @perror(i8* %7)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @remove_lib(i8* %0) {
%2 = tail call i64 @bproc_libdel(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* %0)
br label %6
6: ; preds = %4, %1
ret void
}
int clickplc_exe_SubProgrammReturn_enc(void *obj, unsigned char *stream) {
  int encsize = 4;
  stream[0] = 0x00;
  stream[1] = 0x18;
  stream[2] = 0xff;
  stream[3] = 0xff;
  return (encsize);
}


x86 assembly (clang, -O0):
<clickplc_exe_SubProgrammReturn_enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x18,0x1(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x2(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x3(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clickplc_exe_SubProgrammReturn_enc>:
movl   $0xffff1800,(%rsi)
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @clickplc_exe_SubProgrammReturn_enc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 4, i32* %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 24, i8* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 2
store i8 -1, i8* %11
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 3
store i8 -1, i8* %13
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @clickplc_exe_SubProgrammReturn_enc(i8* nocapture readnone %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
%3 = getelementptr inbounds i8, i8* %1, i64 1
store i8 24, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 2
store i8 -1, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 3
store i8 -1, i8* %5
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ do_return(int /*<<< orphan*/);
void zrfalse(void) { do_return(0); }


x86 assembly (clang, -O0):
<zrfalse>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <do_return@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zrfalse>:
xor    %edi,%edi
jmp    1030 <do_return@plt>

LLVM IR (-O0):
define void @zrfalse() {
%1 = call i32 @do_return(i32 0)
ret void
}

LLVM IR (-O2):
define void @zrfalse() {
%1 = tail call i32 @do_return(i32 0)
ret void
}
void fn_transition(unsigned int fromNode, unsigned int toNode, void *input,
                   void *data) {
  int input_value = *((int *)input);
  unsigned int *data_ptr = (unsigned int *)data;
  *data_ptr = (*data_ptr * 10) + input_value;
  return;
}


x86 assembly (clang, -O0):
<fn_transition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
imul   $0xa,(%rax),%ecx
add    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_transition>:
mov    (%rcx),%eax
lea    (%rax,%rax,4),%eax
add    %eax,%eax
add    (%rdx),%eax
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @fn_transition(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %7
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %9
%14 = load i8*, i8** %8
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %10
%16 = load i32*, i32** %10
%17 = load i32, i32* %16
%18 = mul i32 %17, 10
%19 = load i32, i32* %9
%20 = add i32 %18, %19
%21 = load i32*, i32** %10
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @fn_transition(i32 %0, i32 %1, i8* nocapture %2, i8* nocapture %3) {
%5 = bitcast i8* %2 to i32*
%6 = load i32, i32* %5
%7 = bitcast i8* %3 to i32*
%8 = load i32, i32* %7
%9 = mul i32 %8, 10
%10 = add i32 %9, %6
store i32 %10, i32* %7
ret void
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct list *);
int /*<<< orphan*/ list_clear(struct list *);
void list_free(struct list *list) {
  if (list != NULL) {
    list_clear(list);
    free(list);
  }
}


x86 assembly (clang, -O0):
<list_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1149 <list_free+0x29>
mov    -0x8(%rbp),%rdi
call   1040 <list_clear@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_free>:
test   %rdi,%rdi
je     1137 <list_free+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <list_clear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
%struct.list = type { i32 }
define void @list_free(%struct.list* %0) {
%2 = icmp eq %struct.list* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @list_clear(%struct.list* %0)
%5 = tail call i32 @free(%struct.list* %0)
br label %6
6: ; preds = %3, %1
ret void
}
unsigned long ScaleColor8to5(const unsigned char color) {
  return ((unsigned long)(((color) & ~0x07) >> 3));
}


x86 assembly (clang, -O0):
<ScaleColor8to5>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xfffffff8,%eax
sar    $0x3,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScaleColor8to5>:
shr    $0x3,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i64 @ScaleColor8to5(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, -8
%6 = ashr i32 %5, 3
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @ScaleColor8to5(i8 zeroext %0) {
%2 = lshr i8 %0, 3
%3 = zext i8 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ eV();
void gV(void) { eV(); }


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

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

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

LLVM IR (-O2):
define void @gV() {
%1 = tail call i32 (...) @eV()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_version() { printf("TAP version 13\n"); }


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

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

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

LLVM IR (-O2):
@str = [15 x i8] c"TAP version 13\00"
define void @print_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
int khugepaged_enter(struct vm_area_struct *vma, unsigned long vm_flags) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.vm_area_struct = type opaque
define i32 @khugepaged_enter(%struct.vm_area_struct* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void *printWorker(void *input) {
  double *pt = (double *)input;
  printf("%lf\n", *pt);
}


x86 assembly (clang, -O0):
<printWorker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printWorker>:
movsd  (%rdi),%xmm0
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%lf\0A\00"
define i8* @printWorker(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca double*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to double*
store double* %6, double** %4
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %8)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
define noalias i8* @printWorker(i8* nocapture %0) {
%2 = bitcast i8* %0 to double*
%3 = load double, double* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %3)
ret i8* undef
}
void handle_SOUND(sig) int sig;
{}


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

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

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

LLVM IR (-O2):
define void @handle_SOUND(i32 %0) {
ret void
}
void free_string_shares(char **shares, int n) {
  int i;
  for (i = 0; i < n; ++i) {
    free(shares[i]);
  }
  free(shares);
}


x86 assembly (clang, -O0):
<free_string_shares>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_string_shares+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_string_shares+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_string_shares>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_string_shares+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_string_shares+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_string_shares(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
/* Variables and functions */
int logical_iterator(int, int, int *, unsigned short);
bool logical_xnor(unsigned short array_size, bool *boolean_list) {
  return logical_iterator(false, false, boolean_list, array_size);
}


x86 assembly (clang, -O0):
<logical_xnor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
mov    %esi,%edi
movzwl -0x2(%rbp),%ecx
call   1030 <logical_iterator@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logical_xnor>:
mov    %rsi,%rdx
mov    %edi,%ecx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <logical_iterator@plt>

LLVM IR (-O0):
define i32 @logical_xnor(i16 zeroext %0, i32* %1) {
%3 = alloca i16
%4 = alloca i32*
store i16 %0, i16* %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i16, i16* %3
%7 = call i32 @logical_iterator(i32 0, i32 0, i32* %5, i16 zeroext %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @logical_xnor(i16 zeroext %0, i32* %1) {
%3 = tail call i32 @logical_iterator(i32 0, i32 0, i32* %1, i16 zeroext %0)
ret i32 %3
}
char *itoa(int i) {
  static char b[10] = "########";
  char *p;
  p = &b[8];
  do
    *p-- = i % 10 + '0';
  while (i /= 10);
  return (++p);
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0x2f12(%rip),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    1116 <itoa+0x16>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
lea    0x2f22(%rip),%rax
nopw   0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    $0x30,%sil
mov    %sil,-0x1(%rax)
add    $0xffffffffffffffff,%rax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <itoa+0x10>
ret

LLVM IR (-O0):
@itoa.b = internal global [10 x i8] c"########\00\00"
define i8* @itoa(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @itoa.b, i64 0, i64 8), i8** %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %2
%6 = srem i32 %5, 10
%7 = add nsw i32 %6, 48
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 -1
store i8* %10, i8** %3
store i8 %8, i8* %9
br label %11
11: ; preds = %4
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 10
store i32 %13, i32* %2
%14 = icmp ne i32 %13, 0
br i1 %14, label %4, label %15
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@itoa.b = internal global [10 x i8] c"########\00\00"
define i8* @itoa(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %9, %2 ]
%4 = phi i8* [ getelementptr inbounds ([10 x i8], [10 x i8]* @itoa.b, i64 0, i64 8), %1 ], [ %8, %2 ]
%5 = srem i32 %3, 10
%6 = trunc i32 %5 to i8
%7 = add nsw i8 %6, 48
%8 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 %7, i8* %4
%9 = sdiv i32 %3, 10
%10 = add i32 %3, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %2
12: ; preds = %2
ret i8* %4
}
float a_half(void) { return .5; }


x86 assembly (clang, -O0):
<a_half>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_half>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @a_half() {
ret float 5.000000e-01
}

LLVM IR (-O2):
define float @a_half() {
ret float 5.000000e-01
}