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

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ quux(int /*<<< orphan*/);
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
void qux(jmp_buf buf) {
  jmp_buf local_buf;
  printf("Inside qux\n");
  if (!setjmp(local_buf))
    quux(buf);
  else
    printf("Error: Shouldn't be here in qux\n");
}


x86 assembly (clang, -O0):
<qux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <setjmp@plt>
cmp    $0x0,%eax
jne    1165 <qux+0x35>
mov    -0x4(%rbp),%edi
call   1050 <quux@plt>
jmp    1171 <qux+0x41>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qux>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
call   1040 <setjmp@plt>
test   %eax,%eax
je     1156 <qux+0x26>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
pop    %rbx
ret
mov    %ebx,%edi
call   1050 <quux@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Inside qux\0A\00"
@.str.1 = [33 x i8] c"Error: Shouldn't be here in qux\0A\00"
define void @qux(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %3
%6 = call i32 @setjmp(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @quux(i32 %9)
br label %13
11: ; preds = %1
%12 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"Inside qux\00"
@str.2 = [32 x i8] c"Error: Shouldn't be here in qux\00"
define void @qux(i32 %0) {
%2 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = call i32 @setjmp(i32 undef)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @quux(i32 %0)
br label %9
7: ; preds = %1
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int N;
  scanf(" %d", &N);
  printf("%d", N * 4);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
shl    $0x2,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = shl nsw i32 %4, 2
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fortchartoc(char *);
int /*<<< orphan*/ gmvwrite_openfile_ir_ascii(int /*<<< orphan*/, int, int);
void fgmvwrite_openfile_ir_ascii_(char *filnam, int *isize, int *rsize) {
  gmvwrite_openfile_ir_ascii(fortchartoc(filnam), *isize, *rsize);
}


x86 assembly (clang, -O0):
<fgmvwrite_openfile_ir_ascii_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fortchartoc@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
call   1040 <gmvwrite_openfile_ir_ascii@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgmvwrite_openfile_ir_ascii_>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1030 <fortchartoc@plt>
mov    (%rbx),%esi
mov    (%r14),%edx
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <gmvwrite_openfile_ir_ascii@plt>

LLVM IR (-O0):
define void @fgmvwrite_openfile_ir_ascii_(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = call i32 @fortchartoc(i8* %7)
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = call i32 @gmvwrite_openfile_ir_ascii(i32 %8, i32 %10, i32 %12)
ret void
}

LLVM IR (-O2):
define void @fgmvwrite_openfile_ir_ascii_(i8* %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i32 @fortchartoc(i8* %0)
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = tail call i32 @gmvwrite_openfile_ir_ascii(i32 %4, i32 %5, i32 %6)
ret void
}
/* Variables and functions */
int PAPI_query_event(int);
void PAPIF_QUERY_EVENT(int *EventCode, int *check) {
  *check = PAPI_query_event(*EventCode);
}


x86 assembly (clang, -O0):
<PAPIF_QUERY_EVENT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <PAPI_query_event@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_QUERY_EVENT>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_query_event@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @PAPIF_QUERY_EVENT(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_query_event(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ nodelay(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ wclear(int /*<<< orphan*/ *);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void initwindow(WINDOW *win) {
  nodelay(win, TRUE);
  wclear(win);
  wrefresh(win);
}


x86 assembly (clang, -O0):
<initwindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1040 <nodelay@plt>
mov    -0x8(%rbp),%rdi
call   1050 <wclear@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wrefresh@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initwindow>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1040 <nodelay@plt>
mov    %rbx,%rdi
call   1050 <wclear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <wrefresh@plt>

LLVM IR (-O0):
@TRUE = global i32 0
define void @initwindow(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @TRUE
%5 = call i32 @nodelay(i32* %3, i32 %4)
%6 = load i32*, i32** %2
%7 = call i32 @wclear(i32* %6)
%8 = load i32*, i32** %2
%9 = call i32 @wrefresh(i32* %8)
ret void
}

LLVM IR (-O2):
@TRUE = global i32 0
define void @initwindow(i32* %0) {
%2 = load i32, i32* @TRUE
%3 = tail call i32 @nodelay(i32* %0, i32 %2)
%4 = tail call i32 @wclear(i32* %0)
%5 = tail call i32 @wrefresh(i32* %0)
ret void
}
/* Variables and functions */
int pop();
int /*<<< orphan*/ printf(char *, int);
void calc_eof() {
  int n = pop();
  printf("[Result=%d]EOF\n", n);
}


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

x86 assembly (clang, -O2):
<calc_eof>:
push   %rax
xor    %eax,%eax
call   1040 <pop@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"[Result=%d]EOF\0A\00"
define void @calc_eof() {
%1 = alloca i32
%2 = call i32 (...) @pop()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"[Result=%d]EOF\0A\00"
define void @calc_eof() {
%1 = tail call i32 (...) @pop()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void _libinit() { printf("[+] lib init\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"[+] lib init\00"
define void @_libinit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
double SQ(double a) { return (a) * (a); }


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

x86 assembly (clang, -O2):
<SQ>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @SQ(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @SQ(double %0) {
%2 = fmul double %0, %0
ret double %2
}
void tearDown() {}


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

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

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

LLVM IR (-O2):
define void @tearDown() {
ret void
}
int test_imm_1Eint8_mem(signed char *val) {
  return ((*val) & (0x1E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Eint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x1e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_1Eint8_mem>:
testb  $0x1e,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_1Eint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 30
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct rudp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ noWarnAbort();
struct rudp *rudpOpen();
struct rudp *rudpMustOpen() {
  struct rudp *ru = rudpOpen();
  if (ru == NULL)
    noWarnAbort();
  return ru;
}


x86 assembly (clang, -O0):
<rudpMustOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <rudpOpen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <rudpMustOpen+0x25>
mov    $0x0,%al
call   1030 <noWarnAbort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rudpMustOpen>:
push   %rbx
xor    %eax,%eax
call   1040 <rudpOpen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1137 <rudpMustOpen+0x17>
xor    %eax,%eax
call   1030 <noWarnAbort@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rudp = type { i32 }
define %struct.rudp* @rudpMustOpen() {
%1 = alloca %struct.rudp*
%2 = call %struct.rudp* (...) @rudpOpen()
store %struct.rudp* %2, %struct.rudp** %1
%3 = load %struct.rudp*, %struct.rudp** %1
%4 = icmp eq %struct.rudp* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @noWarnAbort()
br label %7
7: ; preds = %5, %0
%8 = load %struct.rudp*, %struct.rudp** %1
ret %struct.rudp* %8
}

LLVM IR (-O2):
%struct.rudp = type { i32 }
define %struct.rudp* @rudpMustOpen() {
%1 = tail call %struct.rudp* (...) @rudpOpen()
%2 = icmp eq %struct.rudp* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @noWarnAbort()
br label %5
5: ; preds = %3, %0
ret %struct.rudp* %1
}
/* Variables and functions */
double circle_area(double);
double circle_column_volume(double r, double h) { return circle_area(r) * h; }


x86 assembly (clang, -O0):
<circle_column_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <circle_area@plt>
mulsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circle_column_volume>:
push   %rax
movsd  %xmm1,(%rsp)
call   1030 <circle_area@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @circle_column_volume(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call double @circle_area(double %5)
%7 = load double, double* %4
%8 = fmul double %6, %7
ret double %8
}

LLVM IR (-O2):
define double @circle_column_volume(double %0, double %1) {
%3 = tail call double @circle_area(double %0)
%4 = fmul double %3, %1
ret double %4
}
void function_void() {
  int a, b, c;
  c = (a + b) / a * b;
}


x86 assembly (clang, -O0):
<function_void>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @function_void() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = add nsw i32 %4, %5
%7 = load i32, i32* %1
%8 = sdiv i32 %6, %7
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
store i32 %10, i32* %3
ret void
}

LLVM IR (-O2):
define void @function_void() {
ret void
}
void l_empty_destructor(void **tag, void **cell) {}


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

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

LLVM IR (-O0):
define void @l_empty_destructor(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 @l_empty_destructor(i8** nocapture %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int countPrimes(int);
int /*<<< orphan*/ printf(char *, int);
int main() { printf("%d\n", countPrimes(100)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%edi
call   1040 <countPrimes@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = call i32 @countPrimes(i32 100)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @countPrimes(i32 100)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
R0RX1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if (r0 <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<R0RX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movswl -0x6(%rbp),%eax
mov    -0x20(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movswl (%rcx,%rdx,2),%ecx
cmp    %ecx,%eax
jg     1143 <R0RX1+0x43>
movl   $0x1,-0x4(%rbp)
jmp    114a <R0RX1+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<R0RX1>:
movswl %di,%edx
movslq %ecx,%rax
movswl (%r9,%rax,2),%ecx
xor    %eax,%eax
cmp    %ecx,%edx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @R0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = shl i32 %0, 16
%8 = ashr exact i32 %7, 16
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i16, i16* %5, i64 %9
%11 = load i16, i16* %10
%12 = sext i16 %11 to i32
%13 = icmp sle i32 %8, %12
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Type definitions */
struct s {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int s_cat_u4_dec(struct s *, int /*<<< orphan*/);
int /*<<< orphan*/ s_catn(struct s *, char *, int);
int s_cat_i4_dec(struct s *s, int32_t v) {
  int i = 0;
  if (v < 0) {
    i++;
    s_catn(s, "-", 1);
    v = -v;
  }
  return s_cat_u4_dec(s, v) + i;
}


x86 assembly (clang, -O0):
<s_cat_i4_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1166 <s_cat_i4_dec+0x46>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x1,%edx
call   1030 <s_catn@plt>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <s_cat_u4_dec@plt>
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_cat_i4_dec>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
xor    %ebp,%ebp
test   %esi,%esi
jns    114a <s_cat_i4_dec+0x2a>
lea    0xeca(%rip),%rsi
mov    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%edx
call   1030 <s_catn@plt>
neg    %ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <s_cat_u4_dec@plt>
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.s = type { i32 }
@.str = [2 x i8] c"-\00"
define i32 @s_cat_i4_dec(%struct.s* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @s_catn(%struct.s* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = sub nsw i32 0, %1
br label %7
7: ; preds = %4, %2
%8 = phi i32 [ %6, %4 ], [ %1, %2 ]
%9 = phi i32 [ 1, %4 ], [ 0, %2 ]
%10 = tail call i32 @s_cat_u4_dec(%struct.s* %0, i32 %8)
%11 = add nsw i32 %10, %9
ret i32 %11
}
unsigned int jz_readl(unsigned int address) {
  return *((volatile unsigned int *)address);
}


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

x86 assembly (clang, -O2):
<jz_readl>:
mov    %edi,%eax
mov    (%rax),%eax
ret

LLVM IR (-O0):
define i32 @jz_readl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @jz_readl(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ output_with_tab(char *);
void gen_def_word(void) { output_with_tab(".dw\t"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c".dw\09\00"
define void @gen_def_word() {
%1 = call i32 @output_with_tab(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c".dw\09\00"
define void @gen_def_word() {
%1 = tail call i32 @output_with_tab(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
int writeValueToFile(char *, char const *);
int setPinDirection(unsigned int pin, const char *dir) {
  char fullPath[250];
  sprintf(fullPath, "/sys/class/gpio/gpio%u/direction", pin);
  return writeValueToFile(fullPath, dir);
}


x86 assembly (clang, -O0):
<setPinDirection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1030 <sprintf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <writeValueToFile@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPinDirection>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xeca(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <writeValueToFile@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [33 x i8] c"/sys/class/gpio/gpio%u/direction\00"
define i32 @setPinDirection(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [250 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [250 x i8], [250 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [250 x i8], [250 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = call i32 @writeValueToFile(i8* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [33 x i8] c"/sys/class/gpio/gpio%u/direction\00"
define i32 @setPinDirection(i32 %0, i8* %1) {
%3 = alloca [250 x i8]
%4 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = call i32 @writeValueToFile(i8* %4, i8* %1)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void catch_alarm() {
  fprintf(stderr, "lock timeout\n");
  exit(124);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"lock timeout\0A\00"
define void @catch_alarm() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 124)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"lock timeout\0A\00"
define void @catch_alarm() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 124)
unreachable
}
unsigned int GetMsTime(void) {}


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

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

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

LLVM IR (-O2):
define i32 @GetMsTime() {
ret i32 undef
}
int f6(void) {
  int a31 = 31, a32 = 32, a33 = 33, a34 = 34;
#pragma omp parallel
  {
#pragma omp sections
    {
#pragma omp section
      { a31 = 9; }
#pragma omp section
      {
        int i = 10;
        __builtin_memcpy(&a32, &i, sizeof(int));
      }
    }
#pragma omp single
    a33 = 11;
#pragma omp atomic
    a34++;
  }
  return a31 + a32 + a33 + a34;
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1f,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
movl   $0x21,-0xc(%rbp)
movl   $0x22,-0x10(%rbp)
movl   $0x9,-0x4(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0xb,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f6() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 31, i32* %1
store i32 32, i32* %2
store i32 33, i32* %3
store i32 34, i32* %4
store i32 9, i32* %1
store i32 10, i32* %5
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %5 to i8*
store i32 11, i32* %3
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
%15 = load i32, i32* %4
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @f6() {
ret i32 65
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ write_be32(int /*<<< orphan*/ *, int /*<<< orphan*/);
void write_at_be32(void *dest, uint32_t val, size_t offset) {
  uint8_t *d = dest;
  d += offset;
  write_be32(d, val);
}


x86 assembly (clang, -O0):
<write_at_be32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <write_be32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_at_be32>:
lea    (%rdi,%rdx,4),%rdi
jmp    1030 <write_be32@plt>

LLVM IR (-O0):
define void @write_at_be32(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i64, i64* %6
%11 = load i32*, i32** %7
%12 = getelementptr inbounds i32, i32* %11, i64 %10
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = load i32, i32* %5
%15 = call i32 @write_be32(i32* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @write_at_be32(i8* %0, i32 %1, i64 %2) {
%4 = bitcast i8* %0 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 %2
%6 = tail call i32 @write_be32(i32* %5, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pthread_free(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<pthread_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @pthread_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int bics_si_test2(int a, int b, int c) {
  int d = a & ~(b << 3);
  if (d == 0)
    return a + c;
  else
    return b + d + c;
}


x86 assembly (clang, -O0):
<bics_si_test2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x3,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1136 <bics_si_test2+0x36>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1142 <bics_si_test2+0x42>
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bics_si_test2>:
lea    0x0(,%rsi,8),%ecx
not    %ecx
and    %edi,%ecx
lea    (%rsi,%rcx,1),%eax
test   %ecx,%ecx
cmove  %edi,%eax
add    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @bics_si_test2(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 3
%5 = xor i32 %4, -1
%6 = and i32 %5, %0
%7 = icmp eq i32 %6, 0
%8 = add nsw i32 %6, %1
%9 = select i1 %7, i32 %0, i32 %8
%10 = add nsw i32 %9, %2
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_RADIO_FIFO_PIN() { set_io_bit(-1, 6); }


x86 assembly (clang, -O0):
<TOSH_SET_RADIO_FIFO_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
mov    $0x6,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_RADIO_FIFO_PIN>:
mov    $0xffffffff,%edi
mov    $0x6,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_RADIO_FIFO_PIN() {
%1 = call i32 @set_io_bit(i32 -1, i32 6)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_RADIO_FIFO_PIN() {
%1 = tail call i32 @set_io_bit(i32 -1, i32 6)
ret void
}
unsigned short swap_short(void *l) {
  unsigned char *b = (unsigned char *)l;
  return (unsigned short)b[0] | (b[1] << 8);
}


x86 assembly (clang, -O0):
<swap_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
movzwl %ax,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_short>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @swap_short(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i16
%9 = zext i16 %8 to i32
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = or i32 %9, %14
%16 = trunc i32 %15 to i16
ret i16 %16
}

LLVM IR (-O2):
define zeroext i16 @swap_short(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = shl nuw i16 %6, 8
%8 = or i16 %7, %3
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_bits(unsigned int mask) {
  unsigned int size = sizeof(unsigned int);
  unsigned int max_pow = 1 << (size * 8 - 1);
  for (int i = 0; i < size * 8; ++i) {
    printf("%u", mask & max_pow ? 1 : 0);
    mask = mask << 1;
  }
}


x86 assembly (clang, -O0):
<print_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jae    1183 <print_bits+0x73>
mov    -0x4(%rbp),%ecx
and    -0xc(%rbp),%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113c <print_bits+0x2c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bits>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x20,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%esi
shr    $0x1f,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    %ebx,%ebx
add    $0xffffffff,%ebp
jne    1130 <print_bits+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define void @print_bits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %3
%6 = load i32, i32* %3
%7 = mul i32 %6, 8
%8 = sub i32 %7, 1
%9 = shl i32 1, %8
store i32 %9, i32* %4
store i32 0, i32* %5
br label %10
10: ; preds = %25, %1
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = mul i32 %12, 8
%14 = icmp ult i32 %11, %13
br i1 %14, label %15, label %28
15: ; preds = %10
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = shl i32 %23, 1
store i32 %24, i32* %2
br label %25
25: ; preds = %15
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %10
28: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define void @print_bits(i32 %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %9, %3 ]
%5 = phi i32 [ %0, %1 ], [ %8, %3 ]
%6 = lshr i32 %5, 31
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = shl i32 %5, 1
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 32
br i1 %10, label %2, label %3
}
void struct_test_norm() {}


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

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

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

LLVM IR (-O2):
define void @struct_test_norm() {
ret void
}
char lower(char c) { return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c; }


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <lower+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <lower+0x33>
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <lower+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @lower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 32
br label %17
14: ; preds = %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %13, %10 ], [ %16, %14 ]
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @lower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int read(int, unsigned char *, int);
int dxl_hal_rx(int socket, unsigned char *pPacket, int numPacket) {
  memset(pPacket, 0, numPacket);
  return read(socket, pPacket, numPacket);
}


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

x86 assembly (clang, -O2):
<dxl_hal_rx>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <read@plt>

LLVM IR (-O0):
define i32 @dxl_hal_rx(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %6
%9 = call i32 @memset(i8* %7, i32 0, i32 %8)
%10 = load i32, i32* %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @read(i32 %10, i8* %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @dxl_hal_rx(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @memset(i8* %1, i32 0, i32 %2)
%5 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %5
}
unsigned int cpuid_ecx(unsigned int op) {
  unsigned int eax, ecx;
  __asm__("cpuid" : "=a"(eax), "=c"(ecx) : "0"(op) : "bx", "dx");
  return ecx;
}


x86 assembly (clang, -O0):
<cpuid_ecx>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_ecx>:
push   %rbx
mov    %edi,%eax
cpuid
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid_ecx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call { i32, i32 } asm "cpuid", "={ax},={cx},0,~{bx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %5)
%7 = extractvalue { i32, i32 } %6, 0
%8 = extractvalue { i32, i32 } %6, 1
store i32 %7, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpuid_ecx(i32 %0) {
%2 = tail call { i32, i32 } asm "cpuid", "={ax},={cx},0,~{bx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32 } %2, 1
ret i32 %3
}
int var_ele(int n, int A[n][n], int i, int j) { return A[i][j]; }


x86 assembly (clang, -O0):
<var_ele>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_ele>:
mov    %edi,%eax
movslq %edx,%rdx
imul   %rax,%rdx
lea    (%rsi,%rdx,4),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @var_ele(i32 %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* %5
%12 = zext i32 %11 to i64
%13 = load i32*, i32** %6
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = mul nsw i64 %15, %12
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @var_ele(i32 %0, i32* nocapture %1, i32 %2, i32 %3) {
%5 = zext i32 %0 to i64
%6 = sext i32 %2 to i64
%7 = mul nsw i64 %6, %5
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* %8, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}
long tclmin(long a, long b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<tclmin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <tclmin+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <tclmin+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tclmin>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @tclmin(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ xip_fpo_unordered_flt(int *, float, float);
int xil_fpo_unordered_flt(float a, float b) {
  int res_int;
  xip_fpo_unordered_flt(&res_int, a, b);
  return res_int;
}


x86 assembly (clang, -O0):
<xil_fpo_unordered_flt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
lea    -0xc(%rbp),%rdi
call   1030 <xip_fpo_unordered_flt@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xil_fpo_unordered_flt>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <xip_fpo_unordered_flt@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @xil_fpo_unordered_flt(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = call i32 @xip_fpo_unordered_flt(i32* %5, float %6, float %7)
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @xil_fpo_unordered_flt(float %0, float %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @xip_fpo_unordered_flt(i32* %3, float %0, float %1)
%6 = load i32, i32* %3
ret i32 %6
}
void SSMR3PutStructEx(void) {}


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

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

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

LLVM IR (-O2):
define void @SSMR3PutStructEx() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((weak)) abort(void) {
  printf("abort() called.\n");
  while (1)
    ;
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
jmp    1120 <abort+0x10>

x86 assembly (clang, -O2):
<abort>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
nopl   (%rax)
jmp    1120 <abort+0x10>

LLVM IR (-O0):
@.str = [17 x i8] c"abort() called.\0A\00"
define weak void @abort() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
@str = [16 x i8] c"abort() called.\00"
define weak void @abort() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
size_t bnode_red_value(size_t index) { return (((index) << 1) | (1)); }


x86 assembly (clang, -O0):
<bnode_red_value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
or     $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bnode_red_value>:
lea    (%rdi,%rdi,1),%rax
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @bnode_red_value(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 1
%5 = or i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @bnode_red_value(i64 %0) {
%2 = shl i64 %0, 1
%3 = or i64 %2, 1
ret i64 %3
}
void caller_with_value_site_never_called2() {}


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

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

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

LLVM IR (-O2):
define void @caller_with_value_site_never_called2() {
ret void
}
void cleanup_nanosleep_sems(int num) { return; }


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

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

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

LLVM IR (-O2):
define void @cleanup_nanosleep_sems(i32 %0) {
ret void
}
int f_bgt_rc1(float a1) { return (__builtin_isgreater(a1, 100)); }


x86 assembly (clang, -O0):
<f_bgt_rc1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_bgt_rc1>:
xor    %eax,%eax
ucomiss 0xef7(%rip),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @f_bgt_rc1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ogt float %3, 1.000000e+02
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f_bgt_rc1(float %0) {
%2 = fcmp ogt float %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
int StopIPCService() {}


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

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

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

LLVM IR (-O2):
define i32 @StopIPCService() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void libtestfunc() { printf("Hello from the libtest library\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"Hello from the libtest library\0A\00"
define void @libtestfunc() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"Hello from the libtest library\00"
define void @libtestfunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}