xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello world!\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
unsigned hash(const char *s) {
  unsigned hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % 1001;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x3e9,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     114a <hash+0x4a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x5e1d27b,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x9,%edx
imul   $0x3e9,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 1001
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int get_key(int /*<<< orphan*/ *, int, int, int, unsigned char *);
int get_RSA2048_qInv(FILE *fp, int *key_off, int *key_name_off,
                     unsigned char *RSA2048_qInv) {
  return get_key(fp, key_off[7] + 5, key_name_off[8], 128, RSA2048_qInv);
}


x86 assembly (clang, -O0):
<get_RSA2048_qInv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
add    $0x5,%esi
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%edx
mov    -0x20(%rbp),%r8
mov    $0x80,%ecx
call   1030 <get_key@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_RSA2048_qInv>:
mov    %rcx,%r8
mov    0x1c(%rsi),%esi
add    $0x5,%esi
mov    0x20(%rdx),%edx
mov    $0x80,%ecx
jmp    1030 <get_key@plt>

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

LLVM IR (-O2):
define i32 @get_RSA2048_qInv(i32* %0, i32* nocapture %1, i32* nocapture %2, i8* %3) {
%5 = getelementptr inbounds i32, i32* %1, i64 7
%6 = load i32, i32* %5
%7 = add nsw i32 %6, 5
%8 = getelementptr inbounds i32, i32* %2, i64 8
%9 = load i32, i32* %8
%10 = tail call i32 @get_key(i32* %0, i32 %7, i32 %9, i32 128, i8* %3)
ret i32 %10
}
int osd_getkey(char *name) {
  int ii = 0;
  register char *pp;
  pp = name;
  while (*pp)
    ii = ii << 1 ^ *pp++;
  if (ii < 0)
    ii = -ii;
  return ii;
}


x86 assembly (clang, -O0):
<osd_getkey>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <osd_getkey+0x46>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <osd_getkey+0x17>
cmpl   $0x0,-0xc(%rbp)
jge    1158 <osd_getkey+0x58>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<osd_getkey>:
mov    (%rdi),%al
test   %al,%al
je     1124 <osd_getkey+0x24>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
add    %ecx,%ecx
movsbl %al,%eax
xor    %eax,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <osd_getkey+0x10>
jmp    1126 <osd_getkey+0x26>
xor    %ecx,%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @osd_getkey(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = shl i32 %7, 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = sext i8 %5 to i32
%11 = xor i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
%16 = tail call i32 @llvm.abs.i32(i32 %15, i1 true)
ret i32 %16
}
unsigned int hash(char *cp) {
  unsigned int h = 2166136261;
  unsigned char ch;
  while ((ch = *cp++) != '\0') {
    h ^= (unsigned char)ch;
    h *= 16777619;
  }
  return h;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x811c9dc5,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movzbl %al,%eax
cmp    $0x0,%eax
je     1148 <hash+0x48>
movzbl -0xd(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
imul   $0x1000193,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <hash+0x27>
add    $0x1,%rdi
mov    $0x811c9dc5,%eax
nop
movzbl %cl,%ecx
xor    %eax,%ecx
imul   $0x1000193,%ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
mov    $0x811c9dc5,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ -2128831035, %1 ]
%8 = zext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = xor i32 %7, %8
%11 = mul i32 %10, 16777619
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ -2128831035, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
char *__body_init_status(char **, int *, int);
void body_init_status(char *buffer[2], char **header, int *num_lines) {
  int z;
  for (z = 0; z < 2; z++)
    buffer[z] = __body_init_status(header, num_lines, z);
}


x86 assembly (clang, -O0):
<body_init_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x1c(%rbp)
jge    1162 <body_init_status+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <__body_init_status@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <body_init_status+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<body_init_status>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
xor    %edx,%edx
call   1030 <__body_init_status@plt>
mov    %rax,(%r15)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <__body_init_status@plt>
mov    %rax,0x8(%r15)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @body_init_status(i8** nocapture writeonly %0, i8** %1, i32* %2) {
%4 = tail call i8* @__body_init_status(i8** %1, i32* %2, i32 0)
store i8* %4, i8** %0
%5 = tail call i8* @__body_init_status(i8** %1, i32* %2, i32 1)
%6 = getelementptr inbounds i8*, i8** %0, i64 1
store i8* %5, i8** %6
ret void
}
int test_imm_5Fint16_mem(short *val) {
  return ((*val) & (0x5F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Fint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 95
%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_5Fint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 95
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int defaultDataToInt(void *data) { return *(int *)data; }


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

x86 assembly (clang, -O2):
<defaultDataToInt>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @defaultDataToInt(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
ret i32 %5
}

LLVM IR (-O2):
define i32 @defaultDataToInt(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int func(void) {
  printf("This is a dummy shared obect.\n");
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"This is a dummy shared obect.\0A\00"
define i32 @func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"This is a dummy shared obect.\00"
define i32 @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_24uint8_mem(unsigned char *val) {
  return ((*val) & (-0x24 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_24uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -36
%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_24uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -36
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ _rdrand64_step(unsigned long long *);
unsigned long long hardware_rand64(void) {
  unsigned long long int x;
  while (!_rdrand64_step(&x))
    continue;
  return x;
}


x86 assembly (clang, -O0):
<hardware_rand64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <_rdrand64_step@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1136 <hardware_rand64+0x26>
jmp    113b <hardware_rand64+0x2b>
jmp    1118 <hardware_rand64+0x8>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hardware_rand64>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <_rdrand64_step@plt>
test   %eax,%eax
je     1120 <hardware_rand64+0x10>
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @hardware_rand64() {
%1 = alloca i64
br label %2
2: ; preds = %6, %0
%3 = call i32 @_rdrand64_step(i64* %1)
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
%8 = load i64, i64* %1
ret i64 %8
}

LLVM IR (-O2):
define i64 @hardware_rand64() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @_rdrand64_step(i64* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = load i64, i64* %1
ret i64 %7
}
int numLength(int num) {
  int length = 1;
  if (num < 0) {
    length += 1;
    num *= -1;
  }
  while (num / 10 != 0) {
    length += 1;
    num /= 10;
  }
  return length;
}


x86 assembly (clang, -O0):
<numLength>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1128 <numLength+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112d <numLength+0x2d>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     115d <numLength+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    112d <numLength+0x2d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numLength>:
mov    %edi,%eax
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
shr    $0x1f,%eax
add    $0x1,%eax
cmp    $0xa,%ecx
jb     1145 <numLength+0x45>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
lea    (%rdx,%rsi,1),%ecx
add    $0x1,%eax
add    %esi,%edx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1120 <numLength+0x20>
ret

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

LLVM IR (-O2):
define i32 @numLength(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = sub nsw i32 0, %0
%4 = select i1 %2, i32 %3, i32 %0
%5 = select i1 %2, i32 2, i32 1
%6 = icmp ult i32 %4, 10
br i1 %6, label %14, label %7
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %5, %1 ]
%9 = phi i32 [ %10, %7 ], [ %4, %1 ]
%10 = sdiv i32 %9, 10
%11 = add nuw nsw i32 %8, 1
%12 = add nsw i32 %10, 9
%13 = icmp ult i32 %12, 19
br i1 %13, label %14, label %7
14: ; preds = %7, %1
%15 = phi i32 [ %5, %1 ], [ %11, %7 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ e_acsl_assert(int, char *, char *, char *, int);
long long foo();
long long __e_acsl_foo(void) {
  long long __retres;
  __retres = foo();
  e_acsl_assert(__retres == (long long)100, (char *)"Postcondition",
                (char *)"foo", (char *)"\\result == 100", 19);
  return __retres;
}


x86 assembly (clang, -O0):
<__e_acsl_foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <foo@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x64,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xeb9(%rip),%rsi
lea    0xec0(%rip),%rdx
lea    0xebd(%rip),%rcx
mov    $0x13,%r8d
call   1030 <e_acsl_assert@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__e_acsl_foo>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%rbx
xor    %edi,%edi
cmp    $0x64,%rax
sete   %dil
lea    0xec4(%rip),%rsi
lea    0xecb(%rip),%rdx
lea    0xec8(%rip),%rcx
mov    $0x13,%r8d
call   1030 <e_acsl_assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Postcondition\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [15 x i8] c"\\result == 100\00"
define i64 @__e_acsl_foo() {
%1 = alloca i64
%2 = call i64 (...) @foo()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp eq i64 %3, 100
%5 = zext i1 %4 to i32
%6 = call i32 @e_acsl_assert(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 19)
%7 = load i64, i64* %1
ret i64 %7
}

LLVM IR (-O2):
@.str = [14 x i8] c"Postcondition\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [15 x i8] c"\\result == 100\00"
define i64 @__e_acsl_foo() {
%1 = tail call i64 (...) @foo()
%2 = icmp eq i64 %1, 100
%3 = zext i1 %2 to i32
%4 = tail call i32 @e_acsl_assert(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 19)
ret i64 %1
}
nplot(n, c) int n, c;
{
  while (n--)
    putchar(c);
}


x86 assembly (clang, -O0):
<nplot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1141 <nplot+0x31>
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
jmp    111e <nplot+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nplot>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
je     112e <nplot+0x1e>
mov    %esi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1120 <nplot+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @nplot(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %1)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ closesocket(int);
void socketClose(int socket) { closesocket(socket); }


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

x86 assembly (clang, -O2):
<socketClose>:
jmp    1030 <closesocket@plt>

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

LLVM IR (-O2):
define void @socketClose(i32 %0) {
%2 = tail call i32 @closesocket(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set32(int, int);
void SomeFuncA(void) {
  set32(0xD80018C, 0x400);
  set32(0xD80018C, 0x800);
}


x86 assembly (clang, -O0):
<SomeFuncA>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd80018c,%edi
mov    $0x400,%esi
call   1030 <set32@plt>
mov    $0xd80018c,%edi
mov    $0x800,%esi
call   1030 <set32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SomeFuncA>:
push   %rax
mov    $0xd80018c,%edi
mov    $0x400,%esi
call   1030 <set32@plt>
mov    $0xd80018c,%edi
mov    $0x800,%esi
pop    %rax
jmp    1030 <set32@plt>

LLVM IR (-O0):
define void @SomeFuncA() {
%1 = call i32 @set32(i32 226492812, i32 1024)
%2 = call i32 @set32(i32 226492812, i32 2048)
ret void
}

LLVM IR (-O2):
define void @SomeFuncA() {
%1 = tail call i32 @set32(i32 226492812, i32 1024)
%2 = tail call i32 @set32(i32 226492812, i32 2048)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, unsigned int);
void sasl_erasebuffer(char *buf, unsigned len) { memset(buf, 0, len); }


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

x86 assembly (clang, -O2):
<sasl_erasebuffer>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @sasl_erasebuffer(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void default_pbc_free(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<default_pbc_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):
<default_pbc_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @default_pbc_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 @default_pbc_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct can_frame {
  int *data;
};

/* Variables and functions */
int sdo_is_end_segment(const struct can_frame *frame) {
  return frame->data[0] & 1;
}


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

x86 assembly (clang, -O2):
<sdo_is_end_segment>:
mov    (%rdi),%rax
mov    (%rax),%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
%struct.can_frame = type { i32* }
define i32 @sdo_is_end_segment(%struct.can_frame* %0) {
%2 = alloca %struct.can_frame*
store %struct.can_frame* %0, %struct.can_frame** %2
%3 = load %struct.can_frame*, %struct.can_frame** %2
%4 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %3, i32 0, i32 0
%5 = load i32*, i32** %4
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = and i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
%struct.can_frame = type { i32* }
define i32 @sdo_is_end_segment(%struct.can_frame* nocapture %0) {
%2 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %0, i64 0, i32 0
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 1
ret i32 %5
}
int kt_int_log10(int n) {
  int tmp1 = n;
  int tmp2 = 0;
  while (tmp1 /= 10) {
    tmp2++;
  }
  return tmp2;
}


x86 assembly (clang, -O0):
<kt_int_log10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1139 <kt_int_log10+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1114 <kt_int_log10+0x14>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kt_int_log10>:
lea    0x9(%rdi),%ecx
xor    %eax,%eax
cmp    $0x13,%ecx
jb     1135 <kt_int_log10+0x35>
xor    %eax,%eax
nopl   0x0(%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
lea    (%rcx,%rdx,1),%edi
add    $0x1,%eax
add    %edx,%ecx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <kt_int_log10+0x10>
ret

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

LLVM IR (-O2):
define i32 @kt_int_log10(i32 %0) {
%2 = add i32 %0, 9
%3 = icmp ult i32 %2, 19
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32 [ %7, %4 ], [ %0, %1 ]
%7 = sdiv i32 %6, 10
%8 = add nuw nsw i32 %5, 1
%9 = add nsw i32 %7, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ insert_char(char, int);
int /*<<< orphan*/ putchar(char);
void print_margin(char c) {
  insert_char(' ', 4 - 1);
  putchar(c);
}


x86 assembly (clang, -O0):
<print_margin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x20,%edi
mov    $0x3,%esi
call   1040 <insert_char@plt>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_margin>:
push   %rbx
mov    %edi,%ebx
mov    $0x20,%edi
mov    $0x3,%esi
call   1040 <insert_char@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @print_margin(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @insert_char(i8 signext 32, i32 3)
%4 = load i8, i8* %2
%5 = call i32 @putchar(i8 signext %4)
ret void
}

LLVM IR (-O2):
define void @print_margin(i8 signext %0) {
%2 = tail call i32 @insert_char(i8 signext 32, i32 3)
%3 = tail call i32 @putchar(i8 signext %0)
ret void
}
/* Variables and functions */
char *strncat(char *, char *, int);
void test1(char *to, int to_size, char *from) {
  char *r = strncat(to + to_size, from, 2);
}


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

x86 assembly (clang, -O2):
<test1>:
movslq %esi,%rax
add    %rax,%rdi
mov    %rdx,%rsi
mov    $0x2,%edx
jmp    1030 <strncat@plt>

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

LLVM IR (-O2):
define void @test1(i8* %0, i32 %1, i8* %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i8* @strncat(i8* %5, i8* %2, i32 2)
ret void
}
int llcompare(const void *p, const void *q) {
  const long long *a = (const long long *)p;
  const long long *b = (const long long *)q;
  if (a[0] < b[0])
    return -1;
  else if (a[0] > b[0])
    return +1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<llcompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jge    113c <llcompare+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <llcompare+0x63>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jle    115c <llcompare+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1163 <llcompare+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llcompare>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @llcompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = icmp sgt i64 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void writeb(unsigned char val, volatile void *addr) {
  asm volatile("mov"
               "b"
               " %0,%1"
               :
               : "q"(val), "m"(*(volatile unsigned char *)addr)
               : "memory");
}


x86 assembly (clang, -O0):
<writeb>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeb>:
mov    %dil,(%rsi)
ret

LLVM IR (-O0):
define void @writeb(i8 zeroext %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** %4
ret void
}

LLVM IR (-O2):
define void @writeb(i8 zeroext %0, i8* %1) {
tail call void asm sideeffect "movb $0,$1", "q,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i8 %0, i8* elementtype(i8) %1)
ret void
}
/* Variables and functions */
double gsw_ct_from_pt(double, double);
double gsw_latentheat_evap_ct(double, double);
double gsw_latentheat_evap_t(double sa, double t) {
  double ct = gsw_ct_from_pt(sa, t);
  return (gsw_latentheat_evap_ct(sa, ct));
}


x86 assembly (clang, -O0):
<gsw_latentheat_evap_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <gsw_ct_from_pt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <gsw_latentheat_evap_ct@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_latentheat_evap_t>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <gsw_ct_from_pt@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <gsw_latentheat_evap_ct@plt>

LLVM IR (-O0):
define double @gsw_latentheat_evap_t(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = call double @gsw_ct_from_pt(double %6, double %7)
store double %8, double* %5
%9 = load double, double* %3
%10 = load double, double* %5
%11 = call double @gsw_latentheat_evap_ct(double %9, double %10)
ret double %11
}

LLVM IR (-O2):
define double @gsw_latentheat_evap_t(double %0, double %1) {
%3 = tail call double @gsw_ct_from_pt(double %0, double %1)
%4 = tail call double @gsw_latentheat_evap_ct(double %0, double %3)
ret double %4
}
void read_littleEndian_short(short *dest, unsigned char *source) {
  *dest = *(short *)source;
}


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

x86 assembly (clang, -O2):
<read_littleEndian_short>:
movzwl (%rsi),%eax
mov    %ax,(%rdi)
ret

LLVM IR (-O0):
define void @read_littleEndian_short(i16* %0, i8* %1) {
%3 = alloca i16*
%4 = alloca i8*
store i16* %0, i16** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i16*
%7 = load i16, i16* %6
%8 = load i16*, i16** %3
store i16 %7, i16* %8
ret void
}

LLVM IR (-O2):
define void @read_littleEndian_short(i16* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i16*
%4 = load i16, i16* %3
store i16 %4, i16* %0
ret void
}
void SmFreeReasons(count, reasonMsgs) int count;
char **reasonMsgs;
{
  if (reasonMsgs) {
    int i;
    for (i = 0; i < count; i++)
      free(reasonMsgs[i]);
    free((char *)reasonMsgs);
  }
}


x86 assembly (clang, -O0):
<SmFreeReasons>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1165 <SmFreeReasons+0x55>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115c <SmFreeReasons+0x4c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <SmFreeReasons+0x21>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @SmFreeReasons(i32 %0, i8** %1) {
%3 = icmp eq i8** %1, null
br i1 %3, label %16, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %14
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %7
br i1 %13, label %14, label %8
14: ; preds = %8, %4
%15 = bitcast i8** %1 to i8*
tail call void @free(i8* %15)
br label %16
16: ; preds = %14, %2
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ trim(char *);
int main() {
  char *s = (char *)malloc(42 * sizeof(char));
  printf("Enter a text to trim (max 42 char long): ");
  scanf("%42s", s);
  trim(s);
  printf("Trimmed: %s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2a,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb4(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <trim@plt>
mov    -0x10(%rbp),%rsi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2a,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <trim@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Enter a text to trim (max 42 char long): \00"
@.str.1 = [5 x i8] c"%42s\00"
@.str.2 = [13 x i8] c"Trimmed: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 42)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %2
%9 = call i32 @trim(i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [42 x i8] c"Enter a text to trim (max 42 char long): \00"
@.str.1 = [5 x i8] c"%42s\00"
@.str.2 = [13 x i8] c"Trimmed: %s\0A\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 42)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = tail call i32 @trim(i8* %2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void another() { printf("Another lib.\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Another lib.\0A\00"
define void @another() {
%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"Another lib.\00"
define void @another() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x;
  printf("Hello World! %d\n", x);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"Hello World! %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xa9() {
  Assert_real((isdigit(169) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              850, ("isdigit should be 0 for 0xa9"));
}


x86 assembly (clang, -O0):
<t_isdigit_0xa9>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa9,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x352,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0xa9>:
push   %rax
mov    $0xa9,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x352,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xa9\00"
define void @t_isdigit_0xa9() {
%1 = call i64 @isdigit(i32 169)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 850, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xa9\00"
define void @t_isdigit_0xa9() {
%1 = tail call i64 @isdigit(i32 169)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 850, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ client_posix_sleep(unsigned int);
void client_sleep(unsigned msecs) { client_posix_sleep(msecs); }


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

x86 assembly (clang, -O2):
<client_sleep>:
jmp    1030 <client_posix_sleep@plt>

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

LLVM IR (-O2):
define void @client_sleep(i32 %0) {
%2 = tail call i32 @client_posix_sleep(i32 %0)
ret void
}
/* Type definitions */
typedef char *uint32_t;

/* Variables and functions */
uint32_t bitfn_swap32(uint32_t a) {
  asm("bswap %0" : "=r"(a) : "0"(a));
  return a;
}


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

x86 assembly (clang, -O2):
<bitfn_swap32>:
mov    %rdi,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i8* @bitfn_swap32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @bitfn_swap32(i8* readnone %0) {
%2 = tail call i8* asm "bswap $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}