xunge/DecIR huggingface dataset:
int isxdigit(int character) {
  return (((character >= '0') && (character <= '9')) ||
          ((character >= 'A') && (character <= 'F')) ||
          ((character >= 'a') && (character <= 'f')));
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     1120 <isxdigit+0x20>
mov    $0x1,%al
cmpl   $0x39,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isxdigit+0x58>
cmpl   $0x41,-0x4(%rbp)
jl     1139 <isxdigit+0x39>
mov    $0x1,%al
cmpl   $0x46,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isxdigit+0x58>
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1152 <isxdigit+0x52>
cmpl   $0x66,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
setb   %al
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
cmp    $0x6,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %22, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 65
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 70
br i1 %13, label %22, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 97
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 102
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br label %22
22: ; preds = %20, %11, %5
%23 = phi i1 [ true, %11 ], [ true, %5 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ just_before_exit_soar();
void exit_soar(void) {
  just_before_exit_soar();
  exit(0);
}


x86 assembly (clang, -O0):
<exit_soar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <just_before_exit_soar@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exit_soar>:
push   %rax
xor    %eax,%eax
call   1030 <just_before_exit_soar@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @exit_soar() {
%1 = call i32 (...) @just_before_exit_soar()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @exit_soar() {
%1 = tail call i32 (...) @just_before_exit_soar()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ AT_SYMLINK_FOLLOW;
scalar_t__ linkat(int, char const *, int, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int copy_file(int srcd_fd, const char *src, int dstd_fd, const char *dst) {
  if (linkat(srcd_fd, src, dstd_fd, dst, AT_SYMLINK_FOLLOW) != 0) {
    perror("copy_file failed");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<copy_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x2e9d(%rip),%rax
mov    (%rax),%r8d
call   1030 <linkat@plt>
cmp    $0x0,%rax
je     1175 <copy_file+0x55>
lea    0xe9c(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <copy_file+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_file>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%r8d
call   1030 <linkat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    113c <copy_file+0x1c>
pop    %rcx
ret
lea    0xebd(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@AT_SYMLINK_FOLLOW = global i32 0
@.str = [17 x i8] c"copy_file failed\00"
define i32 @copy_file(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = load i8*, i8** %9
%14 = load i32, i32* @AT_SYMLINK_FOLLOW
%15 = call i64 @linkat(i32 %10, i8* %11, i32 %12, i8* %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %4
%18 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
br label %20
19: ; preds = %4
store i32 0, i32* %5
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
@AT_SYMLINK_FOLLOW = global i32 0
@.str = [17 x i8] c"copy_file failed\00"
define i32 @copy_file(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = load i32, i32* @AT_SYMLINK_FOLLOW
%6 = tail call i64 @linkat(i32 %0, i8* %1, i32 %2, i8* %3, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %4, %8
%11 = phi i32 [ -1, %8 ], [ 0, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ isNumber(char);
int isNumberStr(char *str) {
  while (*str) {
    if (!isNumber(*str))
      return (0);
    ++str;
  }
  return (1);
}


x86 assembly (clang, -O0):
<isNumberStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <isNumberStr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isNumber@plt>
cmp    $0x0,%eax
jne    114a <isNumberStr+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1162 <isNumberStr+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isNumberStr+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumberStr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <isNumberStr+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isNumber@plt>
test   %eax,%eax
je     1149 <isNumberStr+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isNumberStr+0x20>
jmp    114b <isNumberStr+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isNumberStr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isNumber(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
void pasarDatos() {}


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

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

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

LLVM IR (-O2):
define void @pasarDatos() {
ret void
}
int isvariable(const char *s) {
  if ('_' != *s)
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<isvariable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x5f,%eax
cmp    %ecx,%eax
je     1128 <isvariable+0x28>
movl   $0x0,-0x4(%rbp)
jmp    112f <isvariable+0x2f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isvariable>:
xor    %eax,%eax
cmpb   $0x5f,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isvariable(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ strtoll(char const *, int /*<<< orphan*/, int);
int64_t mc_int64_value(const char *value) {
  return (NULL != value) ? strtoll(value, 0, 10) : 0;
}


x86 assembly (clang, -O0):
<mc_int64_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     1140 <mc_int64_value+0x30>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %eax,-0xc(%rbp)
jmp    114a <mc_int64_value+0x3a>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <mc_int64_value+0x3a>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mc_int64_value>:
test   %rdi,%rdi
je     1121 <mc_int64_value+0x11>
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtoll@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @mc_int64_value(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* null, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strtoll(i8* %6, i32 0, i32 10)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @mc_int64_value(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strtoll(i8* %0, i32 0, i32 10)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
scalar_t__ INT_MAX;
int main(void) { INT_MAX - 1; }


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

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

LLVM IR (-O0):
@INT_MAX = global i64 0
define i32 @main() {
%1 = load i64, i64* @INT_MAX
%2 = sub nsw i64 %1, 1
ret i32 0
}

LLVM IR (-O2):
@INT_MAX = global i64 0
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_disable_blockprotect_generic(struct flashrom_flashctx *, int, int,
                                     int /*<<< orphan*/, int);
int spi_disable_blockprotect_at25f512a(struct flashrom_flashctx *flash) {
  return spi_disable_blockprotect_generic(flash, 0x04, 1 << 7, 0, 0xFF);
}


x86 assembly (clang, -O0):
<spi_disable_blockprotect_at25f512a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
call   1030 <spi_disable_blockprotect_generic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_disable_blockprotect_at25f512a>:
mov    $0x4,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
jmp    1030 <spi_disable_blockprotect_generic@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25f512a(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %3, i32 4, i32 128, i32 0, i32 255)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25f512a(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %0, i32 4, i32 128, i32 0, i32 255)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
void abort(void) {
  while (1)
    _exit(1);
}


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <abort+0x9>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @abort() {
br label %1
1: ; preds = %0
%2 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @abort() {
%1 = tail call i32 @_exit(i32 1)
unreachable
}
int get_HasBMS(unsigned char *pds) { return (pds[7] & 0x40) != 0; }


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

x86 assembly (clang, -O2):
<get_HasBMS>:
movzbl 0x7(%rdi),%eax
shr    $0x6,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_HasBMS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 7
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 64
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_HasBMS(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 7
%3 = load i8, i8* %2
%4 = lshr i8 %3, 6
%5 = and i8 %4, 1
%6 = zext i8 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
int __byte_decode_array(const void *_buf, int offset, int maxlen, uint8_t *p,
                        int elements) {
  if (maxlen < elements)
    return -1;
  const uint8_t *buf = (const uint8_t *)_buf;
  memcpy(p, &buf[offset], elements);
  return elements;
}


x86 assembly (clang, -O0):
<__byte_decode_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1142 <__byte_decode_array+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    116b <__byte_decode_array+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__byte_decode_array>:
mov    $0xffffffff,%eax
cmp    %r8d,%edx
jl     1133 <__byte_decode_array+0x23>
push   %rbx
mov    %r8d,%ebx
movslq %esi,%rax
lea    (%rdi,%rax,4),%rsi
mov    %rcx,%rdi
mov    %r8d,%edx
call   1030 <memcpy@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @__byte_decode_array(i8* %0, i32 %1, i32 %2, i32* %3, i32 %4) {
%6 = icmp slt i32 %2, %4
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = bitcast i8* %0 to i32*
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i32, i32* %8, i64 %9
%11 = tail call i32 @memcpy(i32* %3, i32* %10, i32 %4)
br label %12
12: ; preds = %5, %7
%13 = phi i32 [ %4, %7 ], [ -1, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ UPnPResponse_ContentDirectory_GetSystemUpdateID(void *, int);
int /*<<< orphan*/ printf(char *);
void UPnPContentDirectory_GetSystemUpdateID(void *upnptoken) {
  printf("Invoke: UPnPContentDirectory_GetSystemUpdateID();\r\n");
  UPnPResponse_ContentDirectory_GetSystemUpdateID(upnptoken, 250);
}


x86 assembly (clang, -O0):
<UPnPContentDirectory_GetSystemUpdateID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0xfa,%esi
call   1040 <UPnPResponse_ContentDirectory_GetSystemUpdateID@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UPnPContentDirectory_GetSystemUpdateID>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0xfa,%esi
pop    %rbx
jmp    1040 <UPnPResponse_ContentDirectory_GetSystemUpdateID@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Invoke: UPnPContentDirectory_GetSystemUpdateID();\0D\0A\00"
define void @UPnPContentDirectory_GetSystemUpdateID(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @UPnPResponse_ContentDirectory_GetSystemUpdateID(i8* %4, i32 250)
ret void
}

LLVM IR (-O2):
@str = [51 x i8] c"Invoke: UPnPContentDirectory_GetSystemUpdateID();\0D\00"
define void @UPnPContentDirectory_GetSystemUpdateID(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @UPnPResponse_ContentDirectory_GetSystemUpdateID(i8* %0, i32 250)
ret void
}
int CCutil_sbits(unsigned int x) {
  int i;
  int ux = x;
  unsigned int b;
  i = 32;
  b = ((unsigned int)1) << 31;
  while ((ux & b) == 0 && i > 1) {
    b >>= 1;
    i--;
  }
  return i;
}


x86 assembly (clang, -O0):
<CCutil_sbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x20,-0x8(%rbp)
movl   $0x80000000,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
and    -0x10(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
jne    1139 <CCutil_sbits+0x39>
cmpl   $0x1,-0x8(%rbp)
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1149 <CCutil_sbits+0x49>
jmp    1160 <CCutil_sbits+0x60>
mov    -0x10(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    111b <CCutil_sbits+0x1b>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CCutil_sbits>:
test   %edi,%edi
js     1121 <CCutil_sbits+0x21>
mov    $0x20,%edx
mov    $0x80000000,%ecx
xchg   %ax,%ax
shr    %ecx
lea    -0x1(%rdx),%eax
test   %edi,%ecx
jne    1120 <CCutil_sbits+0x20>
cmp    $0x2,%edx
mov    %eax,%edx
ja     1110 <CCutil_sbits+0x10>
ret
mov    $0x20,%eax
ret

LLVM IR (-O0):
define i32 @CCutil_sbits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %4
store i32 32, i32* %3
store i32 -2147483648, i32* %5
br label %7
7: ; preds = %17, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = and i32 %8, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 1
br label %15
15: ; preds = %12, %7
%16 = phi i1 [ false, %7 ], [ %14, %12 ]
br i1 %16, label %17, label %22
17: ; preds = %15
%18 = load i32, i32* %5
%19 = lshr i32 %18, 1
store i32 %19, i32* %5
%20 = load i32, i32* %3
%21 = add nsw i32 %20, -1
store i32 %21, i32* %3
br label %7
22: ; preds = %15
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @CCutil_sbits(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %12
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ -2147483648, %1 ]
%5 = phi i32 [ %7, %3 ], [ 32, %1 ]
%6 = lshr i32 %4, 1
%7 = add nsw i32 %5, -1
%8 = and i32 %6, %0
%9 = icmp eq i32 %8, 0
%10 = icmp ugt i32 %5, 2
%11 = select i1 %9, i1 %10, i1 false
br i1 %11, label %3, label %12
12: ; preds = %3, %1
%13 = phi i32 [ 32, %1 ], [ %7, %3 ]
ret i32 %13
}
int getOutputPower(unsigned int *const power,
                   int (*spiTransfer)(unsigned char *const, unsigned int,
                                      void *const customData),
                   void *const customData) {
  unsigned char data[] = {0x11, 0x00};
  int res = (*spiTransfer)(data, 2, customData);
  if (res < 0) {
    return res;
  }
  *power = (unsigned int)(data[1] & 0b00011111);
  return 0;
}


x86 assembly (clang, -O0):
<getOutputPower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0xee5(%rip),%ax
mov    %ax,-0x22(%rbp)
mov    -0x18(%rbp),%rax
lea    -0x22(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x2,%esi
call   *%rax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    114a <getOutputPower+0x4a>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <getOutputPower+0x5e>
movzbl -0x21(%rbp),%ecx
and    $0x1f,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOutputPower>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movw   $0x11,0xe(%rsp)
lea    0xe(%rsp),%rdi
mov    $0x2,%esi
call   *%rax
test   %eax,%eax
js     112e <getOutputPower+0x2e>
movzbl 0xf(%rsp),%eax
and    $0x1f,%eax
mov    %eax,(%rbx)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.getOutputPower.data = [2 x i8] c"\11\00"
define i32 @getOutputPower(i32* %0, i32 (i8*, i32, i8*)* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32 (i8*, i32, i8*)*
%7 = alloca i8*
%8 = alloca [2 x i8]
%9 = alloca i32
store i32* %0, i32** %5
store i32 (i8*, i32, i8*)* %1, i32 (i8*, i32, i8*)** %6
store i8* %2, i8** %7
%10 = bitcast [2 x i8]* %8 to i8*
%11 = load i32 (i8*, i32, i8*)*, i32 (i8*, i32, i8*)** %6
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%13 = load i8*, i8** %7
%14 = call i32 %11(i8* %12, i32 2, i8* %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = load i32, i32* %9
store i32 %18, i32* %4
br label %25
19: ; preds = %3
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = and i32 %22, 31
%24 = load i32*, i32** %5
store i32 %23, i32* %24
store i32 0, i32* %4
br label %25
25: ; preds = %19, %17
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @getOutputPower(i32* nocapture writeonly %0, i32 (i8*, i32, i8*)* nocapture %1, i8* %2) {
%4 = alloca i16
%5 = bitcast i16* %4 to i8*
store i16 17, i16* %4
%6 = call i32 %1(i8* %5, i32 2, i8* %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %3
%9 = bitcast i16* %4 to [2 x i8]*
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %9, i64 0, i64 1
%11 = load i8, i8* %10
%12 = and i8 %11, 31
%13 = zext i8 %12 to i32
store i32 %13, i32* %0
br label %14
14: ; preds = %3, %8
%15 = phi i32 [ 0, %8 ], [ %6, %3 ]
ret i32 %15
}
char countUp(char c) { return c + 1; }


x86 assembly (clang, -O0):
<countUp>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countUp>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @countUp(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, 1
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @countUp(i8 signext %0) {
%2 = add i8 %0, 1
ret i8 %2
}
/* Type definitions */
struct nwindow {
  int dummy;
};

/* Variables and functions */
struct nwindow *nw_create_fd(int);
struct nwindow *nw_create_default() {
  return nw_create_fd(3);
}


x86 assembly (clang, -O0):
<nw_create_default>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <nw_create_fd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nw_create_default>:
mov    $0x3,%edi
jmp    1030 <nw_create_fd@plt>

LLVM IR (-O0):
%struct.nwindow = type { i32 }
define %struct.nwindow* @nw_create_default() {
%1 = call %struct.nwindow* @nw_create_fd(i32 3)
ret %struct.nwindow* %1
}

LLVM IR (-O2):
%struct.nwindow = type { i32 }
define %struct.nwindow* @nw_create_default() {
%1 = tail call %struct.nwindow* @nw_create_fd(i32 3)
ret %struct.nwindow* %1
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ _SSIBaseValid(scalar_t__ volatile);
void SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ASSERT(_SSIBaseValid(ui32Base));
  (*((volatile uint32_t *)(ui32Base + 0x00000014))) |= ui32IntFlags;
}


x86 assembly (clang, -O0):
<SSIIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x14(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIIntEnable>:
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
mov    %rsi,0x10(%rsp)
mov    0x8(%rsp),%rdi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
or     %rax,0x14(%rcx)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %3
%6 = call i32 @_SSIBaseValid(i64 %5)
%7 = call i32 @ASSERT(i32 %6)
%8 = load volatile i64, i64* %4
%9 = load volatile i64, i64* %3
%10 = add nsw i64 %9, 20
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = or i64 %12, %8
store volatile i64 %13, i64* %11
ret void
}

LLVM IR (-O2):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %3
%6 = tail call i32 @_SSIBaseValid(i64 %5)
%7 = tail call i32 @ASSERT(i32 %6)
%8 = load volatile i64, i64* %4
%9 = load volatile i64, i64* %3
%10 = add nsw i64 %9, 20
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = or i64 %12, %8
store volatile i64 %13, i64* %11
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ mbstate_t;
typedef int /*<<< orphan*/ mbs;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
size_t wcrtomb(char *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int wctomb(char *s, wchar_t wchar) {
  static mbstate_t mbs;
  size_t rval;
  if (s == NULL) {
    memset(&mbs, 0, sizeof(mbs));
    return (0);
  }
  if ((rval = wcrtomb(s, wchar, &mbs)) == (size_t)-1)
    return (-1);
  return ((int)rval);
}


x86 assembly (clang, -O0):
<wctomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <wctomb+0x39>
lea    0x2ef3(%rip),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
movl   $0x0,-0x4(%rbp)
jmp    118d <wctomb+0x6d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    0x2ecd(%rip),%rdx
call   1040 <wcrtomb@plt>
mov    %rax,-0x20(%rbp)
cmp    $0xffffffffffffffff,%rax
jne    1186 <wctomb+0x66>
movl   $0xffffffff,-0x4(%rbp)
jmp    118d <wctomb+0x6d>
mov    -0x20(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wctomb>:
push   %rbx
test   %rdi,%rdi
je     1137 <wctomb+0x17>
lea    0x2f07(%rip),%rdx
call   1040 <wcrtomb@plt>
mov    %rax,%rbx
jmp    114c <wctomb+0x2c>
lea    0x2ef6(%rip),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@wctomb.mbs = internal global i32 0
define i32 @wctomb(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @memset(i32* @wctomb.mbs, i32 0, i32 4)
store i32 0, i32* %3
br label %20
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i32, i32* %5
%14 = call i64 @wcrtomb(i8* %12, i32 %13, i32* @wctomb.mbs)
store i64 %14, i64* %6
%15 = icmp eq i64 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %3
br label %20
17: ; preds = %11
%18 = load i64, i64* %6
%19 = trunc i64 %18 to i32
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %16, %9
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@wctomb.mbs = internal global i32 0
define i32 @wctomb(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @memset(i32* @wctomb.mbs, i32 0, i32 4)
br label %9
6: ; preds = %2
%7 = tail call i64 @wcrtomb(i8* %0, i32 %1, i32* @wctomb.mbs)
%8 = trunc i64 %7 to i32
br label %9
9: ; preds = %6, %4
%10 = phi i32 [ 0, %4 ], [ %8, %6 ]
ret i32 %10
}
void cc_debugfs_fini(struct cc_drvdata *drvdata) {}


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

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

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

LLVM IR (-O2):
%struct.cc_drvdata = type opaque
define void @cc_debugfs_fini(%struct.cc_drvdata* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void fatal(char *s) {
  printf("%s\n", s);
  exit(-1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @fatal(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int bar(int i) {
  if (i) {
    foo(i - 1);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113c <bar+0x2c>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <foo@plt>
movl   $0x0,-0x4(%rbp)
jmp    1143 <bar+0x33>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
test   %edi,%edi
je     1124 <bar+0x14>
push   %rax
add    $0xffffffff,%edi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @foo(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ 0, %3 ], [ 1, %1 ]
ret i32 %7
}
/* Variables and functions */
int _function(int);
int function(int x) { return _function(x); }


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

x86 assembly (clang, -O2):
<function>:
jmp    1030 <_function@plt>

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

LLVM IR (-O2):
define i32 @function(i32 %0) {
%2 = tail call i32 @_function(i32 %0)
ret i32 %2
}
/* Variables and functions */
int _pb_print_bits(unsigned char *, int);
int _pb_print_bits_uc(unsigned char value) {
  return _pb_print_bits(&value, sizeof(unsigned char));
  ;
}


x86 assembly (clang, -O0):
<_pb_print_bits_uc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1030 <_pb_print_bits@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pb_print_bits_uc>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
call   1030 <_pb_print_bits@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_pb_print_bits_uc(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @_pb_print_bits(i8* %2, i32 1)
ret i32 %3
}

LLVM IR (-O2):
define i32 @_pb_print_bits_uc(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @_pb_print_bits(i8* %2, i32 1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int get_ingress_egress(int /*<<< orphan*/ *);
uint16_t get_egress_if(uint8_t *hof) { return get_ingress_egress(hof) & 0xfff; }


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

x86 assembly (clang, -O2):
<get_egress_if>:
push   %rax
call   1030 <get_ingress_egress@plt>
and    $0xfff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_egress_if(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @get_ingress_egress(i32* %3)
%5 = and i32 %4, 4095
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_egress_if(i32* %0) {
%2 = tail call i32 @get_ingress_egress(i32* %0)
%3 = and i32 %2, 4095
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
unsigned int be24put(void *p, uint32_t v) {
  uint8_t *a;
  a = p;
  a[0] = v >> 16;
  a[1] = v >> 8;
  a[2] = v;
  return 3;
}


x86 assembly (clang, -O0):
<be24put>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be24put>:
mov    %esi,%eax
sar    $0x10,%eax
mov    %eax,(%rdi)
mov    %esi,%eax
sar    $0x8,%eax
mov    %eax,0x4(%rdi)
mov    %esi,0x8(%rdi)
mov    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @be24put(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %4
%9 = ashr i32 %8, 16
%10 = load i32*, i32** %5
%11 = getelementptr inbounds i32, i32* %10, i64 0
store i32 %9, i32* %11
%12 = load i32, i32* %4
%13 = ashr i32 %12, 8
%14 = load i32*, i32** %5
%15 = getelementptr inbounds i32, i32* %14, i64 1
store i32 %13, i32* %15
%16 = load i32, i32* %4
%17 = load i32*, i32** %5
%18 = getelementptr inbounds i32, i32* %17, i64 2
store i32 %16, i32* %18
ret i32 3
}

LLVM IR (-O2):
define i32 @be24put(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = ashr i32 %1, 16
store i32 %4, i32* %3
%5 = ashr i32 %1, 8
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = bitcast i8* %6 to i32*
store i32 %5, i32* %7
%8 = getelementptr inbounds i8, i8* %0, i64 8
%9 = bitcast i8* %8 to i32*
store i32 %1, i32* %9
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ print_two_parts(int *, int);
int main() {
  int array[] = {1, 2, 3, 4, 5, 5};
  int n = sizeof(array) / sizeof(array[0]);
  print_two_parts(array, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x6,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <print_two_parts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
call   1030 <print_two_parts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.array = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
store i32 6, i32* %3
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @print_two_parts(i32* %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 5]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @print_two_parts(i32* %3, i32 6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
void stub1();
int main(void) {
  char *shellcode = "\xeb\x09\x5b\x31\xc9\xf7\xe1\xb0\x0b\xcd\x80\xe8\xf2\xff"
                    "\xff\xff\x2f\x62\x69\x6e\x2f\x73\x68";
  printf("strlen(shellcode)=%d\n", strlen(shellcode));
  ((void (*)(void))shellcode)();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
call   1040 <printf@plt>
call   *-0x10(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"\EB\09[1\C9\F7\E1\B0\0B\CD\80\E8\F2\FF\FF\FF/bin/sh\00"
@.str.1 = [22 x i8] c"strlen(shellcode)=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to void ()*
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"\EB\09[1\C9\F7\E1\B0\0B\CD\80\E8\F2\FF\FF\FF/bin/sh\00"
@.str.1 = [22 x i8] c"strlen(shellcode)=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %1)
tail call void bitcast ([24 x i8]* @.str to void ()*)()
ret i32 0
}
/* Variables and functions */
int ltlv_nb_chunks(size_t size) {
  return size / ((1 << ((3) * 8)) - 1) +
         ((1) < (size % ((1 << ((3) * 8)) - 1))
              ? (1)
              : (size % ((1 << ((3) * 8)) - 1)));
}


x86 assembly (clang, -O0):
<ltlv_nb_chunks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xffffff,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xffffff,%ecx
xor    %edx,%edx
div    %rcx
mov    $0x1,%eax
cmp    %rdx,%rax
jae    1144 <ltlv_nb_chunks+0x44>
mov    $0x1,%edx
mov    %rdx,-0x18(%rbp)
jmp    1156 <ltlv_nb_chunks+0x56>
mov    -0x8(%rbp),%rax
mov    $0xffffff,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltlv_nb_chunks>:
movabs $0x10000010001,%rcx
mov    %rdi,%rax
mul    %rcx
mov    %rdi,%rax
sub    %rdx,%rax
shr    %rax
add    %rdx,%rax
shr    $0x17,%rax
mov    %rax,%rcx
shl    $0x18,%rcx
mov    %rax,%rdx
sub    %rcx,%rdx
xor    %ecx,%ecx
add    %rdi,%rdx
setne  %cl
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ltlv_nb_chunks(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 16777215
%5 = load i64, i64* %2
%6 = urem i64 %5, 16777215
%7 = icmp ult i64 1, %6
br i1 %7, label %8, label %9
8: ; preds = %1
br label %12
9: ; preds = %1
%10 = load i64, i64* %2
%11 = urem i64 %10, 16777215
br label %12
12: ; preds = %9, %8
%13 = phi i64 [ 1, %8 ], [ %11, %9 ]
%14 = add i64 %4, %13
%15 = trunc i64 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @ltlv_nb_chunks(i64 %0) {
%2 = urem i64 %0, 16777215
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = udiv i64 %0, 16777215
%6 = add nuw nsw i64 %5, %4
%7 = trunc i64 %6 to i32
ret i32 %7
}
void soundcard_main_loop(struct lm_interface_state *s) {}


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

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

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

LLVM IR (-O2):
%struct.lm_interface_state = type opaque
define void @soundcard_main_loop(%struct.lm_interface_state* nocapture %0) {
ret void
}
void message_handler_req_lib_amf_pmstop(void *conn, void *msg) {}


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

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

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

LLVM IR (-O2):
define void @message_handler_req_lib_amf_pmstop(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void log_msg(char *message) {
  time_t t;
  char *timestamp;
  t = time(0);
  timestamp = ctime(&t);
  timestamp[strlen(timestamp) - 1] = 0;
  fprintf(stderr, "%s: %s\n", timestamp, message);
}


x86 assembly (clang, -O0):
<log_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_msg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
define void @log_msg(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i32 @time(i32 0)
store i32 %5, i32* %3
%6 = call i8* @ctime(i32* %3)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
store i8 0, i8* %12
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
define void @log_msg(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @time(i32 0)
store i32 %4, i32* %2
%5 = call i8* @ctime(i32* %2)
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
store i8 0, i8* %9
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %0)
ret void
}
/* Variables and functions */
int func2();
int func() { return func2(); }


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

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

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

LLVM IR (-O2):
define i32 @func() {
%1 = tail call i32 (...) @func2()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void writee(char *str) { write(2, str, strlen(str)); }


x86 assembly (clang, -O0):
<writee>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writee>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @writee(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 2, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @writee(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 2, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
double pow(double, double);
double kx_pow10(register double y) { return pow(10.0, y); }


x86 assembly (clang, -O0):
<kx_pow10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kx_pow10>:
movaps %xmm0,%xmm1
movsd  0xee5(%rip),%xmm0
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @kx_pow10(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @pow(double 1.000000e+01, double %3)
ret double %4
}

LLVM IR (-O2):
define double @kx_pow10(double %0) {
%2 = tail call double @pow(double 1.000000e+01, double %0)
ret double %2
}