xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ check_tv1();
int /*<<< orphan*/ check_tv2();
int /*<<< orphan*/ check_tv3();
int /*<<< orphan*/ check_tv4();
void check_tv() {
  check_tv1();
  check_tv2();
  check_tv3();
  check_tv4();
}


x86 assembly (clang, -O0):
<check_tv>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <check_tv1@plt>
mov    $0x0,%al
call   1030 <check_tv2@plt>
mov    $0x0,%al
call   1050 <check_tv3@plt>
mov    $0x0,%al
call   1040 <check_tv4@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_tv>:
push   %rax
xor    %eax,%eax
call   1060 <check_tv1@plt>
xor    %eax,%eax
call   1030 <check_tv2@plt>
xor    %eax,%eax
call   1050 <check_tv3@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <check_tv4@plt>

LLVM IR (-O0):
define void @check_tv() {
%1 = call i32 (...) @check_tv1()
%2 = call i32 (...) @check_tv2()
%3 = call i32 (...) @check_tv3()
%4 = call i32 (...) @check_tv4()
ret void
}

LLVM IR (-O2):
define void @check_tv() {
%1 = tail call i32 (...) @check_tv1()
%2 = tail call i32 (...) @check_tv2()
%3 = tail call i32 (...) @check_tv3()
%4 = tail call i32 (...) @check_tv4()
ret void
}
int ShrTest10(int Y, int X, unsigned C) { return (Y & (X >> C)) << C; }


x86 assembly (clang, -O0):
<ShrTest10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShrTest10>:
mov    %edx,%ecx
mov    %esi,%eax
sar    %cl,%eax
and    %edi,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ShrTest10(i32 %0, i32 %1, i32 %2) {
%4 = ashr i32 %1, %2
%5 = and i32 %4, %0
%6 = shl i32 %5, %2
ret i32 %6
}
extern void freeXcmdResources(void) {}


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

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

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

LLVM IR (-O2):
define void @freeXcmdResources() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pnp_write_config(unsigned char, unsigned int, int);
void pnp_set_iobase1(unsigned char port, unsigned iobase) {
  pnp_write_config(port, (iobase >> 8) & 0xff, 0x62);
  pnp_write_config(port, iobase & 0xff, 0x63);
}


x86 assembly (clang, -O0):
<pnp_set_iobase1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%esi
shr    $0x8,%esi
and    $0xff,%esi
mov    $0x62,%edx
movzbl %al,%edi
call   1030 <pnp_write_config@plt>
mov    -0x1(%rbp),%al
mov    -0x8(%rbp),%esi
and    $0xff,%esi
mov    $0x63,%edx
movzbl %al,%edi
call   1030 <pnp_write_config@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnp_set_iobase1>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
movzbl %bh,%esi
mov    $0x62,%edx
call   1030 <pnp_write_config@plt>
movzbl %bl,%esi
mov    %ebp,%edi
mov    $0x63,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <pnp_write_config@plt>

LLVM IR (-O0):
define void @pnp_set_iobase1(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = load i32, i32* %4
%7 = lshr i32 %6, 8
%8 = and i32 %7, 255
%9 = call i32 @pnp_write_config(i8 zeroext %5, i32 %8, i32 98)
%10 = load i8, i8* %3
%11 = load i32, i32* %4
%12 = and i32 %11, 255
%13 = call i32 @pnp_write_config(i8 zeroext %10, i32 %12, i32 99)
ret void
}

LLVM IR (-O2):
define void @pnp_set_iobase1(i8 zeroext %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = and i32 %3, 255
%5 = tail call i32 @pnp_write_config(i8 zeroext %0, i32 %4, i32 98)
%6 = and i32 %1, 255
%7 = tail call i32 @pnp_write_config(i8 zeroext %0, i32 %6, i32 99)
ret void
}
/* Variables and functions */
char *get_input_edit(char *, int /*<<< orphan*/ *);
char *get_input(char *prompt) { return get_input_edit(prompt, NULL); }


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

