xunge/DecIR huggingface dataset:
/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, double);
double format(double Value, int nPrecision) {
  char *buffer = malloc(128 * sizeof(char));
  snprintf(buffer, 127, "%0.*f", nPrecision, Value);
  double d = atof(buffer);
  free(buffer);
  return d;
}


x86 assembly (clang, -O0):
<format>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    $0x80,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%ecx
movsd  -0x8(%rbp),%xmm0
mov    $0x7f,%esi
lea    0xe8a(%rip),%rdx
call   1050 <snprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
movsd  %xmm0,(%rsp)
mov    $0x80,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rdx
mov    %rax,%rdi
mov    $0x7f,%esi
mov    %ebp,%ecx
movsd  (%rsp),%xmm0
call   1050 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <atof@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%0.*f\00"
define double @format(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%7 = call i8* @malloc(i32 128)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = load double, double* %3
%11 = call i32 @snprintf(i8* %8, i32 127, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9, double %10)
%12 = load i8*, i8** %5
%13 = call double @atof(i8* %12)
store double %13, double* %6
%14 = load i8*, i8** %5
%15 = call i32 @free(i8* %14)
%16 = load double, double* %6
ret double %16
}

LLVM IR (-O2):
@.str = [6 x i8] c"%0.*f\00"
define double @format(double %0, i32 %1) {
%3 = tail call dereferenceable_or_null(128) i8* @malloc(i32 128)
%4 = tail call i32 @snprintf(i8* %3, i32 127, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1, double %0)
%5 = tail call double @atof(i8* %3)
%6 = tail call i32 @free(i8* %3)
ret double %5
}
/* Type definitions */
typedef char *uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
__attribute__((always_)) uint8_t
bitw_bit_scan_reverse_64_bsr(uint64_t bit_sequence) {
  uint64_t result;
  __asm__ __volatile__("bsr %1, %0;" : "=r"(result) : "r"(bit_sequence));
  return (uint8_t)result;
}


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

x86 assembly (clang, -O2):
<bitw_bit_scan_reverse_64_bsr>:
bsr    %edi,%eax
cltq
ret

LLVM IR (-O0):
define i8* @bitw_bit_scan_reverse_64_bsr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 asm sideeffect "bsr $1, $0;", "=r,r,~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @bitw_bit_scan_reverse_64_bsr(i32 %0) {
%2 = tail call i32 asm sideeffect "bsr $1, $0;", "=r,r,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
scalar_t__ LONG_MIN;
int /*<<< orphan*/ foo(scalar_t__);
int main() {
  foo(LONG_MIN);
  foo(LONG_MIN + 10000);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ed0(%rip),%rbx
mov    (%rbx),%rdi
call   1030 <foo@plt>
mov    $0x2710,%edi
add    (%rbx),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@LONG_MIN = global i64 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i64, i64* @LONG_MIN
%3 = call i32 @foo(i64 %2)
%4 = load i64, i64* @LONG_MIN
%5 = add nsw i64 %4, 10000
%6 = call i32 @foo(i64 %5)
ret i32 0
}

LLVM IR (-O2):
@LONG_MIN = global i64 0
define i32 @main() {
%1 = load i64, i64* @LONG_MIN
%2 = tail call i32 @foo(i64 %1)
%3 = load i64, i64* @LONG_MIN
%4 = add nsw i64 %3, 10000
%5 = tail call i32 @foo(i64 %4)
ret i32 0
}
/* Type definitions */
struct fpga_bits {
  int dummy;
};

