xunge/DecIR huggingface dataset:
void xfree(s) char *s;
{ free(s); }


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

x86 assembly (clang, -O2):
<xfree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @xfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
int init_ext(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @init_ext() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Send_MPlayer_Command(int, int /*<<< orphan*/);
void MPlayer_Next() { Send_MPlayer_Command(0x02, 0); }


x86 assembly (clang, -O0):
<MPlayer_Next>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <Send_MPlayer_Command@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPlayer_Next>:
mov    $0x2,%edi
xor    %esi,%esi
jmp    1030 <Send_MPlayer_Command@plt>

LLVM IR (-O0):
define void @MPlayer_Next() {
%1 = call i32 @Send_MPlayer_Command(i32 2, i32 0)
ret void
}

LLVM IR (-O2):
define void @MPlayer_Next() {
%1 = tail call i32 @Send_MPlayer_Command(i32 2, i32 0)
ret void
}
/* Variables and functions */
int O_RDWR;
int O_WRONLY;
int libc_open64(char const *, int);
int /*<<< orphan*/ watch_log(char *, char const *);
int open64(const char *path, int flags, ...) {
  if ((flags & O_WRONLY) || (flags & O_RDWR)) {
    watch_log("open %s w\n", path);
  }
  return libc_open64(path, flags);
}


x86 assembly (clang, -O0):
<open64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e97(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1159 <open64+0x39>
mov    -0xc(%rbp),%eax
mov    0x2e9a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1169 <open64+0x49>
mov    -0x8(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1040 <watch_log@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <libc_open64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open64>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    0x2ea0(%rip),%rax
test   %esi,(%rax)
jne    113f <open64+0x1f>
mov    0x2ead(%rip),%rax
test   %ebx,(%rax)
je     114e <open64+0x2e>
lea    0xeba(%rip),%rdi
mov    %r14,%rsi
call   1040 <watch_log@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <libc_open64@plt>

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_RDWR = global i32 0
@.str = [11 x i8] c"open %s w\0A\00"
define i32 @open64(i8* %0, i32 %1, ...) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* @O_WRONLY
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* @O_RDWR
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9, %2
%15 = load i8*, i8** %3
%16 = call i32 @watch_log(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %9
%18 = load i8*, i8** %3
%19 = load i32, i32* %4
%20 = call i32 @libc_open64(i8* %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_RDWR = global i32 0
@.str = [11 x i8] c"open %s w\0A\00"
define i32 @open64(i8* %0, i32 %1, ...) {
%3 = load i32, i32* @O_WRONLY
%4 = and i32 %3, %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @O_RDWR
%8 = and i32 %7, %1
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6, %2
%11 = tail call i32 @watch_log(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %6
%13 = tail call i32 @libc_open64(i8* %0, i32 %1)
ret i32 %13
}
void av_frame_set_pkt_size() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_set_pkt_size() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_GREEN_LED_PIN() { clear_io_bit(0x37, 6); }


x86 assembly (clang, -O0):
<TOSH_CLR_GREEN_LED_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
mov    $0x6,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_GREEN_LED_PIN>:
mov    $0x37,%edi
mov    $0x6,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_GREEN_LED_PIN() {
%1 = call i32 @clear_io_bit(i32 55, i32 6)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_GREEN_LED_PIN() {
%1 = tail call i32 @clear_io_bit(i32 55, i32 6)
ret void
}
/* Variables and functions */
char tolower(char);
void strToLower(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    str[i] = tolower(str[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<strToLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <strToLower+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <strToLower+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strToLower>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <strToLower+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strToLower+0x10>
pop    %rbx
ret

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

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


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

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

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

LLVM IR (-O2):
define void @DisableIntP1() {
ret void
}
/* Type definitions */
struct rlimit {
  int member_0;
  int member_1;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_MEMLOCK;
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int test();
int main(void) {
  struct rlimit r = {1 << 20, 1 << 20};
  setrlimit(RLIMIT_MEMLOCK, &r);
  return test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <setrlimit@plt>
mov    $0x0,%al
call   1040 <test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movabs $0x10000000100000,%rax
mov    %rax,(%rsp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <setrlimit@plt>
xor    %eax,%eax
call   1040 <test@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@__const.main.r = %struct.rlimit { i32 1048576, i32 1048576 }
@RLIMIT_MEMLOCK = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rlimit
store i32 0, i32* %1
%3 = bitcast %struct.rlimit* %2 to i8*
%4 = load i32, i32* @RLIMIT_MEMLOCK
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %2)
%6 = call i32 (...) @test()
ret i32 %6
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_MEMLOCK = global i32 0
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to %struct.rlimit*
%3 = bitcast i64* %1 to i8*
store i64 4503599628419072, i64* %1
%4 = load i32, i32* @RLIMIT_MEMLOCK
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %2)
%6 = call i32 (...) @test()
ret i32 %6
}
/* Variables and functions */
bool last_blank_input_page(void) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @last_blank_input_page() {
ret i32 1
}
unsigned int ldw(unsigned int *p) { return p[7]; }


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

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

LLVM IR (-O0):
define i32 @ldw(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 7
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @ldw(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 7
%3 = load i32, i32* %2
ret i32 %3
}
void RTSemPong(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSemPong() {
ret void
}
double yardsToInches(double yards) { return yards * 36.0; }


x86 assembly (clang, -O0):
<yardsToInches>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<yardsToInches>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @yardsToInches(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.600000e+01
ret double %4
}

LLVM IR (-O2):
define double @yardsToInches(double %0) {
%2 = fmul double %0, 3.600000e+01
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ mock_free(void *);
void umockalloc_free(void *ptr) { mock_free(ptr); }


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

x86 assembly (clang, -O2):
<umockalloc_free>:
jmp    1030 <mock_free@plt>

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

LLVM IR (-O2):
define void @umockalloc_free(i8* %0) {
%2 = tail call i32 @mock_free(i8* %0)
ret void
}
/* Variables and functions */
int yas_lis331dl_write_reg(unsigned char, unsigned char *, int);
int yas_lis331dl_write_reg_byte(unsigned char adr, unsigned char val) {
  return yas_lis331dl_write_reg(adr, &val, 1);
}


x86 assembly (clang, -O0):
<yas_lis331dl_write_reg_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0x2(%rbp),%rsi
mov    $0x1,%edx
movzbl -0x1(%rbp),%edi
call   1030 <yas_lis331dl_write_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_lis331dl_write_reg_byte>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <yas_lis331dl_write_reg@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @yas_lis331dl_write_reg_byte(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @yas_lis331dl_write_reg(i8 zeroext %0, i8* %3, i32 1)
ret i32 %4
}
/* Variables and functions */
short RandomInt(int);
short AssignNewAltitude(void) {
  short which, altitude;
  which = RandomInt(4);
  switch (which) {
  case 0:
    altitude = 65 << 4;
    break;
  case 1:
    altitude = 150 << 4;
    break;
  case 2:
    altitude = 245 << 4;
    break;
  case 3:
    altitude = 384 << 4;
    break;
  }
  return (altitude);
}


x86 assembly (clang, -O0):
<AssignNewAltitude>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <RandomInt@plt>
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1174 <AssignNewAltitude+0x64>
mov    -0x10(%rbp),%rax
lea    0xebc(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movw   $0x410,-0x4(%rbp)
jmp    1174 <AssignNewAltitude+0x64>
movw   $0x960,-0x4(%rbp)
jmp    1174 <AssignNewAltitude+0x64>
movw   $0xf50,-0x4(%rbp)
jmp    1174 <AssignNewAltitude+0x64>
movw   $0x1800,-0x4(%rbp)
movswl -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AssignNewAltitude>:
push   %rax
mov    $0x4,%edi
call   1030 <RandomInt@plt>
cwtl
add    $0xffffffff,%eax
mov    %eax,%ecx
shl    $0x4,%ecx
movabs $0x18000f500960,%rdx
shr    %cl,%rdx
cmp    $0x3,%eax
mov    $0x410,%eax
cmovb  %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @AssignNewAltitude() {
%1 = alloca i16
%2 = alloca i16
%3 = call signext i16 @RandomInt(i32 4)
store i16 %3, i16* %1
%4 = load i16, i16* %1
%5 = sext i16 %4 to i32
switch i32 %5, label %10 [
i32 0, label %6
i32 1, label %7
i32 2, label %8
i32 3, label %9
]
6: ; preds = %0
store i16 1040, i16* %2
br label %10
7: ; preds = %0
store i16 2400, i16* %2
br label %10
8: ; preds = %0
store i16 3920, i16* %2
br label %10
9: ; preds = %0
store i16 6144, i16* %2
br label %10
10: ; preds = %0, %9, %8, %7, %6
%11 = load i16, i16* %2
ret i16 %11
}

LLVM IR (-O2):
define signext i16 @AssignNewAltitude() {
%1 = tail call signext i16 @RandomInt(i32 4)
%2 = sext i16 %1 to i32
%3 = add nsw i32 %2, -1
%4 = icmp ult i32 %3, 3
%5 = zext i32 %3 to i48
%6 = shl nuw nsw i48 %5, 4
%7 = lshr i48 26388535970144, %6
%8 = trunc i48 %7 to i16
%9 = select i1 %4, i16 %8, i16 1040
ret i16 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void CatchSigUsr1(int signo) {
  char msg[] = "In SIGUSR1 handler\n";
  static int FirstTime = 1;
  exit(1);
}


x86 assembly (clang, -O0):
<CatchSigUsr1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed9(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
@__const.CatchSigUsr1.msg = [20 x i8] c"In SIGUSR1 handler\0A\00"
@CatchSigUsr1.FirstTime = internal global i32 1
define void @CatchSigUsr1(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 %0, i32* %2
%4 = bitcast [20 x i8]* %3 to i8*
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @CatchSigUsr1(i32 %0) {
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
int sendmsg(int, struct msghdr const *, int);
ssize_t xsendmsg(int sockfd, const struct msghdr *msg, int flags) {
  int sent = sendmsg(sockfd, msg, flags);
  if (sent == -1) {
    ;
  }
  return sent;
}


x86 assembly (clang, -O0):
<xsendmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <sendmsg@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1143 <xsendmsg+0x33>
jmp    1143 <xsendmsg+0x33>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsendmsg>:
jmp    1030 <sendmsg@plt>

LLVM IR (-O0):
%struct.msghdr = type { i32 }
define i32 @xsendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load %struct.msghdr*, %struct.msghdr** %5
%10 = load i32, i32* %6
%11 = call i32 @sendmsg(i32 %8, %struct.msghdr* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %3
br label %15
15: ; preds = %14, %3
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
define i32 @xsendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = tail call i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %2)
ret i32 %4
}
void g_rand_new_with_seed() {}


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

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

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

LLVM IR (-O2):
define void @g_rand_new_with_seed() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _getargv(int *, char ***);
int /*<<< orphan*/ monLock();
int /*<<< orphan*/ monUnlock();
void mon_getargv(int *argc, char ***argv) {
  monLock();
  _getargv(argc, argv);
  monUnlock();
}


x86 assembly (clang, -O0):
<mon_getargv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <monLock@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_getargv@plt>
mov    $0x0,%al
call   1050 <monUnlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mon_getargv>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <monLock@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <_getargv@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <monUnlock@plt>

LLVM IR (-O0):
define void @mon_getargv(i32* %0, i8*** %1) {
%3 = alloca i32*
%4 = alloca i8***
store i32* %0, i32** %3
store i8*** %1, i8**** %4
%5 = call i32 (...) @monLock()
%6 = load i32*, i32** %3
%7 = load i8***, i8**** %4
%8 = call i32 @_getargv(i32* %6, i8*** %7)
%9 = call i32 (...) @monUnlock()
ret void
}

LLVM IR (-O2):
define void @mon_getargv(i32* %0, i8*** %1) {
%3 = tail call i32 (...) @monLock()
%4 = tail call i32 @_getargv(i32* %0, i8*** %1)
%5 = tail call i32 (...) @monUnlock()
ret void
}
void nothingLoop() {}


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

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

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

LLVM IR (-O2):
define void @nothingLoop() {
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ nomem();
void *xcalloc(size_t n, size_t m) {
  void *v;
  v = calloc(n, m);
  if (!v)
    nomem();
  return v;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <xcalloc+0x33>
mov    $0x0,%al
call   1040 <nomem@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xcalloc+0x15>
xor    %eax,%eax
call   1040 <nomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = call i32 (...) @nomem()
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @nomem()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
struct modemchannel {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hdlc_receive(struct modemchannel *, unsigned char const *,
                                unsigned int);
void pktput(struct modemchannel *chan, const unsigned char *data,
            unsigned int len) {
  hdlc_receive(chan, data, len);
}


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

x86 assembly (clang, -O2):
<pktput>:
jmp    1030 <hdlc_receive@plt>

LLVM IR (-O0):
%struct.modemchannel = type { i32 }
define void @pktput(%struct.modemchannel* %0, i8* %1, i32 %2) {
%4 = alloca %struct.modemchannel*
%5 = alloca i8*
%6 = alloca i32
store %struct.modemchannel* %0, %struct.modemchannel** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.modemchannel*, %struct.modemchannel** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @hdlc_receive(%struct.modemchannel* %7, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
%struct.modemchannel = type { i32 }
define void @pktput(%struct.modemchannel* %0, i8* %1, i32 %2) {
%4 = tail call i32 @hdlc_receive(%struct.modemchannel* %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_charfunc(void) { return GppcFinfoV1(); }


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

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

LLVM IR (-O0):
define i8* @pg_finfo_charfunc() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_charfunc() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
float check_float() { return 0; }


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

x86 assembly (clang, -O2):
<check_float>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @check_float() {
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @check_float() {
ret float 0.000000e+00
}
int do_073() { return 73; }


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

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

LLVM IR (-O0):
define i32 @do_073() {
ret i32 73
}

LLVM IR (-O2):
define i32 @do_073() {
ret i32 73
}
void DHparams_print(void) {}


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

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

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

LLVM IR (-O2):
define void @DHparams_print() {
ret void
}
int test_imm_AAint16_mem(short *val) {
  return ((*val) & (0xAA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_AAint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 170
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ctfail();
int /*<<< orphan*/ ctlog(char *);
void cttestfail() {
  return;
  ctlog("first");
  ctfail();
  ctlog("second");
  ctfail();
  ctlog("third");
}


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

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

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

LLVM IR (-O2):
define void @cttestfail() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
void main() {
  char c = 32;
  int i;
  for (i = 32; i <= 255; i++) {
    printf("%c\n", c++);
  }
  system("pause");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x20,-0x1(%rbp)
movl   $0x20,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jg     1168 <main+0x48>
mov    -0x1(%rbp),%al
mov    %al,%cl
add    $0x1,%cl
mov    %cl,-0x1(%rbp)
movsbl %al,%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <main+0x13>
lea    0xe95(%rip),%rdi
call   1030 <system@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x20000000,%ebp
mov    $0xe0,%ebx
lea    0xecb(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%esi
sar    $0x18,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1000000,%ebp
add    $0xffffffff,%ebx
jne    1140 <main+0x20>
lea    0xea5(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define void @main() {
%1 = alloca i8
%2 = alloca i32
store i8 32, i8* %1
store i32 32, i32* %2
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 255
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i8, i8* %1
%8 = add i8 %7, 1
store i8 %8, i8* %1
%9 = sext i8 %7 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %3
14: ; preds = %3
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [6 x i8] c"pause\00"
define void @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 32, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = shl i32 %2, 24
%5 = ashr exact i32 %4, 24
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %3, 256
br i1 %7, label %8, label %1
8: ; preds = %1
%9 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void term_error() {
  fprintf(stderr, "An error occured\n");
  perror("");
  exit(1);
}


x86 assembly (clang, -O0):
<term_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xec1(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<term_error>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xec4(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"An error occured\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @term_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"An error occured\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define void @term_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
void c64_sid_block_end(void) {}


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

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

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

LLVM IR (-O2):
define void @c64_sid_block_end() {
ret void
}
/* Variables and functions */
int foo88(int);
int /*<<< orphan*/ link_error();
int test888(void) {
  static int l;
  extern int foo(int *);
  int v1;
  static int sarr[10];
  l = 8;
  sarr[0] = 4;
  v1 = l;
  if (v1 != 8)
    link_error();
  foo(sarr);
  l = foo88(l);
  return v1 + sarr[0];
}


x86 assembly (clang, -O0):
<test888>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x8,0x2f0e(%rip)
movl   $0x4,0x2f14(%rip)
mov    0x2efe(%rip),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
je     1166 <test888+0x36>
mov    $0x0,%al
call   1050 <link_error@plt>
lea    0x2ef3(%rip),%rdi
call   1030 <foo@plt>
mov    0x2ed8(%rip),%edi
call   1040 <foo88@plt>
mov    %eax,0x2ecd(%rip)
mov    -0x4(%rbp),%eax
add    0x2ed4(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test888>:
push   %rax
movl   $0x8,0x2f15(%rip)
movl   $0x4,0x2f1b(%rip)
lea    0x2f14(%rip),%rdi
call   1030 <foo@plt>
mov    0x2ef9(%rip),%edi
call   1040 <foo88@plt>
mov    %eax,0x2eee(%rip)
mov    0x2ef8(%rip),%eax
add    $0x8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@test888.l = internal global i32 0
@test888.sarr = internal global [10 x i32] zeroinitializer
define i32 @test888() {
%1 = alloca i32
store i32 8, i32* @test888.l
store i32 4, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0)
%2 = load i32, i32* @test888.l
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 8
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @link_error()
br label %7
7: ; preds = %5, %0
%8 = call i32 @foo(i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0))
%9 = load i32, i32* @test888.l
%10 = call i32 @foo88(i32 %9)
store i32 %10, i32* @test888.l
%11 = load i32, i32* %1
%12 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0)
%13 = add nsw i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
@test888.l = internal unnamed_addr global i32 0
@test888.sarr = internal global [10 x i32] zeroinitializer
define i32 @test888() {
store i32 8, i32* @test888.l
store i32 4, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0)
%1 = tail call i32 @foo(i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0))
%2 = load i32, i32* @test888.l
%3 = tail call i32 @foo88(i32 %2)
store i32 %3, i32* @test888.l
%4 = load i32, i32* getelementptr inbounds ([10 x i32], [10 x i32]* @test888.sarr, i64 0, i64 0)
%5 = add nsw i32 %4, 8
ret i32 %5
}
void update_var(int increase, int *sum, int *low, int *high, int i) {
  *sum += increase;
  *high = i;
  if (*low == -1) {
    *low = i;
  }
}


x86 assembly (clang, -O0):
<update_var>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1141 <update_var+0x41>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_var>:
add    %edi,(%rsi)
mov    %r8d,(%rcx)
cmpl   $0xffffffff,(%rdx)
je     110b <update_var+0xb>
ret
mov    %r8d,(%rdx)
ret

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

LLVM IR (-O2):
define void @update_var(i32 %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture writeonly %3, i32 %4) {
%6 = load i32, i32* %1
%7 = add nsw i32 %6, %0
store i32 %7, i32* %1
store i32 %4, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %5
store i32 %4, i32* %2
br label %11
11: ; preds = %10, %5
ret void
}
void memzero(void *data, unsigned nbytes) {
  unsigned char *charp = (unsigned char *)data;
  while (nbytes-- > 0)
    *charp++ = 0;
}


x86 assembly (clang, -O0):
<memzero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jbe    113e <memzero+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    1113 <memzero+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<memzero>:
test   %esi,%esi
je     1122 <memzero+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @memzero(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ callee2();
int /*<<< orphan*/ indirect2();
int /*<<< orphan*/ scc3();
void scc2() {
  scc3();
  callee2();
  indirect2();
}


x86 assembly (clang, -O0):
<scc2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <scc3@plt>
mov    $0x0,%al
call   1040 <callee2@plt>
mov    $0x0,%al
call   1030 <indirect2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<scc2>:
push   %rax
xor    %eax,%eax
call   1050 <scc3@plt>
xor    %eax,%eax
call   1040 <callee2@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <indirect2@plt>

LLVM IR (-O0):
define void @scc2() {
%1 = call i32 (...) @scc3()
%2 = call i32 (...) @callee2()
%3 = call i32 (...) @indirect2()
ret void
}

LLVM IR (-O2):
define void @scc2() {
%1 = tail call i32 (...) @scc3()
%2 = tail call i32 (...) @callee2()
%3 = tail call i32 (...) @indirect2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xb8() {
  Assert_real((iscntrl(184) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              925, ("iscntrl should be 0 for 0xb8"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0xb8>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x39d,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0xb8>:
push   %rax
mov    $0xb8,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x39d,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xb8\00"
define void @t_iscntrl_0xb8() {
%1 = call i64 @iscntrl(i32 184)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 925, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xb8\00"
define void @t_iscntrl_0xb8() {
%1 = tail call i64 @iscntrl(i32 184)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 925, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int default_is_printable_fn(unsigned char c) {
  return (c >= 0x20) && (c <= 0x7e);
}


x86 assembly (clang, -O0):
<default_is_printable_fn>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <default_is_printable_fn+0x29>
movzbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_is_printable_fn>:
add    $0xe0,%dil
xor    %eax,%eax
cmp    $0x5f,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @default_is_printable_fn(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp sle i32 %8, 126
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @default_is_printable_fn(i8 zeroext %0) {
%2 = add i8 %0, -32
%3 = icmp ult i8 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
short int cast_ushort_short_fast(unsigned short int x) { return (short int)x; }


x86 assembly (clang, -O0):
<cast_ushort_short_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @cast_ushort_short_fast(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @cast_ushort_short_fast(i16 returned zeroext %0) {
ret i16 %0
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
uint16_t w5100_sock_reg_get(uint16_t sn_reg, int socket) {
  return 0x0400 + sn_reg + (socket * 0x0100);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x400,%rax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
shl    $0x8,%esi
movslq %esi,%rax
add    %rdi,%rax
add    $0x400,%rax
ret

LLVM IR (-O0):
define i64 @w5100_sock_reg_get(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = add nsw i64 1024, %5
%7 = load i32, i32* %4
%8 = mul nsw i32 %7, 256
%9 = sext i32 %8 to i64
%10 = add nsw i64 %6, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @w5100_sock_reg_get(i64 %0, i32 %1) {
%3 = add nsw i64 %0, 1024
%4 = shl nsw i32 %1, 8
%5 = sext i32 %4 to i64
%6 = add nsw i64 %3, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ sig_catch(int /*<<< orphan*/, int /*<<< orphan*/);
void sig_pipedefault() { sig_catch(SIGPIPE, SIG_DFL); }


x86 assembly (clang, -O0):
<sig_pipedefault>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
call   1030 <sig_catch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_pipedefault>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
jmp    1030 <sig_catch@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_DFL = global i32 0
define void @sig_pipedefault() {
%1 = load i32, i32* @SIGPIPE
%2 = load i32, i32* @SIG_DFL
%3 = call i32 @sig_catch(i32 %1, i32 %2)
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_DFL = global i32 0
define void @sig_pipedefault() {
%1 = load i32, i32* @SIGPIPE
%2 = load i32, i32* @SIG_DFL
%3 = tail call i32 @sig_catch(i32 %1, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t cpu_to_le16(uint16_t v) { return (v); }


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

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

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

LLVM IR (-O2):
define i32 @cpu_to_le16(i32 returned %0) {
ret i32 %0
}
void doit() {
  __asm__("movl    $54, %eax\n"
          "movl    $0, %ebx\n"
          "movl    $0x5422, %ecx\n"
          "movl    $0, %edx\n"
          "int     $0x80\n");
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x36,%eax
mov    $0x0,%ebx
mov    $0x5422,%ecx
mov    $0x0,%edx
int    $0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
mov    $0x36,%eax
mov    $0x0,%ebx
mov    $0x5422,%ecx
mov    $0x0,%edx
int    $0x80
ret

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

LLVM IR (-O2):
define void @doit() {
tail call void asm sideeffect "movl $$54, %eax\0Amovl $$0, %ebx\0Amovl $$0x5422, %ecx\0Amovl $$0, %edx\0Aint $$0x80\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int vdeFun_n_in(void) { return 4; }


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

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

LLVM IR (-O0):
define i32 @vdeFun_n_in() {
ret i32 4
}

LLVM IR (-O2):
define i32 @vdeFun_n_in() {
ret i32 4
}
/* Variables and functions */
scalar_t__ EFAULT;
int /*<<< orphan*/ abort();
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *getcwd(void *, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (getcwd((void *)-1, 4096) != NULL || errno != EFAULT)
    abort();
  printf("pass\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1050 <getcwd@plt>
cmp    $0x0,%rax
jne    118b <main+0x4b>
mov    0x2e60(%rip),%rax
mov    (%rax),%rax
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%rax
je     1192 <main+0x52>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffffffffffff,%rdi
mov    $0x1000,%esi
call   1050 <getcwd@plt>
test   %rax,%rax
jne    1180 <main+0x40>
mov    0x2e7a(%rip),%rax
mov    (%rax),%rax
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%rax
jne    1180 <main+0x40>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@errno = global i64 0
@EFAULT = global i64 0
@.str = [6 x i8] c"pass\0A\00"
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 = call i32* @getcwd(i8* inttoptr (i64 -1 to i8*), i32 4096)
%7 = icmp ne i32* %6, null
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i64, i64* @errno
%10 = load i64, i64* @EFAULT
%11 = icmp ne i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %8, %2
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@errno = global i64 0
@EFAULT = global i64 0
@str = [5 x i8] c"pass\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @getcwd(i8* inttoptr (i64 -1 to i8*), i32 4096)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = load i64, i64* @EFAULT
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %5, %2
%10 = tail call i32 (...) @abort()
unreachable
11: ; preds = %5
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 0)
unreachable
}
int main(int argc, char **argv) {
  unsigned x = argc + 4;
  return ((x << 20) | (x >> 12)) + 7;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x14,%eax
mov    -0x14(%rbp),%ecx
shr    $0xc,%ecx
or     %ecx,%eax
add    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0x4(%rdi),%eax
rol    $0x14,%eax
add    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 4
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = shl i32 %9, 20
%11 = load i32, i32* %6
%12 = lshr i32 %11, 12
%13 = or i32 %10, %12
%14 = add i32 %13, 7
ret i32 %14
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = add nsw i32 %0, 4
%4 = tail call i32 @llvm.fshl.i32(i32 %3, i32 %3, i32 20)
%5 = add i32 %4, 7
ret i32 %5
}