xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int foo() {
  int i;
  int j;
  int k;
  i = j ? k : k;
  i = j ? j : k;
  assert(i == k);
  return i ? j : j;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,-0x8(%rbp)
je     112d <foo+0x1d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <foo+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114e <foo+0x3e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <foo+0x44>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x4(%rbp)
je     1182 <foo+0x72>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1188 <foo+0x78>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 @assert(i32 0)
ret i32 undef
}
/* Variables and functions */
scalar_t__ INW(int);
int /*<<< orphan*/ OUTW(int, int);
unsigned long gfx_get_core_freq(void) {
  unsigned long value;
  OUTW(0xAC1C, 0xFC53);
  OUTW(0xAC1C, 0x1201);
  value = (unsigned long)(INW(0xAC1E));
  return (value);
}


x86 assembly (clang, -O0):
<gfx_get_core_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xac1c,%edi
mov    $0xfc53,%esi
call   1040 <OUTW@plt>
mov    $0xac1c,%edi
mov    $0x1201,%esi
call   1040 <OUTW@plt>
mov    $0xac1e,%edi
call   1030 <INW@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_get_core_freq>:
push   %rax
mov    $0xac1c,%edi
mov    $0xfc53,%esi
call   1040 <OUTW@plt>
mov    $0xac1c,%edi
mov    $0x1201,%esi
call   1040 <OUTW@plt>
mov    $0xac1e,%edi
pop    %rax
jmp    1030 <INW@plt>

LLVM IR (-O0):
define i64 @gfx_get_core_freq() {
%1 = alloca i64
%2 = call i32 @OUTW(i32 44060, i32 64595)
%3 = call i32 @OUTW(i32 44060, i32 4609)
%4 = call i64 @INW(i32 44062)
store i64 %4, i64* %1
%5 = load i64, i64* %1
ret i64 %5
}