/* Variables and functions */
int frame_get_bit(scalar_t__, int);
scalar_t__ get_first_minor(struct fpga_bits *, int, int);
int get_bit(struct fpga_bits *bits, int row, int major, int minor, int bit_i) {
  return frame_get_bit(get_first_minor(bits, row, major) + minor * (65 * 2),
                       bit_i);
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <get_first_minor@plt>
mov    %rax,%rdi
imul   $0x82,-0x14(%rbp),%eax
cltq
add    %rax,%rdi
mov    -0x18(%rbp),%esi
call   1040 <frame_get_bit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %ecx,%ebx
call   1030 <get_first_minor@plt>
mov    %ebx,%ecx
shl    $0x7,%ecx
lea    (%rcx,%rbx,2),%ecx
movslq %ecx,%rdi
add    %rax,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <frame_get_bit@plt>

LLVM IR (-O0):
%struct.fpga_bits = type { i32 }
define i32 @get_bit(%struct.fpga_bits* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.fpga_bits*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.fpga_bits* %0, %struct.fpga_bits** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.fpga_bits*, %struct.fpga_bits** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i64 @get_first_minor(%struct.fpga_bits* %11, i32 %12, i32 %13)
%15 = load i32, i32* %9
%16 = mul nsw i32 %15, 130
%17 = sext i32 %16 to i64
%18 = add nsw i64 %14, %17
%19 = load i32, i32* %10
%20 = call i32 @frame_get_bit(i64 %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.fpga_bits = type { i32 }
define i32 @get_bit(%struct.fpga_bits* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i64 @get_first_minor(%struct.fpga_bits* %0, i32 %1, i32 %2)
%7 = mul nsw i32 %3, 130
%8 = sext i32 %7 to i64
%9 = add nsw i64 %6, %8
%10 = tail call i32 @frame_get_bit(i64 %9, i32 %4)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ kputc(unsigned char);
int _write(int fd, const void *buf, int count) {
  int written = 0;
  (void)fd;
  unsigned char *charbuf = (unsigned char *)buf;
  for (; count > 0; --count) {
    kputc(*charbuf);
    charbuf++;
    written++;
  }
  return written;
}


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    116a <_write+0x5a>
mov    -0x20(%rbp),%rax
movzbl (%rax),%edi
call   1030 <kputc@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <_write+0x21>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1144 <_write+0x34>
mov    %edx,%r14d
mov    %rsi,%r15
mov    %edx,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%r15,%rbx,1),%edi
call   1030 <kputc@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1130 <_write+0x20>
jmp    1147 <_write+0x37>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %7
%9 = load i32, i32* %4
%10 = load i8*, i8** %5
store i8* %10, i8** %8
br label %11
11: ; preds = %22, %3
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %11
%15 = load i8*, i8** %8
%16 = load i8, i8* %15
%17 = call i32 @kputc(i8 zeroext %16)
%18 = load i8*, i8** %8
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %8
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %22
22: ; preds = %14
%23 = load i32, i32* %6
%24 = add nsw i32 %23, -1
store i32 %24, i32* %6
br label %11
25: ; preds = %11
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
define i32 @_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %13
5: ; preds = %3, %5
%6 = phi i8* [ %10, %5 ], [ %1, %3 ]
%7 = phi i32 [ %11, %5 ], [ 0, %3 ]
%8 = load i8, i8* %6
%9 = tail call i32 @kputc(i8 zeroext %8)
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add nuw nsw i32 %7, 1
%12 = icmp eq i32 %11, %2
br i1 %12, label %13, label %5
13: ; preds = %5, %3
%14 = phi i32 [ 0, %3 ], [ %2, %5 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void usage() {
  fputs("Usage: mkdir [OPTION(S)] [DIRECTORY(IES)]\n\n"
        "OPTIONS:\n"
        "  -v, --verbose      print a message for every created directory\n"
        "  -m, --mode         set file mode(only octal representation)\n"
        "  -p, --parents      make parents directories, no errors on existing "
        "directories\n"
        "    --help           print this message and exit\n"
        "    --version        print version and exit\n",
        stdout);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [354 x i8] c"Usage: mkdir [OPTION(S)] [DIRECTORY(IES)]\0A\0AOPTIONS:\0A -v, --verbose print a message for every created directory\0A -m, --mode set file mode(only octal representation)\0A -p, --parents make parents directories, no errors on existing directories\0A --help print this message and exit\0A --version print version and exit\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([354 x i8], [354 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [354 x i8] c"Usage: mkdir [OPTION(S)] [DIRECTORY(IES)]\0A\0AOPTIONS:\0A -v, --verbose print a message for every created directory\0A -m, --mode set file mode(only octal representation)\0A -p, --parents make parents directories, no errors on existing directories\0A --help print this message and exit\0A --version print version and exit\0A\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([354 x i8], [354 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int call_delete();
int call_delete_all1();
int call_delete_all2();
int call_all() {
  int ret1 = call_delete();
  int ret2 = call_delete_all1();
  int ret3 = call_delete_all2();
  return 1 / (ret1 + ret2 + ret3);
}


x86 assembly (clang, -O0):
<call_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <call_delete@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <call_delete_all1@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <call_delete_all2@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_all>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <call_delete@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <call_delete_all1@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <call_delete_all2@plt>
add    %ebp,%ebx
mov    %ebx,%ecx
add    %eax,%ecx
add    %ebx,%eax
add    $0x1,%eax
cmp    $0x3,%eax
cmovae %r14d,%ecx
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @call_all() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @call_delete()
store i32 %4, i32* %1
%5 = call i32 (...) @call_delete_all1()
store i32 %5, i32* %2
%6 = call i32 (...) @call_delete_all2()
store i32 %6, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
%12 = sdiv i32 1, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @call_all() {
%1 = tail call i32 (...) @call_delete()
%2 = tail call i32 (...) @call_delete_all1()
%3 = tail call i32 (...) @call_delete_all2()
%4 = add nsw i32 %2, %1
%5 = add nsw i32 %4, %3
%6 = add i32 %5, 1
%7 = icmp ult i32 %6, 3
%8 = select i1 %7, i32 %5, i32 0
ret i32 %8
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ errx(int, char *, int /*<<< orphan*/);
int read(int, void *, size_t);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
ssize_t checked_read(int fd, void *buffer, size_t size) {
  ssize_t s = read(fd, buffer, size);
  if (s == -1) {
    errx(1, "Failed to read a file: %s", strerror(errno));
  }
  return (s);
}


x86 assembly (clang, -O0):
<checked_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1181 <checked_read+0x51>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe84(%rip),%rsi
call   1030 <errx@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_read>:
push   %rbx
call   1040 <read@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    115e <checked_read+0x2e>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeae(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
call   1030 <errx@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Failed to read a file: %s\00"
@errno = global i32 0
define i32 @checked_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @read(i32 %8, i8* %9, i64 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i32, i32* @errno
%16 = call i32 @strerror(i32 %15)
%17 = call i32 @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %3
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
@.str = [26 x i8] c"Failed to read a file: %s\00"
@errno = global i32 0
define i32 @checked_read(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %6, %3
ret i32 %4
}
/* Variables and functions */
float quintic_io(float, float, float);
float quintic_f_io(float step, float max_steps, float max_val) {
  return quintic_io(step, max_steps, max_val);
}


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

x86 assembly (clang, -O2):
<quintic_f_io>:
jmp    1030 <quintic_io@plt>

LLVM IR (-O0):
define float @quintic_f_io(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call float @quintic_io(float %7, float %8, float %9)
ret float %10
}

LLVM IR (-O2):
define float @quintic_f_io(float %0, float %1, float %2) {
%4 = tail call float @quintic_io(float %0, float %1, float %2)
ret float %4
}
/* Variables and functions */
char *memrchr(char const *, int, scalar_t__);
scalar_t__ strlen(char const *);
char *strrchr(const char *s, int c) { return memrchr(s, c, strlen(s) + 1); }


x86 assembly (clang, -O0):
<strrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    %rax,%rdx
add    $0x1,%rdx
call   1040 <memrchr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrchr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <memrchr@plt>

LLVM IR (-O0):
define i8* @strrchr(i8* %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 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 1
%10 = call i8* @memrchr(i8* %5, i32 %6, i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @strrchr(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add nsw i64 %3, 1
%5 = tail call i8* @memrchr(i8* %0, i32 %1, i64 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int dice;
  srand(time(NULL));
  dice = rand() % 6 + 1;
  printf("Congrats, you rolled a %d!!", dice);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Congrats, you rolled a %d!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32* null)
%4 = call i32 @srand(i32 %3)
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 6
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"Congrats, you rolled a %d!!\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = add nsw i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void ack_irq(int int_no) {
  if (int_no >= 40) {
    outb(0xA0, 0x20);
  }
  outb(0x20, 0x20);
}


x86 assembly (clang, -O0):
<ack_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x28,-0x4(%rbp)
jl     1134 <ack_irq+0x24>
mov    $0xa0,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
mov    $0x20,%esi
mov    %esi,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ack_irq>:
cmp    $0x28,%edi
jl     1129 <ack_irq+0x19>
push   %rax
mov    $0xa0,%edi
mov    $0x20,%esi
call   1030 <outb@plt>
add    $0x8,%rsp
mov    $0x20,%edi
mov    $0x20,%esi
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @ack_irq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 40
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @outb(i32 160, i32 32)
br label %7
7: ; preds = %5, %1
%8 = call i32 @outb(i32 32, i32 32)
ret void
}

LLVM IR (-O2):
define void @ack_irq(i32 %0) {
%2 = icmp sgt i32 %0, 39
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @outb(i32 160, i32 32)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @outb(i32 32, i32 32)
ret void
}
int div(int x, int y) {
  int dresult;
  dresult = (x / y);
  return dresult;
}


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

x86 assembly (clang, -O2):
<div>:
mov    %edi,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @div(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sdiv i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

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


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

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

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

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @milliseconds(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %5
ret i32 %10
}
void bfqg_stats_update_io_remove(struct bfq_group *bfqg, int rw) {}


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

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

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

LLVM IR (-O2):
%struct.bfq_group = type opaque
define void @bfqg_stats_update_io_remove(%struct.bfq_group* nocapture %0, i32 %1) {
ret void
}
void audmux_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @audmux_iomux_config() {
ret void
}
void SSL_set_bio(void) {}


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

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

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

LLVM IR (-O2):
define void @SSL_set_bio() {
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t HibernateRTCMatchGet(uint32_t ui32Match) {
  ;
  return ((*((volatile unsigned long *)(0x400FC004))));
}


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

x86 assembly (clang, -O2):
<HibernateRTCMatchGet>:
mov    %rdi,-0x8(%rsp)
mov    0x400fc004,%rax
40
ret

LLVM IR (-O0):
define i64 @HibernateRTCMatchGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1074774020 to i64*)
ret i64 %3
}

LLVM IR (-O2):
define i64 @HibernateRTCMatchGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1074774020 to i64*)
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ g(int **);
void f(int *p, int **pp) { g(&p); }


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

x86 assembly (clang, -O2):
<f>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
call   1030 <g@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @f(i32* %0, i32** nocapture readnone %1) {
%3 = alloca i32*
store i32* %0, i32** %3
%4 = call i32 @g(i32** %3)
ret void
}
/* Variables and functions */
int print_rng_simple();
int fprint_rng_simple(void) { return print_rng_simple(); }


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

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

LLVM IR (-O0):
define i32 @fprint_rng_simple() {
%1 = call i32 (...) @print_rng_simple()
ret i32 %1
}

LLVM IR (-O2):
define i32 @fprint_rng_simple() {
%1 = tail call i32 (...) @print_rng_simple()
ret i32 %1
}
int do_922() { return 922; }


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

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

LLVM IR (-O0):
define i32 @do_922() {
ret i32 922
}

LLVM IR (-O2):
define i32 @do_922() {
ret i32 922
}
/* Variables and functions */
int /*<<< orphan*/ my_printnbr(unsigned long, char *, int);
int /*<<< orphan*/ my_putchar(char);
int /*<<< orphan*/ my_putstr(char *);
int my_putptr(unsigned long nbr) {
  if (nbr == 0) {
    my_putchar('0');
    return (0);
  } else if (nbr < 0)
    my_putchar('-');
  my_putstr("0x");
  my_printnbr(nbr, "0123456789abcdef", 16);
  return (0);
}


x86 assembly (clang, -O0):
<my_putptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <my_putptr+0x2d>
mov    $0x30,%edi
call   1030 <my_putchar@plt>
movl   $0x0,-0x4(%rbp)
jmp    119f <my_putptr+0x6f>
cmpq   $0x0,-0x10(%rbp)
jae    1172 <my_putptr+0x42>
mov    $0x2d,%edi
call   1030 <my_putchar@plt>
jmp    1177 <my_putptr+0x47>
lea    0xe82(%rip),%rdi
call   1040 <my_putstr@plt>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
mov    $0x10,%edx
call   1050 <my_printnbr@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putptr>:
push   %rbx
test   %rdi,%rdi
je     115b <my_putptr+0x2b>
mov    %rdi,%rbx
lea    0xec0(%rip),%rdi
call   1040 <my_putstr@plt>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1050 <my_printnbr@plt>
jmp    1165 <my_putptr+0x35>
mov    $0x30,%edi
call   1030 <my_putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"0x\00"
@.str.1 = [17 x i8] c"0123456789abcdef\00"
define i32 @my_putptr(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @my_putchar(i8 signext 48)
store i32 0, i32* %2
br label %18
8: ; preds = %1
%9 = load i64, i64* %3
%10 = icmp ult i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @my_putchar(i8 signext 45)
br label %13
13: ; preds = %11, %8
br label %14
14: ; preds = %13
%15 = call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = load i64, i64* %3
%17 = call i32 @my_printnbr(i64 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 16)
store i32 0, i32* %2
br label %18
18: ; preds = %14, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [3 x i8] c"0x\00"
@.str.1 = [17 x i8] c"0123456789abcdef\00"
define i32 @my_putptr(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @my_putchar(i8 signext 48)
br label %8
5: ; preds = %1
%6 = tail call i32 @my_putstr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @my_printnbr(i64 %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 16)
br label %8
8: ; preds = %5, %3
ret i32 0
}
/* Type definitions */
struct type_macro {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ type_macro_print_args(int /*<<< orphan*/ *,
                                         struct type_macro *);
void type_macro_print(FILE *output, struct type_macro *self) {
  int i;
  fprintf(output, "(macro ");
  type_macro_print_args(output, self);
  fprintf(output, ")");
}


x86 assembly (clang, -O0):
<type_macro_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <type_macro_print_args@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_macro_print>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <type_macro_print_args@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fputc@plt>

LLVM IR (-O0):
%struct.type_macro = type { i32 }
@.str = [8 x i8] c"(macro \00"
@.str.1 = [2 x i8] c")\00"
define void @type_macro_print(i32* %0, %struct.type_macro* %1) {
%3 = alloca i32*
%4 = alloca %struct.type_macro*
%5 = alloca i32
store i32* %0, i32** %3
store %struct.type_macro* %1, %struct.type_macro** %4
%6 = load i32*, i32** %3
%7 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i32*, i32** %3
%9 = load %struct.type_macro*, %struct.type_macro** %4
%10 = call i32 @type_macro_print_args(i32* %8, %struct.type_macro* %9)
%11 = load i32*, i32** %3
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.type_macro = type { i32 }
@.str = [8 x i8] c"(macro \00"
define void @type_macro_print(i32* %0, %struct.type_macro* %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, i32* %0)
%4 = tail call i32 @type_macro_print_args(i32* %0, %struct.type_macro* %1)
%5 = tail call i32 @fputc(i32 41, i32* %0)
ret void
}
long time(loc)
long *loc;
{
  struct {
    long l1, l2;
  } t1;
  if (gettimeofday(&t1, (char *)0) < 0) {
    return -1;
  }
  if (loc)
    *loc = t1.l1;
  return t1.l1;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x0,%al
call   1030 <gettimeofday@plt>
cmp    $0x0,%eax
jge    1141 <time+0x31>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    115f <time+0x4f>
cmpq   $0x0,-0x10(%rbp)
je     1157 <time+0x47>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <gettimeofday@plt>
test   %eax,%eax
js     1136 <time+0x26>
mov    (%rsp),%rax
test   %rbx,%rbx
je     113d <time+0x2d>
mov    %rax,(%rbx)
jmp    113d <time+0x2d>
mov    $0xffffffffffffffff,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.anon = type { i64, i64 }
define i64 @time(i64* %0) {
%2 = alloca i64
%3 = alloca i64*
%4 = alloca %struct.anon
store i64* %0, i64** %3
%5 = call i32 (%struct.anon*, i8*, ...) bitcast (i32 (...)* @gettimeofday to i32 (%struct.anon*, i8*, ...)*)(%struct.anon* %4, i8* null)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i64 -1, i64* %2
br label %18
8: ; preds = %1
%9 = load i64*, i64** %3
%10 = icmp ne i64* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = getelementptr inbounds %struct.anon, %struct.anon* %4, i32 0, i32 0
%13 = load i64, i64* %12
%14 = load i64*, i64** %3
store i64 %13, i64* %14
br label %15
15: ; preds = %11, %8
%16 = getelementptr inbounds %struct.anon, %struct.anon* %4, i32 0, i32 0
%17 = load i64, i64* %16
store i64 %17, i64* %2
br label %18
18: ; preds = %15, %7
%19 = load i64, i64* %2
ret i64 %19
}

LLVM IR (-O2):
%struct.anon = type { i64, i64 }
define i64 @time(i64* writeonly %0) {
%2 = alloca %struct.anon
%3 = bitcast %struct.anon* %2 to i8*
%4 = call i32 (%struct.anon*, i8*, ...) bitcast (i32 (...)* @gettimeofday to i32 (%struct.anon*, i8*, ...)*)(%struct.anon* %2, i8* null)
%5 = icmp slt i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = icmp eq i64* %0, null
%8 = getelementptr inbounds %struct.anon, %struct.anon* %2, i64 0, i32 0
%9 = load i64, i64* %8
br i1 %7, label %11, label %10
10: ; preds = %6
store i64 %9, i64* %0
br label %11
11: ; preds = %6, %10, %1
%12 = phi i64 [ -1, %1 ], [ %9, %10 ], [ %9, %6 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ w5100_writeSn_byte(unsigned int, int, unsigned int);
void w5100_writeSnCR(unsigned sock, unsigned data) {
  w5100_writeSn_byte(sock, 0x0001, data);
}


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

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

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

LLVM IR (-O2):
define void @w5100_writeSnCR(i32 %0, i32 %1) {
%3 = tail call i32 @w5100_writeSn_byte(i32 %0, i32 1, i32 %1)
ret void
}
int __attribute__((constructor)) foo(void) { return 0; }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* bitcast (i32 ()* @foo to void ()*), i8* null }]
define i32 @foo() {
ret i32 0
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* bitcast (i32 ()* @foo to void ()*), i8* null }]
define i32 @foo() {
ret i32 0
}
void gpio_int_mask_set(unsigned gpio) { return; }


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

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

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

LLVM IR (-O2):
define void @gpio_int_mask_set(i32 %0) {
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
void get_current_time(int *p_sec, int *p_usec) {
  struct timeval tv;
  gettimeofday(&tv, 0);
  if (p_sec)
    *p_sec = tv.tv_sec;
  if (p_usec)
    *p_usec = tv.tv_usec;
}


x86 assembly (clang, -O0):
<get_current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmpq   $0x0,-0x8(%rbp)
je     113f <get_current_time+0x2f>
mov    -0x18(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     1153 <get_current_time+0x43>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_current_time>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rbx,%rbx
je     112e <get_current_time+0x1e>
mov    (%rsp),%eax
mov    %eax,(%rbx)
test   %r14,%r14
je     113a <get_current_time+0x2a>
mov    0x4(%rsp),%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @get_current_time(i32* writeonly %0, i32* writeonly %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
%6 = icmp eq i32* %0, null
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%9 = load i32, i32* %8
store i32 %9, i32* %0
br label %10
10: ; preds = %7, %2
%11 = icmp eq i32* %1, null
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%14 = load i32, i32* %13
store i32 %14, i32* %1
br label %15
15: ; preds = %12, %10
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ init();
int /*<<< orphan*/ x_read(int, void *, size_t);
ssize_t v4l2_read(int fd, void *buf, size_t sz) {
  init();
  return x_read(fd, buf, sz);
}


x86 assembly (clang, -O0):
<v4l2_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <init@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <x_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v4l2_read>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <x_read@plt>

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

LLVM IR (-O2):
define i32 @v4l2_read(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @init()
%5 = tail call i32 @x_read(i32 %0, i8* %1, i64 %2)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void I2SWclkCounterReset(uint32_t ui32Base) {
  ;
  (*((volatile unsigned short *)(0x40021000 + 0x00000050))) = 0;
}


x86 assembly (clang, -O0):
<I2SWclkCounterReset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x40021050,%eax
movw   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SWclkCounterReset>:
movw   $0x0,0x40021050
ret

LLVM IR (-O0):
define void @I2SWclkCounterReset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store volatile i16 0, i16* inttoptr (i64 1073877072 to i16*)
ret void
}

LLVM IR (-O2):
define void @I2SWclkCounterReset(i32 %0) {
store volatile i16 0, i16* inttoptr (i64 1073877072 to i16*)
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
int lstat(char const *, struct stat *);
bool is_dir(const char *pathname) {
  struct stat file_mode;
  if (lstat(pathname, &file_mode) == -1)
    return false;
  return S_ISDIR(file_mode.st_mode);
}


x86 assembly (clang, -O0):
<is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <lstat@plt>
cmp    $0xffffffff,%eax
jne    114e <is_dir+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1159 <is_dir+0x39>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <lstat@plt>
cmp    $0xffffffff,%eax
je     1137 <is_dir+0x17>
mov    (%rsp),%edi
pop    %rax
jmp    1030 <S_ISDIR@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_dir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @lstat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISDIR(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_dir(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @lstat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *malloc(size_t);
void *xmalloc(size_t size) {
  void *ptr = malloc(size);
  if (!ptr)
    error("memory exhausted");
  return ptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"memory exhausted\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  char *s, *t;
  s = getenv("LD_LIBRARY_PATH");
  t = s;
  printf(t);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"LD_LIBRARY_PATH\00"
define i32 @main() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) %1)
ret i32 0
}
/* Variables and functions */
void *valloc(size_t);
void *__libc_valloc(size_t size) { return valloc(size); }


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

x86 assembly (clang, -O2):
<__libc_valloc>:
jmp    1030 <valloc@plt>

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

LLVM IR (-O2):
define noalias i8* @__libc_valloc(i64 %0) {
%2 = tail call i8* @valloc(i64 %0)
ret i8* %2
}