xunge/DecIR huggingface dataset:
/* Type definitions */
struct Value_array {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ array_concat_to(struct Value_array *, struct Value_array *);
struct Value_array *array_copy_heap(struct Value_array *);
struct Value_array *array_concat_heap(struct Value_array *a,
                                      struct Value_array *b) {
  struct Value_array *temp = array_copy_heap(a);
  array_concat_to(temp, b);
  return temp;
}


x86 assembly (clang, -O0):
<array_concat_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <array_copy_heap@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <array_concat_to@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_concat_heap>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <array_copy_heap@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <array_concat_to@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.Value_array = type { i32 }
define %struct.Value_array* @array_concat_heap(%struct.Value_array* %0, %struct.Value_array* %1) {
%3 = alloca %struct.Value_array*
%4 = alloca %struct.Value_array*
%5 = alloca %struct.Value_array*
store %struct.Value_array* %0, %struct.Value_array** %3
store %struct.Value_array* %1, %struct.Value_array** %4
%6 = load %struct.Value_array*, %struct.Value_array** %3
%7 = call %struct.Value_array* @array_copy_heap(%struct.Value_array* %6)
store %struct.Value_array* %7, %struct.Value_array** %5
%8 = load %struct.Value_array*, %struct.Value_array** %5
%9 = load %struct.Value_array*, %struct.Value_array** %4
%10 = call i32 @array_concat_to(%struct.Value_array* %8, %struct.Value_array* %9)
%11 = load %struct.Value_array*, %struct.Value_array** %5
ret %struct.Value_array* %11
}

LLVM IR (-O2):
%struct.Value_array = type { i32 }
define %struct.Value_array* @array_concat_heap(%struct.Value_array* %0, %struct.Value_array* %1) {
%3 = tail call %struct.Value_array* @array_copy_heap(%struct.Value_array* %0)
%4 = tail call i32 @array_concat_to(%struct.Value_array* %3, %struct.Value_array* %1)
ret %struct.Value_array* %3
}
int isInTable(int nombre, int *tab, int nb) {
  int i = 0;
  int retour = 0;
  while (i < nb && !retour) {
    if (tab[i] == nombre)
      retour = 1;
    i++;
  }
  return retour;
}


x86 assembly (clang, -O0):
<isInTable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jge    1139 <isInTable+0x39>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1149 <isInTable+0x49>
jmp    1172 <isInTable+0x72>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x4(%rbp),%eax
jne    1164 <isInTable+0x64>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111c <isInTable+0x1c>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isInTable>:
test   %edx,%edx
jle    1129 <isInTable+0x29>
mov    %edx,%eax
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
mov    -0x4(%rsi,%rcx,4),%edx
cmp    %rax,%rcx
jae    1121 <isInTable+0x21>
add    $0x1,%rcx
cmp    %edi,%edx
jne    1110 <isInTable+0x10>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isInTable(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %28, %3
%10 = load i32, i32* %7
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ false, %9 ], [ %16, %13 ]
br i1 %18, label %19, label %31
19: ; preds = %17
%20 = load i32*, i32** %5
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %4
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %19
store i32 1, i32* %8
br label %28
28: ; preds = %27, %19
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %9
31: ; preds = %17
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
define i32 @isInTable(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %1, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %0
%12 = add nuw nsw i64 %8, 1
%13 = icmp ult i64 %12, %6
%14 = xor i1 %11, true
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %7, label %16
16: ; preds = %7
%17 = zext i1 %11 to i32
br label %18
18: ; preds = %16, %3
%19 = phi i32 [ 0, %3 ], [ %17, %16 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f_1(char *a) { printf("f_1\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"f_1\00"
define void @f_1(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ shift_rows(int /*<<< orphan*/ *, int);
void superaes_InvShiftRows(uint16_t *state) { shift_rows(state, 1); }


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

x86 assembly (clang, -O2):
<superaes_InvShiftRows>:
mov    $0x1,%esi
jmp    1030 <shift_rows@plt>

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

LLVM IR (-O2):
define void @superaes_InvShiftRows(i32* %0) {
%2 = tail call i32 @shift_rows(i32* %0, i32 1)
ret void
}
/* Variables and functions */
char *normalize(char *);
int /*<<< orphan*/ sflap_send(char *, int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
void serv_get_dir(char *name) {
  char buf[2048];
  snprintf(buf, 2048, "toc_get_dir %s", normalize(name));
  sflap_send(buf, -1, 2);
}


x86 assembly (clang, -O0):
<serv_get_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <normalize@plt>
mov    -0x818(%rbp),%rdi
mov    %rax,%rcx
mov    $0x800,%esi
lea    0xe94(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x810(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1050 <sflap_send@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serv_get_dir>:
push   %rbx
sub    $0x800,%rsp
call   1040 <normalize@plt>
lea    0xebc(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x800,%esi
mov    %rax,%rcx
call   1030 <snprintf@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x2,%edx
call   1050 <sflap_send@plt>
add    $0x800,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"toc_get_dir %s\00"
define void @serv_get_dir(i8* %0) {
%2 = alloca i8*
%3 = alloca [2048 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i8* @normalize(i8* %5)
%7 = call i32 @snprintf(i8* %4, i32 2048, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%9 = call i32 @sflap_send(i8* %8, i32 -1, i32 2)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"toc_get_dir %s\00"
define void @serv_get_dir(i8* %0) {
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = tail call i8* @normalize(i8* %0)
%5 = call i32 @snprintf(i8* %3, i32 2048, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @sflap_send(i8* %3, i32 -1, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handler(int sig) { printf("foobar ....\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"foobar ....\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
int app_main() {
  unsigned int val;
  while (1) {
    val = (*(volatile unsigned int *)((0x3FF0000 + 0x5008)));
    val = (val >> 4) & 0xf;
    (*(volatile unsigned int *)((0x3FF0000 + 0x5008)) = (val));
  }
}


x86 assembly (clang, -O0):
<app_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3ff5008,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0xc(%rbp)
and    $0xf,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x3ff5008,%eax
mov    %ecx,(%rax)
jmp    1104 <app_main+0x4>

x86 assembly (clang, -O2):
<app_main>:
mov    0x3ff5008,%eax
shr    $0x4,%eax
and    $0xf,%eax
mov    %eax,0x3ff5008
jmp    1100 <app_main>

LLVM IR (-O0):
define i32 @app_main() {
%1 = alloca i32
br label %2
2: ; preds = %0, %2
%3 = load volatile i32, i32* inttoptr (i64 67063816 to i32*)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = lshr i32 %4, 4
%6 = and i32 %5, 15
store i32 %6, i32* %1
%7 = load i32, i32* %1
store volatile i32 %7, i32* inttoptr (i64 67063816 to i32*)
br label %2
}

LLVM IR (-O2):
define i32 @app_main() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i32, i32* inttoptr (i64 67063816 to i32*)
%3 = lshr i32 %2, 4
%4 = and i32 %3, 15
store volatile i32 %4, i32* inttoptr (i64 67063816 to i32*)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *realloc(void *, size_t);
void *xrealloc(void *buff, size_t size) {
  void *p = realloc(buff, size);
  if (!p)
    die("out of memory");
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <xrealloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xrealloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
unsigned long Hk_GetPrimeOffset() { return 159; }


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

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

LLVM IR (-O0):
define i64 @Hk_GetPrimeOffset() {
ret i64 159
}

LLVM IR (-O2):
define i64 @Hk_GetPrimeOffset() {
ret i64 159
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bin2bcd(uint8_t val) { return ((val / 10) << 4) | (val % 10); }


x86 assembly (clang, -O0):
<bin2bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
or     %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin2bcd>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x4,%edx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @bin2bcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = srem i32 %6, 10
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bin2bcd(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = srem i32 %0, 10
%5 = or i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ element_vsnprintf(char *, int, char const *,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
void report(const char *prefix, const char *err, va_list params) {
  char msg[1024];
  element_vsnprintf(msg, sizeof(msg), err, params);
  fprintf(stderr, "%s%s\n", prefix, msg);
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x400,%esi
call   1040 <element_vsnprintf@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    -0x420(%rbp),%rcx
lea    0xe97(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1040 <element_vsnprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%s%s\0A\00"
define void @report(i8* %0, i8* %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @element_vsnprintf(i8* %5, i32 1024, i8* %1, i32 %2)
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lm9830_write_register(int, int, int);
int /*<<< orphan*/ usleep(int);
int lm9830_reset(int fd) {
  lm9830_write_register(fd, 0x07, 0x08);
  usleep(100);
  lm9830_write_register(fd, 0x07, 0x00);
  usleep(100);
  return 0;
}


x86 assembly (clang, -O0):
<lm9830_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
mov    $0x8,%edx
call   1030 <lm9830_write_register@plt>
mov    $0x64,%edi
call   1040 <usleep@plt>
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1030 <lm9830_write_register@plt>
mov    $0x64,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lm9830_reset>:
push   %rbx
mov    %edi,%ebx
mov    $0x7,%esi
mov    $0x8,%edx
call   1030 <lm9830_write_register@plt>
mov    $0x64,%edi
call   1040 <usleep@plt>
mov    %ebx,%edi
mov    $0x7,%esi
xor    %edx,%edx
call   1030 <lm9830_write_register@plt>
mov    $0x64,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lm9830_reset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @lm9830_write_register(i32 %3, i32 7, i32 8)
%5 = call i32 @usleep(i32 100)
%6 = load i32, i32* %2
%7 = call i32 @lm9830_write_register(i32 %6, i32 7, i32 0)
%8 = call i32 @usleep(i32 100)
ret i32 0
}

LLVM IR (-O2):
define i32 @lm9830_reset(i32 %0) {
%2 = tail call i32 @lm9830_write_register(i32 %0, i32 7, i32 8)
%3 = tail call i32 @usleep(i32 100)
%4 = tail call i32 @lm9830_write_register(i32 %0, i32 7, i32 0)
%5 = tail call i32 @usleep(i32 100)
ret i32 0
}
/* Variables and functions */
int memcmp(void const *, void const *, size_t);
__attribute__((__weak__, __always___)) int
softboundcets_memcmp(const void *s1, const void *s2, size_t n) {
  return memcmp(s1, s2, n);
}


x86 assembly (clang, -O0):
<softboundcets_memcmp>:
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
mov    -0x18(%rbp),%rdx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundcets_memcmp>:
jmp    1030 <memcmp@plt>

LLVM IR (-O0):
define weak i32 @softboundcets_memcmp(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcmp(i8* %7, i8* %8, i64 %9)
ret i32 %10
}

LLVM IR (-O2):
define weak i32 @softboundcets_memcmp(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int callee_flat_s(int);
int caller_flat_s(int bla) { return callee_flat_s(bla); }


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

x86 assembly (clang, -O2):
<caller_flat_s>:
jmp    1030 <callee_flat_s@plt>

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

LLVM IR (-O2):
define i32 @caller_flat_s(i32 %0) {
%2 = tail call i32 @callee_flat_s(i32 %0)
ret i32 %2
}
int _max(int i, int j) { return (i > j ? i : j); }


x86 assembly (clang, -O0):
<_max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <_max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <_max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @_max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
unsigned short f() { return 0xff00; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff00,%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    $0xff00,%ax
ret

LLVM IR (-O0):
define zeroext i16 @f() {
ret i16 -256
}

LLVM IR (-O2):
define zeroext i16 @f() {
ret i16 -256
}
/* Variables and functions */
int /*<<< orphan*/ demo_7_main_core_0();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ tas_finalize();
int /*<<< orphan*/ tas_init(int);
int main(void) {
  tas_init((8 - 1));
  demo_7_main_core_0();
  tas_finalize();
  exit(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7,%edi
call   1040 <tas_init@plt>
mov    $0x0,%al
call   1060 <demo_7_main_core_0@plt>
mov    $0x0,%al
call   1030 <tas_finalize@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7,%edi
call   1040 <tas_init@plt>
xor    %eax,%eax
call   1060 <demo_7_main_core_0@plt>
xor    %eax,%eax
call   1030 <tas_finalize@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @tas_init(i32 7)
%3 = call i32 (...) @demo_7_main_core_0()
%4 = call i32 (...) @tas_finalize()
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @tas_init(i32 7)
%2 = tail call i32 (...) @demo_7_main_core_0()
%3 = tail call i32 (...) @tas_finalize()
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t sk_atomic_dec(int32_t *addr) {
  int32_t value = *addr;
  *addr = value - 1;
  return value;
}


x86 assembly (clang, -O0):
<sk_atomic_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sk_atomic_dec>:
mov    (%rdi),%rax
lea    -0x1(%rax),%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i64 @sk_atomic_dec(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = sub nsw i64 %6, 1
%8 = load i64*, i64** %2
store i64 %7, i64* %8
%9 = load i64, i64* %3
ret i64 %9
}

LLVM IR (-O2):
define i64 @sk_atomic_dec(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = add nsw i64 %2, -1
store i64 %3, i64* %0
ret i64 %2
}
/* Type definitions */
struct timeval {
  long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ show(char *, long);
long gettime() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  show("gettime", tv.tv_sec);
  return tv.tv_sec;
}


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <show@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%rbx
lea    0xec3(%rip),%rdi
mov    %rbx,%rsi
call   1040 <show@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
@.str = [8 x i8] c"gettime\00"
define i64 @gettime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = call i32 @show(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %4)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
@.str = [8 x i8] c"gettime\00"
define i64 @gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = tail call i32 @show(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %5)
ret i64 %5
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
unsigned tv2ms(struct timeval *tv) {
  return (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
}


x86 assembly (clang, -O0):
<tv2ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3e8,(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tv2ms>:
imul   $0x3e8,(%rdi),%ecx
movslq 0x4(%rdi),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @tv2ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = load %struct.timeval*, %struct.timeval** %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000
%11 = add nsw i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @tv2ms(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = sdiv i32 %6, 1000
%8 = add nsw i32 %7, %4
ret i32 %8
}
unsigned xrop3_168_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | S;
  stk1 = D & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_168_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_168_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
not    %eax
and    %esi,%eax
or     %edi,%esi
not    %ecx
and    %esi,%ecx
or     %edi,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_168_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = and i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = and i32 %28, %29
%31 = load i32, i32* %8
%32 = load i32, i32* %7
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = or i32 %30, %34
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %5
%41 = and i32 %39, %40
%42 = or i32 %35, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_168_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i8 %1, %0
%8 = zext i8 %7 to i32
%9 = xor i32 %6, -1
%10 = and i32 %9, %8
%11 = xor i32 %4, -1
%12 = and i32 %11, %5
%13 = or i32 %12, %3
%14 = or i32 %13, %10
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void catch_winch(int sig) { printf("WINCH\n"); }


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"WINCH\00"
define void @catch_winch(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
void BT_kFree(void *ptr) { return; }


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

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

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

LLVM IR (-O2):
define void @BT_kFree(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int f(int);
main() {
  switch (7) { case sizeof(int):; }
  if (f(-1) != 1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
je     1149 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
jne    1134 <main+0x14>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 -1)
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 -1)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lignePleine();
int /*<<< orphan*/ ligneVide();
void margeHaut() {
  lignePleine();
  ligneVide();
  ligneVide();
}


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

x86 assembly (clang, -O2):
<margeHaut>:
push   %rax
xor    %eax,%eax
call   1030 <lignePleine@plt>
xor    %eax,%eax
call   1040 <ligneVide@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <ligneVide@plt>

LLVM IR (-O0):
define void @margeHaut() {
%1 = call i32 (...) @lignePleine()
%2 = call i32 (...) @ligneVide()
%3 = call i32 (...) @ligneVide()
ret void
}

LLVM IR (-O2):
define void @margeHaut() {
%1 = tail call i32 (...) @lignePleine()
%2 = tail call i32 (...) @ligneVide()
%3 = tail call i32 (...) @ligneVide()
ret void
}
void __cxa_finalize(void *dso) {}


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

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

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

LLVM IR (-O2):
define void @__cxa_finalize(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ cancel_reserve(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  pid_t pid = (pid_t)atoi(argv[1]);
  cancel_reserve(pid);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <cancel_reserve@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <cancel_reserve@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @cancel_reserve(i32 %5)
ret i32 1
}
void transform_matrix(double *matrix, double x, double y, double z) {
  matrix[12] += x;
  matrix[13] += y;
  matrix[14] += z;
}


x86 assembly (clang, -O0):
<transform_matrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x60(%rax),%xmm0
movsd  %xmm0,0x60(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x68(%rax),%xmm0
movsd  %xmm0,0x68(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
addsd  0x70(%rax),%xmm0
movsd  %xmm0,0x70(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_matrix>:
movupd 0x60(%rdi),%xmm3
unpcklpd %xmm1,%xmm0
addpd  %xmm3,%xmm0
movupd %xmm0,0x60(%rdi)
addsd  0x70(%rdi),%xmm2
movsd  %xmm2,0x70(%rdi)
ret

LLVM IR (-O0):
define void @transform_matrix(double* %0, double %1, double %2, double %3) {
%5 = alloca double*
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %6
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 12
%12 = load double, double* %11
%13 = fadd double %12, %9
store double %13, double* %11
%14 = load double, double* %7
%15 = load double*, double** %5
%16 = getelementptr inbounds double, double* %15, i64 13
%17 = load double, double* %16
%18 = fadd double %17, %14
store double %18, double* %16
%19 = load double, double* %8
%20 = load double*, double** %5
%21 = getelementptr inbounds double, double* %20, i64 14
%22 = load double, double* %21
%23 = fadd double %22, %19
store double %23, double* %21
ret void
}

LLVM IR (-O2):
define void @transform_matrix(double* nocapture %0, double %1, double %2, double %3) {
%5 = getelementptr inbounds double, double* %0, i64 12
%6 = bitcast double* %5 to <2 x double>*
%7 = load <2 x double>, <2 x double>* %6
%8 = insertelement <2 x double> poison, double %1, i64 0
%9 = insertelement <2 x double> %8, double %2, i64 1
%10 = fadd <2 x double> %7, %9
%11 = bitcast double* %5 to <2 x double>*
store <2 x double> %10, <2 x double>* %11
%12 = getelementptr inbounds double, double* %0, i64 14
%13 = load double, double* %12
%14 = fadd double %13, %3
store double %14, double* %12
ret void
}
int test_imm_ADuint8_reg(unsigned char val) {
  return ((val) & (0xAD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_ADuint8_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, 173
%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_ADuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -83
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __cpuid(unsigned int, unsigned int, unsigned int,
                           unsigned int, unsigned int);
unsigned int cpuid_eax(unsigned int op) {
  unsigned int eax, ebx, ecx, edx;
  __cpuid(op, eax, ebx, ecx, edx);
  return eax;
}


x86 assembly (clang, -O0):
<cpuid_eax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1030 <__cpuid@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_eax>:
jmp    1030 <__cpuid@plt>

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

LLVM IR (-O2):
define i32 @cpuid_eax(i32 %0) {
%2 = tail call i32 @__cpuid(i32 %0, i32 undef, i32 undef, i32 undef, i32 undef)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int __VERIFIER_nondet_int();
int main() {
  int x = __VERIFIER_nondet_int();
  int y = x > 0 && x < 0;
  if (y)
    __VERIFIER_error();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jle    1152 <main+0x32>
cmpl   $0x0,-0x8(%rbp)
setl   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116e <main+0x4e>
mov    $0x0,%al
call   1040 <__VERIFIER_error@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br label %10
10: ; preds = %7, %0
%11 = phi i1 [ false, %0 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = call i32 (...) @__VERIFIER_error()
br label %17
17: ; preds = %15, %10
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int /*<<< orphan*/ done(int, int /*<<< orphan*/);
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
void fail(void) {
  (void)kill(0, SIGTERM);
  done(1, 0);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <kill@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <done@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1040 <kill@plt>
mov    $0x1,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <done@plt>

LLVM IR (-O0):
@SIGTERM = global i32 0
define void @fail() {
%1 = load i32, i32* @SIGTERM
%2 = call i32 @kill(i32 0, i32 %1)
%3 = call i32 @done(i32 1, i32 0)
ret void
}

LLVM IR (-O2):
@SIGTERM = global i32 0
define void @fail() {
%1 = load i32, i32* @SIGTERM
%2 = tail call i32 @kill(i32 0, i32 %1)
%3 = tail call i32 @done(i32 1, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ _unsupported();
int pthread_cancel(pthread_t thread) {
  _unsupported();
  return -1;
}


x86 assembly (clang, -O0):
<pthread_cancel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <_unsupported@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_cancel>:
push   %rax
xor    %eax,%eax
call   1030 <_unsupported@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pthread_cancel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @_unsupported()
ret i32 -1
}

LLVM IR (-O2):
define i32 @pthread_cancel(i32 %0) {
%2 = tail call i32 (...) @_unsupported()
ret i32 -1
}
/* Variables and functions */
int unix_status(char *);
int wfile_status(char *filename) { return (unix_status(filename)); }


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

x86 assembly (clang, -O2):
<wfile_status>:
jmp    1030 <unix_status@plt>

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

LLVM IR (-O2):
define i32 @wfile_status(i8* %0) {
%2 = tail call i32 @unix_status(i8* %0)
ret i32 %2
}
/* Variables and functions */
char getchar();
void my_getline(char *s) {
  int i = 0;
  while ((s[i] = getchar()) != '\n')
    i++;
  s[i] = '\0';
}


x86 assembly (clang, -O0):
<my_getline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     114f <my_getline+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <my_getline+0x13>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_getline>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,0x1(%r14,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1120 <my_getline+0x10>
mov    %ebx,%eax
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @my_getline(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = tail call signext i8 (...) @getchar()
%5 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 %4, i8* %5
%6 = icmp eq i8 %4, 10
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = and i64 %3, 4294967295
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 0, i8* %10
ret void
}
TR_CLASSVARS_DECL(TR_LoggerStderr) {}


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

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

LLVM IR (-O0):
define i32 @TR_CLASSVARS_DECL(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 @TR_CLASSVARS_DECL(i32 %0) {
ret i32 undef
}