LLVM IR (-O2):
define i64 @gfx_get_core_freq() {
%1 = tail call i32 @OUTW(i32 44060, i32 64595)
%2 = tail call i32 @OUTW(i32 44060, i32 4609)
%3 = tail call i64 @INW(i32 44062)
ret i64 %3
}
/* Type definitions */
struct asObject {
  int dummy;
};
struct asColumn {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ errAbort(char *, char *);
struct asColumn *findColumn(struct asObject *, char *);
struct asColumn *mustFindColumn(struct asObject *table, char *colName) {
  struct asColumn *col = findColumn(table, colName);
  if (!col)
    errAbort("Couldn't find column %s", colName);
  return col;
}


x86 assembly (clang, -O0):
<mustFindColumn>:
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   1040 <findColumn@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115c <mustFindColumn+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <errAbort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mustFindColumn>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <findColumn@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <mustFindColumn+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <errAbort@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.asColumn = type { i32 }
%struct.asObject = type { i32 }
@.str = [24 x i8] c"Couldn't find column %s\00"
define %struct.asColumn* @mustFindColumn(%struct.asObject* %0, i8* %1) {
%3 = alloca %struct.asObject*
%4 = alloca i8*
%5 = alloca %struct.asColumn*
store %struct.asObject* %0, %struct.asObject** %3
store i8* %1, i8** %4
%6 = load %struct.asObject*, %struct.asObject** %3
%7 = load i8*, i8** %4
%8 = call %struct.asColumn* @findColumn(%struct.asObject* %6, i8* %7)
store %struct.asColumn* %8, %struct.asColumn** %5
%9 = load %struct.asColumn*, %struct.asColumn** %5
%10 = icmp ne %struct.asColumn* %9, null
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @errAbort(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %2
%15 = load %struct.asColumn*, %struct.asColumn** %5
ret %struct.asColumn* %15
}

LLVM IR (-O2):
%struct.asColumn = type { i32 }
%struct.asObject = type { i32 }
@.str = [24 x i8] c"Couldn't find column %s\00"
define %struct.asColumn* @mustFindColumn(%struct.asObject* %0, i8* %1) {
%3 = tail call %struct.asColumn* @findColumn(%struct.asObject* %0, i8* %1)
%4 = icmp eq %struct.asColumn* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @errAbort(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %5, %2
ret %struct.asColumn* %3
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ listLocations();
int /*<<< orphan*/ showLocation(int /*<<< orphan*/);
char *strtok(int /*<<< orphan*/ *, char *);
void handleLocationsCommand() {
  char *parameter = strtok(NULL, "");
  if (parameter == 0)
    listLocations();
  else
    showLocation(atoi(parameter));
}


x86 assembly (clang, -O0):
<handleLocationsCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
lea    0xead(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1173 <handleLocationsCommand+0x33>
mov    $0x0,%al
call   1040 <listLocations@plt>
jmp    1183 <handleLocationsCommand+0x43>
mov    -0x8(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1030 <showLocation@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleLocationsCommand>:
push   %rax
lea    0xeb8(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
test   %rax,%rax
je     1164 <handleLocationsCommand+0x24>
mov    %rax,%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <showLocation@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <listLocations@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @handleLocationsCommand() {
%1 = alloca i8*
%2 = call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @listLocations()
br label %11
7: ; preds = %0
%8 = load i8*, i8** %1
%9 = call i32 @atoi(i8* %8)
%10 = call i32 @showLocation(i32 %9)
br label %11
11: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @handleLocationsCommand() {
%1 = tail call i8* @strtok(i32* null, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @listLocations()
br label %8
5: ; preds = %0
%6 = tail call i32 @atoi(i8* %1)
%7 = tail call i32 @showLocation(i32 %6)
br label %8
8: ; preds = %5, %3
ret void
}
void reverse(char *start, char *end) {
  char temp;
  while (start < end) {
    temp = *start;
    *start = *end;
    *end = temp;
    start++;
    end--;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1155 <reverse+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <reverse+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
cmp    %rsi,%rdi
jae    112c <reverse+0x2c>
add    $0xffffffffffffffff,%rsi
nopl   0x0(%rax)
movzbl (%rdi),%eax
movzbl 0x1(%rsi),%ecx
mov    %cl,(%rdi)
mov    %al,0x1(%rsi)
add    $0x1,%rdi
lea    -0x1(%rsi),%rax
cmp    %rsi,%rdi
mov    %rax,%rsi
jb     1110 <reverse+0x10>
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8* [ %9, %4 ], [ %0, %2 ]
%6 = phi i8* [ %10, %4 ], [ %1, %2 ]
%7 = load i8, i8* %5
%8 = load i8, i8* %6
store i8 %8, i8* %5
store i8 %7, i8* %6
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = getelementptr inbounds i8, i8* %6, i64 -1
%11 = icmp ult i8* %9, %10
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int anprint(char *str, int psize, FILE *fp) {
  if (fwrite(str, psize, 1, fp) != 1)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<anprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
cmp    $0x1,%eax
je     114d <anprint+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1154 <anprint+0x44>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anprint>:
push   %rax
mov    %rdx,%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @anprint(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32 @fwrite(i8* %0, i32 %1, i32 1, i32* %2)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ RSA;
typedef int /*<<< orphan*/ EVP_MD;

/* Variables and functions */
int RSA_verify_PKCS1_PSS_mgf1(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                              int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ const *, int);
int RSA_verify_PKCS1_PSS(RSA *rsa, const uint8_t *mHash, const EVP_MD *Hash,
                         const uint8_t *EM, int sLen) {
  return RSA_verify_PKCS1_PSS_mgf1(rsa, mHash, Hash, NULL, EM, sLen);
}


x86 assembly (clang, -O0):
<RSA_verify_PKCS1_PSS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <RSA_verify_PKCS1_PSS_mgf1@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA_verify_PKCS1_PSS>:
mov    %r8d,%r9d
mov    %rcx,%r8
xor    %ecx,%ecx
jmp    1030 <RSA_verify_PKCS1_PSS_mgf1@plt>

LLVM IR (-O0):
define i32 @RSA_verify_PKCS1_PSS(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load i32, i32* %10
%16 = call i32 @RSA_verify_PKCS1_PSS_mgf1(i32* %11, i32* %12, i32* %13, i32* null, i32* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @RSA_verify_PKCS1_PSS(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = tail call i32 @RSA_verify_PKCS1_PSS_mgf1(i32* %0, i32* %1, i32* %2, i32* null, i32* %3, i32 %4)
ret i32 %6
}
int jpeg_int(int bits, int width) {
  int b = (1 << width) - 1;
  if (bits <= b >> 1)
    bits = -(bits ^ b);
  return (bits);
}


x86 assembly (clang, -O0):
<jpeg_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jg     1138 <jpeg_int+0x38>
mov    -0x4(%rbp),%ecx
xor    -0xc(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jpeg_int>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
mov    %eax,%ecx
sar    %ecx
xor    %edi,%eax
neg    %eax
cmp    %edi,%ecx
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @jpeg_int(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* %4
%7 = shl i32 1, %6
%8 = sub nsw i32 %7, 1
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = ashr i32 %10, 1
%12 = icmp sle i32 %9, %11
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = xor i32 %14, %15
%17 = sub nsw i32 0, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %13, %2
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @jpeg_int(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = ashr i32 %4, 1
%6 = icmp slt i32 %5, %0
%7 = xor i32 %4, %0
%8 = sub nsw i32 0, %7
%9 = select i1 %6, i32 %0, i32 %8
ret i32 %9
}
/* Variables and functions */
char *generatePasscode(int);
int /*<<< orphan*/ phase(int);
void phase_5() {
  char *pass = generatePasscode(5);
  phase(5);
}


x86 assembly (clang, -O0):
<phase_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1030 <generatePasscode@plt>
mov    %rax,-0x8(%rbp)
mov    $0x5,%edi
call   1040 <phase@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phase_5>:
push   %rax
mov    $0x5,%edi
call   1030 <generatePasscode@plt>
mov    $0x5,%edi
pop    %rax
jmp    1040 <phase@plt>

LLVM IR (-O0):
define void @phase_5() {
%1 = alloca i8*
%2 = call i8* @generatePasscode(i32 5)
store i8* %2, i8** %1
%3 = call i32 @phase(i32 5)
ret void
}

LLVM IR (-O2):
define void @phase_5() {
%1 = tail call i8* @generatePasscode(i32 5)
%2 = tail call i32 @phase(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ driveRaw(int, int, int, int);
void driveBackwards(int speedForward, int speedTurn, int speedStrafe) {
  int speedBR = speedForward + speedTurn + speedStrafe;
  int speedFR = speedForward + speedTurn - speedStrafe;
  int speedBL = speedForward - speedTurn - speedStrafe;
  int speedFL = speedForward - speedTurn + speedStrafe;
  driveRaw(speedFL, speedBL, speedFR, speedBR);
}


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

x86 assembly (clang, -O2):
<driveBackwards>:
lea    (%rsi,%rdi,1),%eax
lea    (%rax,%rdx,1),%ecx
sub    %edx,%eax
sub    %esi,%edi
mov    %edi,%esi
sub    %edx,%esi
add    %edx,%edi
mov    %eax,%edx
jmp    1030 <driveRaw@plt>

LLVM IR (-O0):
define void @driveBackwards(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
store i32 %15, i32* %7
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
store i32 %20, i32* %8
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %21, %22
%24 = load i32, i32* %6
%25 = sub nsw i32 %23, %24
store i32 %25, i32* %9
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = sub nsw i32 %26, %27
%29 = load i32, i32* %6
%30 = add nsw i32 %28, %29
store i32 %30, i32* %10
%31 = load i32, i32* %10
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = load i32, i32* %7
%35 = call i32 @driveRaw(i32 %31, i32 %32, i32 %33, i32 %34)
ret void
}

LLVM IR (-O2):
define void @driveBackwards(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
%6 = sub nsw i32 %4, %2
%7 = sub nsw i32 %0, %1
%8 = sub nsw i32 %7, %2
%9 = add nsw i32 %7, %2
%10 = tail call i32 @driveRaw(i32 %9, i32 %8, i32 %6, i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FIONREAD;
int ioctl(int, int /*<<< orphan*/, unsigned int *);
int /*<<< orphan*/ perror(char *);
unsigned get_queue_size(int fd) {
  unsigned queue_len;
  int ret = ioctl(fd, FIONREAD, &queue_len);
  if (ret < 0) {
    perror("ioctl");
    return 0;
  }
  return queue_len;
}


x86 assembly (clang, -O0):
<get_queue_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1165 <get_queue_size+0x45>
lea    0xeac(%rip),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    116b <get_queue_size+0x4b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_queue_size>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
test   %eax,%eax
js     113e <get_queue_size+0x1e>
mov    0x4(%rsp),%eax
pop    %rcx
ret
lea    0xebb(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@FIONREAD = global i32 0
@.str = [6 x i8] c"ioctl\00"
define i32 @get_queue_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @FIONREAD
%8 = call i32 @ioctl(i32 %6, i32 %7, i32* %4)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@FIONREAD = global i32 0
@.str = [6 x i8] c"ioctl\00"
define i32 @get_queue_size(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @FIONREAD
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = load i32, i32* %2
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ 0, %7 ], [ %10, %9 ]
ret i32 %12
}
void enable_interrupts() {}


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

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

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

LLVM IR (-O2):
define void @enable_interrupts() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(void *, int, size_t, int /*<<< orphan*/ *);
size_t CK_Cross_freadInt16LE(void *ptr, size_t count, FILE *stream) {
  count = fread(ptr, 2, count, stream);
  return count;
}


x86 assembly (clang, -O0):
<CK_Cross_freadInt16LE>:
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),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x2,%esi
call   1030 <fread@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CK_Cross_freadInt16LE>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    $0x2,%esi
jmp    1030 <fread@plt>

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

LLVM IR (-O2):
define i64 @CK_Cross_freadInt16LE(i8* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i64 @fread(i8* %0, i32 2, i64 %1, i32* %2)
ret i64 %4
}
int fun677() { return 677; }


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

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

LLVM IR (-O0):
define i32 @fun677() {
ret i32 677
}

LLVM IR (-O2):
define i32 @fun677() {
ret i32 677
}
int re_match_2(bufp, string1, length1, string2, length2, start, regs, stop)
struct re_pattern_buffer *bufp;
const char *string1, *string2;
int length1, length2, start, stop;
struct re_registers *regs;
{
  return re_search_2_stub(bufp, string1, length1, string2, length2, start, 0,
                          regs, stop, 1);
}


x86 assembly (clang, -O0):
<re_match_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%eax
xor    %r11d,%r11d
movl   $0x0,(%rsp)
mov    %r10,0x8(%rsp)
mov    %eax,0x10(%rsp)
movl   $0x1,0x18(%rsp)
mov    $0x0,%al
call   1030 <re_search_2_stub@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_match_2>:
push   %rax
mov    0x18(%rsp),%r10d
xor    %eax,%eax
push   $0x1
push   %r10
push   0x20(%rsp)
push   $0x0
call   1030 <re_search_2_stub@plt>
add    $0x20,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match_2(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, %struct.re_registers* %6, i32 %7) {
%9 = alloca %struct.re_pattern_buffer*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.re_registers*
%16 = alloca i32
store %struct.re_pattern_buffer* %0, %struct.re_pattern_buffer** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store %struct.re_registers* %6, %struct.re_registers** %15
store i32 %7, i32* %16
%17 = load %struct.re_pattern_buffer*, %struct.re_pattern_buffer** %9
%18 = load i8*, i8** %10
%19 = load i32, i32* %11
%20 = load i8*, i8** %12
%21 = load i32, i32* %13
%22 = load i32, i32* %14
%23 = load %struct.re_registers*, %struct.re_registers** %15
%24 = load i32, i32* %16
%25 = call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, i32, ...) bitcast (i32 (...)* @re_search_2_stub to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, i32, ...)*)(%struct.re_pattern_buffer* %17, i8* %18, i32 %19, i8* %20, i32 %21, i32 %22, i32 0, %struct.re_registers* %23, i32 %24, i32 1)
ret i32 %25
}

LLVM IR (-O2):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match_2(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, %struct.re_registers* %6, i32 %7) {
%9 = tail call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, i32, ...) bitcast (i32 (...)* @re_search_2_stub to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, i32, %struct.re_registers*, i32, i32, ...)*)(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, i32 0, %struct.re_registers* %6, i32 %7, i32 1)
ret i32 %9
}
/* Type definitions */
struct schedule {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ coroutine_close(struct schedule *);
struct schedule *coroutine_open();
int /*<<< orphan*/ test(struct schedule *);
int main() {
  struct schedule *S = coroutine_open();
  test(S);
  coroutine_close(S);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <coroutine_open@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <test@plt>
mov    -0x10(%rbp),%rdi
call   1030 <coroutine_close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <coroutine_open@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <test@plt>
mov    %rbx,%rdi
call   1030 <coroutine_close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.schedule = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.schedule*
store i32 0, i32* %1
%3 = call %struct.schedule* (...) @coroutine_open()
store %struct.schedule* %3, %struct.schedule** %2
%4 = load %struct.schedule*, %struct.schedule** %2
%5 = call i32 @test(%struct.schedule* %4)
%6 = load %struct.schedule*, %struct.schedule** %2
%7 = call i32 @coroutine_close(%struct.schedule* %6)
ret i32 0
}

LLVM IR (-O2):
%struct.schedule = type { i32 }
define i32 @main() {
%1 = tail call %struct.schedule* (...) @coroutine_open()
%2 = tail call i32 @test(%struct.schedule* %1)
%3 = tail call i32 @coroutine_close(%struct.schedule* %1)
ret i32 0
}
unsigned uDivTest3(unsigned X, unsigned Y) { return X / -1; }


x86 assembly (clang, -O0):
<uDivTest3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xffffffff,%ecx
xor    %edx,%edx
div    %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDivTest3>:
xor    %eax,%eax
cmp    $0xffffffff,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @uDivTest3(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 = udiv i32 %5, -1
ret i32 %6
}

LLVM IR (-O2):
define i32 @uDivTest3(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, -1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void error(const char *str) {
  fprintf(stderr, "*** ERROR: %s\n", str);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"*** ERROR: %s\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"*** ERROR: %s\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int error1(char *message) {
  perror(message);
  exit(1);
}


x86 assembly (clang, -O0):
<error1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error1>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @error1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define i32 @error1(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
scalar_t__ flag_has(char *);
int /*<<< orphan*/ gph_reset();
int /*<<< orphan*/ printf(char *, char *);
void error_check(char *msg) {
  if (flag_has("fatal_error") != 0) {
    gph_reset();
    printf("\n** FATAL ERROR %s **\n\n", (msg));
    exit(1);
  }
}


x86 assembly (clang, -O0):
<error_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1030 <flag_has@plt>
cmp    $0x0,%rax
je     1183 <error_check+0x43>
mov    $0x0,%al
call   1050 <gph_reset@plt>
mov    -0x8(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_check>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
call   1030 <flag_has@plt>
test   %rax,%rax
jne    1157 <error_check+0x17>
pop    %rbx
ret
xor    %eax,%eax
call   1050 <gph_reset@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"fatal_error\00"
@.str.1 = [24 x i8] c"\0A** FATAL ERROR %s **\0A\0A\00"
define void @error_check(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 @flag_has(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = call i32 (...) @gph_reset()
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"fatal_error\00"
@.str.1 = [24 x i8] c"\0A** FATAL ERROR %s **\0A\0A\00"
define void @error_check(i8* %0) {
%2 = tail call i64 @flag_has(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 (...) @gph_reset()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ write(int, char *, scalar_t__);
void msg_send(int comm, char *msg, int size) {
  write(comm, msg, strlen(msg) + 1);
  printf("send -> %s\n", msg);
}


x86 assembly (clang, -O0):
<msg_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1030 <write@plt>
mov    -0x10(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1050 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_send>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <write@plt>
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"send -> %s\0A\00"
define void @msg_send(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %5
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %10, 1
%12 = call i32 @write(i32 %7, i8* %8, i64 %11)
%13 = load i8*, i8** %5
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"send -> %s\0A\00"
define void @msg_send(i32 %0, i8* %1, i32 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, 1
%6 = tail call i32 @write(i32 %0, i8* %1, i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
int getLenStringLen(char *ptr) {
  int len = 256 * ((unsigned char)(*ptr)) + (unsigned char)(*(ptr + 1));
  return len;
}


x86 assembly (clang, -O0):
<getLenStringLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getLenStringLen>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @getLenStringLen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_token(char *tok) {
  if (tok) {
    free(tok);
  }
}


x86 assembly (clang, -O0):
<free_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <free_token+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_token>:
test   %rdi,%rdi
je     111a <free_token+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @free_token(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @free_token(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int listen(int, int);
int /*<<< orphan*/ unix_error(char *);
void csapp_listen(int s, int backlog) {
  int rc;
  if ((rc = listen(s, backlog)) < 0)
    unix_error("listen error");
}


x86 assembly (clang, -O0):
<csapp_listen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <listen@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    1151 <csapp_listen+0x31>
lea    0xeb4(%rip),%rdi
call   1030 <unix_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csapp_listen>:
push   %rax
call   1040 <listen@plt>
test   %eax,%eax
js     112c <csapp_listen+0xc>
pop    %rax
ret
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <unix_error@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"listen error\00"
define void @csapp_listen(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 = call i32 @listen(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @unix_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"listen error\00"
define void @csapp_listen(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @unix_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
int ft_isspace(unsigned char c) {
  if (c == ' ' || c == '\n' || c == '\t')
    return (1);
  if (c == '\v' || c == '\r' || c == '\f')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     1131 <ft_isspace+0x31>
movzbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1131 <ft_isspace+0x31>
movzbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    113d <ft_isspace+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1177 <ft_isspace+0x77>
movzbl -0x5(%rbp),%eax
cmp    $0xb,%eax
je     1164 <ft_isspace+0x64>
movzbl -0x5(%rbp),%eax
cmp    $0xd,%eax
je     1164 <ft_isspace+0x64>
movzbl -0x5(%rbp),%eax
cmp    $0xc,%eax
jne    1170 <ft_isspace+0x70>
movl   $0x1,-0x4(%rbp)
jmp    1177 <ft_isspace+0x77>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isspace>:
cmp    $0x20,%dil
ja     111e <ft_isspace+0x1e>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    111e <ft_isspace+0x1e>
ret
lea    -0xb(%rdi),%ecx
xor    %eax,%eax
cmp    $0x3,%cl
setb   %al
ret

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

LLVM IR (-O2):
define i32 @ft_isspace(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 32, label %6
i8 10, label %6
i8 9, label %6
]
2: ; preds = %1
%3 = add i8 %0, -11
%4 = icmp ult i8 %3, 3
%5 = zext i1 %4 to i32
br label %6
6: ; preds = %2, %1, %1, %1
%7 = phi i32 [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ %5, %2 ]
ret i32 %7
}
/* Variables and functions */
int icrypto_verifylibfile(char const *, char const **, int);
int crypto_verifylibfile(const char *libfile, const char **pubkeys,
                         int npubkeys) {
  if (!libfile || !pubkeys) {
    return -1;
  }
  return icrypto_verifylibfile(libfile, pubkeys, npubkeys);
}


x86 assembly (clang, -O0):
<crypto_verifylibfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <crypto_verifylibfile+0x29>
cmpq   $0x0,-0x18(%rbp)
jne    1145 <crypto_verifylibfile+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <crypto_verifylibfile+0x48>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <icrypto_verifylibfile@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_verifylibfile>:
test   %rdi,%rdi
je     111f <crypto_verifylibfile+0xf>
test   %rsi,%rsi
je     111f <crypto_verifylibfile+0xf>
jmp    1030 <icrypto_verifylibfile@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @crypto_verifylibfile(i8* %0, i8** %1, i32 %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8** %1, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @icrypto_verifylibfile(i8* %0, i8** %1, i32 %2)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ %8, %7 ], [ -1, %3 ]
ret i32 %10
}
void RTco_signalThread(__attribute__((unused)) int tid) {}


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

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

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

LLVM IR (-O2):
define void @RTco_signalThread(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xCPUwfi();
void SysCtlEnterStandbyMode(void) {
  (*((volatile unsigned long *)(0x40007000))) |= 0x00000004;
  (*((volatile unsigned long *)(0x40007000))) |= 0x00000002;
  (*((volatile unsigned long *)(0xE000ED10))) |= 0x00000004;
  xCPUwfi();
}


x86 assembly (clang, -O0):
<SysCtlEnterStandbyMode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40007000,%eax
mov    (%rax),%rcx
or     $0x4,%rcx
mov    $0x40007000,%eax
mov    %rcx,(%rax)
mov    $0x40007000,%eax
mov    (%rax),%rcx
or     $0x2,%rcx
mov    $0x40007000,%eax
mov    %rcx,(%rax)
mov    $0xe000ed10,%eax
mov    (%rax),%rcx
or     $0x4,%rcx
mov    $0xe000ed10,%eax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <xCPUwfi@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlEnterStandbyMode>:
orq    $0x4,0x40007000
40 04
orq    $0x2,0x40007000
40 02
mov    $0xe000ed10,%eax
orq    $0x4,(%rax)
xor    %eax,%eax
jmp    1030 <xCPUwfi@plt>

LLVM IR (-O0):
define void @SysCtlEnterStandbyMode() {
%1 = load volatile i64, i64* inttoptr (i64 1073770496 to i64*)
%2 = or i64 %1, 4
store volatile i64 %2, i64* inttoptr (i64 1073770496 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 1073770496 to i64*)
%4 = or i64 %3, 2
store volatile i64 %4, i64* inttoptr (i64 1073770496 to i64*)
%5 = load volatile i64, i64* inttoptr (i64 3758157072 to i64*)
%6 = or i64 %5, 4
store volatile i64 %6, i64* inttoptr (i64 3758157072 to i64*)
%7 = call i32 (...) @xCPUwfi()
ret void
}

LLVM IR (-O2):
define void @SysCtlEnterStandbyMode() {
%1 = load volatile i64, i64* inttoptr (i64 1073770496 to i64*)
%2 = or i64 %1, 4
store volatile i64 %2, i64* inttoptr (i64 1073770496 to i64*)
%3 = load volatile i64, i64* inttoptr (i64 1073770496 to i64*)
%4 = or i64 %3, 2
store volatile i64 %4, i64* inttoptr (i64 1073770496 to i64*)
%5 = load volatile i64, i64* inttoptr (i64 3758157072 to i64*)
%6 = or i64 %5, 4
store volatile i64 %6, i64* inttoptr (i64 3758157072 to i64*)
%7 = tail call i32 (...) @xCPUwfi()
ret void
}
/* Variables and functions */
char *intToRoman(int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("%s\n", intToRoman(3999));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* @intToRoman(i32 3999)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
void null_command() { return; }


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

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

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

LLVM IR (-O2):
define void @null_command() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void bitcomp_handler(void) { write_src("PUSH(~POP());\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"PUSH(~POP());\0A\00"
define void @bitcomp_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"PUSH(~POP());\0A\00"
define void @bitcomp_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int padre(int i) { return (i - 1) / 2; }


x86 assembly (clang, -O0):
<padre>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<padre>:
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0xffffffff,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @padre(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = sdiv i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @padre(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 2
ret i32 %3
}