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

/* Variables and functions */
int /*<<< orphan*/ write_at_le16(void *, int, int);
int /*<<< orphan*/ write_le16(void *, int);
void write_le32(void *dest, uint32_t val) {
  write_le16(dest, val >> 0);
  write_at_le16(dest, val >> 16, sizeof(uint16_t));
}


x86 assembly (clang, -O0):
<write_le32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x0,%esi
call   1040 <write_le16@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sar    $0x10,%esi
mov    $0x4,%edx
call   1030 <write_at_le16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_le32>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
call   1040 <write_le16@plt>
sar    $0x10,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write_at_le16@plt>

LLVM IR (-O0):
define void @write_le32(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 = ashr i32 %6, 0
%8 = call i32 @write_le16(i8* %5, i32 %7)
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = ashr i32 %10, 16
%12 = call i32 @write_at_le16(i8* %9, i32 %11, i32 4)
ret void
}

LLVM IR (-O2):
define void @write_le32(i8* %0, i32 %1) {
%3 = tail call i32 @write_le16(i8* %0, i32 %1)
%4 = ashr i32 %1, 16
%5 = tail call i32 @write_at_le16(i8* %0, i32 %4, i32 4)
ret void
}
/* Variables and functions */
scalar_t__ strncmp(char *, void *, int);
int _get_by_id(void *v, char key[16], void *orig) {
  return strncmp(key, orig, 16) != 0;
}


