xunge/DecIR huggingface dataset:
int _gdbm_rename(old_name, new_name)
char *old_name;
char *new_name;
{
  if (unlink(new_name) != 0)
    return -1;
  if (link(old_name, new_name) != 0)
    return -1;
  unlink(old_name);
  return 0;
}


x86 assembly (clang, -O0):
<_gdbm_rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
cmp    $0x0,%eax
je     1150 <_gdbm_rename+0x30>
movl   $0xffffffff,-0x4(%rbp)
jmp    1186 <_gdbm_rename+0x66>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <link@plt>
cmp    $0x0,%eax
je     1174 <_gdbm_rename+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    1186 <_gdbm_rename+0x66>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gdbm_rename>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <unlink@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
jne    115a <_gdbm_rename+0x3a>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <link@plt>
test   %eax,%eax
jne    115a <_gdbm_rename+0x3a>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <unlink@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_gdbm_rename(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %19
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %11, i8* %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 -1, i32* %3
br label %19
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %17)
store i32 0, i32* %3
br label %19
19: ; preds = %16, %15, %9
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @_gdbm_rename(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %0)
br label %10
10: ; preds = %5, %2, %8
%11 = phi i32 [ 0, %8 ], [ -1, %2 ], [ -1, %5 ]
ret i32 %11
}
/* Variables and functions */
int isPrime(int);
int isTwin(int number) {
  if (isPrime(number) == 0)
    return 0;
  if (isPrime(number + 2) == 1 || isPrime(number - 2) == 1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isTwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isPrime@plt>
cmp    $0x0,%eax
jne    1138 <isTwin+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1173 <isTwin+0x63>
mov    -0x8(%rbp),%edi
add    $0x2,%edi
call   1030 <isPrime@plt>
cmp    $0x1,%eax
je     1160 <isTwin+0x50>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <isPrime@plt>
cmp    $0x1,%eax
jne    116c <isTwin+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1173 <isTwin+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isTwin>:
push   %rbx
mov    %edi,%ebx
call   1030 <isPrime@plt>
test   %eax,%eax
je     1146 <isTwin+0x36>
lea    0x2(%rbx),%edi
call   1030 <isPrime@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x1,%ecx
je     1144 <isTwin+0x34>
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <isPrime@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isTwin(i32 %0) {
%2 = tail call i32 @isPrime(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = add nsw i32 %0, 2
%6 = tail call i32 @isPrime(i32 %5)
%7 = icmp eq i32 %6, 1
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = add nsw i32 %0, -2
%10 = tail call i32 @isPrime(i32 %9)
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %4, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %12, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_PUNPCKLDQ(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0x62);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_PUNPCKLDQ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x62,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_PUNPCKLDQ>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x62,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_PUNPCKLDQ(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 98)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_PUNPCKLDQ(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 98)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
__float128 f128_p3(__float128 x) { return x * x * x; }


x86 assembly (clang, -O0):
<f128_p3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movaps %xmm0,-0x10(%rbp)
movaps -0x10(%rbp),%xmm1
movaps %xmm1,-0x20(%rbp)
movaps %xmm1,%xmm0
call   1130 <__multf3>
movaps -0x20(%rbp),%xmm1
call   1130 <__multf3>
add    $0x20,%rsp
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<f128_p3>:
sub    $0x18,%rsp
movaps %xmm0,(%rsp)
movaps %xmm0,%xmm1
call   1120 <__multf3>
movaps (%rsp),%xmm1
add    $0x18,%rsp
jmp    1120 <__multf3>
nopl   (%rax)

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

LLVM IR (-O2):
define fp128 @f128_p3(fp128 %0) {
%2 = fmul fp128 %0, %0
%3 = fmul fp128 %2, %0
ret fp128 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ XFontStruct;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ XFreeFontNames(char **);
char **XListFonts(int /*<<< orphan*/ *, char *, int, int *);
int /*<<< orphan*/ *XLoadQueryFont(int /*<<< orphan*/ *, char *);
XFontStruct *getFirstFoundEntry(Display *d, char *str) {
  int counter;
  char **list;
  XFontStruct *font;
  list = XListFonts(d, str, 1, &counter);
  font = XLoadQueryFont(d, list[0]);
  XFreeFontNames(list);
  return font;
}


x86 assembly (clang, -O0):
<getFirstFoundEntry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
lea    -0x14(%rbp),%rcx
call   1040 <XListFonts@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
call   1050 <XLoadQueryFont@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <XFreeFontNames@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFirstFoundEntry>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x4(%rsp),%rcx
mov    $0x1,%edx
call   1040 <XListFonts@plt>
mov    %rax,%rbx
mov    (%rax),%rsi
mov    %r14,%rdi
call   1050 <XLoadQueryFont@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <XFreeFontNames@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @getFirstFoundEntry(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32*
store i32* %0, i32** %3
store i8* %1, i8** %4
%8 = load i32*, i32** %3
%9 = load i8*, i8** %4
%10 = call i8** @XListFonts(i32* %8, i8* %9, i32 1, i32* %5)
store i8** %10, i8*** %6
%11 = load i32*, i32** %3
%12 = load i8**, i8*** %6
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32* @XLoadQueryFont(i32* %11, i8* %14)
store i32* %15, i32** %7
%16 = load i8**, i8*** %6
%17 = call i32 @XFreeFontNames(i8** %16)
%18 = load i32*, i32** %7
ret i32* %18
}

LLVM IR (-O2):
define i32* @getFirstFoundEntry(i32* %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i8** @XListFonts(i32* %0, i8* %1, i32 1, i32* %3)
%6 = load i8*, i8** %5
%7 = call i32* @XLoadQueryFont(i32* %0, i8* %6)
%8 = call i32 @XFreeFontNames(i8** %5)
ret i32* %7
}
/* Variables and functions */
char *longestCommonPrefix(char **, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  printf("%s\n", longestCommonPrefix(argv + 1, argc - 1));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x8(%rsi),%rax
lea    -0x1(%rdi),%esi
mov    %rax,%rdi
call   1030 <longestCommonPrefix@plt>
lea    0xec9(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = call i8* @longestCommonPrefix(i8** %7, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = add nsw i32 %0, -1
%5 = tail call i8* @longestCommonPrefix(i8** %3, i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
unsigned int f(unsigned int a) { return a & 0xfffffff0; }


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

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
and    $0xfffffff0,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = and i32 %0, -16
ret i32 %2
}
void dados_to_char(int *dados, char *asciidados) {
  for (int i = 0; i < 5; i++)
    *asciidados++ = '0' + *dados++;
  *asciidados = '\0';
}


x86 assembly (clang, -O0):
<dados_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1152 <dados_to_char+0x52>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <dados_to_char+0x13>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dados_to_char>:
mov    (%rdi),%al
add    $0x30,%al
mov    %al,(%rsi)
mov    0x4(%rdi),%al
add    $0x30,%al
mov    %al,0x1(%rsi)
mov    0x8(%rdi),%al
add    $0x30,%al
mov    %al,0x2(%rsi)
mov    0xc(%rdi),%al
add    $0x30,%al
mov    %al,0x3(%rsi)
mov    0x10(%rdi),%al
add    $0x30,%al
mov    %al,0x4(%rsi)
movb   $0x0,0x5(%rsi)
ret

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

LLVM IR (-O2):
define void @dados_to_char(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %0
%5 = trunc i32 %4 to i8
%6 = add i8 %5, 48
%7 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %6, i8* %1
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %3
%10 = trunc i32 %9 to i8
%11 = add i8 %10, 48
%12 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %11, i8* %7
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %8
%15 = trunc i32 %14 to i8
%16 = add i8 %15, 48
%17 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %16, i8* %12
%18 = getelementptr inbounds i32, i32* %0, i64 4
%19 = load i32, i32* %13
%20 = trunc i32 %19 to i8
%21 = add i8 %20, 48
%22 = getelementptr inbounds i8, i8* %1, i64 4
store i8 %21, i8* %17
%23 = load i32, i32* %18
%24 = trunc i32 %23 to i8
%25 = add i8 %24, 48
%26 = getelementptr inbounds i8, i8* %1, i64 5
store i8 %25, i8* %22
store i8 0, i8* %26
ret void
}
int cmp_char(const void *a, const void *b) {
  const char *aa = (char *)a;
  const char *bb = (char *)b;
  return *aa - *bb;
}


x86 assembly (clang, -O0):
<cmp_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    -0x20(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_char>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_char(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int BIT(int);
int wpa_key_mgmt_fils(int akm) {
  return !!(akm & (BIT(18) | BIT(19) | BIT(20) | BIT(21)));
}


x86 assembly (clang, -O0):
<wpa_key_mgmt_fils>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x12,%edi
call   1030 <BIT@plt>
mov    %eax,-0x14(%rbp)
mov    $0x13,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    $0x14,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    $0x15,%edi
call   1030 <BIT@plt>
mov    -0xc(%rbp),%ecx
mov    %eax,%edx
mov    -0x8(%rbp),%eax
or     %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_key_mgmt_fils>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0x12,%edi
call   1030 <BIT@plt>
mov    %eax,%ebp
mov    $0x13,%edi
call   1030 <BIT@plt>
mov    %eax,%ebx
or     %ebp,%ebx
mov    $0x14,%edi
call   1030 <BIT@plt>
mov    %eax,%ebp
mov    $0x15,%edi
call   1030 <BIT@plt>
or     %ebp,%eax
or     %ebx,%eax
xor    %ecx,%ecx
test   %r14d,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wpa_key_mgmt_fils(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @BIT(i32 18)
%5 = call i32 @BIT(i32 19)
%6 = or i32 %4, %5
%7 = call i32 @BIT(i32 20)
%8 = or i32 %6, %7
%9 = call i32 @BIT(i32 21)
%10 = or i32 %8, %9
%11 = and i32 %3, %10
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = xor i1 %13, true
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @wpa_key_mgmt_fils(i32 %0) {
%2 = tail call i32 @BIT(i32 18)
%3 = tail call i32 @BIT(i32 19)
%4 = or i32 %3, %2
%5 = tail call i32 @BIT(i32 20)
%6 = or i32 %4, %5
%7 = tail call i32 @BIT(i32 21)
%8 = or i32 %6, %7
%9 = and i32 %8, %0
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
void bar_long_long(void) { foo_long_long(2LL - 3LLi); }


x86 assembly (clang, -O0):
<bar_long_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x2,-0x10(%rbp)
movq   $0xfffffffffffffffd,-0x8(%rbp)
ff
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <foo_long_long@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar_long_long>:
mov    $0x2,%edi
mov    $0xfffffffffffffffd,%rsi
xor    %eax,%eax
jmp    1030 <foo_long_long@plt>

LLVM IR (-O0):
define void @bar_long_long() {
%1 = alloca { i64, i64 }
%2 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %1, i32 0, i32 0
%3 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %1, i32 0, i32 1
store i64 2, i64* %2
store i64 -3, i64* %3
%4 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %1, i32 0, i32 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %1, i32 0, i32 1
%7 = load i64, i64* %6
%8 = call i32 (i64, i64, ...) bitcast (i32 (...)* @foo_long_long to i32 (i64, i64, ...)*)(i64 %5, i64 %7)
ret void
}

LLVM IR (-O2):
define void @bar_long_long() {
%1 = tail call i32 (i64, i64, ...) bitcast (i32 (...)* @foo_long_long to i32 (i64, i64, ...)*)(i64 2, i64 -3)
ret void
}
int f4(volatile int *a) {
  int b = a[2];
  int c = a[3];
  return b + c;
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    0x8(%rdi),%eax
add    0xc(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @f4(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load volatile i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 3
%5 = load volatile i32, i32* %4
%6 = add nsw i32 %5, %3
ret i32 %6
}
int test_imm_C9uint8_reg(unsigned char val) {
  return ((val) & (0xC9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_C9uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -55
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long TMPFILE() {
  FILE *tmpfile();
  return ((long)tmpfile());
}


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

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

LLVM IR (-O0):
define i64 @TMPFILE() {
%1 = call i32* (...) @tmpfile()
%2 = ptrtoint i32* %1 to i64
ret i64 %2
}

LLVM IR (-O2):
define i64 @TMPFILE() {
%1 = tail call i32* (...) @tmpfile()
%2 = ptrtoint i32* %1 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void clearScreen(void) {
  printf("\033[2J");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
@stdout = global i32 0
define void @clearScreen() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fflush(i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
@stdout = global i32 0
define void @clearScreen() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
ret void
}
void tap2audio_file_resume(void *priv) {}


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

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

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

LLVM IR (-O2):
define void @tap2audio_file_resume(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
void str_remove_blanks(char *str) {
  register char *p;
  assert(str);
  for (p = str; *p; p++)
    if (*p != ' ')
      *str++ = *p;
  *str = '\0';
}


x86 assembly (clang, -O0):
<str_remove_blanks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1177 <str_remove_blanks+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1161 <str_remove_blanks+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1166 <str_remove_blanks+0x56>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112d <str_remove_blanks+0x1d>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_remove_blanks>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    %rbx,%rax
jmp    1124 <str_remove_blanks+0x14>
xchg   %ax,%ax
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1120 <str_remove_blanks+0x10>
test   %cl,%cl
je     1138 <str_remove_blanks+0x28>
mov    %cl,(%rbx)
add    $0x1,%rbx
jmp    1120 <str_remove_blanks+0x10>
movb   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @str_remove_blanks(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
br label %3
3: ; preds = %9, %1
%4 = phi i8* [ %0, %1 ], [ %10, %9 ]
%5 = phi i8* [ %0, %1 ], [ %11, %9 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %12
i8 32, label %9
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %6, i8* %4
br label %9
9: ; preds = %3, %7
%10 = phi i8* [ %8, %7 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %5, i64 1
br label %3
12: ; preds = %3
store i8 0, i8* %4
ret void
}
void RTTarFileOpenCurrentFile(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTarFileOpenCurrentFile() {
ret void
}
int pstrcmp(a, b)
char **a, **b;
{ return strcmp(*a, *b); }


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

x86 assembly (clang, -O2):
<pstrcmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @pstrcmp(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
/* Variables and functions */
int Clip255(int);
int AddSubtractComponentFull(int a, int b, int c) { return Clip255(a + b - c); }


x86 assembly (clang, -O0):
<AddSubtractComponentFull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1030 <Clip255@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddSubtractComponentFull>:
add    %esi,%edi
sub    %edx,%edi
jmp    1030 <Clip255@plt>

LLVM IR (-O0):
define i32 @AddSubtractComponentFull(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = call i32 @Clip255(i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @AddSubtractComponentFull(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = sub i32 %4, %2
%6 = tail call i32 @Clip255(i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void catch_hup(int sig) { printf("HUP\n"); }


x86 assembly (clang, -O0):
<catch_hup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [4 x i8] c"HUP\00"
define void @catch_hup(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
int end_f(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @end_f() {
ret i32 1
}

LLVM IR (-O2):
define i32 @end_f() {
ret i32 1
}
void multi_arr(int (*ptr)[3]) {
  printf("%d\n", sizeof(ptr));
  printf("%d\n", ptr[1]);
}


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

x86 assembly (clang, -O2):
<multi_arr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%r14
mov    $0x8,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0xc,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @multi_arr([3 x i32]* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 8)
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %0, i64 1, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
ret void
}
/* Variables and functions */
unsigned int arch_cpuid_1(int);
unsigned int cpuid_signature() { return arch_cpuid_1(1); }


x86 assembly (clang, -O0):
<cpuid_signature>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <arch_cpuid_1@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cpuid_signature() {
%1 = call i32 @arch_cpuid_1(i32 1)
ret i32 %1
}

LLVM IR (-O2):
define i32 @cpuid_signature() {
%1 = tail call i32 @arch_cpuid_1(i32 1)
ret i32 %1
}
void dfree_vector(v, nl, nh) double *v;
int nl, nh;
{ free((char *)(v + nl)); }


x86 assembly (clang, -O0):
<dfree_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dfree_vector>:
movslq %esi,%rax
lea    (%rdi,%rax,8),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @dfree_vector(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = bitcast double* %10 to i8*
ret void
}

LLVM IR (-O2):
define void @dfree_vector(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = bitcast double* %5 to i8*
tail call void @free(i8* %6)
ret void
}
void gtk_viewport_get_hadjustment() {}


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

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

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

LLVM IR (-O2):
define void @gtk_viewport_get_hadjustment() {
ret void
}
void foo_2_1_1_2_2_1_2_1_2() {}


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

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

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

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

/* Variables and functions */
uint32_t __le_u24(const void *p) { return *((uint32_t *)(p)) & 0xFFFFFF; }


x86 assembly (clang, -O0):
<__le_u24>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__le_u24>:
mov    $0xffffff,%eax
and    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @__le_u24(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = and i32 %5, 16777215
ret i32 %6
}

LLVM IR (-O2):
define i32 @__le_u24(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = and i32 %3, 16777215
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr,
          "usage: gen [[lLrumi]=VALUE]... (where VALUE is a number >= 0)\n"
          "      l: number of labels in policy, l>0\n"
          "      L: maximal number of each label reoccurance in policy, L>0\n"
          "      u: number of unique rules (rules with different subject, "
          "object pair), u>0\n"
          "      m: number of merges per each unique rule, m>=0\n"
          "      r: number of different rights generated randomly, r>0\n"
          "      i: i=0: generate labels, i>0: read labels from stdio, 0 by "
          "default\n"
          "      s: shuffles or sort the result. s=0, default, sorts. s>0, "
          "shuffles.\n"
          "      p: percentage of modification rules, from 0 to 100, default: "
          "33\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [580 x i8] c"usage: gen [[lLrumi]=VALUE]... (where VALUE is a number >= 0)\0A l: number of labels in policy, l>0\0A L: maximal number of each label reoccurance in policy, L>0\0A u: number of unique rules (rules with different subject, object pair), u>0\0A m: number of merges per each unique rule, m>=0\0A r: number of different rights generated randomly, r>0\0A i: i=0: generate labels, i>0: read labels from stdio, 0 by default\0A s: shuffles or sort the result. s=0, default, sorts. s>0, shuffles.\0A p: percentage of modification rules, from 0 to 100, default: 33\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([580 x i8], [580 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [580 x i8] c"usage: gen [[lLrumi]=VALUE]... (where VALUE is a number >= 0)\0A l: number of labels in policy, l>0\0A L: maximal number of each label reoccurance in policy, L>0\0A u: number of unique rules (rules with different subject, object pair), u>0\0A m: number of merges per each unique rule, m>=0\0A r: number of different rights generated randomly, r>0\0A i: i=0: generate labels, i>0: read labels from stdio, 0 by default\0A s: shuffles or sort the result. s=0, default, sorts. s>0, shuffles.\0A p: percentage of modification rules, from 0 to 100, default: 33\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([580 x i8], [580 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int mapcon_top_dimension(int *dim) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(433, dim, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<mapcon_top_dimension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1b1,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapcon_top_dimension>:
mov    %rdi,%rsi
mov    $0x1b1,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @mapcon_top_dimension(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = load i32*, i32** %3
%8 = load double*, double** %5
%9 = call i32 @_ada_use_c2phc4c(i32 433, i32* %6, i32* %7, double* %8, i32 0)
store i32 %9, i32* %4
%10 = load i32, i32* %4
ret i32 %10
}

LLVM IR (-O2):
define i32 @mapcon_top_dimension(i32* %0) {
%2 = tail call i32 @_ada_use_c2phc4c(i32 433, i32* %0, i32* undef, double* undef, i32 0)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t my_ntohl(uint32_t u) {
  uint32_t t;
  t = 0x00000011;
  if (!(((char *)&t)[0]))
    return (u);
  u = ((u >> 8) & 0x00FF00FF) | ((u << 8) & 0xFF00FF00);
  u = ((u >> 16) & 0x0000FFFF) | ((u << 16) & 0xFFFF0000);
  return (u);
}


x86 assembly (clang, -O0):
<my_ntohl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x11,-0xc(%rbp)
cmpb   $0x0,-0xc(%rbp)
jne    1123 <my_ntohl+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <my_ntohl+0x61>
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
and    $0xff00ff,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff00ff00,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
and    $0xffff,%eax
mov    -0x8(%rbp),%ecx
shl    $0x10,%ecx
and    $0xffff0000,%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @my_ntohl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 17, i32* %4
%5 = bitcast i32* %4 to i8*
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %27
11: ; preds = %1
%12 = load i32, i32* %3
%13 = ashr i32 %12, 8
%14 = and i32 %13, 16711935
%15 = load i32, i32* %3
%16 = shl i32 %15, 8
%17 = and i32 %16, -16711936
%18 = or i32 %14, %17
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = ashr i32 %19, 16
%21 = and i32 %20, 65535
%22 = load i32, i32* %3
%23 = shl i32 %22, 16
%24 = and i32 %23, -65536
%25 = or i32 %21, %24
store i32 %25, i32* %3
%26 = load i32, i32* %3
store i32 %26, i32* %2
br label %27
27: ; preds = %11, %9
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @my_ntohl(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
double __complex__ fun_dcomplex(double __complex__ a, double __complex__ b) {
  return a;
}


x86 assembly (clang, -O0):
<fun_dcomplex>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
pop    %rbp
ret

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

LLVM IR (-O0):
define { double, double } @fun_dcomplex(double %0, double %1, double %2, double %3) {
%5 = alloca { double, double }
%6 = alloca { double, double }
%7 = alloca { double, double }
%8 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 0
store double %0, double* %8
%9 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 1
store double %1, double* %9
%10 = getelementptr inbounds { double, double }, { double, double }* %7, i32 0, i32 0
store double %2, double* %10
%11 = getelementptr inbounds { double, double }, { double, double }* %7, i32 0, i32 1
store double %3, double* %11
%12 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 0
%13 = load double, double* %12
%14 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 1
%15 = load double, double* %14
%16 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%17 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
store double %13, double* %16
store double %15, double* %17
%18 = load { double, double }, { double, double }* %5
ret { double, double } %18
}

LLVM IR (-O2):
define { double, double } @fun_dcomplex(double %0, double %1, double %2, double %3) {
%5 = insertvalue { double, double } poison, double %0, 0
%6 = insertvalue { double, double } %5, double %1, 1
ret { double, double } %6
}
int main() {
  int x;
  x = 50;
  while (x)
    x = x - 1;
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112a <main+0x2a>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %2
br label %3
9: ; preds = %3
%10 = load i32, i32* %2
ret i32 %10
}

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

/* Variables and functions */
void border_set(volatile uint32_t reg, uint32_t value) {
  *(&reg) = value;
  *(&reg) = value;
}


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

x86 assembly (clang, -O2):
<border_set>:
mov    %edi,-0x4(%rsp)
mov    %esi,-0x4(%rsp)
mov    %esi,-0x4(%rsp)
ret

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

LLVM IR (-O2):
define void @border_set(i32 %0, i32 %1) {
%3 = alloca i32
store volatile i32 %0, i32* %3
store volatile i32 %1, i32* %3
store volatile i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outp(int, int);
void PIC_end(void) {
  outp(0x020, 0x11);
  outp(0x021, 0x08);
  outp(0x021, 0x04);
  outp(0x021, 0x01);
  outp(0x021, 0xFF);
  outp(0x0A0, 0x11);
  outp(0x0A1, 0x70);
  outp(0x0A1, 0x02);
  outp(0x0A1, 0x01);
  outp(0x0A1, 0xFF);
}


x86 assembly (clang, -O0):
<PIC_end>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x8,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1030 <outp@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x70,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1030 <outp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PIC_end>:
push   %rax
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x8,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <outp@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1030 <outp@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x70,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <outp@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
pop    %rax
jmp    1030 <outp@plt>

LLVM IR (-O0):
define void @PIC_end() {
%1 = call i32 @outp(i32 32, i32 17)
%2 = call i32 @outp(i32 33, i32 8)
%3 = call i32 @outp(i32 33, i32 4)
%4 = call i32 @outp(i32 33, i32 1)
%5 = call i32 @outp(i32 33, i32 255)
%6 = call i32 @outp(i32 160, i32 17)
%7 = call i32 @outp(i32 161, i32 112)
%8 = call i32 @outp(i32 161, i32 2)
%9 = call i32 @outp(i32 161, i32 1)
%10 = call i32 @outp(i32 161, i32 255)
ret void
}

LLVM IR (-O2):
define void @PIC_end() {
%1 = tail call i32 @outp(i32 32, i32 17)
%2 = tail call i32 @outp(i32 33, i32 8)
%3 = tail call i32 @outp(i32 33, i32 4)
%4 = tail call i32 @outp(i32 33, i32 1)
%5 = tail call i32 @outp(i32 33, i32 255)
%6 = tail call i32 @outp(i32 160, i32 17)
%7 = tail call i32 @outp(i32 161, i32 112)
%8 = tail call i32 @outp(i32 161, i32 2)
%9 = tail call i32 @outp(i32 161, i32 1)
%10 = tail call i32 @outp(i32 161, i32 255)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *init_behaviour(void *raw) {
  printf("Init behaviour.....");
  printf("done\n");
  return raw;
}


x86 assembly (clang, -O0):
<init_behaviour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_behaviour>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Init behaviour.....\00"
@str = [5 x i8] c"done\00"
define i8* @init_behaviour(i8* readnone returned %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i8* %0
}