xunge/DecIR huggingface dataset:
int PopCount(long b) {
  int c = 0;
  b++;
  while (b) {
    b &= b - 1;
    c++;
  }
  return c;
}


x86 assembly (clang, -O0):
<PopCount>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1144 <PopCount+0x44>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111b <PopCount+0x1b>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PopCount>:
xor    %eax,%eax
inc    %rdi
je     111c <PopCount+0x1c>
xor    %eax,%eax
nopl   0x0(%rax)
lea    -0x1(%rdi),%rcx
add    $0x1,%eax
and    %rcx,%rdi
jne    1110 <PopCount+0x10>
ret

LLVM IR (-O0):
define i32 @PopCount(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
%4 = load i64, i64* %2
%5 = add nsw i64 %4, 1
store i64 %5, i64* %2
br label %6
6: ; preds = %9, %1
%7 = load i64, i64* %2
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i64, i64* %2
%11 = sub nsw i64 %10, 1
%12 = load i64, i64* %2
%13 = and i64 %12, %11
store i64 %13, i64* %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %6
16: ; preds = %6
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @PopCount(i64 %0) {
%2 = add nsw i64 %0, 1
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %9, %4 ], [ 0, %1 ]
%6 = phi i64 [ %8, %4 ], [ %2, %1 ]
%7 = add nsw i64 %6, -1
%8 = and i64 %7, %6
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i64 %8, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ val;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *, int, int, int);
scalar_t__ setsockopt(int, int, int, int *, int);
void do_setsockopt(int fd, int level, int optname, int val) {
  if (setsockopt(fd, level, optname, &val, sizeof(val)))
    error(1, errno, "setsockopt %d.%d: %d", level, optname, val);
}