x86 assembly (clang, -O0):
<_get_by_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_by_id>:
push   %rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    $0x10,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_get_by_id(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i64 @strncmp(i8* %7, i8* %8, i32 16)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @_get_by_id(i8* nocapture readnone %0, i8* %1, i8* %2) {
%4 = tail call i64 @strncmp(i8* %1, i8* %2, i32 16)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ add_command(unsigned int *, int, int);
int /*<<< orphan*/ ipfw_init(int, char **, unsigned int, char const *,
                             int /*<<< orphan*/);
scalar_t__ optind;
int ipfw_del_chain(int args, char **arglist, const char *chain) {
  unsigned int command = 0;
  add_command(&command, 0x0200U, 0x0000U);
  ipfw_init(args, arglist, command, chain, 0);
  optind = 0;
  return (0);
}


x86 assembly (clang, -O0):
<ipfw_del_chain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x200,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <ipfw_init@plt>
mov    0x2e81(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipfw_del_chain>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x200,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
mov    0xc(%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1030 <ipfw_init@plt>
mov    0x2e84(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@optind = global i64 0
define i32 @ipfw_del_chain(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = call i32 @add_command(i32* %7, i32 512, i32 0)
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = load i32, i32* %7
%12 = load i8*, i8** %6
%13 = call i32 @ipfw_init(i32 %9, i8** %10, i32 %11, i8* %12, i32 0)
store i64 0, i64* @optind
ret i32 0
}

LLVM IR (-O2):
@optind = global i64 0
define i32 @ipfw_del_chain(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = call i32 @add_command(i32* %4, i32 512, i32 0)
%7 = load i32, i32* %4
%8 = call i32 @ipfw_init(i32 %0, i8** %1, i32 %7, i8* %2, i32 0)
store i64 0, i64* @optind
ret i32 0
}
/* Variables and functions */
int read(int, char *, int);
int ws_read_offset(int filehandle, char *buf, int offset, int length) {
  return read(filehandle, buf + offset, length);
}


x86 assembly (clang, -O0):
<ws_read_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    -0x18(%rbp),%edx
call   1030 <read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ws_read_offset>:
movslq %edx,%rax
add    %rax,%rsi
mov    %ecx,%edx
jmp    1030 <read@plt>

LLVM IR (-O0):
define i32 @ws_read_offset(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 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i32, i32* %8
%15 = call i32 @read(i32 %9, i8* %13, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @ws_read_offset(i32 %0, i8* nocapture %1, i32 %2, i32 %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = tail call i32 @read(i32 %0, i8* %6, i32 %3)
ret i32 %7
}
int Amain() { return 1; }


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

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

LLVM IR (-O0):
define i32 @Amain() {
ret i32 1
}

LLVM IR (-O2):
define i32 @Amain() {
ret i32 1
}
void kasan_check_read(const volatile void *p, unsigned int size) {}


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

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

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

LLVM IR (-O2):
define void @kasan_check_read(i8* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
struct ringbuffer_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ringbuffer_store(struct ringbuffer_t *, char *, int);
void ringbuffer_copy_callback(char *data, int count, int offset,
                              void *userdata) {
  ringbuffer_store((struct ringbuffer_t *)userdata, data, count);
}


x86 assembly (clang, -O0):
<ringbuffer_copy_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <ringbuffer_store@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ringbuffer_copy_callback>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    %rcx,%rdi
jmp    1030 <ringbuffer_store@plt>

LLVM IR (-O0):
%struct.ringbuffer_t = type { i32 }
define void @ringbuffer_copy_callback(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load i8*, i8** %8
%10 = bitcast i8* %9 to %struct.ringbuffer_t*
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @ringbuffer_store(%struct.ringbuffer_t* %10, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.ringbuffer_t = type { i32 }
define void @ringbuffer_copy_callback(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = bitcast i8* %3 to %struct.ringbuffer_t*
%6 = tail call i32 @ringbuffer_store(%struct.ringbuffer_t* %5, i8* %0, i32 %1)
ret void
}
long long szzs() { return 0xffff00000000ffffLL; }


x86 assembly (clang, -O0):
<szzs>:
push   %rbp
mov    %rsp,%rbp
movabs $0xffff00000000ffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<szzs>:
movabs $0xffff00000000ffff,%rax
ret

LLVM IR (-O0):
define i64 @szzs() {
ret i64 -281474976645121
}

LLVM IR (-O2):
define i64 @szzs() {
ret i64 -281474976645121
}
/* Variables and functions */
scalar_t__ is_alpha(char);
scalar_t__ is_number(char);
const bool is_rest_ident(char c) {
  return (is_number(c) || is_alpha(c) || c == '_');
}


x86 assembly (clang, -O0):
<is_rest_ident>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <is_number@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1171 <is_rest_ident+0x51>
movsbl -0x1(%rbp),%edi
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    1171 <is_rest_ident+0x51>
movsbl -0x1(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_rest_ident>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1030 <is_number@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    114b <is_rest_ident+0x2b>
movsbl %bpl,%edi
call   1040 <is_alpha@plt>
test   %rax,%rax
jne    114b <is_rest_ident+0x2b>
xor    %ebx,%ebx
cmp    $0x5f,%bpl
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_rest_ident(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @is_number(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @is_alpha(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 95
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_rest_ident(i8 signext %0) {
%2 = tail call i64 @is_number(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = tail call i64 @is_alpha(i8 signext %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = icmp eq i8 %0, 95
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %7, %4, %1
%11 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %9, %7 ]
ret i32 %11
}
int youngerFirst(int age1, int age2) {
  if (age1 <= age2)
    return age1;
  else
    return age2;
}


x86 assembly (clang, -O0):
<youngerFirst>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1121 <youngerFirst+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <youngerFirst+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<youngerFirst>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @youngerFirst(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Type definitions */
struct usb_hcd {
  int dummy;
};
struct ft313_hcd {
  int dummy;
};

/* Variables and functions */
scalar_t__ ehci_is_TDI(struct ft313_hcd *);
struct ft313_hcd *hcd_to_ft313(struct usb_hcd *);
int ft313_port_handed_over(struct usb_hcd *hcd, int portnum) {
  struct ft313_hcd *ft313 = hcd_to_ft313(hcd);
  if (ehci_is_TDI(ft313))
    return 0;
}


x86 assembly (clang, -O0):
<ft313_port_handed_over>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <hcd_to_ft313@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <ehci_is_TDI@plt>
cmp    $0x0,%rax
je     1156 <ft313_port_handed_over+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft313_port_handed_over>:
push   %rax
call   1040 <hcd_to_ft313@plt>
mov    %rax,%rdi
call   1030 <ehci_is_TDI@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.usb_hcd = type { i32 }
%struct.ft313_hcd = type { i32 }
define i32 @ft313_port_handed_over(%struct.usb_hcd* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.usb_hcd*
%5 = alloca i32
%6 = alloca %struct.ft313_hcd*
store %struct.usb_hcd* %0, %struct.usb_hcd** %4
store i32 %1, i32* %5
%7 = load %struct.usb_hcd*, %struct.usb_hcd** %4
%8 = call %struct.ft313_hcd* @hcd_to_ft313(%struct.usb_hcd* %7)
store %struct.ft313_hcd* %8, %struct.ft313_hcd** %6
%9 = load %struct.ft313_hcd*, %struct.ft313_hcd** %6
%10 = call i64 @ehci_is_TDI(%struct.ft313_hcd* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %2
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
%struct.usb_hcd = type { i32 }
%struct.ft313_hcd = type { i32 }
define i32 @ft313_port_handed_over(%struct.usb_hcd* %0, i32 %1) {
%3 = tail call %struct.ft313_hcd* @hcd_to_ft313(%struct.usb_hcd* %0)
%4 = tail call i64 @ehci_is_TDI(%struct.ft313_hcd* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ memset(char *, char, int);
int main(int argc, const char *argv[]) {
  char *p = malloc(1024 - 8);
  char *p2 = malloc(1024 - 8);
  memset(p, 'A', 1024 - 8);
  memset(p2, 'B', 1024 - 8);
  p[1024 - 8] = '\0';
  free(p2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3f8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x3f8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x41,%esi
mov    $0x3f8,%edx
call   1040 <memset@plt>
mov    -0x20(%rbp),%rdi
mov    $0x42,%esi
mov    $0x3f8,%edx
call   1040 <memset@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0x3f8(%rax)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x3f8,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x3f8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x41,%esi
mov    $0x3f8,%edx
call   1040 <memset@plt>
mov    %rbx,%rdi
mov    $0x42,%esi
mov    $0x3f8,%edx
call   1040 <memset@plt>
movb   $0x0,0x3f8(%r14)
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i8* @malloc(i32 1016)
store i8* %7, i8** %5
%8 = call i8* @malloc(i32 1016)
store i8* %8, i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @memset(i8* %9, i8 signext 65, i32 1016)
%11 = load i8*, i8** %6
%12 = call i32 @memset(i8* %11, i8 signext 66, i32 1016)
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 1016
store i8 0, i8* %14
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(1016) i8* @malloc(i32 1016)
%4 = tail call dereferenceable_or_null(1016) i8* @malloc(i32 1016)
%5 = tail call i32 @memset(i8* %3, i8 signext 65, i32 1016)
%6 = tail call i32 @memset(i8* %4, i8 signext 66, i32 1016)
%7 = getelementptr inbounds i8, i8* %3, i64 1016
store i8 0, i8* %7
%8 = tail call i32 @free(i8* %4)
ret i32 0
}
int any_even_bit(unsigned x) { return (x & 0xAAAA) != 0; }


x86 assembly (clang, -O0):
<any_even_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaa,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<any_even_bit>:
xor    %eax,%eax
test   $0xaaaa,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @any_even_bit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 43690
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @any_even_bit(i32 %0) {
%2 = and i32 %0, 43690
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int absi(int x) { return x > 0 ? x : 0 - x; }


x86 assembly (clang, -O0):
<absi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <absi+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <absi+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<absi>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @absi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i32 [ %6, %5 ], [ %9, %7 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @absi(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ lua_pushlstring(char *, int /*<<< orphan*/);
int /*<<< orphan*/ lua_pushnil();
int /*<<< orphan*/ strlen(char *);
void lua_pushstring(char *s) {
  if (s == NULL)
    lua_pushnil();
  else
    lua_pushlstring(s, strlen(s));
}


x86 assembly (clang, -O0):
<lua_pushstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <lua_pushstring+0x23>
mov    $0x0,%al
call   1050 <lua_pushnil@plt>
jmp    116f <lua_pushstring+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <lua_pushlstring@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lua_pushstring>:
test   %rdi,%rdi
je     1149 <lua_pushstring+0x19>
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <lua_pushlstring@plt>
xor    %eax,%eax
jmp    1050 <lua_pushnil@plt>

LLVM IR (-O0):
define void @lua_pushstring(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @lua_pushnil()
br label %12
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @lua_pushlstring(i8* %8, i32 %10)
br label %12
12: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @lua_pushstring(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @lua_pushnil()
br label %8
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i32 @lua_pushlstring(i8* %0, i32 %6)
br label %8
8: ; preds = %5, %3
ret void
}
int getNumber() { return 42; }


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

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

LLVM IR (-O0):
define i32 @getNumber() {
ret i32 42
}

LLVM IR (-O2):
define i32 @getNumber() {
ret i32 42
}
void wifi_rsp_sme_set_scan_channels(
    const struct wifi_msg_sme_set_scan_channels_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_sme_set_scan_channels_rsp_t = type opaque
define void @wifi_rsp_sme_set_scan_channels(%struct.wifi_msg_sme_set_scan_channels_rsp_t* nocapture %0) {
ret void
}
unsigned int call_read(unsigned int descriptor, void *buffer,
                       unsigned int count) {
  return 0;
}


x86 assembly (clang, -O0):
<call_read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @call_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @call_read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
void gendsrl() {}


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

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

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

LLVM IR (-O2):
define void @gendsrl() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mcal_cpu_nop();
void __mem_manage_handler() {
  for (;;) {
    mcal_cpu_nop();
  }
}


x86 assembly (clang, -O0):
<__mem_manage_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <__mem_manage_handler+0x9>
mov    $0x0,%al
call   1030 <mcal_cpu_nop@plt>
jmp    1119 <__mem_manage_handler+0x9>

x86 assembly (clang, -O2):
<__mem_manage_handler>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <mcal_cpu_nop@plt>
jmp    1120 <__mem_manage_handler+0x10>

LLVM IR (-O0):
define void @__mem_manage_handler() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @mcal_cpu_nop()
br label %1
}

LLVM IR (-O2):
define void @__mem_manage_handler() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @mcal_cpu_nop()
br label %1
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMRB2_set(void) { return U_WMRCORENONE_set("U_WMRB2"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRB2\00"
define i8* @U_WMRB2_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRB2\00"
define i8* @U_WMRB2_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
void _exit(int status) {
  (void)status;
  while (1) {
  }
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

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

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
br label %4
4: ; preds = %1, %4
br label %4
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %1, %2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free_memory();
int /*<<< orphan*/ prepare_for_exit();
void signal_handler(const int sig) {
  prepare_for_exit();
  free_memory();
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <prepare_for_exit@plt>
mov    $0x0,%al
call   1040 <free_memory@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
xor    %eax,%eax
call   1030 <prepare_for_exit@plt>
xor    %eax,%eax
call   1040 <free_memory@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @prepare_for_exit()
%4 = call i32 (...) @free_memory()
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @signal_handler(i32 %0) {
%2 = tail call i32 (...) @prepare_for_exit()
%3 = tail call i32 (...) @free_memory()
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
long long inswap_le64(long long n) {
  unsigned long long num = n;
  return (num >> 56) | ((num & 0xff000000000000LL) >> 40) |
         ((num & 0xff0000000000LL) >> 24) | ((num & 0xff00000000LL) >> 8) |
         ((num & 0xff000000) << 8) | ((num & 0xff0000) << 24) |
         ((num & 0xff00) << 40) | ((num & 0xff) << 56);
}


x86 assembly (clang, -O0):
<inswap_le64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x38,%rax
movabs $0xff000000000000,%rcx
and    -0x10(%rbp),%rcx
shr    $0x28,%rcx
or     %rcx,%rax
movabs $0xff0000000000,%rcx
and    -0x10(%rbp),%rcx
shr    $0x18,%rcx
or     %rcx,%rax
movabs $0xff00000000,%rcx
and    -0x10(%rbp),%rcx
shr    $0x8,%rcx
or     %rcx,%rax
movabs $0xff000000,%rcx
and    -0x10(%rbp),%rcx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0xff0000,%rcx
shl    $0x18,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0xff00,%rcx
shl    $0x28,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0xff,%rcx
shl    $0x38,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inswap_le64>:
mov    %rdi,%rax
bswap  %rax
ret

LLVM IR (-O0):
define i64 @inswap_le64(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = lshr i64 %5, 56
%7 = load i64, i64* %3
%8 = and i64 %7, 71776119061217280
%9 = lshr i64 %8, 40
%10 = or i64 %6, %9
%11 = load i64, i64* %3
%12 = and i64 %11, 280375465082880
%13 = lshr i64 %12, 24
%14 = or i64 %10, %13
%15 = load i64, i64* %3
%16 = and i64 %15, 1095216660480
%17 = lshr i64 %16, 8
%18 = or i64 %14, %17
%19 = load i64, i64* %3
%20 = and i64 %19, 4278190080
%21 = shl i64 %20, 8
%22 = or i64 %18, %21
%23 = load i64, i64* %3
%24 = and i64 %23, 16711680
%25 = shl i64 %24, 24
%26 = or i64 %22, %25
%27 = load i64, i64* %3
%28 = and i64 %27, 65280
%29 = shl i64 %28, 40
%30 = or i64 %26, %29
%31 = load i64, i64* %3
%32 = and i64 %31, 255
%33 = shl i64 %32, 56
%34 = or i64 %30, %33
ret i64 %34
}

LLVM IR (-O2):
define i64 @inswap_le64(i64 %0) {
%2 = tail call i64 @llvm.bswap.i64(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
scalar_t__ isStringEmpty(char const *);
int /*<<< orphan*/ printf(char *, ...);
void confirm(const char *str) {
  if (isStringEmpty(str)) {
    printf("CONFIRM:\n");
    return;
  }
  printf("CONFIRM: %s\n", str + sizeof(int32_t));
}


x86 assembly (clang, -O0):
<confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <isStringEmpty@plt>
cmp    $0x0,%rax
je     1152 <confirm+0x32>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1168 <confirm+0x48>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confirm>:
push   %rbx
mov    %rdi,%rbx
call   1050 <isStringEmpty@plt>
test   %rax,%rax
je     114b <confirm+0x1b>
lea    0xec8(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
add    $0x4,%rbx
lea    0xeaa(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [13 x i8] c"CONFIRM: %s\0A\00"
@str = [9 x i8] c"CONFIRM:\00"
define void @confirm(i8* %0) {
%2 = tail call i64 @isStringEmpty(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %9
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %6, %4
ret void
}
int test_imm_59int8_mem(signed char *val) {
  return ((*val) & (-0x59 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_59int8_mem>:
testb  $0xa7,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_59int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -89
%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_59int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -89
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *needMem(int);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ safef(char *, int, char *, char *, char *);
int strlen(char *);
void envUpdate(char *name, char *value) {
  int size = strlen(name) + strlen(value) + 2;
  char *s = needMem(size);
  safef(s, size, "%s=%s", name, value);
  putenv(s);
}


x86 assembly (clang, -O0):
<envUpdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <needMem@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe6c(%rip),%rdx
call   1060 <safef@plt>
mov    -0x20(%rbp),%rdi
call   1040 <putenv@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<envUpdate>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%ebp
add    $0x2,%ebp
mov    %ebp,%edi
call   1050 <needMem@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r12,%rcx
mov    %r14,%r8
call   1060 <safef@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putenv@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s=%s\00"
define void @envUpdate(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %8, %10
%12 = add nsw i32 %11, 2
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i8* @needMem(i32 %13)
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = load i32, i32* %5
%17 = load i8*, i8** %3
%18 = load i8*, i8** %4
%19 = call i32 @safef(i8* %15, i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18)
%20 = load i8*, i8** %6
%21 = call i32 @putenv(i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s=%s\00"
define void @envUpdate(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = add i32 %3, 2
%6 = add i32 %5, %4
%7 = tail call i8* @needMem(i32 %6)
%8 = tail call i32 @safef(i8* %7, i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%9 = tail call i32 @putenv(i8* %7)
ret void
}
/* Variables and functions */
unsigned char get_char();
int /*<<< orphan*/ put_char(char);
int /*<<< orphan*/ put_word(unsigned int);
unsigned char target_read_byte(unsigned addr) {
  put_char('g');
  put_word(addr);
  return get_char();
}


x86 assembly (clang, -O0):
<target_read_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x67,%edi
call   1030 <put_char@plt>
mov    -0x4(%rbp),%edi
call   1040 <put_word@plt>
mov    $0x0,%al
call   1050 <get_char@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_read_byte>:
push   %rbx
mov    %edi,%ebx
mov    $0x67,%edi
call   1030 <put_char@plt>
mov    %ebx,%edi
call   1040 <put_word@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <get_char@plt>

LLVM IR (-O0):
define zeroext i8 @target_read_byte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put_char(i8 signext 103)
%4 = load i32, i32* %2
%5 = call i32 @put_word(i32 %4)
%6 = call zeroext i8 (...) @get_char()
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @target_read_byte(i32 %0) {
%2 = tail call i32 @put_char(i8 signext 103)
%3 = tail call i32 @put_word(i32 %0)
%4 = tail call zeroext i8 (...) @get_char()
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int l;
  int n;
  int i;
  i = l;
  if (!(l > 0))
    return 0;
  while (i < n) {
    i++;
  }
  assert(l >= 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     113b <main+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1172 <main+0x62>
jmp    1140 <main+0x30>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <main+0x4a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1140 <main+0x30>
cmpl   $0x1,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
store i32 %5, i32* %4
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %0
store i32 0, i32* %1
br label %22
9: ; preds = %0
br label %10
10: ; preds = %14, %9
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
br label %10
17: ; preds = %10
%18 = load i32, i32* %2
%19 = icmp sge i32 %18, 1
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
store i32 0, i32* %1
br label %22
22: ; preds = %17, %8
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void DMA1_Stream6_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @DMA1_Stream6_IRQHandler() {
ret void
}
int set_bit(int number, int position) { return number | (1 << position); }


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @set_bit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = or i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void usage(char *argv0) {
  fprintf(stdout, "Usage: %s <filename>\n", argv0);
  exit(-1);
}


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

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

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [22 x i8] c"Usage: %s <filename>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
__attribute__((always_)) int16_t min_int16_t(int16_t a, int16_t b) {
  return a < b ? a : b;
}


x86 assembly (clang, -O0):
<min_int16_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <min_int16_t+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <min_int16_t+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_int16_t>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @min_int16_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @min_int16_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_NAME;

/* Variables and functions */
int /*<<< orphan*/ NID_commonName;
char const *req_GetNameNid(int /*<<< orphan*/ *, int /*<<< orphan*/);
const char *req_GetName_CN(X509_NAME *name) {
  return req_GetNameNid(name, NID_commonName);
}


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

x86 assembly (clang, -O2):
<req_GetName_CN>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <req_GetNameNid@plt>

LLVM IR (-O0):
@NID_commonName = global i32 0
define i8* @req_GetName_CN(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @NID_commonName
%5 = call i8* @req_GetNameNid(i32* %3, i32 %4)
ret i8* %5
}

LLVM IR (-O2):
@NID_commonName = global i32 0
define i8* @req_GetName_CN(i32* %0) {
%2 = load i32, i32* @NID_commonName
%3 = tail call i8* @req_GetNameNid(i32* %0, i32 %2)
ret i8* %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
scalar_t__ ERR;
int /*<<< orphan*/ *initscr();
scalar_t__ setupterm(int /*<<< orphan*/ *, int, int *);
uint8_t ccbi_initscr() {
  int err;
  if (setupterm(NULL, 1, &err) == ERR)
    return 0;
  return initscr() == NULL ? 0 : 1;
}


x86 assembly (clang, -O0):
<ccbi_initscr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
mov    $0x1,%esi
lea    -0x8(%rbp),%rdx
call   1030 <setupterm@plt>
mov    0x2ea7(%rip),%rcx
cmp    (%rcx),%rax
jne    1156 <ccbi_initscr+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1171 <ccbi_initscr+0x51>
mov    $0x0,%al
call   1040 <initscr@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccbi_initscr>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0xc(%rsp),%rdx
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <setupterm@plt>
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%rax
je     1153 <ccbi_initscr+0x33>
xor    %eax,%eax
call   1040 <initscr@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@ERR = global i64 0
define i32 @ccbi_initscr() {
%1 = alloca i32
%2 = alloca i32
%3 = call i64 @setupterm(i32* null, i32 1, i32* %2)
%4 = load i64, i64* @ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %12
7: ; preds = %0
%8 = call i32* (...) @initscr()
%9 = icmp eq i32* %8, null
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 0, i32 1
store i32 %11, i32* %1
br label %12
12: ; preds = %7, %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@ERR = global i64 0
define i32 @ccbi_initscr() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @setupterm(i32* null, i32 1, i32* %1)
%4 = load i64, i64* @ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = call i32* (...) @initscr()
%8 = icmp ne i32* %7, null
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %0, %6
%11 = phi i32 [ %9, %6 ], [ 0, %0 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ malloc(size_t);
char *strcpy(char *, char const *);
size_t strlen(char const *);
char *strndup(const char *s, size_t n) {
  size_t len = strlen(s);
  if (len > n) {
    len = n;
  }
  char *new_string = (char *)malloc((len + 1) * sizeof(char));
  return strcpy(new_string, s);
}


x86 assembly (clang, -O0):
<strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1163 <strndup+0x33>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strndup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
cmp    %rbx,%rax
cmovbe %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = icmp ugt i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i64, i64* %4
store i64 %13, i64* %5
br label %14
14: ; preds = %12, %2
%15 = load i64, i64* %5
%16 = add i64 %15, 1
%17 = mul i64 %16, 1
%18 = call i64 @malloc(i64 %17)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = load i8*, i8** %3
%22 = call i8* @strcpy(i8* %20, i8* %21)
ret i8* %22
}

LLVM IR (-O2):
define i8* @strndup(i8* nocapture %0, i64 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp ugt i64 %3, %1
%5 = select i1 %4, i64 %1, i64 %3
%6 = add i64 %5, 1
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i8* @strcpy(i8* dereferenceable(1) %8, i8* dereferenceable(1) %0)
ret i8* %8
}
unsigned int hashfunction(char *str) {
  unsigned int hash = 5381;
  while (*str) {
    hash += (hash << 5) + (*str++);
  }
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<hashfunction>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1141 <hashfunction+0x41>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hashfunction+0xf>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashfunction>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <hashfunction+0x2d>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
add    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hashfunction+0x10>
and    $0x7fffffff,%eax
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @hashfunction(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 5381, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = mul i32 %6, 33
%11 = add i32 %10, %9
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 5381, %1 ], [ %15, %14 ]
ret i32 %17
}