xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ timeout(int);
void init_ncurses(void) {
  initscr();
  noecho();
  keypad(stdscr, TRUE);
  curs_set(0);
  timeout(50);
}


x86 assembly (clang, -O0):
<init_ncurses>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <initscr@plt>
mov    $0x0,%al
call   1060 <noecho@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
xor    %edi,%edi
call   1070 <curs_set@plt>
mov    $0x32,%edi
call   1050 <timeout@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_ncurses>:
push   %rax
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %eax,%eax
call   1060 <noecho@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    0x2e71(%rip),%rax
mov    (%rax),%esi
call   1030 <keypad@plt>
xor    %edi,%edi
call   1070 <curs_set@plt>
mov    $0x32,%edi
pop    %rax
jmp    1050 <timeout@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define void @init_ncurses() {
%1 = call i32 (...) @initscr()
%2 = call i32 (...) @noecho()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = call i32 @keypad(i32 %3, i32 %4)
%6 = call i32 @curs_set(i32 0)
%7 = call i32 @timeout(i32 50)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define void @init_ncurses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @noecho()
%3 = load i32, i32* @stdscr
%4 = load i32, i32* @TRUE
%5 = tail call i32 @keypad(i32 %3, i32 %4)
%6 = tail call i32 @curs_set(i32 0)
%7 = tail call i32 @timeout(i32 50)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Fibonacci(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int i;
  scanf("%d", &i);
  printf("%ld\n", Fibonacci(i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <Fibonacci@plt>
mov    %eax,%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <Fibonacci@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @Fibonacci(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
bool nrf91_errata_21(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf91_errata_21() {
ret i32 0
}
/* Variables and functions */
int shim_enosys(int /*<<< orphan*/, int, unsigned int, char const *,
                void const *, int);
int shim_fsconfig(int fd, unsigned int cmd, const char *key, const void *value,
                  int aux) {
  return shim_enosys(0, fd, cmd, key, value, aux);
}


x86 assembly (clang, -O0):
<shim_fsconfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
xor    %edi,%edi
call   1030 <shim_enosys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shim_fsconfig>:
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <shim_enosys@plt>

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

LLVM IR (-O2):
define i32 @shim_fsconfig(i32 %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = tail call i32 @shim_enosys(i32 0, i32 %0, i32 %1, i8* %2, i8* %3, i32 %4)
ret i32 %6
}
/* Variables and functions */
int socket(int, int, int);
int plt_sockOpen(int domain, int type, int protocol) {
  return socket(domain, type, protocol);
}


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

x86 assembly (clang, -O2):
<plt_sockOpen>:
jmp    1030 <socket@plt>

LLVM IR (-O0):
define i32 @plt_sockOpen(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 = call i32 @socket(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @plt_sockOpen(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
char *skipchar(char *in, char c) {
  if (*in != c)
    panic("Syntax error!\n");
  return ++in;
}


x86 assembly (clang, -O0):
<skipchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1141 <skipchar+0x31>
lea    0xec4(%rip),%rdi
call   1030 <panic@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipchar>:
push   %rbx
mov    %rdi,%rbx
cmp    %sil,(%rdi)
je     1125 <skipchar+0x15>
lea    0xee0(%rip),%rdi
call   1030 <panic@plt>
add    $0x1,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Syntax error!\0A\00"
define i8* @skipchar(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [15 x i8] c"Syntax error!\0A\00"
define i8* @skipchar(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @panic(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ rt_kprintf(char *);
void show_version(void) {
  rt_kprintf("Copyright (C) Memoright 2015\n");
  rt_kprintf("Hynix flash diagnostic tool, firmware version V1.0.0\n");
  rt_kprintf("\n");
}


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

x86 assembly (clang, -O2):
<show_version>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <rt_kprintf@plt>
lea    0xefa(%rip),%rdi
call   1030 <rt_kprintf@plt>
lea    0xf22(%rip),%rdi
pop    %rax
jmp    1030 <rt_kprintf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Copyright (C) Memoright 2015\0A\00"
@.str.1 = [54 x i8] c"Hynix flash diagnostic tool, firmware version V1.0.0\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @show_version() {
%1 = call i32 @rt_kprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @rt_kprintf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @rt_kprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Copyright (C) Memoright 2015\0A\00"
@.str.1 = [54 x i8] c"Hynix flash diagnostic tool, firmware version V1.0.0\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @show_version() {
%1 = tail call i32 @rt_kprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @rt_kprintf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @rt_kprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}
char hdigit(char ch) {
  static char d[] = "0123456789abcdef";
  return d[ch & 0xf];
}


x86 assembly (clang, -O0):
<hdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0x2f15(%rip),%rax
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdigit>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@hdigit.d = internal global [17 x i8] c"0123456789abcdef\00"
define signext i8 @hdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 15
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [17 x i8], [17 x i8]* @hdigit.d, i64 0, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
@hdigit.d = internal unnamed_addr constant [17 x i8] c"0123456789abcdef\00"
define signext i8 @hdigit(i8 signext %0) {
%2 = and i8 %0, 15
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @hdigit.d, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
int dxl_get_highbyte(int word) {
  unsigned short temp;
  temp = word & 0xff00;
  temp = temp >> 8;
  return (int)temp;
}


x86 assembly (clang, -O0):
<dxl_get_highbyte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
sar    $0x8,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dxl_get_highbyte>:
mov    %edi,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @dxl_get_highbyte(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 65280
%6 = trunc i32 %5 to i16
store i16 %6, i16* %3
%7 = load i16, i16* %3
%8 = zext i16 %7 to i32
%9 = ashr i32 %8, 8
%10 = trunc i32 %9 to i16
store i16 %10, i16* %3
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @dxl_get_highbyte(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
ret i32 %3
}
int test_imm_36uint16_mem(unsigned short *val) {
  return ((*val) & (-0x36 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_36uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffffca,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_36uint16_mem>:
movzwl (%rdi),%eax
test   $0xffca,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_36uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -54
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_36uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -54
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ mpf_t;

/* Variables and functions */
int /*<<< orphan*/ fp_exp(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ reduced_lngamma(int /*<<< orphan*/, int /*<<< orphan*/ const,
                                   int);
void reduced_gamma(mpf_t gam, const mpf_t ex, int prec) {
  reduced_lngamma(gam, ex, prec);
  fp_exp(gam, gam, prec);
}


x86 assembly (clang, -O0):
<reduced_gamma>:
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   1030 <reduced_lngamma@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <fp_exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reduced_gamma>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %edi,%ebp
call   1030 <reduced_lngamma@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fp_exp@plt>

LLVM IR (-O0):
define void @reduced_gamma(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 = call i32 @reduced_lngamma(i32 %7, i32 %8, i32 %9)
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = load i32, i32* %6
%14 = call i32 @fp_exp(i32 %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @reduced_gamma(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @reduced_lngamma(i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @fp_exp(i32 %0, i32 %0, i32 %2)
ret void
}
/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ realloc(int *, int /*<<< orphan*/);
void f6_realloc() {
  int *p = malloc(12);
  if (!p)
    return;
  else
    realloc(p, 0);
}


x86 assembly (clang, -O0):
<f6_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1146 <f6_realloc+0x26>
jmp    1151 <f6_realloc+0x31>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <realloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6_realloc>:
push   %rax
mov    $0xc,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     113b <f6_realloc+0x1b>
mov    %rax,%rdi
xor    %esi,%esi
pop    %rax
jmp    1040 <realloc@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @f6_realloc() {
%1 = tail call i32* @malloc(i32 12)
%2 = icmp eq i32* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @realloc(i32* %1, i32 0)
br label %5
5: ; preds = %0, %3
ret void
}
int DGifGetPrefixChar(unsigned int *Prefix, int Code, int ClearCode) {
  int i = 0;
  while (Code > ClearCode && i++ <= 4095)
    Code = Prefix[Code];
  return Code;
}


x86 assembly (clang, -O0):
<DGifGetPrefixChar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x15(%rbp)
jle    113c <DGifGetPrefixChar+0x3c>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0xfff,%eax
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114c <DGifGetPrefixChar+0x4c>
jmp    115f <DGifGetPrefixChar+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <DGifGetPrefixChar+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DGifGetPrefixChar>:
mov    %esi,%eax
cmp    %edx,%esi
jle    1126 <DGifGetPrefixChar+0x26>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cltq
mov    (%rdi,%rax,4),%eax
cmp    %edx,%eax
jle    1126 <DGifGetPrefixChar+0x26>
lea    0x1(%rcx),%esi
cmp    $0xfff,%ecx
mov    %esi,%ecx
jb     1110 <DGifGetPrefixChar+0x10>
ret

LLVM IR (-O0):
define i32 @DGifGetPrefixChar(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
store i32 0, i32* %7
br label %8
8: ; preds = %18, %3
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* %7
%14 = add nsw i32 %13, 1
store i32 %14, i32* %7
%15 = icmp sle i32 %13, 4095
br label %16
16: ; preds = %12, %8
%17 = phi i1 [ false, %8 ], [ %15, %12 ]
br i1 %17, label %18, label %24
18: ; preds = %16
%19 = load i32*, i32** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
%23 = load i32, i32* %22
store i32 %23, i32* %5
br label %8
24: ; preds = %16
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
define i32 @DGifGetPrefixChar(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
br i1 %4, label %5, label %15
5: ; preds = %3, %5
%6 = phi i32 [ %8, %5 ], [ 0, %3 ]
%7 = phi i32 [ %11, %5 ], [ %1, %3 ]
%8 = add nuw nsw i32 %6, 1
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, %2
%13 = icmp ult i32 %6, 4095
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %5, label %15
15: ; preds = %5, %3
%16 = phi i32 [ %1, %3 ], [ %11, %5 ]
ret i32 %16
}
int is_ordered(const int *v, int n) {
  for (int i = 0; i < n - 1; ++i) {
    if (v[i] > v[i + 1])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_ordered>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1163 <is_ordered+0x63>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1150 <is_ordered+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_ordered+0x6a>
jmp    1155 <is_ordered+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <is_ordered+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ordered>:
add    $0xffffffff,%esi
xor    %edx,%edx
test   %esi,%esi
mov    $0x0,%r8d
cmovg  %esi,%r8d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdx,%rcx
cmp    %rdx,%r8
je     1135 <is_ordered+0x35>
mov    (%rdi,%rcx,4),%eax
lea    0x1(%rcx),%rdx
cmp    0x4(%rdi,%rcx,4),%eax
jle    1120 <is_ordered+0x20>
movslq %esi,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
setge  %al
ret

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

LLVM IR (-O2):
define i32 @is_ordered(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %2
%7 = phi i64 [ %12, %9 ], [ 0, %2 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %0, i64 %7
%11 = load i32, i32* %10
%12 = add nuw nsw i64 %7, 1
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp sgt i32 %11, %14
br i1 %15, label %16, label %6
16: ; preds = %9, %6
%17 = sext i32 %3 to i64
%18 = icmp sge i64 %7, %17
%19 = zext i1 %18 to i32
ret i32 %19
}
void bmp280_get_ut(void) {}


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

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

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

LLVM IR (-O2):
define void @bmp280_get_ut() {
ret void
}
int os_getenv(const char *name, char **rc) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @os_getenv(i8* nocapture readnone %0, i8** nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int machdep_sys_getdents(int, char *, int);
int machdep_sys_getdirentries(int fd, char *buf, int len, int *seek) {
  return (machdep_sys_getdents(fd, buf, len));
}


x86 assembly (clang, -O0):
<machdep_sys_getdirentries>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <machdep_sys_getdents@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machdep_sys_getdirentries>:
jmp    1030 <machdep_sys_getdents@plt>

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

LLVM IR (-O2):
define i32 @machdep_sys_getdirentries(i32 %0, i8* %1, i32 %2, i32* nocapture readnone %3) {
%5 = tail call i32 @machdep_sys_getdents(i32 %0, i8* %1, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("\nUsage: npag_rec [interface address] [-options]\n"
         "       npag_rec host [-options]\n\n"
         "interface address: address to bind\n"
         "Options:\n"
         "\t -u    receive UDP packets\n"
         "\t -t    receive TCP packets\n"
         "\t -p##  portnumber to listen at\n\n");
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [215 x i8] c"\0AUsage: npag_rec [interface address] [-options]\0A npag_rec host [-options]\0A\0Ainterface address: address to bind\0AOptions:\0A\09 -u receive UDP packets\0A\09 -t receive TCP packets\0A\09 -p## portnumber to listen at\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([215 x i8], [215 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [214 x i8] c"\0AUsage: npag_rec [interface address] [-options]\0A npag_rec host [-options]\0A\0Ainterface address: address to bind\0AOptions:\0A\09 -u receive UDP packets\0A\09 -t receive TCP packets\0A\09 -p## portnumber to listen at\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([214 x i8], [214 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ valid_number_character(char const);
int strtod_buffer_size(const char *s) {
  const char *p = s;
  while (valid_number_character(*p))
    p++;
  return p - s;
}


x86 assembly (clang, -O0):
<strtod_buffer_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <valid_number_character@plt>
cmp    $0x0,%rax
je     114b <strtod_buffer_size+0x3b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <strtod_buffer_size+0x14>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtod_buffer_size>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xffffffff,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
call   1030 <valid_number_character@plt>
add    $0x1,%rbx
add    $0x1,%ebp
test   %rax,%rax
jne    1120 <strtod_buffer_size+0x10>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @strtod_buffer_size(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @valid_number_character(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = ptrtoint i8* %3 to i64
%10 = ptrtoint i8* %0 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ get_stack_leave_ops();
int /*<<< orphan*/ get_stack_leave_ops_len();
int /*<<< orphan*/ write_bytes(char *, unsigned char *, unsigned int,
                               unsigned int *, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void output_stack_leave(unsigned char *buf, unsigned int buf_size,
                        unsigned int *bytes_written) {
  write_bytes("stack leave", buf, buf_size, bytes_written,
              get_stack_leave_ops(), get_stack_leave_ops_len());
}


x86 assembly (clang, -O0):
<output_stack_leave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1030 <get_stack_leave_ops@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <get_stack_leave_ops_len@plt>
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    %eax,%r9d
lea    0xe7d(%rip),%rdi
call   1050 <write_bytes@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_stack_leave>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <get_stack_leave_ops@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <get_stack_leave_ops_len@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <write_bytes@plt>

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

LLVM IR (-O2):
@.str = [12 x i8] c"stack leave\00"
define void @output_stack_leave(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 (...) @get_stack_leave_ops()
%5 = tail call i32 (...) @get_stack_leave_ops_len()
%6 = tail call i32 @write_bytes(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32* %2, i32 %4, i32 %5)
ret void
}
int sub_it(int suc, int value) { return suc - value; }


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

x86 assembly (clang, -O2):
<sub_it>:
mov    %edi,%eax
sub    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @sub_it(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int this_is_a_number;
  printf("Please enter a number: ");
  scanf("%d", &this_is_a_number);
  printf("You entered %d", this_is_a_number);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Please enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"You entered %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Please enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"You entered %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int getpgid(int);
int getpgrp();
int getpid();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("PID of the process is : %d\n", getpid());
  printf("Group PID of the process is : %d\n", getpgrp());
  printf("Group leader PID is : %d\n", getpgid(getpid()));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getpgrp@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
call   1060 <getpgid@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getpgrp@plt>
lea    0xe9c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
call   1060 <getpgid@plt>
lea    0xea2(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"PID of the process is : %d\0A\00"
@.str.1 = [34 x i8] c"Group PID of the process is : %d\0A\00"
@.str.2 = [26 x i8] c"Group leader PID is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getpid()
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 (...) @getpgrp()
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getpid()
%7 = call i32 @getpgid(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"PID of the process is : %d\0A\00"
@.str.1 = [34 x i8] c"Group PID of the process is : %d\0A\00"
@.str.2 = [26 x i8] c"Group leader PID is : %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @getpgrp()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @getpgid(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
int is_mnemonic(char *s) {
  while (*s)
    if (*s++ == '_')
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_mnemonic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1141 <is_mnemonic+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x5f,%eax
jne    113c <is_mnemonic+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1148 <is_mnemonic+0x48>
jmp    1108 <is_mnemonic+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_mnemonic>:
movzbl (%rdi),%eax
test   %al,%al
je     1115 <is_mnemonic+0x15>
add    $0x1,%rdi
cmp    $0x5f,%al
jne    1100 <is_mnemonic>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_mnemonic(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %15, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 95
br i1 %13, label %14, label %15
14: ; preds = %8
store i32 1, i32* %2
br label %17
15: ; preds = %8
br label %4
16: ; preds = %4
store i32 0, i32* %2
br label %17
17: ; preds = %16, %14
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_mnemonic(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = icmp eq i8 %4, 95
br i1 %8, label %9, label %2
9: ; preds = %2, %6
%10 = phi i32 [ 1, %6 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int setbit(int);
void main() {
  int i = 16;
  printf("Set bit position in %d is %d", i, setbit(i));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x10,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <setbit@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x10,%edi
call   1040 <setbit@plt>
lea    0xece(%rip),%rdi
mov    $0x10,%esi
mov    %eax,%edx
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Set bit position in %d is %d\00"
define void @main() {
%1 = alloca i32
store i32 16, i32* %1
%2 = load i32, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @setbit(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Set bit position in %d is %d\00"
define void @main() {
%1 = tail call i32 @setbit(i32 16)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 16, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ rand();
void random_vector_float(float *a, const unsigned int n) {
  for (unsigned int i = 0; i < n; i++) {
    a[i] = (float)rand();
  }
}


x86 assembly (clang, -O0):
<random_vector_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1158 <random_vector_float+0x48>
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <random_vector_float+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_vector_float>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     114e <random_vector_float+0x3e>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
movss  %xmm0,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <random_vector_float+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @random_vector_float(float* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = tail call i64 (...) @rand()
%10 = sitofp i64 %9 to float
%11 = getelementptr inbounds float, float* %0, i64 %8
store float %10, float* %11
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
int calc_divisor(unsigned int baud) { return ((48000000) / 16 / baud); }


x86 assembly (clang, -O0):
<calc_divisor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x2dc6c0,%eax
xor    %edx,%edx
divl   -0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_divisor>:
mov    $0x2dc6c0,%eax
xor    %edx,%edx
div    %edi
ret

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

LLVM IR (-O2):
define i32 @calc_divisor(i32 %0) {
%2 = udiv i32 3000000, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ bingham_init();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
double get_time_ms();
int /*<<< orphan*/ stderr;
void test_bingham_init() {
  double t0 = get_time_ms();
  bingham_init();
  double t1 = get_time_ms();
  fprintf(stderr, "Initialized bingham library in %.0f ms\n", t1 - t0);
}


x86 assembly (clang, -O0):
<test_bingham_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_time_ms@plt>
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <bingham_init@plt>
mov    $0x0,%al
call   1030 <get_time_ms@plt>
movsd  %xmm0,-0x10(%rbp)
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bingham_init>:
push   %rax
xor    %eax,%eax
call   1030 <get_time_ms@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1050 <bingham_init@plt>
xor    %eax,%eax
call   1030 <get_time_ms@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
subsd  (%rsp),%xmm0
lea    0xea0(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Initialized bingham library in %.0f ms\0A\00"
define void @test_bingham_init() {
%1 = alloca double
%2 = alloca double
%3 = call double (...) @get_time_ms()
store double %3, double* %1
%4 = call i32 (...) @bingham_init()
%5 = call double (...) @get_time_ms()
store double %5, double* %2
%6 = load i32, i32* @stderr
%7 = load double, double* %2
%8 = load double, double* %1
%9 = fsub double %7, %8
%10 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), double %9)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Initialized bingham library in %.0f ms\0A\00"
define void @test_bingham_init() {
%1 = tail call double (...) @get_time_ms()
%2 = tail call i32 (...) @bingham_init()
%3 = tail call double (...) @get_time_ms()
%4 = load i32, i32* @stderr
%5 = fsub double %3, %1
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), double %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ test_ffs();
int /*<<< orphan*/ test_strcasecmp();
int /*<<< orphan*/ test_strncasecmp();
void run_strings_tests() {
  printf("\nRunning Test Case: %s\n", "Test POSIX strings.h functions");
  ;
  test_ffs();
  test_strcasecmp();
  test_strncasecmp();
}


x86 assembly (clang, -O0):
<run_strings_tests>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <test_ffs@plt>
mov    $0x0,%al
call   1040 <test_strcasecmp@plt>
mov    $0x0,%al
call   1050 <test_strncasecmp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_strings_tests>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1060 <test_ffs@plt>
xor    %eax,%eax
call   1040 <test_strcasecmp@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <test_strncasecmp@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [31 x i8] c"Test POSIX strings.h functions\00"
define void @run_strings_tests() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (...) @test_ffs()
%3 = call i32 (...) @test_strcasecmp()
%4 = call i32 (...) @test_strncasecmp()
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [31 x i8] c"Test POSIX strings.h functions\00"
define void @run_strings_tests() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @test_ffs()
%3 = tail call i32 (...) @test_strcasecmp()
%4 = tail call i32 (...) @test_strncasecmp()
ret void
}
/* Variables and functions */
char *cha_malloc_char(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *cha_strdup(char *str) {
  char *newstr;
  newstr = cha_malloc_char(strlen(str) + 1);
  strcpy(newstr, str);
  return newstr;
}


x86 assembly (clang, -O0):
<cha_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1040 <cha_malloc_char@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cha_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1040 <cha_malloc_char@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @cha_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @cha_malloc_char(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @cha_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @cha_malloc_char(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}