x86 assembly (clang, -O2):
<get_input>:
xor    %esi,%esi
jmp    1030 <get_input_edit@plt>

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

LLVM IR (-O2):
define i8* @get_input(i8* %0) {
%2 = tail call i8* @get_input_edit(i8* %0, i32* null)
ret i8* %2
}
void ppc_dummy_func(void) {}


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

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

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

LLVM IR (-O2):
define void @ppc_dummy_func() {
ret void
}
void IrqHandlerNotUsed(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<IrqHandlerNotUsed>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <IrqHandlerNotUsed+0x9>
jmp    1109 <IrqHandlerNotUsed+0x9>

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

LLVM IR (-O0):
define void @IrqHandlerNotUsed() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @IrqHandlerNotUsed() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
void *new (void *frontier, size_t size) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @new(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @new(i8* nocapture readnone %0, i64 %1) {
ret i8* null
}
void ble_evt_system_debug(const struct ble_msg_system_debug_evt_t *msg) {}


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

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

LLVM IR (-O0):
%struct.ble_msg_system_debug_evt_t = type opaque
define void @ble_evt_system_debug(%struct.ble_msg_system_debug_evt_t* %0) {
%2 = alloca %struct.ble_msg_system_debug_evt_t*
store %struct.ble_msg_system_debug_evt_t* %0, %struct.ble_msg_system_debug_evt_t** %2
ret void
}

LLVM IR (-O2):
%struct.ble_msg_system_debug_evt_t = type opaque
define void @ble_evt_system_debug(%struct.ble_msg_system_debug_evt_t* nocapture %0) {
ret void
}
void process_row_data(int i) {}


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

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

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

LLVM IR (-O2):
define void @process_row_data(i32 %0) {
ret void
}
int min(int *a, int *b, int **w) {
  if (*a < *b) {
    *w = a;
  } else {
    *w = b;
  }
}


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1132 <min+0x32>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    113d <min+0x3d>
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    (%rdi),%eax
cmp    (%rsi),%eax
cmovl  %rdi,%rsi
mov    %rsi,(%rdx)
ret

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

LLVM IR (-O2):
define i32 @min(i32* %0, i32* %1, i32** nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %4, %5
%7 = select i1 %6, i32* %0, i32* %1
store i32* %7, i32** %2
ret i32 undef
}
int main() {
  int i = 0;
  int j = 123;
  float b = 2.2;
  double h = j + b;
  double x = 125.2 - h;
  if (x > 0.0) {
    goto Error;
  }
  return 0;
Error:
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x7b,-0xc(%rbp)
movss  0xee7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
addss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xebf(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1162 <main+0x62>
jmp    116e <main+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    1175 <main+0x75>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 123, i32* %3
store float 0x40019999A0000000, float* %4
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = load float, float* %4
%10 = fadd float %8, %9
%11 = fpext float %10 to double
store double %11, double* %5
%12 = load double, double* %5
%13 = fsub double 1.252000e+02, %12
store double %13, double* %6
%14 = load double, double* %6
%15 = fcmp ogt double %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %0
br label %18
17: ; preds = %0
store i32 0, i32* %1
br label %19
18: ; preds = %16
store i32 -1, i32* %1
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @main() {
ret i32 -1
}
/* Variables and functions */
scalar_t__ malloc(size_t);
void *xmalloc(size_t mem) {
  void *ptr;
  if ((int)mem) {
    ptr = (void *)malloc(mem);
    return ptr;
  } else {
    return (void *)NULL;
  }
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    $0x0,%eax
je     1143 <xmalloc+0x33>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114b <xmalloc+0x3b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
test   %edi,%edi
je     111f <xmalloc+0xf>
push   %rax
call   1030 <malloc@plt>
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @xmalloc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @malloc(i64 %0)
%6 = inttoptr i64 %5 to i8*
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %8
}
int condition_parenOpen(char c) { return c == '('; }


x86 assembly (clang, -O0):
<condition_parenOpen>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x28,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<condition_parenOpen>:
xor    %eax,%eax
cmp    $0x28,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @condition_parenOpen(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 40
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @condition_parenOpen(i8 signext %0) {
%2 = icmp eq i8 %0, 40
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int set_standard_state_to_verbose(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(630, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<set_standard_state_to_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x276,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_standard_state_to_verbose>:
mov    $0x276,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @set_standard_state_to_verbose() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 630, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @set_standard_state_to_verbose() {
%1 = tail call i32 @_ada_use_c2phc(i32 630, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getpgrp();
void test(void) {
  pid_t pgrp;
  pgrp = getpgrp();
}


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

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

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = call i32 (...) @getpgrp()
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 (...) @getpgrp()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int sesc_fork_successor(void) {
  fprintf(stderr,
          "Versioning simulator is needed to execute sesc_fork_successor\n");
  return 0;
}


x86 assembly (clang, -O0):
<sesc_fork_successor>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sesc_fork_successor>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"Versioning simulator is needed to execute sesc_fork_successor\0A\00"
define i32 @sesc_fork_successor() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"Versioning simulator is needed to execute sesc_fork_successor\0A\00"
define i32 @sesc_fork_successor() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void frobulate(unsigned int v) {
  const char *s;
  switch (v) {
  case 0:
    s = "foo";
    break;
  case 1:
    s = "bar";
    break;
  case 2:
    s = "spam";
    break;
  default:
    __builtin_abort();
    break;
  }
  __builtin_printf("%s\n", s);
}


x86 assembly (clang, -O0):
<frobulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1160 <frobulate+0x40>
jmp    113e <frobulate+0x1e>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1170 <frobulate+0x50>
jmp    114f <frobulate+0x2f>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1180 <frobulate+0x60>
jmp    1190 <frobulate+0x70>
lea    0xe99(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1195 <frobulate+0x75>
lea    0xe8d(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1195 <frobulate+0x75>
lea    0xe81(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1195 <frobulate+0x75>
call   1030 <abort@plt>
mov    -0x10(%rbp),%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frobulate>:
push   %rax
cmp    $0x3,%edi
jae    113d <frobulate+0x1d>
movslq %edi,%rax
lea    0xee0(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
pop    %rax
jmp    1040 <puts@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [5 x i8] c"spam\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @frobulate(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
6: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %9
8: ; preds = %1
unreachable
9: ; preds = %7, %6, %5
%10 = load i8*, i8** %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
@.str.1 = [4 x i8] c"bar\00"
@.str.2 = [5 x i8] c"spam\00"
@reltable.frobulate = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.frobulate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.frobulate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.frobulate to i64)) to i32)]
define void @frobulate(i32 %0) {
%2 = icmp ult i32 %0, 3
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
%5 = sext i32 %0 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.frobulate to i8*), i64 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret void
}
long extract_rbs(unsigned long insn, int dialect __attribute__((unused)),
                 int *invalid) {
  if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
    *invalid = 1;
  return 0;
}


x86 assembly (clang, -O0):
<extract_rbs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x15,%rax
and    $0x1f,%rax
mov    -0x8(%rbp),%rcx
shr    $0xb,%rcx
and    $0x1f,%rcx
cmp    %rcx,%rax
je     113a <extract_rbs+0x3a>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_rbs>:
mov    %edi,%eax
shr    $0xb,%eax
shr    $0x15,%edi
xor    %eax,%edi
test   $0x1f,%dil
je     1116 <extract_rbs+0x16>
movl   $0x1,(%rdx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @extract_rbs(i64 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = lshr i64 %0, 21
%5 = lshr i64 %0, 11
%6 = xor i64 %4, %5
%7 = and i64 %6, 31
%8 = icmp eq i64 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %3
store i32 1, i32* %2
br label %10
10: ; preds = %9, %3
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse_string_bitwise(char *);
int main(int argc, char **argv) {
  char input[] = "the sky is blue";
  printf("[before] input : %s\n", input);
  reverse_string_bitwise(input);
  printf("[after]  input : %s\n", input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <reverse_string_bitwise@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xed9(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <reverse_string_bitwise@plt>
lea    0xed4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.input = [16 x i8] c"the sky is blue\00"
@.str = [21 x i8] c"[before] input : %s\0A\00"
@.str.1 = [21 x i8] c"[after] input : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [16 x i8]* %6 to i8*
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%11 = call i32 @reverse_string_bitwise(i8* %10)
%12 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.input = [16 x i8] c"the sky is blue\00"
@.str = [21 x i8] c"[before] input : %s\0A\00"
@.str.1 = [21 x i8] c"[after] input : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @reverse_string_bitwise(i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
}
int fun794() { return 794; }


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

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

LLVM IR (-O0):
define i32 @fun794() {
ret i32 794
}

LLVM IR (-O2):
define i32 @fun794() {
ret i32 794
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ log_entry(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void vlog_error(char *format, va_list ap) { log_entry(stderr, format, ap); }


x86 assembly (clang, -O0):
<vlog_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <log_entry@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlog_error>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <log_entry@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
define void @vlog_error(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @log_entry(i32 %3, i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ SwapWord(char *, int);
unsigned long big2littleul(unsigned long num) {
  SwapWord((char *)&num, sizeof(num));
  return num;
}


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

x86 assembly (clang, -O2):
<big2littleul>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
mov    $0x8,%esi
call   1030 <SwapWord@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @big2littleul(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = bitcast i64* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @big2littleul(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = bitcast i64* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}
int t(int i) {
  int j;
  if (i == 0)
    j = 1;
  else
    j = 0;
  return j;
}


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    111d <t+0x1d>
movl   $0x1,-0x8(%rbp)
jmp    1124 <t+0x24>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @t(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %3
br label %8
7: ; preds = %1
store i32 0, i32* %3
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @t(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int fdt_check_prop_offset_(void const *, int);
int nextprop_(void const *, int);
int fdt_next_property_offset(const void *fdt, int offset) {
  if ((offset = fdt_check_prop_offset_(fdt, offset)) < 0)
    return offset;
  return nextprop_(fdt, offset);
}


x86 assembly (clang, -O0):
<fdt_next_property_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <fdt_check_prop_offset_@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1152 <fdt_next_property_offset+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <fdt_next_property_offset+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <nextprop_@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdt_next_property_offset>:
push   %rbx
mov    %rdi,%rbx
call   1030 <fdt_check_prop_offset_@plt>
test   %eax,%eax
js     1138 <fdt_next_property_offset+0x18>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <nextprop_@plt>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fdt_next_property_offset(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = load i32, i32* %5
%8 = call i32 @fdt_check_prop_offset_(i8* %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 = load i32, i32* %5
store i32 %11, i32* %3
br label %16
12: ; preds = %2
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = call i32 @nextprop_(i8* %13, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %10
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @fdt_next_property_offset(i8* %0, i32 %1) {
%3 = tail call i32 @fdt_check_prop_offset_(i8* %0, i32 %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @nextprop_(i8* %0, i32 %3)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}
int array1_main(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @array1_main() {
ret i32 0
}

LLVM IR (-O2):
define i32 @array1_main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ L_add(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ L_mac(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ extract_h(int /*<<< orphan*/);
int16_t mac_r(int32_t L_var3, int16_t var1, int16_t var2) {
  int16_t var_out;
  L_var3 = L_mac(L_var3, var1, var2);
  L_var3 = L_add(L_var3, (int32_t)0x00008000);
  var_out = extract_h(L_var3);
  return (var_out);
}


x86 assembly (clang, -O0):
<mac_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <L_mac@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8000,%esi
call   1050 <L_add@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <extract_h@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mac_r>:
push   %rax
call   1040 <L_mac@plt>
mov    %eax,%edi
mov    $0x8000,%esi
call   1050 <L_add@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <extract_h@plt>

LLVM IR (-O0):
define i32 @mac_r(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @L_mac(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = call i32 @L_add(i32 %12, i32 32768)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = call i32 @extract_h(i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @mac_r(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @L_mac(i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @L_add(i32 %4, i32 32768)
%6 = tail call i32 @extract_h(i32 %5)
ret i32 %6
}
int Operand_immrx4_encode(unsigned int *valp) {
  unsigned r_0, immrx4_0;
  immrx4_0 = *valp;
  r_0 = ((immrx4_0 >> 2) & 0xf);
  *valp = r_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_immrx4_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x2,%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_immrx4_encode>:
mov    (%rdi),%eax
shr    $0x2,%eax
and    $0xf,%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_immrx4_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = lshr i32 %7, 2
%9 = and i32 %8, 15
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
store i32 %10, i32* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_immrx4_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 2
%4 = and i32 %3, 15
store i32 %4, i32* %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strerror(int);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
char *strerror_r(int n, char *buf, int len) {
  strncpy(buf, strerror(n), len);
  buf[len - 1] = 0;
  return buf;
}


x86 assembly (clang, -O0):
<strerror_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <strerror@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror_r>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <strerror@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @strerror_r(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 i8*, i8** %5
%8 = load i32, i32* %4
%9 = call i32 @strerror(i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @strncpy(i8* %7, i32 %9, i32 %10)
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %12, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @strerror_r(i32 %0, i8* returned %1, i32 %2) {
%4 = tail call i32 @strerror(i32 %0)
%5 = tail call i32 @strncpy(i8* %1, i32 %4, i32 %2)
%6 = add nsw i32 %2, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 0, i8* %8
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ unimplemented();
void ldii_dir(void) { unimplemented(); }


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

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

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

LLVM IR (-O2):
define void @ldii_dir() {
%1 = tail call i32 (...) @unimplemented()
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int nchars;
};
typedef TYPE_1__ XTextItem16;

/* Variables and functions */
void set_XTextItem16_nchars(void *_p, int _v) {
  ((XTextItem16 *)_p)->nchars = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XTextItem16_nchars>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XTextItem16_nchars(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XTextItem16_nchars(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void null_deref_bad() {
  int *p = 0;
  *p = 42;
}


x86 assembly (clang, -O0):
<null_deref_bad>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @null_deref_bad() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
store i32 42, i32* %2
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int longestPalindromeSubseq(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "Usage: ./test s\n");
    exit(-1);
  }
  printf("%d\n", longestPalindromeSubseq(argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x3f>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <longestPalindromeSubseq@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1161 <main+0x21>
mov    0x8(%rsi),%rdi
call   1030 <longestPalindromeSubseq@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @longestPalindromeSubseq(i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Usage: ./test s\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @longestPalindromeSubseq(i8* %10)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
int HelpItem90(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @HelpItem90() {
ret i32 0
}

LLVM IR (-O2):
define i32 @HelpItem90() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
char *strdup(int /*<<< orphan*/);
int /*<<< orphan*/ strrev(char *);
int main(int argc, char *argv[]) {
  char *reverse, str[12];
  sprintf(str, "Test String");
  reverse = strdup(strrev(str));
  printf("'%s' '%s'\r\n", str, reverse);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x24(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x24(%rbp),%rdi
call   1040 <strrev@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,-0x18(%rbp)
lea    -0x24(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x7274532074736554,%rax
53 74 72
mov    %rax,(%rsp)
movl   $0x676e69,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strrev@plt>
mov    %eax,%edi
call   1050 <strdup@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Test String\00"
@.str.1 = [12 x i8] c"'%s' '%s'\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [12 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%11 = call i32 @strrev(i8* %10)
%12 = call i8* @strdup(i32 %11)
store i8* %12, i8** %6
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %6
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %13, i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Test String\00"
@.str.1 = [12 x i8] c"'%s' '%s'\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = call i32 @strrev(i8* %4)
%6 = call i8* @strdup(i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _funlockfile_stub(int /*<<< orphan*/ *);
void funlockfile(FILE *fp) { _funlockfile_stub(fp); }


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

x86 assembly (clang, -O2):
<funlockfile>:
jmp    1030 <_funlockfile_stub@plt>

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

LLVM IR (-O2):
define void @funlockfile(i32* %0) {
%2 = tail call i32 @_funlockfile_stub(i32* %0)
ret void
}
/* Variables and functions */
int format_number_sigsafe(unsigned long, char *, int, int);
int format_hex_number_sigsafe(unsigned long x, char *buf, int buf_len) {
  return format_number_sigsafe(x, buf, buf_len, 16);
}


x86 assembly (clang, -O0):
<format_hex_number_sigsafe>:
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    $0x10,%ecx
call   1030 <format_number_sigsafe@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_hex_number_sigsafe>:
mov    $0x10,%ecx
jmp    1030 <format_number_sigsafe@plt>

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

LLVM IR (-O2):
define i32 @format_hex_number_sigsafe(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @format_number_sigsafe(i64 %0, i8* %1, i32 %2, i32 16)
ret i32 %4
}
/* Type definitions */
struct _Locale_ctype {
  int dummy;
};

/* Variables and functions */
int toupper(int);
int _Locale_toupper(struct _Locale_ctype *lctype, int c) { return toupper(c); }


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

x86 assembly (clang, -O2):
<_Locale_toupper>:
mov    %esi,%edi
jmp    1030 <toupper@plt>

LLVM IR (-O0):
%struct._Locale_ctype = type { i32 }
define i32 @_Locale_toupper(%struct._Locale_ctype* %0, i32 %1) {
%3 = alloca %struct._Locale_ctype*
%4 = alloca i32
store %struct._Locale_ctype* %0, %struct._Locale_ctype** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @toupper(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct._Locale_ctype = type { i32 }
define i32 @_Locale_toupper(%struct._Locale_ctype* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @toupper(i32 %1)
ret i32 %3
}
/* Variables and functions */
float __nv_norm4df(float, float, float, float);
float norm4df(float __a, float __b, float __c, float __d) {
  return __nv_norm4df(__a, __b, __c, __d);
}


x86 assembly (clang, -O0):
<norm4df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1030 <__nv_norm4df@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm4df>:
jmp    1030 <__nv_norm4df@plt>

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

LLVM IR (-O2):
define float @norm4df(float %0, float %1, float %2, float %3) {
%5 = tail call float @__nv_norm4df(float %0, float %1, float %2, float %3)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ set_ir_angle(int, int);
void setSensors() {
  set_ir_angle(0, -45);
  set_ir_angle(1, -75);
}


x86 assembly (clang, -O0):
<setSensors>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0xffffffd3,%esi
call   1030 <set_ir_angle@plt>
mov    $0x1,%edi
mov    $0xffffffb5,%esi
call   1030 <set_ir_angle@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setSensors>:
push   %rax
xor    %edi,%edi
mov    $0xffffffd3,%esi
call   1030 <set_ir_angle@plt>
mov    $0x1,%edi
mov    $0xffffffb5,%esi
pop    %rax
jmp    1030 <set_ir_angle@plt>

LLVM IR (-O0):
define void @setSensors() {
%1 = call i32 @set_ir_angle(i32 0, i32 -45)
%2 = call i32 @set_ir_angle(i32 1, i32 -75)
ret void
}

LLVM IR (-O2):
define void @setSensors() {
%1 = tail call i32 @set_ir_angle(i32 0, i32 -45)
%2 = tail call i32 @set_ir_angle(i32 1, i32 -75)
ret void
}
int XPointInRegion() {}


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

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

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

LLVM IR (-O2):
define i32 @XPointInRegion() {
ret i32 undef
}
int isunderscore(int c) {
  if (c == '_') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isunderscore>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x5f,-0x8(%rbp)
jne    111d <isunderscore+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <isunderscore+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @isunderscore(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 95
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @isunderscore(i32 %0) {
%2 = icmp eq i32 %0, 95
%3 = zext i1 %2 to i32
ret i32 %3
}
int USB_otg_switch_get(unsigned char *pucValue) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @USB_otg_switch_get(i8* nocapture readnone %0) {
ret i32 0
}