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

/* Variables and functions */
int /*<<< orphan*/ read_ble8(int /*<<< orphan*/ const *);
uint8_t read_at_ble8(const void *src, size_t offset) {
  const uint8_t *s = src;
  s += offset;
  return read_ble8(s);
}


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

x86 assembly (clang, -O2):
<read_at_ble8>:
lea    (%rdi,%rsi,4),%rdi
jmp    1030 <read_ble8@plt>

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

LLVM IR (-O2):
define i32 @read_at_ble8(i8* %0, i64 %1) {
%3 = bitcast i8* %0 to i32*
%4 = getelementptr inbounds i32, i32* %3, i64 %1
%5 = tail call i32 @read_ble8(i32* %4)
ret i32 %5
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sleep_ms(uint64_t ms) { usleep(ms * 1000); }


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

x86 assembly (clang, -O2):
<sleep_ms>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sleep_ms(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @sleep_ms(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Type definitions */
struct BoolExpr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _bx_mark_flags(struct BoolExpr *, int);
struct BoolExpr *_bx_to_nnf(struct BoolExpr *);
struct BoolExpr *BX_ToNNF(struct BoolExpr *ex) {
  struct BoolExpr *nnf;
  do {
    if ((nnf = _bx_to_nnf(ex)) == NULL)
      return NULL;
  } while (0);
  _bx_mark_flags(nnf, 0x02 | 0x01);
  return nnf;
}


x86 assembly (clang, -O0):
<BX_ToNNF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_bx_to_nnf@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1150 <BX_ToNNF+0x30>
movq   $0x0,-0x8(%rbp)
jmp    116b <BX_ToNNF+0x4b>
jmp    1155 <BX_ToNNF+0x35>
mov    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   1030 <_bx_mark_flags@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BX_ToNNF>:
push   %rbx
call   1040 <_bx_to_nnf@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113b <BX_ToNNF+0x1b>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <_bx_mark_flags@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.BoolExpr = type { i32 }
define %struct.BoolExpr* @BX_ToNNF(%struct.BoolExpr* %0) {
%2 = alloca %struct.BoolExpr*
%3 = alloca %struct.BoolExpr*
%4 = alloca %struct.BoolExpr*
store %struct.BoolExpr* %0, %struct.BoolExpr** %3
br label %5
5: ; preds = %1
%6 = load %struct.BoolExpr*, %struct.BoolExpr** %3
%7 = call %struct.BoolExpr* @_bx_to_nnf(%struct.BoolExpr* %6)
store %struct.BoolExpr* %7, %struct.BoolExpr** %4
%8 = icmp eq %struct.BoolExpr* %7, null
br i1 %8, label %9, label %10
9: ; preds = %5
store %struct.BoolExpr* null, %struct.BoolExpr** %2
br label %15
10: ; preds = %5
br label %11
11: ; preds = %10
%12 = load %struct.BoolExpr*, %struct.BoolExpr** %4
%13 = call i32 @_bx_mark_flags(%struct.BoolExpr* %12, i32 3)
%14 = load %struct.BoolExpr*, %struct.BoolExpr** %4
store %struct.BoolExpr* %14, %struct.BoolExpr** %2
br label %15
15: ; preds = %11, %9
%16 = load %struct.BoolExpr*, %struct.BoolExpr** %2
ret %struct.BoolExpr* %16
}

LLVM IR (-O2):
%struct.BoolExpr = type { i32 }
define %struct.BoolExpr* @BX_ToNNF(%struct.BoolExpr* %0) {
%2 = tail call %struct.BoolExpr* @_bx_to_nnf(%struct.BoolExpr* %0)
%3 = icmp eq %struct.BoolExpr* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @_bx_mark_flags(%struct.BoolExpr* %2, i32 3)
br label %6
6: ; preds = %1, %4
ret %struct.BoolExpr* %2
}
/* Variables and functions */
double **produto(double **, double **, int, int, int, int);
double **produto_quadradas(double **M1, double **M2, int dim) {
  return produto(M1, M2, dim, dim, dim, dim);
}


x86 assembly (clang, -O0):
<produto_quadradas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1030 <produto@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<produto_quadradas>:
mov    %edx,%ecx
mov    %edx,%r8d
mov    %edx,%r9d
jmp    1030 <produto@plt>

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

LLVM IR (-O2):
define double** @produto_quadradas(double** %0, double** %1, i32 %2) {
%4 = tail call double** @produto(double** %0, double** %1, i32 %2, i32 %2, i32 %2, i32 %2)
ret double** %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void redmacfree(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<redmacfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @redmacfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ decrypt_archive(char *, char *);
void main() { decrypt_archive("opensoft", "sanket"); }


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
lea    0xeeb(%rip),%rsi
jmp    1030 <decrypt_archive@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"opensoft\00"
@.str.1 = [7 x i8] c"sanket\00"
define void @main() {
%1 = call i32 @decrypt_archive(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"opensoft\00"
@.str.1 = [7 x i8] c"sanket\00"
define void @main() {
%1 = tail call i32 @decrypt_archive(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  char msg[] = {70,  101, 108, 105, 122, 32, 100, 105, 97,  32,  100, 111, 32,
                112, 114, 111, 103, 114, 97, 109, 97,  100, 111, 114, 0};
  printf(msg);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed9(%rip),%al
mov    %al,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xeee(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.msg = [25 x i8] c"Feliz dia do programador\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = bitcast [25 x i8]* %1 to i8*
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* %3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.msg = [25 x i8] c"Feliz dia do programador\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void skyeye_free(void *p) {
  free(p);
  p = NULL;
  return;
}


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

x86 assembly (clang, -O2):
<skyeye_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @skyeye_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct cli_def {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void pc(struct cli_def *cli __attribute__((unused)), const char *string) {
  printf("%s\n", string);
}


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

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

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

LLVM IR (-O2):
%struct.cli_def = type { i32 }
@.str = [4 x i8] c"%s\0A\00"
define void @pc(%struct.cli_def* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Type definitions */
struct ottery_state {
  int dummy;
};
struct ottery_config {
  int dummy;
};

/* Variables and functions */
int ottery_st_initialize(struct ottery_state *, struct ottery_config const *,
                         int /*<<< orphan*/);
int ottery_st_init_nolock(struct ottery_state *st,
                          const struct ottery_config *cfg) {
  return ottery_st_initialize(st, cfg, 0);
}


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

x86 assembly (clang, -O2):
<ottery_st_init_nolock>:
xor    %edx,%edx
jmp    1030 <ottery_st_initialize@plt>

LLVM IR (-O0):
%struct.ottery_state = type { i32 }
%struct.ottery_config = type { i32 }
define i32 @ottery_st_init_nolock(%struct.ottery_state* %0, %struct.ottery_config* %1) {
%3 = alloca %struct.ottery_state*
%4 = alloca %struct.ottery_config*
store %struct.ottery_state* %0, %struct.ottery_state** %3
store %struct.ottery_config* %1, %struct.ottery_config** %4
%5 = load %struct.ottery_state*, %struct.ottery_state** %3
%6 = load %struct.ottery_config*, %struct.ottery_config** %4
%7 = call i32 @ottery_st_initialize(%struct.ottery_state* %5, %struct.ottery_config* %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.ottery_state = type { i32 }
%struct.ottery_config = type { i32 }
define i32 @ottery_st_init_nolock(%struct.ottery_state* %0, %struct.ottery_config* %1) {
%3 = tail call i32 @ottery_st_initialize(%struct.ottery_state* %0, %struct.ottery_config* %1, i32 0)
ret i32 %3
}
void pq_reset(int *items, int *_size) { *_size = 0; }


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

x86 assembly (clang, -O2):
<pq_reset>:
movl   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define void @pq_reset(i32* nocapture readnone %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
ret void
}
/* Type definitions */
struct cpl_allocator {
  int dummy;
};

/* Variables and functions */
void *malloc(size_t);
void *cpl_default_malloc(struct cpl_allocator *pAllocator, size_t sz) {
  return malloc(sz);
}


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

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

LLVM IR (-O0):
%struct.cpl_allocator = type { i32 }
define i8* @cpl_default_malloc(%struct.cpl_allocator* %0, i64 %1) {
%3 = alloca %struct.cpl_allocator*
%4 = alloca i64
store %struct.cpl_allocator* %0, %struct.cpl_allocator** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i8* @malloc(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
%struct.cpl_allocator = type { i32 }
define noalias i8* @cpl_default_malloc(%struct.cpl_allocator* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
ret i8* %3
}
char *langRomTypeWaveSCSI256() { return "256kB WAVE-SCSI"; }


x86 assembly (clang, -O0):
<langRomTypeWaveSCSI256>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeWaveSCSI256>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"256kB WAVE-SCSI\00"
define i8* @langRomTypeWaveSCSI256() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"256kB WAVE-SCSI\00"
define i8* @langRomTypeWaveSCSI256() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int rand();
void generate_winding_numbers(int nbt, int *wind) {
  int i;
  for (i = 0; i < nbt; i++)
    wind[i] = -99 + (rand() % 199);
}


x86 assembly (clang, -O0):
<generate_winding_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1160 <generate_winding_numbers+0x50>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xc7,%ecx
cltd
idiv   %ecx
add    $0xffffff9d,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <generate_winding_numbers+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_winding_numbers>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1167 <generate_winding_numbers+0x57>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x5254e78f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0xc7,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xffffff9d,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <generate_winding_numbers+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @generate_winding_numbers(i32 %0, i32* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 199
%10 = add nsw i32 %9, -99
%11 = getelementptr inbounds i32, i32* %1, i64 %7
store i32 %10, i32* %11
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Type definitions */
struct b_tonegen {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ setMIDIDrawBar(struct b_tonegen *, int, unsigned char);
void setDrawbar3(void *d, unsigned char v) {
  setMIDIDrawBar((struct b_tonegen *)d, 3, v);
}


x86 assembly (clang, -O0):
<setDrawbar3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
movzbl -0x9(%rbp),%edx
call   1030 <setMIDIDrawBar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setDrawbar3>:
mov    %esi,%edx
mov    $0x3,%esi
jmp    1030 <setMIDIDrawBar@plt>

LLVM IR (-O0):
%struct.b_tonegen = type { i32 }
define void @setDrawbar3(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to %struct.b_tonegen*
%7 = load i8, i8* %4
%8 = call i32 @setMIDIDrawBar(%struct.b_tonegen* %6, i32 3, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
%struct.b_tonegen = type { i32 }
define void @setDrawbar3(i8* %0, i8 zeroext %1) {
%3 = bitcast i8* %0 to %struct.b_tonegen*
%4 = tail call i32 @setMIDIDrawBar(%struct.b_tonegen* %3, i32 3, i8 zeroext %1)
ret void
}
void foo523(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo523(i32 %0) {
ret void
}
void rop3_147_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T & *D;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_147_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_147_0_0>:
and    (%rdi),%dl
xor    %sil,%dl
not    %dl
mov    %dl,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_147_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %2
%6 = xor i8 %5, %1
%7 = xor i8 %6, -1
store i8 %7, i8* %0
ret void
}
int st_internal_numcmp(long x, long y) { return x != y; }


x86 assembly (clang, -O0):
<st_internal_numcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_internal_numcmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
ret

LLVM IR (-O0):
define i32 @st_internal_numcmp(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @st_internal_numcmp(i64 %0, i64 %1) {
%3 = icmp ne i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct kbsentry {
  int dummy;
};
typedef int /*<<< orphan*/ m;

/* Variables and functions */
int main(void) {
  struct kbsentry m;
  (void)m;
  return sizeof(m);
}


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

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

LLVM IR (-O0):
%struct.kbsentry = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.kbsentry
store i32 0, i32* %1
ret i32 4
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
void lgdt(void *p) { __asm volatile("lgdt (%0)" : : "r"(p) : "memory"); }


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

x86 assembly (clang, -O2):
<lgdt>:
lgdt   (%rdi)
ret

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

LLVM IR (-O2):
define void @lgdt(i8* %0) {
tail call void asm sideeffect "lgdt ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
int test_imm_FEint64_highword_reg(long long val) {
  return ((val >> 32) & (0xFE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FEint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0xfe,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_FEint64_highword_reg>:
movabs $0xfe00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_FEint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 254
%6 = icmp ne i64 %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_FEint64_highword_reg(i64 %0) {
%2 = and i64 %0, 1090921693184
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double ceil(double);
double floor(double);
double Func_Trunc(double *oplist, unsigned int numops) {
  return oplist[0] < 0.0 ? ceil(oplist[0]) : floor(oplist[0]);
}


x86 assembly (clang, -O0):
<Func_Trunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    1157 <Func_Trunc+0x37>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x18(%rbp)
jmp    1169 <Func_Trunc+0x49>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Func_Trunc>:
movsd  (%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1133 <Func_Trunc+0x13>
jmp    1030 <ceil@plt>
jmp    1040 <floor@plt>

LLVM IR (-O0):
define double @Func_Trunc(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = call double @llvm.ceil.f64(double %12)
br label %19
14: ; preds = %2
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 0
%17 = load double, double* %16
%18 = call double @llvm.floor.f64(double %17)
br label %19
19: ; preds = %14, %9
%20 = phi double [ %13, %9 ], [ %18, %14 ]
ret double %20
}

LLVM IR (-O2):
define double @Func_Trunc(double* nocapture %0, i32 %1) {
%3 = load double, double* %0
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call double @llvm.ceil.f64(double %3)
br label %9
7: ; preds = %2
%8 = tail call double @llvm.floor.f64(double %3)
br label %9
9: ; preds = %7, %5
%10 = phi double [ %6, %5 ], [ %8, %7 ]
ret double %10
}
/* Variables and functions */
long get_num(char *, char const *, int, char const *);
long get_long(const char *arg, int flags, const char *name) {
  return get_num("get_long", arg, flags, name);
}


x86 assembly (clang, -O0):
<get_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rdi
call   1030 <get_num@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_long>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <get_num@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"get_long\00"
define i64 @get_long(i8* %0, i32 %1, i8* %2) {
%4 = tail call i64 @get_num(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
ret i64 %4
}
void do_nsec_add(long nsecs, struct timespec *ts) {}


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

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

LLVM IR (-O0):
%struct.timespec = type opaque
define void @do_nsec_add(i64 %0, %struct.timespec* %1) {
%3 = alloca i64
%4 = alloca %struct.timespec*
store i64 %0, i64* %3
store %struct.timespec* %1, %struct.timespec** %4
ret void
}

LLVM IR (-O2):
%struct.timespec = type opaque
define void @do_nsec_add(i64 %0, %struct.timespec* nocapture %1) {
ret void
}
void INT_Excep_PERIA_INTA249(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA249() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void SimpleChangeInt(int a) {
  a += 5;
  printf("a din functie %d\n", a);
}


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

x86 assembly (clang, -O2):
<SimpleChangeInt>:
lea    0x5(%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"a din functie %d\0A\00"
define void @SimpleChangeInt(i32 %0) {
%2 = add nsw i32 %0, 5
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c_fstr_sort_index(int *, int);
void fstr_sort_index(int *index_data, int *n) {
  c_fstr_sort_index(index_data, *n);
}


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

x86 assembly (clang, -O2):
<fstr_sort_index>:
mov    (%rsi),%esi
jmp    1030 <c_fstr_sort_index@plt>

LLVM IR (-O0):
define void @fstr_sort_index(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 = load i32, i32* %6
%8 = call i32 @c_fstr_sort_index(i32* %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @fstr_sort_index(i32* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @c_fstr_sort_index(i32* %0, i32 %3)
ret void
}
/* Type definitions */
struct reader {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ readerSkipExplicit(struct reader *, char const *, int);
void readerSkip(struct reader *r, const char *skip) {
  readerSkipExplicit(r, skip, 1);
}


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

x86 assembly (clang, -O2):
<readerSkip>:
mov    $0x1,%edx
jmp    1030 <readerSkipExplicit@plt>

LLVM IR (-O0):
%struct.reader = type { i32 }
define void @readerSkip(%struct.reader* %0, i8* %1) {
%3 = alloca %struct.reader*
%4 = alloca i8*
store %struct.reader* %0, %struct.reader** %3
store i8* %1, i8** %4
%5 = load %struct.reader*, %struct.reader** %3
%6 = load i8*, i8** %4
%7 = call i32 @readerSkipExplicit(%struct.reader* %5, i8* %6, i32 1)
ret void
}

LLVM IR (-O2):
%struct.reader = type { i32 }
define void @readerSkip(%struct.reader* %0, i8* %1) {
%3 = tail call i32 @readerSkipExplicit(%struct.reader* %0, i8* %1, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int32_t;
typedef int /*<<< orphan*/ host;

/* Variables and functions */
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/ *, int);
void htoun32(void *network, u_int32_t host) {
  char *unaligned = (char *)network;
  host = htonl(host);
  memcpy((char *)unaligned, &host, sizeof(host));
}


x86 assembly (clang, -O0):
<htoun32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htonl@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<htoun32>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htonl@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @htoun32(i8* %0, i32 %1) {
%3 = alloca i32
%4 = tail call i32 @htonl(i32 %1)
store i32 %4, i32* %3
%5 = call i32 @memcpy(i8* %0, i32* %3, i32 4)
ret void
}
char getCharBIN(char input, char state0, char state1) {
  if (input == '-')
    return '-';
  if (input == 'N')
    return 'N';
  if (input == state0)
    return '0';
  if (input == state1)
    return '1';
  return 'X';
}


x86 assembly (clang, -O0):
<getCharBIN>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x2(%rbp)
mov    %cl,-0x3(%rbp)
mov    %al,-0x4(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x2d,%eax
jne    112b <getCharBIN+0x2b>
movb   $0x2d,-0x1(%rbp)
jmp    1177 <getCharBIN+0x77>
movsbl -0x2(%rbp),%eax
cmp    $0x4e,%eax
jne    1141 <getCharBIN+0x41>
movb   $0x4e,-0x1(%rbp)
jmp    1177 <getCharBIN+0x77>
movsbl -0x2(%rbp),%eax
movsbl -0x3(%rbp),%ecx
cmp    %ecx,%eax
jne    115a <getCharBIN+0x5a>
movb   $0x30,-0x1(%rbp)
jmp    1177 <getCharBIN+0x77>
movsbl -0x2(%rbp),%eax
movsbl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jne    1173 <getCharBIN+0x73>
movb   $0x31,-0x1(%rbp)
jmp    1177 <getCharBIN+0x77>
movb   $0x58,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCharBIN>:
cmp    $0x2d,%dil
je     110f <getCharBIN+0xf>
cmp    $0x4e,%dil
jne    1112 <getCharBIN+0x12>
mov    $0x4e,%al
ret
mov    %edi,%eax
ret
mov    $0x30,%al
cmp    %sil,%dil
je     1129 <getCharBIN+0x29>
cmp    %dl,%dil
mov    $0x31,%ecx
mov    $0x58,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @getCharBIN(i8 signext %0, i8 signext %1, i8 signext %2) {
switch i8 %0, label %5 [
i8 45, label %10
i8 78, label %4
]
4: ; preds = %3
br label %10
5: ; preds = %3
%6 = icmp eq i8 %0, %1
br i1 %6, label %10, label %7
7: ; preds = %5
%8 = icmp eq i8 %0, %2
%9 = select i1 %8, i8 49, i8 88
br label %10
10: ; preds = %7, %5, %3, %4
%11 = phi i8 [ 78, %4 ], [ %0, %3 ], [ 48, %5 ], [ %9, %7 ]
ret i8 %11
}
int scan_str(const char **str, const char *target) {
  while (*target)
    if (**str == *target)
      ++*str, ++target;
    else
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<scan_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1162 <scan_str+0x62>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1151 <scan_str+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115d <scan_str+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1169 <scan_str+0x69>
jmp    110c <scan_str+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_str>:
mov    (%rsi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1137 <scan_str+0x37>
mov    (%rdi),%rdx
add    $0x1,%rdx
add    $0x1,%rsi
cs nopw 0x0(%rax,%rax,1)
cmp    %cl,-0x1(%rdx)
jne    1138 <scan_str+0x38>
mov    %rdx,(%rdi)
movzbl (%rsi),%ecx
add    $0x1,%rdx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <scan_str+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @scan_str(i8** nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = load i8*, i8** %0
br label %7
7: ; preds = %5, %13
%8 = phi i8* [ %14, %13 ], [ %6, %5 ]
%9 = phi i8 [ %16, %13 ], [ %3, %5 ]
%10 = phi i8* [ %15, %13 ], [ %1, %5 ]
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, %9
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %14, i8** %0
%15 = getelementptr inbounds i8, i8* %10, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %13, %2
%19 = phi i32 [ 1, %2 ], [ 1, %13 ], [ 0, %7 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int mkfifo(char *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int res = mkfifo("/tmp/my_fifo", 0777);
  if (res == 0)
    printf("FIFO created\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x1ff,%esi
call   1040 <mkfifo@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1169 <main+0x39>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
mov    $0x1ff,%esi
call   1040 <mkfifo@plt>
test   %eax,%eax
jne    1152 <main+0x22>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"/tmp/my_fifo\00"
@.str.1 = [14 x i8] c"FIFO created\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @mkfifo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 511)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = load i32, i32* @EXIT_SUCCESS
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@.str = [13 x i8] c"/tmp/my_fifo\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"FIFO created\00"
define i32 @main() {
%1 = tail call i32 @mkfifo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 511)
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = load i32, i32* @EXIT_SUCCESS
%7 = tail call i32 @exit(i32 %6)
unreachable
}
/* Type definitions */
struct sCC1101PhyInfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CC1101Write(struct sCC1101PhyInfo *, int, unsigned char *,
                               unsigned char);
void CC1101WriteTxFifo(struct sCC1101PhyInfo *phyInfo, unsigned char *buffer,
                       unsigned char count) {
  CC1101Write(phyInfo, 0x3Fu, buffer, count);
}


x86 assembly (clang, -O0):
<CC1101WriteTxFifo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x3f,%esi
movzbl -0x11(%rbp),%ecx
call   1030 <CC1101Write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CC1101WriteTxFifo>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    $0x3f,%esi
jmp    1030 <CC1101Write@plt>

LLVM IR (-O0):
%struct.sCC1101PhyInfo = type { i32 }
define void @CC1101WriteTxFifo(%struct.sCC1101PhyInfo* %0, i8* %1, i8 zeroext %2) {
%4 = alloca %struct.sCC1101PhyInfo*
%5 = alloca i8*
%6 = alloca i8
store %struct.sCC1101PhyInfo* %0, %struct.sCC1101PhyInfo** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load %struct.sCC1101PhyInfo*, %struct.sCC1101PhyInfo** %4
%8 = load i8*, i8** %5
%9 = load i8, i8* %6
%10 = call i32 @CC1101Write(%struct.sCC1101PhyInfo* %7, i32 63, i8* %8, i8 zeroext %9)
ret void
}

LLVM IR (-O2):
%struct.sCC1101PhyInfo = type { i32 }
define void @CC1101WriteTxFifo(%struct.sCC1101PhyInfo* %0, i8* %1, i8 zeroext %2) {
%4 = tail call i32 @CC1101Write(%struct.sCC1101PhyInfo* %0, i32 63, i8* %1, i8 zeroext %2)
ret void
}
/* Variables and functions */
size_t base64_encoded_length(size_t srclen) { return ((srclen + 2) / 3) * 4; }


x86 assembly (clang, -O0):
<base64_encoded_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
shl    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_encoded_length>:
lea    0x2(%rdi),%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
lea    (%rdx,%rdx,1),%rax
and    $0xfffffffffffffffc,%rax
ret

LLVM IR (-O0):
define i64 @base64_encoded_length(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 2
%5 = udiv i64 %4, 3
%6 = mul i64 %5, 4
ret i64 %6
}

LLVM IR (-O2):
define i64 @base64_encoded_length(i64 %0) {
%2 = add i64 %0, 2
%3 = udiv i64 %2, 3
%4 = shl i64 %3, 2
ret i64 %4
}
/* Variables and functions */
long SSLeay();
int main() {
  long ver;
  ver = SSLeay();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @SSLeay()
ret i32 0
}
gdec(lval) int lval[];
{
  if (lval[2] == (2 << 2))
    ol("subq.l\t&4,%d0");
  else
    ol("subq.l\t&1,%d0");
}


x86 assembly (clang, -O0):
<gdec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x8,0x8(%rax)
jne    113d <gdec+0x2d>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <ol@plt>
jmp    114b <gdec+0x3b>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdec>:
cmpl   $0x8,0x8(%rdi)
lea    0xee5(%rip),%rax
lea    0xeec(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"subq.l\09&4,%d0\00"
@.str.1 = [14 x i8] c"subq.l\09&1,%d0\00"
define i32 @gdec(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 2
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 8
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %1
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [14 x i8] c"subq.l\09&4,%d0\00"
@.str.1 = [14 x i8] c"subq.l\09&1,%d0\00"
define i32 @gdec(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 8
%5 = select i1 %4, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ol to i32 (i8*, ...)*)(i8* %5)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void b(void) { printf("baz b() called\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"baz b() called\0A\00"
define void @b() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"baz b() called\00"
define void @b() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
int check_balanced(int c, char begin_c, char end_c, int count) {
  if (c == begin_c) {
    count++;
  } else if (c == end_c) {
    count--;
  }
  if (count < 0) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<check_balanced>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %ecx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1132 <check_balanced+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <check_balanced+0x4f>
mov    -0x4(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    114a <check_balanced+0x4a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114f <check_balanced+0x4f>
cmpl   $0x0,-0xc(%rbp)
jge    1162 <check_balanced+0x62>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_balanced>:
cmp    %edi,%esi
jne    1109 <check_balanced+0x9>
add    $0x1,%ecx
jmp    1115 <check_balanced+0x15>
movsbl %dl,%eax
xor    %edx,%edx
cmp    %edi,%eax
sete   %dl
sub    %edx,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @check_balanced(i32 %0, i8 signext %1, i8 signext %2, i32 %3) {
%5 = sext i8 %1 to i32
%6 = icmp eq i32 %5, %0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %3, 1
br label %14
9: ; preds = %4
%10 = sext i8 %2 to i32
%11 = icmp eq i32 %10, %0
%12 = sext i1 %11 to i32
%13 = add nsw i32 %12, %3
br label %14
14: ; preds = %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ]
%16 = lshr i32 %15, 31
%17 = add nsw i32 %16, %15
ret i32 %17
}