xunge/DecIR huggingface dataset:
long date_dayofweek(long *cod) {
  long comp;
  comp = (*cod + 3) % 7;
  if (comp == 0) {
    comp = 7;
  }
  return (comp);
}


x86 assembly (clang, -O0):
<date_dayofweek>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x3,%rax
mov    $0x7,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <date_dayofweek+0x34>
movq   $0x7,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_dayofweek>:
mov    (%rdi),%rcx
lea    0x3(%rcx),%rax
movabs $0x4924924924924925,%rdx
92 24 49
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    %rdx
add    %rax,%rdx
lea    0x0(,%rdx,8),%rax
sub    %rax,%rdx
add    %rdx,%rcx
add    $0x3,%rcx
test   %rcx,%rcx
mov    $0x7,%eax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
define i64 @date_dayofweek(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = add nsw i64 %5, 3
%7 = srem i64 %6, 7
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i64 7, i64* %3
br label %11
11: ; preds = %10, %1
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
define i64 @date_dayofweek(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = add nsw i64 %2, 3
%4 = srem i64 %3, 7
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i64 7, i64 %4
ret i64 %6
}
/* Variables and functions */
char readc(char *);
int eth_up(void) { return readc("/tmp/port_status") == '1'; }


x86 assembly (clang, -O0):
<eth_up>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <readc@plt>
movsbl %al,%eax
cmp    $0x31,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eth_up>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <readc@plt>
xor    %ecx,%ecx
cmp    $0x31,%al
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"/tmp/port_status\00"
define i32 @eth_up() {
%1 = call signext i8 @readc(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = sext i8 %1 to i32
%3 = icmp eq i32 %2, 49
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@.str = [17 x i8] c"/tmp/port_status\00"
define i32 @eth_up() {
%1 = tail call signext i8 @readc(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8 %1, 49
%3 = zext i1 %2 to i32
ret i32 %3
}
void kinit() {}


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

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

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

LLVM IR (-O2):
define void @kinit() {
ret void
}
/* Variables and functions */
int env_variable_as_integer(char *, int *);
int minipmi_get_fd(int *fd) { return env_variable_as_integer("PMI_FD", fd); }


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

x86 assembly (clang, -O2):
<minipmi_get_fd>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <env_variable_as_integer@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"PMI_FD\00"
define i32 @minipmi_get_fd(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @env_variable_as_integer(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"PMI_FD\00"
define i32 @minipmi_get_fd(i32* %0) {
%2 = tail call i32 @env_variable_as_integer(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fun_preinit() {
  printf("fun_preinit"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"fun_preinit\0A\00"
define void @fun_preinit() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"fun_preinit\00"
define void @fun_preinit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *orig_getenv(char const *);
char *getenv(const char *name) { return orig_getenv(name); }


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

x86 assembly (clang, -O2):
<getenv>:
jmp    1030 <orig_getenv@plt>

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

LLVM IR (-O2):
define i8* @getenv(i8* %0) {
%2 = tail call i8* @orig_getenv(i8* %0)
ret i8* %2
}
/* Variables and functions */
int snprintf(char *, int const, char *, char *);
int handle_nick(char *params, char *mesg, const int mesg_len) {
  return (*params) ? snprintf(mesg, mesg_len, "NICK %s\r\n", params + 1) : 0;
}


x86 assembly (clang, -O0):
<handle_nick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1156 <handle_nick+0x46>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rcx
add    $0x1,%rcx
lea    0xeb7(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x18(%rbp)
jmp    1160 <handle_nick+0x50>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <handle_nick+0x50>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_nick>:
cmpb   $0x0,(%rdi)
je     1130 <handle_nick+0x20>
mov    %rdi,%rcx
add    $0x1,%rcx
lea    0xedd(%rip),%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rax,%rdx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
define i32 @handle_nick(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = call i32 @snprintf(i8* %12, i32 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %18
17: ; preds = %3
br label %18
18: ; preds = %17, %11
%19 = phi i32 [ %16, %11 ], [ 0, %17 ]
ret i32 %19
}

LLVM IR (-O2):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
define i32 @handle_nick(i8* %0, i8* %1, i32 %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ %8, %6 ], [ 0, %3 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ XErrorEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int ignore_errors(Display *dpy, XErrorEvent *ev) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ignore_errors(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rdx;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
int cpuid_width_fixed_counters(void) {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 10;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  return (((uint64_t)(rdx) &
           ((((uint64_t)1 << (((12)) - ((5)) + 1)) - 1) << ((5)))) >>
          (5));
}


x86 assembly (clang, -O0):
<cpuid_width_fixed_counters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x10(%rbp),%eax
and    $0x1fe0,%eax
sar    $0x5,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_width_fixed_counters>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    $0xa,%edi
call   1030 <cpuid@plt>
mov    0x8(%rsp),%eax
shr    $0x5,%eax
movzbl %al,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_width_fixed_counters() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 10, i32* %5
%6 = load i32, i32* %5
%7 = call i32 @cpuid(i32 %6, i32* %1, i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %4
%9 = and i32 %8, 8160
%10 = ashr i32 %9, 5
ret i32 %10
}

LLVM IR (-O2):
define i32 @cpuid_width_fixed_counters() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 10, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %4
%11 = lshr i32 %10, 5
%12 = and i32 %11, 255
ret i32 %12
}
signed int double_to_signed_int(double src) { return src; }


x86 assembly (clang, -O0):
<double_to_signed_int>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_to_signed_int>:
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @double_to_signed_int(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @double_to_signed_int(double %0) {
%2 = fptosi double %0 to i32
ret i32 %2
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
bool mii_can_10_mbps_half_dp(uint16_t bmsr) { return (bmsr & 0x00000800); }


x86 assembly (clang, -O0):
<mii_can_10_mbps_half_dp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x800,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mii_can_10_mbps_half_dp>:
mov    %edi,%eax
and    $0x800,%eax
ret

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

LLVM IR (-O2):
define i32 @mii_can_10_mbps_half_dp(i32 %0) {
%2 = and i32 %0, 2048
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ bcm2835_i2c_read(char *, int);
unsigned int I2C_ReadWordPresetPointer(void) {
  char val[2] = {0};
  bcm2835_i2c_read(val, 2);
  unsigned int data = (val[0] << 8) | val[1];
  return data;
}


x86 assembly (clang, -O0):
<I2C_ReadWordPresetPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x2(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
call   1030 <memset@plt>
lea    -0x2(%rbp),%rdi
mov    $0x2,%esi
call   1040 <bcm2835_i2c_read@plt>
movsbl -0x2(%rbp),%eax
shl    $0x8,%eax
movsbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2C_ReadWordPresetPointer>:
push   %rax
movw   $0x0,0x6(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
call   1030 <bcm2835_i2c_read@plt>
movsbl 0x6(%rsp),%ecx
shl    $0x8,%ecx
movsbl 0x7(%rsp),%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @I2C_ReadWordPresetPointer() {
%1 = alloca [2 x i8]
%2 = alloca i32
%3 = bitcast [2 x i8]* %1 to i8*
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%5 = call i32 @bcm2835_i2c_read(i8* %4, i32 2)
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = shl i32 %8, 8
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = or i32 %9, %12
store i32 %13, i32* %2
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @I2C_ReadWordPresetPointer() {
%1 = alloca i16
%2 = bitcast i16* %1 to [2 x i8]*
%3 = bitcast i16* %1 to i8*
store i16 0, i16* %1
%4 = call i32 @bcm2835_i2c_read(i8* %3, i32 2)
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = shl nsw i32 %6, 8
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = or i32 %7, %10
ret i32 %11
}
/* Variables and functions */
int mem_get_be24_as_int(unsigned char const *);
signed int mem_get_sbe24_as_int(const void *vmem) {
  const unsigned char *mem = (const unsigned char *)vmem;
  signed int val = mem_get_be24_as_int(mem);
  return (val << ((sizeof(int) << 3) - 24)) >> ((sizeof(int) << 3) - 24);
}


x86 assembly (clang, -O0):
<mem_get_sbe24_as_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <mem_get_be24_as_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
sar    $0x8,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_get_sbe24_as_int>:
push   %rax
call   1030 <mem_get_be24_as_int@plt>
shl    $0x8,%eax
sar    $0x8,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mem_get_sbe24_as_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @mem_get_be24_as_int(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = shl i32 %8, 8
%10 = ashr i32 %9, 8
ret i32 %10
}

LLVM IR (-O2):
define i32 @mem_get_sbe24_as_int(i8* %0) {
%2 = tail call i32 @mem_get_be24_as_int(i8* %0)
%3 = shl i32 %2, 8
%4 = ashr exact i32 %3, 8
ret i32 %4
}
int init_threads(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @init_threads() {
ret i32 1
}
/* Variables and functions */
char toupper(char);
int ord(char c) {
  c = toupper(c);
  if (c >= 'A' && c <= 'Z')
    return c - 'A' + 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<ord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1156 <ord+0x46>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1156 <ord+0x46>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <ord+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ord>:
push   %rax
call   1030 <toupper@plt>
movsbl %al,%edx
add    $0xbf,%al
add    $0xffffffc0,%edx
xor    %ecx,%ecx
cmp    $0x1a,%al
cmovb  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ord(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call signext i8 @toupper(i8 signext %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 65
br i1 %8, label %9, label %18
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 90
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 65
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %19
18: ; preds = %9, %1
store i32 0, i32* %2
br label %19
19: ; preds = %18, %13
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @ord(i8 signext %0) {
%2 = tail call signext i8 @toupper(i8 signext %0)
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = sext i8 %2 to i32
%6 = add nsw i32 %5, -64
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
void USB_SaveConfig(void) {}


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

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

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

LLVM IR (-O2):
define void @USB_SaveConfig() {
ret void
}
int length(char *string) {
  int count = 0;
  while (*string++)
    count++;
  return count;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <length+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
cmpb   $0x0,(%rdi)
je     111c <length+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <length+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ printf(char *, char);
int main() {
  char a = getchar();
  printf("%i", a);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%esi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void help(void) {
  fprintf(stderr,
          "Syntax for I2C-like access:\n"
          "  isadump [OPTIONS] [-k V1,V2...] ADDRREG DATAREG [BANK [BANKREG]]\n"
          "Syntax for flat address space:\n"
          "  isadump -f [OPTIONS] ADDRESS [RANGE [BANK [BANKREG]]]\n"
          "Options:\n"
          "  -k	Super-I/O configuration access key\n"
          "  -f	Enable flat address space mode\n"
          "  -y	Assume affirmative answer to all questions\n"
          "  -W	Read and display word (16-bit) values\n"
          "  -L	Read and display long (32-bit) values\n");
}


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

x86 assembly (clang, -O2):
<help>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [402 x i8] c"Syntax for I2C-like access:\0A isadump [OPTIONS] [-k V1,V2...] ADDRREG DATAREG [BANK [BANKREG]]\0ASyntax for flat address space:\0A isadump -f [OPTIONS] ADDRESS [RANGE [BANK [BANKREG]]]\0AOptions:\0A -k\09Super-I/O configuration access key\0A -f\09Enable flat address space mode\0A -y\09Assume affirmative answer to all questions\0A -W\09Read and display word (16-bit) values\0A -L\09Read and display long (32-bit) values\0A\00"
define void @help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([402 x i8], [402 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [402 x i8] c"Syntax for I2C-like access:\0A isadump [OPTIONS] [-k V1,V2...] ADDRREG DATAREG [BANK [BANKREG]]\0ASyntax for flat address space:\0A isadump -f [OPTIONS] ADDRESS [RANGE [BANK [BANKREG]]]\0AOptions:\0A -k\09Super-I/O configuration access key\0A -f\09Enable flat address space mode\0A -y\09Assume affirmative answer to all questions\0A -W\09Read and display word (16-bit) values\0A -L\09Read and display long (32-bit) values\0A\00"
define void @help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([402 x i8], [402 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ non_existent(int);
void hip1(void (*f)(void (*)()), void (*g)()) {
  non_existent(2);
  f(g);
}


x86 assembly (clang, -O0):
<hip1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%edi
call   1030 <non_existent@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hip1>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x2,%edi
call   1030 <non_existent@plt>
mov    %r14,%rdi
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    *%rax

LLVM IR (-O0):
define void @hip1(void (void (...)*)* %0, void (...)* %1) {
%3 = alloca void (void (...)*)*
%4 = alloca void (...)*
store void (void (...)*)* %0, void (void (...)*)** %3
store void (...)* %1, void (...)** %4
%5 = call i32 @non_existent(i32 2)
%6 = load void (void (...)*)*, void (void (...)*)** %3
%7 = load void (...)*, void (...)** %4
ret void
}

LLVM IR (-O2):
define void @hip1(void (void (...)*)* nocapture %0, void (...)* %1) {
%3 = tail call i32 @non_existent(i32 2)
tail call void %0(void (...)* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ d2i_of_void;
typedef int /*<<< orphan*/ RSA;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *PEM_ASN1_read(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                  int /*<<< orphan*/ *, void **,
                                  int /*<<< orphan*/ *, void *);
int /*<<< orphan*/ PEM_STRING_PUBLIC;
scalar_t__ d2i_RSA_PUBKEY;
RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, pem_password_cb *cb, void *u) {
  return PEM_ASN1_read((d2i_of_void *)d2i_RSA_PUBKEY, PEM_STRING_PUBLIC, fp,
                       (void **)x, cb, u);
}


x86 assembly (clang, -O0):
<PEM_read_RSA_PUBKEY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%rdi
mov    0x2eaf(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
call   1030 <PEM_ASN1_read@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_read_RSA_PUBKEY>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ead(%rip),%rax
mov    (%rax),%rdi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
jmp    1030 <PEM_ASN1_read@plt>

LLVM IR (-O0):
@d2i_RSA_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32* @PEM_read_RSA_PUBKEY(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32**
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32** %1, i32*** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = load i64, i64* @d2i_RSA_PUBKEY
%10 = inttoptr i64 %9 to i32*
%11 = load i32, i32* @PEM_STRING_PUBLIC
%12 = load i32*, i32** %5
%13 = load i32**, i32*** %6
%14 = bitcast i32** %13 to i8**
%15 = load i32*, i32** %7
%16 = load i8*, i8** %8
%17 = call i32* @PEM_ASN1_read(i32* %10, i32 %11, i32* %12, i8** %14, i32* %15, i8* %16)
ret i32* %17
}

LLVM IR (-O2):
@d2i_RSA_PUBKEY = global i64 0
@PEM_STRING_PUBLIC = global i32 0
define i32* @PEM_read_RSA_PUBKEY(i32* %0, i32** %1, i32* %2, i8* %3) {
%5 = load i64, i64* @d2i_RSA_PUBKEY
%6 = inttoptr i64 %5 to i32*
%7 = load i32, i32* @PEM_STRING_PUBLIC
%8 = bitcast i32** %1 to i8**
%9 = tail call i32* @PEM_ASN1_read(i32* %6, i32 %7, i32* %0, i8** %8, i32* %2, i8* %3)
ret i32* %9
}
execl(f, a) char *f, *a;
{ ; }


x86 assembly (clang, -O0):
<execl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @execl(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
void clamp_buf_len(size_t *expect_buf_len, size_t *actual_buf_len) {
  if (*expect_buf_len > 4096) {
    *expect_buf_len = 4096;
  }
  if (*actual_buf_len > 4096) {
    *actual_buf_len = 4096;
  }
}


x86 assembly (clang, -O0):
<clamp_buf_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x1000,(%rax)
jbe    1128 <clamp_buf_len+0x28>
mov    -0x8(%rbp),%rax
movq   $0x1000,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x1000,(%rax)
jbe    1144 <clamp_buf_len+0x44>
mov    -0x10(%rbp),%rax
movq   $0x1000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_buf_len>:
cmpq   $0x1001,(%rdi)
jae    1113 <clamp_buf_len+0x13>
cmpq   $0x1001,(%rsi)
jae    1123 <clamp_buf_len+0x23>
ret
movq   $0x1000,(%rdi)
cmpq   $0x1001,(%rsi)
jb     1112 <clamp_buf_len+0x12>
movq   $0x1000,(%rsi)
ret

LLVM IR (-O0):
define void @clamp_buf_len(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* %5
%7 = icmp ugt i64 %6, 4096
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64*, i64** %3
store i64 4096, i64* %9
br label %10
10: ; preds = %8, %2
%11 = load i64*, i64** %4
%12 = load i64, i64* %11
%13 = icmp ugt i64 %12, 4096
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i64*, i64** %4
store i64 4096, i64* %15
br label %16
16: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
define void @clamp_buf_len(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = icmp ugt i64 %3, 4096
br i1 %4, label %5, label %6
5: ; preds = %2
store i64 4096, i64* %0
br label %6
6: ; preds = %5, %2
%7 = load i64, i64* %1
%8 = icmp ugt i64 %7, 4096
br i1 %8, label %9, label %10
9: ; preds = %6
store i64 4096, i64* %1
br label %10
10: ; preds = %9, %6
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ send_event;
};
typedef TYPE_1__ XUnmapEvent;

/* Variables and functions */
int get_XUnmapEvent_send_event(void *_p) {
  return (int)((XUnmapEvent *)_p)->send_event;
}


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

x86 assembly (clang, -O2):
<get_XUnmapEvent_send_event>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XUnmapEvent_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
int main() {
  int p;
  char x1;
  {
    if (p)
      x1 = 0;
    else
      x1 = 127;
  };
  char x2 = x1 + 1;
  char y1 = x2 >> 3;
  return y1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111e <main+0x1e>
movb   $0x0,-0x9(%rbp)
jmp    1122 <main+0x22>
movb   $0x7f,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
add    $0x1,%eax
mov    %al,-0xa(%rbp)
movsbl -0xa(%rbp),%eax
sar    $0x3,%eax
mov    %al,-0xb(%rbp)
movsbl -0xb(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 -16
}
/* Variables and functions */
double floor(double);
double principal_value_0(double theta) {
  theta -= 2.0 * 3.14159265358979323846 *
           floor(theta / (2.0 * 3.14159265358979323846));
  if (theta < 3.14159265358979323846)
    return (theta);
  else
    return (theta - 2.0 * 3.14159265358979323846);
}


x86 assembly (clang, -O0):
<principal_value_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee6(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0xec8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeab(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116f <principal_value_0+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1185 <principal_value_0+0x75>
movsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<principal_value_0>:
push   %rax
movsd  %xmm0,(%rsp)
divsd  0xee2(%rip),%xmm0
call   1030 <floor@plt>
movsd  0xedd(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  (%rsp),%xmm0
movapd %xmm0,%xmm2
cmpltsd 0xecf(%rip),%xmm2
addsd  %xmm0,%xmm1
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @principal_value_0(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fdiv double %4, 0x401921FB54442D18
%6 = call double @llvm.floor.f64(double %5)
%7 = load double, double* %3
%8 = call double @llvm.fmuladd.f64(double 0xC01921FB54442D18, double %6, double %7)
store double %8, double* %3
%9 = load double, double* %3
%10 = fcmp olt double %9, 0x400921FB54442D18
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load double, double* %3
store double %12, double* %2
br label %16
13: ; preds = %1
%14 = load double, double* %3
%15 = fsub double %14, 0x401921FB54442D18
store double %15, double* %2
br label %16
16: ; preds = %13, %11
%17 = load double, double* %2
ret double %17
}

LLVM IR (-O2):
define double @principal_value_0(double %0) {
%2 = fdiv double %0, 0x401921FB54442D18
%3 = tail call double @llvm.floor.f64(double %2)
%4 = tail call double @llvm.fmuladd.f64(double %3, double 0xC01921FB54442D18, double %0)
%5 = fcmp olt double %4, 0x400921FB54442D18
%6 = fadd double %4, 0xC01921FB54442D18
%7 = select i1 %5, double %4, double %6
ret double %7
}
int main(int argc, char **argv) {
  (void)argc;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int xfuse_clear_clip_dir(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @xfuse_clear_clip_dir() {
ret i32 0
}
void inplace_swap(char *x, char *y) {
  *y = *x ^ *y;
  *x = *x ^ *y;
  *y = *x ^ *y;
}


x86 assembly (clang, -O0):
<inplace_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inplace_swap>:
mov    (%rsi),%al
xor    (%rdi),%al
mov    %al,(%rsi)
xor    (%rdi),%al
mov    %al,(%rdi)
xor    %al,(%rsi)
ret

LLVM IR (-O0):
define void @inplace_swap(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = xor i32 %7, %10
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %4
store i8 %12, i8* %13
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = xor i32 %16, %19
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %3
store i8 %21, i8* %22
%23 = load i8*, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = load i8*, i8** %4
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = xor i32 %25, %28
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %4
store i8 %30, i8* %31
ret void
}

LLVM IR (-O2):
define void @inplace_swap(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = xor i8 %4, %3
store i8 %5, i8* %1
%6 = load i8, i8* %0
%7 = xor i8 %6, %5
store i8 %7, i8* %0
%8 = load i8, i8* %1
%9 = xor i8 %8, %7
store i8 %9, i8* %1
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ system(char *);
char getch() {
  char c;
  system("stty raw");
  c = getchar();
  system("stty sane");
  return (c);
}


x86 assembly (clang, -O0):
<getch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
lea    0xec4(%rip),%rdi
call   1030 <system@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getch>:
push   %rbx
lea    0xed8(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
lea    0xecc(%rip),%rdi
call   1030 <system@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"stty raw\00"
@.str.1 = [10 x i8] c"stty sane\00"
define signext i8 @getch() {
%1 = alloca i8
%2 = call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8, i8* %1
ret i8 %5
}

LLVM IR (-O2):
@.str = [9 x i8] c"stty raw\00"
@.str.1 = [10 x i8] c"stty sane\00"
define signext i8 @getch() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = tail call i32 @system(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ msg(int, char *);
void drive_select(int drive) {
  msg(0x100, "drive_select called\n");
  exit(1);
}


x86 assembly (clang, -O0):
<drive_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x100,%edi
lea    0xec9(%rip),%rsi
call   1040 <msg@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<drive_select>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x100,%edi
call   1040 <msg@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

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

LLVM IR (-O2):
@.str = [21 x i8] c"drive_select called\0A\00"
define void @drive_select(i32 %0) {
%2 = tail call i32 @msg(i32 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ tap_todo(char *);
int /*<<< orphan*/ test();
void run(void) {
  test();
  tap_todo("FOO TODO");
  test();
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <test@plt>
lea    0xece(%rip),%rdi
call   1030 <tap_todo@plt>
mov    $0x0,%al
call   1040 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
push   %rax
xor    %eax,%eax
call   1040 <test@plt>
lea    0xed1(%rip),%rdi
call   1030 <tap_todo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"FOO TODO\00"
define void @run() {
%1 = call i32 (...) @test()
%2 = call i32 @tap_todo(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test()
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"FOO TODO\00"
define void @run() {
%1 = tail call i32 (...) @test()
%2 = tail call i32 @tap_todo(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @test()
ret void
}
void XSetTSOrigin() {}


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

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

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

LLVM IR (-O2):
define void @XSetTSOrigin() {
ret void
}
/* Variables and functions */
double exp(double);
double fx(double x) { return exp(-x); }


x86 assembly (clang, -O0):
<fx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fx>:
xorps  0xee9(%rip),%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @fx(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = call double @exp(double %4)
ret double %5
}

LLVM IR (-O2):
define double @fx(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ bar(void *, void *, void *);
void test_2(void *p, void *q, void *r) {
  bar(p, q, r);
  bar(NULL, q, r);
  bar(p, NULL, r);
  bar(p, q, NULL);
}


x86 assembly (clang, -O0):
<test_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <bar@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <bar@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <bar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <bar@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <bar@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <bar@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @test_2(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** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @bar(i8* %7, i8* %8, i8* %9)
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @bar(i8* null, i8* %11, i8* %12)
%14 = load i8*, i8** %4
%15 = load i8*, i8** %6
%16 = call i32 @bar(i8* %14, i8* null, i8* %15)
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i32 @bar(i8* %17, i8* %18, i8* null)
ret void
}

LLVM IR (-O2):
define void @test_2(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @bar(i8* %0, i8* %1, i8* %2)
%5 = tail call i32 @bar(i8* null, i8* %1, i8* %2)
%6 = tail call i32 @bar(i8* %0, i8* null, i8* %2)
%7 = tail call i32 @bar(i8* %0, i8* %1, i8* null)
ret void
}
void _backlight_off(void) { (*(volatile unsigned long *)0x80000330) &= ~0x10; }


x86 assembly (clang, -O0):
<_backlight_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x80000330,%eax
mov    (%rax),%rcx
and    $0xffffffffffffffef,%rcx
mov    $0x80000330,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_backlight_off>:
mov    $0x80000330,%eax
andq   $0xffffffffffffffef,(%rax)
ret

LLVM IR (-O0):
define void @_backlight_off() {
%1 = load volatile i64, i64* inttoptr (i64 2147484464 to i64*)
%2 = and i64 %1, -17
store volatile i64 %2, i64* inttoptr (i64 2147484464 to i64*)
ret void
}

LLVM IR (-O2):
define void @_backlight_off() {
%1 = load volatile i64, i64* inttoptr (i64 2147484464 to i64*)
%2 = and i64 %1, -17
store volatile i64 %2, i64* inttoptr (i64 2147484464 to i64*)
ret void
}
/* Variables and functions */
int strlen(char *);
void wfile_addslash(char *dst) {
  int i;
  i = strlen(dst);
  dst[i] = '/';
  dst[i + 1] = '\0';
}


x86 assembly (clang, -O0):
<wfile_addslash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x2f,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_addslash>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
movw   $0x2f,(%rbx,%rax,1)
pop    %rbx
ret

LLVM IR (-O0):
define void @wfile_addslash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 47, i8* %9
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %10, i64 %13
store i8 0, i8* %14
ret void
}

LLVM IR (-O2):
define void @wfile_addslash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 47, i8* %4
%5 = add nsw i32 %2, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %7
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
void fgets_or_exit(char *buffer, int size, FILE *stream) {
  if (fgets(buffer, size, stream) == NULL)
    exit(1);
}


x86 assembly (clang, -O0):
<fgets_or_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
cmp    $0x0,%rax
jne    1157 <fgets_or_exit+0x37>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets_or_exit>:
push   %rax
call   1030 <fgets@plt>
test   %rax,%rax
je     112d <fgets_or_exit+0xd>
pop    %rax
ret
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @fgets_or_exit(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32* @fgets(i8* %0, i32 %1, i32* %2)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %3
ret void
}
/* Type definitions */
struct dirent {
  int dummy;
};

/* Variables and functions */
int alphasort2(struct dirent const **, struct dirent const **);
int antialphasort2(const struct dirent **a, const struct dirent **b) {
  return alphasort2(b, a);
}


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

x86 assembly (clang, -O2):
<antialphasort2>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <alphasort2@plt>

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

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @antialphasort2(%struct.dirent** %0, %struct.dirent** %1) {
%3 = tail call i32 @alphasort2(%struct.dirent** %1, %struct.dirent** %0)
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t rfc4175_get_line_offset(const uint8_t *buf) {
  return ((buf[4] & 0x7f) << 8) | buf[5];
}


x86 assembly (clang, -O0):
<rfc4175_get_line_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
and    $0x7f,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x14(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfc4175_get_line_offset>:
mov    0x10(%rdi),%eax
and    $0x7f,%eax
shl    $0x8,%eax
or     0x14(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rfc4175_get_line_offset(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 4
%5 = load i32, i32* %4
%6 = and i32 %5, 127
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 5
%10 = load i32, i32* %9
%11 = or i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @rfc4175_get_line_offset(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = and i32 %4, 32512
%6 = getelementptr inbounds i32, i32* %0, i64 5
%7 = load i32, i32* %6
%8 = or i32 %5, %7
ret i32 %8
}