x86 assembly (clang, -O0):
<do_setsockopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
je     117b <do_setsockopt+0x5b>
mov    0x2e83(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    $0x1,%edi
lea    0xe8a(%rip),%rdx
call   1040 <error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_setsockopt>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
je     1164 <do_setsockopt+0x44>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
mov    0x4(%rsp),%r9d
lea    0xeab(%rip),%rdx
mov    $0x1,%edi
mov    %ebp,%ecx
mov    %ebx,%r8d
call   1040 <error@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i32 0
@.str = [21 x i8] c"setsockopt %d.%d: %d\00"
define void @do_setsockopt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
store i32 %3, i32* %5
%6 = call i64 @setsockopt(i32 %0, i32 %1, i32 %2, i32* %5, i32 4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = load i32, i32* @errno
%10 = load i32, i32* %5
%11 = call i32 @error(i32 1, i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %10)
br label %12
12: ; preds = %8, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cerr(char *);
void sig(int unused) { cerr("Timed out"); }


x86 assembly (clang, -O0):
<sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <cerr@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [10 x i8] c"Timed out\00"
define void @sig(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @cerr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Timed out\00"
define void @sig(i32 %0) {
%2 = tail call i32 @cerr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
int do_an_allocation() {
  int *a = malloc(sizeof(int));
  int *b = a;
  *a = 4;
  return b;
}


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

x86 assembly (clang, -O2):
<do_an_allocation>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x4,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_an_allocation() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i8* @malloc(i64 4)
%4 = bitcast i8* %3 to i32*
store i32* %4, i32** %1
%5 = load i32*, i32** %1
store i32* %5, i32** %2
%6 = load i32*, i32** %1
store i32 4, i32* %6
%7 = load i32*, i32** %2
%8 = ptrtoint i32* %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @do_an_allocation() {
%1 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%2 = bitcast i8* %1 to i32*
store i32 4, i32* %2
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int realtek_mst_i2c_spi_write_data(int, int, int /*<<< orphan*/ *, int);
int realtek_mst_i2c_spi_write_register(int fd, uint8_t reg, uint8_t value) {
  uint8_t command[] = {reg, value};
  return realtek_mst_i2c_spi_write_data(fd, (0x94 >> 1), command, 2);
}


x86 assembly (clang, -O0):
<realtek_mst_i2c_spi_write_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rdx
mov    $0x4a,%esi
mov    $0x2,%ecx
call   1030 <realtek_mst_i2c_spi_write_data@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realtek_mst_i2c_spi_write_register>:
push   %rax
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %rsp,%rdx
mov    $0x4a,%esi
mov    $0x2,%ecx
call   1030 <realtek_mst_i2c_spi_write_data@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [2 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%9 = load i32, i32* %5
store i32 %9, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 1
%11 = load i32, i32* %6
store i32 %11, i32* %10
%12 = load i32, i32* %4
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%14 = call i32 @realtek_mst_i2c_spi_write_data(i32 %12, i32 74, i32* %13, i32 2)
ret i32 %14
}

LLVM IR (-O2):
define i32 @realtek_mst_i2c_spi_write_register(i32 %0, i32 %1, i32 %2) {
%4 = alloca [2 x i32]
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = call i32 @realtek_mst_i2c_spi_write_data(i32 %0, i32 74, i32* %6, i32 2)
ret i32 %8
}
int *f(void) {
  int x;
  return &x;
}


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

x86 assembly (clang, -O2):
<f>:
lea    -0x4(%rsp),%rax
ret

LLVM IR (-O0):
define i32* @f() {
%1 = alloca i32
ret i32* %1
}

LLVM IR (-O2):
define noalias i32* @f() {
%1 = alloca i32
ret i32* %1
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
void USBDevLPMConfig(uint32_t ui32Base, uint32_t ui32Config) {
  ;
  (*((volatile uint8_t *)(ui32Base + 0x00000362))) = ui32Config;
}


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

x86 assembly (clang, -O2):
<USBDevLPMConfig>:
mov    %rsi,0x362(%rdi)
ret

LLVM IR (-O0):
define void @USBDevLPMConfig(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add nsw i64 %6, 866
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @USBDevLPMConfig(i64 %0, i64 %1) {
%3 = add nsw i64 %0, 866
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
void novm(msg) char *msg;
{ ; }


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

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

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

LLVM IR (-O2):
define void @novm(i8* nocapture %0) {
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void RNDResponseSink_AVTransport_Pause(struct UPnPService *Service,
                                       int ErrorCode, void *User) {
  printf("RND Invoke Response: AVTransport/Pause[ErrorCode:%d]()\r\n",
         ErrorCode);
}


x86 assembly (clang, -O0):
<RNDResponseSink_AVTransport_Pause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [57 x i8] c"RND Invoke Response: AVTransport/Pause[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_AVTransport_Pause(%struct.UPnPService* %0, i32 %1, i8* %2) {
%4 = alloca %struct.UPnPService*
%5 = alloca i32
%6 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [57 x i8] c"RND Invoke Response: AVTransport/Pause[ErrorCode:%d]()\0D\0A\00"
define void @RNDResponseSink_AVTransport_Pause(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
float sqrt(float);
float raiz(float a) { return sqrt(a); }


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

x86 assembly (clang, -O2):
<raiz>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111d <raiz+0xd>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define float @raiz(float %0) {
%2 = tail call float @sqrt(float %0)
ret float %2
}
void none_line(int ax, int ay, int bx, int by, int val) {}


x86 assembly (clang, -O0):
<none_line>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @none_line(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
ret void
}

LLVM IR (-O2):
define void @none_line(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
ret void
}
/* Variables and functions */
float tan(float);
float TAN(float x) { return tan(x); }


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

x86 assembly (clang, -O2):
<TAN>:
jmp    1030 <tan@plt>

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

LLVM IR (-O2):
define float @TAN(float %0) {
%2 = tail call float @tan(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("You can:\n"
         "    login <login-message>    set the login message\n"
         "    exit <exit-message>      set the exit message\n"
         "    prompt <prompt>          set the command prompt\n");
}


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

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

LLVM IR (-O0):
@.str = [163 x i8] c"You can:\0A login <login-message> set the login message\0A exit <exit-message> set the exit message\0A prompt <prompt> set the command prompt\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([163 x i8], [163 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [162 x i8] c"You can:\0A login <login-message> set the login message\0A exit <exit-message> set the exit message\0A prompt <prompt> set the command prompt\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([162 x i8], [162 x i8]* @str, i64 0, i64 0))
ret void
}
__attribute__((always_)) void
pcibios_add_platform_entries(struct pci_dev *dev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pcibios_add_platform_entries(%struct.pci_dev* nocapture %0) {
ret void
}
long int leftChildIndex(long int index) { return (index << 1); }


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

x86 assembly (clang, -O2):
<leftChildIndex>:
lea    (%rdi,%rdi,1),%rax
ret

LLVM IR (-O0):
define i64 @leftChildIndex(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 1
ret i64 %4
}

LLVM IR (-O2):
define i64 @leftChildIndex(i64 %0) {
%2 = shl i64 %0, 1
ret i64 %2
}
void turn(int player[]) {}


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

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

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

LLVM IR (-O2):
define void @turn(i32* nocapture %0) {
ret void
}
int test_imm_25int16_mem(short *val) {
  return ((*val) & (-0x25 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_25int16_mem>:
movzwl (%rdi),%eax
test   $0xffdb,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_25int16_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, -37
%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_25int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -37
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void PrintElement(char *key, int value) { printf("%s:%d\n", key, value); }


x86 assembly (clang, -O0):
<PrintElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintElement>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%s:%d\0A\00"
define void @PrintElement(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PIT0_DriverIRQHandler();
__attribute__((weak)) void PIT0_IRQHandler(void) { PIT0_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @PIT0_IRQHandler() {
%1 = call i32 (...) @PIT0_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @PIT0_IRQHandler() {
%1 = tail call i32 (...) @PIT0_DriverIRQHandler()
ret void
}
/* Variables and functions */
int r_write(int, char *, int);
int readblock(int, char *, int);
int readwriteblock(int fromfd, int tofd, char *buf, int size) {
  int bytesread;
  bytesread = readblock(fromfd, buf, size);
  if (bytesread != size)
    return bytesread;
  return r_write(tofd, buf, size);
}


x86 assembly (clang, -O0):
<readwriteblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <readblock@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
je     115e <readwriteblock+0x3e>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <readwriteblock+0x50>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <r_write@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readwriteblock>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <readblock@plt>
cmp    %ebx,%eax
jne    1149 <readwriteblock+0x29>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <r_write@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @readwriteblock(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @readblock(i32 %0, i8* %2, i32 %3)
%6 = icmp eq i32 %5, %3
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @r_write(i32 %1, i8* %2, i32 %3)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ %8, %7 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int, int);
void vmwClearScreen(int color, unsigned char *buffer) {
  memset(buffer, color, 640 * 480 * sizeof(unsigned char));
}


x86 assembly (clang, -O0):
<vmwClearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x4b000,%edx
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmwClearScreen>:
mov    %edi,%eax
mov    %rsi,%rdi
mov    %eax,%esi
mov    $0x4b000,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @vmwClearScreen(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @memset(i8* %5, i32 %6, i32 307200)
ret void
}

LLVM IR (-O2):
define void @vmwClearScreen(i32 %0, i8* %1) {
%3 = tail call i32 @memset(i8* %1, i32 %0, i32 307200)
ret void
}
int x42_process_syn(struct mypacket *packet) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.mypacket = type opaque
define i32 @x42_process_syn(%struct.mypacket* nocapture readnone %0) {
ret i32 0
}
float Sleef_cosf_u35(float x) { return __builtin_cosf(x); }


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

x86 assembly (clang, -O2):
<Sleef_cosf_u35>:
jmp    1030 <cosf@plt>

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

LLVM IR (-O2):
define float @Sleef_cosf_u35(float %0) {
%2 = tail call float @cosf(float %0)
ret float %2
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[2][3][4];
  int b[][2] = {{1, 1}, {2, 2}};
  printf("%ld\n", (sizeof(a) / sizeof(a[0])));
  printf("%ld\n", (sizeof(a[0]) / sizeof(a[0][0])));
  printf("%ld\n", (sizeof(a[0][0]) / sizeof(a[0][0][0])));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x78(%rbp)
lea    0xed1(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.b = [2 x [2 x i32]] [[2 x i32] [i32 1, i32 1], [2 x i32] [i32 2, i32 2]]
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [3 x [4 x i32]]]
%3 = alloca [2 x [2 x i32]]
store i32 0, i32* %1
%4 = bitcast [2 x [2 x i32]]* %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 3)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t _ntohl(uint32_t n) { return ntohl(n); }


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

x86 assembly (clang, -O2):
<_ntohl>:
jmp    1030 <ntohl@plt>

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

LLVM IR (-O2):
define i32 @_ntohl(i32 %0) {
%2 = tail call i32 @ntohl(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float num = (3.31e-8 * 2.01e-7) / (7.16e-6 + 2.01e-8);
  printf("%e\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float 0x3E0FD67BC0000000)
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int integrity_match_cabinet(char *cabinet_name, int cabinet_num) {
  return !(atoi(cabinet_name) == cabinet_num);
}


x86 assembly (clang, -O0):
<integrity_match_cabinet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
cmp    -0xc(%rbp),%eax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integrity_match_cabinet>:
push   %rbx
mov    %esi,%ebx
call   1030 <atoi@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @integrity_match_cabinet(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @atoi(i8* %5)
%7 = load i32, i32* %4
%8 = icmp eq i32 %6, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @integrity_match_cabinet(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @atoi(i8* %0)
%4 = icmp ne i32 %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int asuint(float);
int ulpscale_f(float x) {
  int e = asuint(x) >> 23 & 0xff;
  if (!e)
    e++;
  return e - 0x7f - 23;
}


x86 assembly (clang, -O0):
<ulpscale_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <asuint@plt>
sar    $0x17,%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1145 <ulpscale_f+0x35>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x7f,%eax
sub    $0x17,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulpscale_f>:
push   %rax
call   1030 <asuint@plt>
shr    $0x17,%eax
movzbl %al,%eax
lea    -0x96(%rax),%ecx
test   %eax,%eax
mov    $0xffffff6b,%eax
cmovne %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ulpscale_f(float %0) {
%2 = alloca float
%3 = alloca i32
store float %0, float* %2
%4 = load float, float* %2
%5 = call i32 @asuint(float %4)
%6 = ashr i32 %5, 23
%7 = and i32 %6, 255
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 127
%16 = sub nsw i32 %15, 23
ret i32 %16
}

LLVM IR (-O2):
define i32 @ulpscale_f(float %0) {
%2 = tail call i32 @asuint(float %0)
%3 = lshr i32 %2, 23
%4 = and i32 %3, 255
%5 = icmp eq i32 %4, 0
%6 = add nsw i32 %4, -150
%7 = select i1 %5, i32 -149, i32 %6
ret i32 %7
}
int foo(int x) {
  switch (x) {
  case 0:
    return 10;
  case 3:
    return -1;
  case 5:
    return 29;
  default:
    __builtin_unreachable();
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1130 <foo+0x30>
jmp    111a <foo+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     113c <foo+0x3c>
jmp    112b <foo+0x2b>
jmp    1148 <foo+0x48>
movl   $0xa,-0x4(%rbp)
jmp    1154 <foo+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <foo+0x54>
movl   $0x1d,-0x4(%rbp)
jmp    1154 <foo+0x54>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
je     110f <foo+0xf>
cmp    $0x5,%edi
jne    1115 <foo+0x15>
mov    $0x1d,%eax
ret
mov    $0xa,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 0, label %5
i32 3, label %6
i32 5, label %7
]
5: ; preds = %1
store i32 10, i32* %2
br label %9
6: ; preds = %1
store i32 -1, i32* %2
br label %9
7: ; preds = %1
store i32 29, i32* %2
br label %9
8: ; preds = %1
unreachable
9: ; preds = %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
switch i32 %0, label %4 [
i32 0, label %5
i32 3, label %2
i32 5, label %3
]
2: ; preds = %1
br label %5
3: ; preds = %1
br label %5
4: ; preds = %1
unreachable
5: ; preds = %1, %3, %2
%6 = phi i32 [ 29, %3 ], [ -1, %2 ], [ 10, %1 ]
ret i32 %6
}
/* Variables and functions */
scalar_t__ strlen(char *);
short STRLEN(char *S) { return ((short)strlen(S)); }


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

x86 assembly (clang, -O2):
<STRLEN>:
push   %rax
call   1030 <strlen@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @STRLEN(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = trunc i64 %4 to i16
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @STRLEN(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i16
ret i16 %3
}
/* Variables and functions */
int /*<<< orphan*/ PUT32(int const, int const);
void doSysCallReboot() {
  const int PM_RSTC = 0x2010001c;
  const int PM_WDOG = 0x20100024;
  const int PM_PASSWORD = 0x5a000000;
  const int PM_RSTC_WRCFG_FULL_RESET = 0x00000020;
  PUT32(PM_WDOG, PM_PASSWORD | 1);
  PUT32(PM_RSTC, PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<doSysCallReboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2010001c,-0x4(%rbp)
movl   $0x20100024,-0x8(%rbp)
movl   $0x5a000000,-0xc(%rbp)
movl   $0x20,-0x10(%rbp)
mov    $0x20100024,%edi
mov    $0x5a000001,%esi
call   1030 <PUT32@plt>
mov    $0x2010001c,%edi
mov    $0x5a000020,%esi
call   1030 <PUT32@plt>
jmp    1152 <doSysCallReboot+0x42>

x86 assembly (clang, -O2):
<doSysCallReboot>:
push   %rax
mov    $0x20100024,%edi
mov    $0x5a000001,%esi
call   1030 <PUT32@plt>
mov    $0x2010001c,%edi
mov    $0x5a000020,%esi
call   1030 <PUT32@plt>
nop
jmp    1130 <doSysCallReboot+0x20>

LLVM IR (-O0):
define void @doSysCallReboot() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 537919516, i32* %1
store i32 537919524, i32* %2
store i32 1509949440, i32* %3
store i32 32, i32* %4
%5 = call i32 @PUT32(i32 537919524, i32 1509949441)
%6 = call i32 @PUT32(i32 537919516, i32 1509949472)
br label %7
7: ; preds = %0, %7
br label %7
}

LLVM IR (-O2):
define void @doSysCallReboot() {
%1 = tail call i32 @PUT32(i32 537919524, i32 1509949441)
%2 = tail call i32 @PUT32(i32 537919516, i32 1509949472)
br label %3
3: ; preds = %3, %0
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ my_str(char *);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
void sig_bye() {
  extern int servfd;
  send(servfd, "/exit", 6, 0);
  close(servfd);
  my_str("\nExiting myirc_client.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<sig_bye>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1040 <close@plt>
lea    0xe91(%rip),%rdi
call   1050 <my_str@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<sig_bye>:
push   %rbx
mov    0x2ea0(%rip),%rbx
mov    (%rbx),%edi
lea    0xeaf(%rip),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    (%rbx),%edi
call   1040 <close@plt>
lea    0xe9b(%rip),%rdi
call   1050 <my_str@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@servfd = external global i32
@.str = [6 x i8] c"/exit\00"
@.str.1 = [24 x i8] c"\0AExiting myirc_client.\0A\00"
define void @sig_bye() {
%1 = load i32, i32* @servfd
%2 = call i32 @send(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6, i32 0)
%3 = load i32, i32* @servfd
%4 = call i32 @close(i32 %3)
%5 = call i32 @my_str(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@servfd = external global i32
@.str = [6 x i8] c"/exit\00"
@.str.1 = [24 x i8] c"\0AExiting myirc_client.\0A\00"
define void @sig_bye() {
%1 = load i32, i32* @servfd
%2 = tail call i32 @send(i32 %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6, i32 0)
%3 = load i32, i32* @servfd
%4 = tail call i32 @close(i32 %3)
%5 = tail call i32 @my_str(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
}
float angsin(float angle) { return sinf((angle)*0.01745329252); }


x86 assembly (clang, -O0):
<angsin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <sinf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angsin>:
cvtss2sd %xmm0,%xmm0
mulsd  0xee4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
jmp    1030 <sinf@plt>

LLVM IR (-O0):
define float @angsin(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x3F91DF46A252DD11
%6 = fptrunc double %5 to float
%7 = call float @sinf(float %6)
ret float %7
}

LLVM IR (-O2):
define float @angsin(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x3F91DF46A252DD11
%4 = fptrunc double %3 to float
%5 = tail call float @sinf(float %4)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void endgrent(void) {
  assert(!"NYI");
  return;
}


x86 assembly (clang, -O0):
<endgrent>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<endgrent>:
xor    %edi,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"NYI\00"
define void @endgrent() {
%1 = call i32 @assert(i32 0)
ret void
}

LLVM IR (-O2):
define void @endgrent() {
%1 = tail call i32 @assert(i32 0)
ret void
}
int grid_xsub_ispeer(int socktype) { return socktype == (2 * 16 + 0) ? 1 : 0; }


x86 assembly (clang, -O0):
<grid_xsub_ispeer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x20,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_xsub_ispeer>:
xor    %eax,%eax
cmp    $0x20,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @grid_xsub_ispeer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @grid_xsub_ispeer(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x57() {
  Assert_real((isalpha(87)),
              "/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_isalpha.c",
              440, ("isalpha should be 1 for W"));
}


x86 assembly (clang, -O0):
<t_isalpha_0x57>:
push   %rbp
mov    %rsp,%rbp
mov    $0x57,%edi
call   1030 <isalpha@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1b8,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0x57>:
push   %rax
mov    $0x57,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x1b8,%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_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for W\00"
define void @t_isalpha_0x57() {
%1 = call i32 @isalpha(i32 87)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 440, i8* getelementptr inbounds ([26 x i8], [26 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_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for W\00"
define void @t_isalpha_0x57() {
%1 = tail call i32 @isalpha(i32 87)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 440, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
double sin(double);
double f(double *y, double t, double *par) { return sin(t); }


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

x86 assembly (clang, -O2):
<f>:
jmp    1030 <sin@plt>

LLVM IR (-O0):
define double @f(double* %0, double %1, double* %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double*
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%7 = load double, double* %5
%8 = call double @sin(double %7)
ret double %8
}

LLVM IR (-O2):
define double @f(double* nocapture readnone %0, double %1, double* nocapture readnone %2) {
%4 = tail call double @sin(double %1)
ret double %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_binary(const uint32_t mask) {
  int i;
  for (i = 31; i >= 0; --i) {
    if (mask & (1 << i)) {
      printf("%d ", i + 1);
    }
  }
}


x86 assembly (clang, -O0):
<print_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     116b <print_binary+0x5b>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1158 <print_binary+0x48>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    115d <print_binary+0x4d>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_binary+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_binary>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0x20,%ebx
lea    0xede(%rip),%r14
jmp    1135 <print_binary+0x25>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%ebx
je     114c <print_binary+0x3c>
lea    -0x1(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
jae    1130 <print_binary+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <print_binary+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @print_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 31, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = shl i32 1, %9
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %13, %7
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, -1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_binary(i32 %0) {
br label %2
2: ; preds = %1, %10
%3 = phi i32 [ 31, %1 ], [ %11, %10 ]
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = add nuw nsw i32 %3, 1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %2, %7
%11 = add nsw i32 %3, -1
%12 = icmp eq i32 %3, 0
br i1 %12, label %13, label %2
13: ; preds = %10
ret void
}
/* Variables and functions */
void myset(char *target, char ch, int size) {
  int i;
  for (i = 0; i < size; ++i) {
    target[i] = ch;
  }
}


x86 assembly (clang, -O0):
<myset>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1140 <myset+0x40>
mov    -0x9(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <myset+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<myset>:
test   %edx,%edx
jle    1124 <myset+0x14>
push   %rax
mov    %edx,%edx
movzbl %sil,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @myset(i8* nocapture writeonly %0, i8 signext %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t null_side_flags(int drive) { return 0x0A; }


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

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

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

LLVM IR (-O2):
define i32 @null_side_flags(i32 %0) {
ret i32 10
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void xpi1(uint32_t *p) {
  p[0] = (p[0] >> 0x0a) ^ (p[0] << 0x16);
  p[2] = (p[2] >> 0x1f) ^ (p[2] << 1);
}


x86 assembly (clang, -O0):
<xpi1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sar    $0xa,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x16,%eax
xor    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
sar    $0x1f,%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
shl    $0x1,%eax
xor    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<xpi1>:
mov    (%rdi),%eax
mov    0x8(%rdi),%ecx
mov    %eax,%edx
sar    $0xa,%edx
shl    $0x16,%eax
xor    %edx,%eax
mov    %eax,(%rdi)
mov    %ecx,%eax
sar    $0x1f,%eax
add    %ecx,%ecx
xor    %eax,%ecx
mov    %ecx,0x8(%rdi)
ret

LLVM IR (-O0):
define void @xpi1(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = ashr i32 %5, 10
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = shl i32 %9, 22
%11 = xor i32 %6, %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 0
store i32 %11, i32* %13
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = ashr i32 %16, 31
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 2
%20 = load i32, i32* %19
%21 = shl i32 %20, 1
%22 = xor i32 %17, %21
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 2
store i32 %22, i32* %24
ret void
}

LLVM IR (-O2):
define void @xpi1(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = ashr i32 %2, 10
%4 = shl i32 %2, 22
%5 = xor i32 %3, %4
store i32 %5, i32* %0
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = ashr i32 %7, 31
%9 = shl i32 %7, 1
%10 = xor i32 %8, %9
store i32 %10, i32* %6
ret void
}