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

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ write(int, char *, int);
void _Unwind_DeleteException() {
  char msg[] = "Aborting: "
               "_Unwind_DeleteException"
               " called "
               "(C++ exception handling is disabled)\n";
  write(2, msg, sizeof(msg) - 1);
  abort();
}


x86 assembly (clang, -O0):
<_Unwind_DeleteException>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x4f,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rsi
mov    $0x2,%edi
mov    $0x4e,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_Unwind_DeleteException>:
sub    $0x58,%rsp
movups 0xf14(%rip),%xmm0
movups %xmm0,0x3f(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
mov    $0x4e,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const._Unwind_DeleteException.msg = [79 x i8] c"Aborting: _Unwind_DeleteException called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_DeleteException() {
%1 = alloca [79 x i8]
%2 = bitcast [79 x i8]* %1 to i8*
%3 = getelementptr inbounds [79 x i8], [79 x i8]* %1, i64 0, i64 0
%4 = call i32 @write(i32 2, i8* %3, i32 78)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@__const._Unwind_DeleteException.msg = [79 x i8] c"Aborting: _Unwind_DeleteException called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_DeleteException() {
%1 = alloca [79 x i8]
%2 = getelementptr inbounds [79 x i8], [79 x i8]* %1, i64 0, i64 0
%3 = call i32 @write(i32 2, i8* %2, i32 78)
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __BKPT(int);
void HardFault_Handler(void) { __BKPT(3); }


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

x86 assembly (clang, -O2):
<HardFault_Handler>:
mov    $0x3,%edi
jmp    1030 <__BKPT@plt>

LLVM IR (-O0):
define void @HardFault_Handler() {
%1 = call i32 @__BKPT(i32 3)
ret void
}

LLVM IR (-O2):
define void @HardFault_Handler() {
%1 = tail call i32 @__BKPT(i32 3)
ret void
}
pq_insert(int key) {}


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

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

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

LLVM IR (-O2):
define i32 @pq_insert(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a = 1, b = 2;
  {
    int tmp = a;
    a = b;
    b = tmp;
  };
  printf("%d %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb4(%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
mov    $0x2,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 2, i32 1)
ret i32 0
}
/* Type definitions */
struct server_list {
  int dummy;
};
struct genlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_shuffle(struct genlist *);
void server_list_shuffle(struct server_list *tthis) {
  genlist_shuffle(((struct genlist *)(tthis)));
}


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

x86 assembly (clang, -O2):
<server_list_shuffle>:
jmp    1030 <genlist_shuffle@plt>

LLVM IR (-O0):
%struct.server_list = type { i32 }
%struct.genlist = type { i32 }
define void @server_list_shuffle(%struct.server_list* %0) {
%2 = alloca %struct.server_list*
store %struct.server_list* %0, %struct.server_list** %2
%3 = load %struct.server_list*, %struct.server_list** %2
%4 = bitcast %struct.server_list* %3 to %struct.genlist*
%5 = call i32 @genlist_shuffle(%struct.genlist* %4)
ret void
}

LLVM IR (-O2):
%struct.server_list = type { i32 }
%struct.genlist = type { i32 }
define void @server_list_shuffle(%struct.server_list* %0) {
%2 = bitcast %struct.server_list* %0 to %struct.genlist*
%3 = tail call i32 @genlist_shuffle(%struct.genlist* %2)
ret void
}
/* Type definitions */
struct hasht {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ free(char *);
char *hasht_delete(struct hasht *, char *);
void test_hasht_delete(struct hasht *t, char *k, char *v) {
  char *test_v = hasht_delete(t, k);
  assert(v == test_v);
  free(v);
}


x86 assembly (clang, -O0):
<test_hasht_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <hasht_delete@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hasht_delete>:
push   %rbx
mov    %rdx,%rbx
call   1040 <hasht_delete@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.hasht = type { i32 }
define void @test_hasht_delete(%struct.hasht* %0, i8* %1, i8* %2) {
%4 = alloca %struct.hasht*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store %struct.hasht* %0, %struct.hasht** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.hasht*, %struct.hasht** %4
%9 = load i8*, i8** %5
%10 = call i8* @hasht_delete(%struct.hasht* %8, i8* %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = icmp eq i8* %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i8*, i8** %6
%17 = call i32 @free(i8* %16)
ret void
}

LLVM IR (-O2):
%struct.hasht = type { i32 }
define void @test_hasht_delete(%struct.hasht* %0, i8* %1, i8* %2) {
%4 = tail call i8* @hasht_delete(%struct.hasht* %0, i8* %1)
%5 = icmp eq i8* %4, %2
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i32 @free(i8* %2)
ret void
}
int getBit(unsigned int word, int pos) {
  unsigned int nword = (word | (1 << (pos)));
  nword ^= word;
  return (nword == 0 ? 1 : 0);
}


x86 assembly (clang, -O0):
<getBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBit>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @getBit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = shl i32 1, %7
%9 = or i32 %6, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = xor i32 %11, %10
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 0
ret i32 %16
}

LLVM IR (-O2):
define i32 @getBit(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void checktrue(int a) {
  if (a == 1) {
    printf("true");
  } else {
    printf("false");
  }
}


x86 assembly (clang, -O0):
<checktrue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1136 <checktrue+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <checktrue+0x32>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checktrue>:
cmp    $0x1,%edi
lea    0xee6(%rip),%rax
lea    0xee4(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define void @checktrue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define void @checktrue(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
ret void
}
int Ptngc_comp_huff_buflen(const int nvals) { return 132000 + nvals * 8; }


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

x86 assembly (clang, -O2):
<Ptngc_comp_huff_buflen>:
lea    0x203a0(,%rdi,8),%eax
ret

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

LLVM IR (-O2):
define i32 @Ptngc_comp_huff_buflen(i32 %0) {
%2 = shl nsw i32 %0, 3
%3 = add nsw i32 %2, 132000
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t badvpn_read_le16(const char *c_ptr) {
  const uint8_t *ptr = (const uint8_t *)c_ptr;
  return ((uint16_t)ptr[1] << 8) | ((uint16_t)ptr[0] << 0);
}


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

x86 assembly (clang, -O2):
<badvpn_read_le16>:
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @badvpn_read_le16(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = getelementptr inbounds i8, i8* %0, i64 8
%4 = bitcast i8* %3 to i64*
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = load i64, i64* %2
%9 = trunc i64 %8 to i32
%10 = or i32 %7, %9
ret i32 %10
}
void Set32(void *base, unsigned int reg, unsigned int m, unsigned int v) {
  unsigned int o;
  o = *((volatile unsigned int *)(base + reg));
  o &= ~m;
  o |= v;
  *((volatile unsigned int *)(base + reg)) = o;
}


x86 assembly (clang, -O0):
<Set32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set32>:
mov    %esi,%eax
not    %edx
and    (%rdi,%rax,1),%edx
or     %ecx,%edx
mov    %edx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @Set32(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = zext i32 %11 to i64
%13 = getelementptr i8, i8* %10, i64 %12
%14 = bitcast i8* %13 to i32*
%15 = load volatile i32, i32* %14
store i32 %15, i32* %9
%16 = load i32, i32* %7
%17 = xor i32 %16, -1
%18 = load i32, i32* %9
%19 = and i32 %18, %17
store i32 %19, i32* %9
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = or i32 %21, %20
store i32 %22, i32* %9
%23 = load i32, i32* %9
%24 = load i8*, i8** %5
%25 = load i32, i32* %6
%26 = zext i32 %25 to i64
%27 = getelementptr i8, i8* %24, i64 %26
%28 = bitcast i8* %27 to i32*
store volatile i32 %23, i32* %28
ret void
}

LLVM IR (-O2):
define void @Set32(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = zext i32 %1 to i64
%6 = getelementptr i8, i8* %0, i64 %5
%7 = bitcast i8* %6 to i32*
%8 = load volatile i32, i32* %7
%9 = xor i32 %2, -1
%10 = and i32 %8, %9
%11 = or i32 %10, %3
store volatile i32 %11, i32* %7
ret void
}
void dec(int *op1, int *op2, unsigned int *pc) {
  (*op1)--;
  (*pc)++;
}


x86 assembly (clang, -O0):
<dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec>:
addl   $0xffffffff,(%rdi)
addl   $0x1,(%rdx)
ret

LLVM IR (-O0):
define void @dec(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* %7
%9 = add nsw i32 %8, -1
store i32 %9, i32* %7
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = add i32 %11, 1
store i32 %12, i32* %10
ret void
}

LLVM IR (-O2):
define void @dec(i32* nocapture %0, i32* nocapture readnone %1, i32* nocapture %2) {
%4 = load i32, i32* %0
%5 = add nsw i32 %4, -1
store i32 %5, i32* %0
%6 = load i32, i32* %2
%7 = add i32 %6, 1
store i32 %7, i32* %2
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn51() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn51");
  return result;
}


x86 assembly (clang, -O0):
<fn51>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn51>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn51\00"
define i8* @fn51() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn51\00"
define i8* @fn51() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
XCirculateSubwindowsUp() {}


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

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

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

LLVM IR (-O2):
define i32 @XCirculateSubwindowsUp() {
ret i32 undef
}
double *dvector(nl, nh)
int nl, nh;
{
  double *v;
  v = (double *)calloc((unsigned)(nh - nl + 1), sizeof(double));
  if (!v)
    nrerror("allocation failure in dvector()");
  return v - nl;
}


x86 assembly (clang, -O0):
<dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1162 <dvector+0x42>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <nrerror@plt>
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvector>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
sub    %edi,%esi
lea    0x1(%rsi),%edi
mov    $0x8,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <dvector+0x2a>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <nrerror@plt>
movslq %ebp,%rax
shl    $0x3,%rax
sub    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in dvector()\00"
define double* @dvector(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = call i8* @calloc(i64 %10, i64 8)
%12 = bitcast i8* %11 to double*
store double* %12, double** %5
%13 = load double*, double** %5
%14 = icmp ne double* %13, null
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = load double*, double** %5
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = sub i64 0, %20
%22 = getelementptr inbounds double, double* %18, i64 %21
ret double* %22
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in dvector()\00"
define double* @dvector(i32 %0, i32 %1) {
%3 = sub i32 1, %0
%4 = add i32 %3, %1
%5 = zext i32 %4 to i64
%6 = tail call i8* @calloc(i64 %5, i64 8)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @nrerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = bitcast i8* %6 to double*
%12 = sext i32 %0 to i64
%13 = sub nsw i64 0, %12
%14 = getelementptr inbounds double, double* %11, i64 %13
ret double* %14
}
/* Variables and functions */
int /*<<< orphan*/ Tracking_UI_lapResetPressed();
void UI_UI_lapResetPressed() { Tracking_UI_lapResetPressed(); }


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

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

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

LLVM IR (-O2):
define void @UI_UI_lapResetPressed() {
%1 = tail call i32 (...) @Tracking_UI_lapResetPressed()
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
__attribute__((always_)) void BME_AND_H(volatile uint16_t *addr,
                                        register uint16_t wdata) {
  *(volatile uint16_t *)((uint32_t)addr | (1 << 26)) = wdata;
}


x86 assembly (clang, -O0):
<BME_AND_H>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
or     $0x4000000,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BME_AND_H>:
movslq %edi,%rax
or     $0x4000000,%rax
mov    %esi,(%rax)
ret

LLVM IR (-O0):
define void @BME_AND_H(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = ptrtoint i32* %6 to i32
%8 = or i32 %7, 67108864
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %5, i32* %10
ret void
}

LLVM IR (-O2):
define void @BME_AND_H(i32* %0, i32 %1) {
%3 = ptrtoint i32* %0 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = or i64 %5, 67108864
%7 = inttoptr i64 %6 to i32*
store volatile i32 %1, i32* %7
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int IgnoreError(Display *disp, XErrorEvent *event) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @IgnoreError(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 0
}
int test(int a, int b, char flags[], int g1, int g2) {
  int ret;
  __asm__ __volatile__("mov %3, %%edx\n\t"
                       "mov %4, %%eax\n\t"
                       "mov %5, %%ecx\n\t"
                       "movb %b1, %%al\n\t"
                       "movb %b2, %%cl\n\t"
                       "addb %%cl, %%al\n\t"
                       "seto (%%edx)\n\t"
                       "sets 1(%%edx)\n\t"
                       "setz 2(%%edx)\n\t"
                       "setp 3(%%edx)\n\t"
                       "setc 4(%%edx)\n\t"
                       "movzbl %%al, %%eax\n\t"
                       "mov %%eax, %0\n\t"
                       : "=m"(ret)
                       : "m"(a), "m"(b), "m"(flags), "m"(g1), "m"(g2)
                       : "eax", "ecx", "edx", "memory");
  return ret;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
mov    -0x4(%rbp),%al
mov    -0x8(%rbp),%cl
add    %cl,%al
seto   (%edx)
sets   0x1(%edx)
sete   0x2(%edx)
setp   0x3(%edx)
setb   0x4(%edx)
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %edi,-0xc(%rsp)
mov    %esi,-0x10(%rsp)
mov    %rdx,-0x8(%rsp)
mov    %ecx,-0x14(%rsp)
mov    %r8d,-0x18(%rsp)
mov    -0x8(%rsp),%edx
mov    -0x14(%rsp),%eax
mov    -0x18(%rsp),%ecx
mov    -0xc(%rsp),%al
mov    -0x10(%rsp),%cl
add    %cl,%al
seto   (%edx)
sets   0x1(%edx)
sete   0x2(%edx)
setp   0x3(%edx)
setb   0x4(%edx)
movzbl %al,%eax
mov    %eax,-0x1c(%rsp)
mov    -0x1c(%rsp),%eax
ret

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

LLVM IR (-O2):
define i32 @test(i32 %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = bitcast i32* %11 to i8*
%13 = load i32, i32* %11
ret i32 %13
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, unsigned int);
void RNDResponseSink_ContentDirectory_ImportResource(
    struct UPnPService *Service, int ErrorCode, void *User,
    unsigned int TransferID) {
  printf("RND Invoke Response: "
         "ContentDirectory/ImportResource[ErrorCode:%d](%u)\r\n",
         ErrorCode, TransferID);
}


x86 assembly (clang, -O0):
<RNDResponseSink_ContentDirectory_ImportResource>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNDResponseSink_ContentDirectory_ImportResource>:
lea    0xee9(%rip),%rdi
mov    %ecx,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [73 x i8] c"RND Invoke Response: ContentDirectory/ImportResource[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_ImportResource(%struct.UPnPService* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.UPnPService*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct.UPnPService* %0, %struct.UPnPService** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = load i32, i32* %8
%11 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [73 x i8] c"RND Invoke Response: ContentDirectory/ImportResource[ErrorCode:%d](%u)\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_ImportResource(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x63() {
  Assert_real((isgraph(99)),
              "/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_isgraph.c",
              500, ("isgraph should be 1 for c"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x63>:
push   %rbp
mov    %rsp,%rbp
mov    $0x63,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1f4,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x63>:
push   %rax
mov    $0x63,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1f4,%edx
pop    %rax
jmp    1030 <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_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for c\00"
define void @t_isgraph_0x63() {
%1 = call i32 @isgraph(i32 99)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 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_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for c\00"
define void @t_isgraph_0x63() {
%1 = tail call i32 @isgraph(i32 99)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int main() {
  long long int a = 1234567890123456789L;
  char b = (char)a;
  short c = (short)a;
  int d = (int)a;
  long int e = (long int)a;
  unsigned char f = (unsigned char)a;
  unsigned short g = (unsigned short)a;
  unsigned int h = (unsigned int)a;
  unsigned long int i = (unsigned long int)a;
  unsigned long long int j = (unsigned long long int)a;
  long double k = 3.1415926535897932384626433832795028841971693993751058209749L;
  double l = (double)k;
  float m = (float)k;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movabs $0x112210f47de98115,%rax
10 22 11
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%ax
mov    %ax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%al
mov    %al,-0x21(%rbp)
mov    -0x10(%rbp),%ax
mov    %ax,-0x24(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
fldt   0xea1(%rip)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fstpl  -0x58(%rbp)
fldt   -0x50(%rbp)
fstps  -0x60(%rbp)
movss  -0x60(%rbp),%xmm0
movss  %xmm0,-0x5c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i8
%4 = alloca i16
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8
%8 = alloca i16
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca x86_fp80
%13 = alloca double
%14 = alloca float
store i32 0, i32* %1
store i64 1234567890123456789, i64* %2
%15 = load i64, i64* %2
%16 = trunc i64 %15 to i8
store i8 %16, i8* %3
%17 = load i64, i64* %2
%18 = trunc i64 %17 to i16
store i16 %18, i16* %4
%19 = load i64, i64* %2
%20 = trunc i64 %19 to i32
store i32 %20, i32* %5
%21 = load i64, i64* %2
store i64 %21, i64* %6
%22 = load i64, i64* %2
%23 = trunc i64 %22 to i8
store i8 %23, i8* %7
%24 = load i64, i64* %2
%25 = trunc i64 %24 to i16
store i16 %25, i16* %8
%26 = load i64, i64* %2
%27 = trunc i64 %26 to i32
store i32 %27, i32* %9
%28 = load i64, i64* %2
store i64 %28, i64* %10
%29 = load i64, i64* %2
store i64 %29, i64* %11
store x86_fp80 0xK4000C90FDAA22168C235, x86_fp80* %12
%30 = load x86_fp80, x86_fp80* %12
%31 = fptrunc x86_fp80 %30 to double
store double %31, double* %13
%32 = load x86_fp80, x86_fp80* %12
%33 = fptrunc x86_fp80 %32 to float
store float %33, float* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gpio_output(int /*<<< orphan*/, int, int /*<<< orphan*/);
void status_off(void) { gpio_output(0, 20, 0); }


x86 assembly (clang, -O0):
<status_off>:
push   %rbp
mov    %rsp,%rbp
xor    %edx,%edx
mov    $0x14,%esi
mov    %edx,%edi
call   1030 <gpio_output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<status_off>:
xor    %edi,%edi
mov    $0x14,%esi
xor    %edx,%edx
jmp    1030 <gpio_output@plt>

LLVM IR (-O0):
define void @status_off() {
%1 = call i32 @gpio_output(i32 0, i32 20, i32 0)
ret void
}

LLVM IR (-O2):
define void @status_off() {
%1 = tail call i32 @gpio_output(i32 0, i32 20, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void consumer(int i) { assert(i == 1); }


x86 assembly (clang, -O0):
<consumer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<consumer>:
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @consumer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
define void @consumer(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
char itoc(int i) { return ('0' + i); }


x86 assembly (clang, -O0):
<itoc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoc>:
lea    0x30(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @itoc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 48, %3
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @itoc(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 48
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *progname) {
  printf("usage: %s <videodevice>\n", progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"usage: %s <videodevice>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"usage: %s <videodevice>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void fd119(int n) {
a : {
  typedef int(*b)[n];
P01A:
  goto P01A;
  {
    typedef int(*c)[n];
  P012A:
    goto P012A;
    0;
  }
P01B:
  goto P01B;
  {
    typedef int(*d)[n];
  P013A:
    goto P013A;
    0;
  }
P01C:
  goto P01C;
  ;
  typedef int(*e)[n];
P014A:
  goto P014A;
  0;
};
p0B:
  goto p0B;
  goto a;
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd119>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd119+0x7>

x86 assembly (clang, -O2):
<fd119>:
jmp    1100 <fd119>

LLVM IR (-O0):
define void @fd119(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %6, %3
br label %6
7: ; No predecessors!
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %10, %7
br label %10
11: ; preds = %11
br label %11
12: ; No predecessors!
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %15, %12
br label %15
16: ; preds = %16
br label %16
17: ; No predecessors!
%18 = load i32, i32* %2
%19 = zext i32 %18 to i64
br label %20
20: ; preds = %20, %17
br label %20
21: ; preds = %21
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd119(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int dummy;
};

/* Variables and functions */
double extract(struct timeval *);
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double dclock() {
  struct timeval tp;
  struct timezone tzp;
  gettimeofday(&tp, &tzp);
  return (extract(&tp));
}


x86 assembly (clang, -O0):
<dclock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <gettimeofday@plt>
lea    -0x8(%rbp),%rdi
call   1040 <extract@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dclock>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <gettimeofday@plt>
mov    %rbx,%rdi
call   1040 <extract@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define double @dclock() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = call double @extract(%struct.timeval* %1)
ret double %4
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define double @dclock() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = call double @extract(%struct.timeval* %1)
ret double %6
}
int compDoubles(const void *A, const void *B) {
  double *a = (double *)A;
  double *b = (double *)B;
  if (*a < *b)
    return -1;
  else if (*a > *b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compDoubles>:
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
movsd  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <compDoubles+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <compDoubles+0x6b>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1164 <compDoubles+0x64>
movl   $0x1,-0x4(%rbp)
jmp    116b <compDoubles+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compDoubles>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compDoubles(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double*
%7 = alloca double*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
store double* %9, double** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to double*
store double* %11, double** %7
%12 = load double*, double** %6
%13 = load double, double* %12
%14 = load double*, double** %7
%15 = load double, double* %14
%16 = fcmp olt double %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %26
18: ; preds = %2
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = load double*, double** %7
%22 = load double, double* %21
%23 = fcmp ogt double %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @compDoubles(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = fcmp ogt double %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int pathcon_nm4_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @pathcon_nm4_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @pathcon_nm4_n_out() {
ret i32 2
}
int test_imm_B9uint8_reg(unsigned char val) {
  return ((val) & (-0xB9 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B9uint8_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, -185
%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_B9uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 71
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int sum(int);
void main() {
  int m, n;
  scanf("%d%d", &m, &n);
  printf("%d\n", sum(m) + sum(n));
  scanf("%d%d", &m, &n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1040 <sum@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <sum@plt>
mov    -0xc(%rbp),%esi
add    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rbx
lea    0x4(%rsp),%r14
mov    %rsp,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <sum@plt>
mov    %eax,%ebp
mov    (%rsp),%edi
call   1040 <sum@plt>
add    %eax,%ebp
lea    0xe95(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <scanf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = call i32 @sum(i32 %6)
%8 = load i32, i32* %2
%9 = call i32 @sum(i32 %8)
%10 = add nsw i32 %9, %7
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
ret void
}
int main() {
  int i;
  char foo[255];
  for (i = 0; i <= 400; i++)
    foo[i] = 42;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x190,-0x8(%rbp)
jg     1140 <main+0x40>
movslq -0x8(%rbp),%rax
movb   $0x2a,-0x110(%rbp,%rax,1)
2a
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    $0x1,%eax
add    $0x90,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [255 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 400
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %9
store i8 42, i8* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ sort(int);
benchmark() { sort(20); }


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

x86 assembly (clang, -O2):
<benchmark>:
mov    $0x14,%edi
jmp    1030 <sort@plt>

LLVM IR (-O0):
define i32 @benchmark() {
%1 = alloca i32
%2 = call i32 @sort(i32 20)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @benchmark() {
%1 = tail call i32 @sort(i32 20)
ret i32 undef
}
/* Variables and functions */
int _f(int, int /*<<< orphan*/, double const, double const *);
double _J_13(const double omega, const double vertices_omegas[4]) {
  return _f(3, 0, omega, vertices_omegas) / 4;
}


x86 assembly (clang, -O0):
<_J_13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <_f@plt>
mov    $0x4,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_J_13>:
push   %rax
mov    %rdi,%rdx
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <_f@plt>
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x2,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_J_13(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
store double %0, double* %3
store double* %1, double** %4
%5 = load double, double* %3
%6 = load double*, double** %4
%7 = call i32 @_f(i32 3, i32 0, double %5, double* %6)
%8 = sdiv i32 %7, 4
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @_J_13(double %0, double* %1) {
%3 = tail call i32 @_f(i32 3, i32 0, double %0, double* %1)
%4 = sdiv i32 %3, 4
%5 = sitofp i32 %4 to double
ret double %5
}