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

/* Variables and functions */
void bit_clear(uint32_t *dword, unsigned int n) { *dword &= ~(1 << n); }


x86 assembly (clang, -O0):
<bit_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_clear>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
and    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @bit_clear(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = xor i32 %6, -1
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = and i32 %9, %7
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @bit_clear(i32* nocapture %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = load i32, i32* %0
%6 = and i32 %5, %4
store i32 %6, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void main() {
  time_t t;
  time(&t);
  printf("Today's date and time : %s", ctime(&t));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <ctime@plt>
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Today's date and time : %s\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @time(i32* %1)
%3 = call i8* @ctime(i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Today's date and time : %s\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i8* @ctime(i32* %1)
%5 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
unsigned int cpuid_ebx(unsigned int op) {
  unsigned int eax, ebx;
  __asm__("cpuid" : "=a"(eax), "=b"(ebx) : "0"(op) : "cx", "dx");
  return ebx;
}


x86 assembly (clang, -O0):
<cpuid_ebx>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,-0x10(%rbp)
mov    %ebx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_ebx>:
push   %rbx
mov    %edi,%eax
cpuid
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid_ebx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call { i32, i32 } asm "cpuid", "={ax},={bx},0,~{cx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %5)
%7 = extractvalue { i32, i32 } %6, 0
%8 = extractvalue { i32, i32 } %6, 1
store i32 %7, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpuid_ebx(i32 %0) {
%2 = tail call { i32, i32 } asm "cpuid", "={ax},={bx},0,~{cx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32 } %2, 1
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
__attribute__((always_)) int64_t max_int64_t(int64_t a, int64_t b) {
  return a > b ? a : b;
}


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

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

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

LLVM IR (-O2):
define i64 @max_int64_t(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int test_imm_43uint16_mem(unsigned short *val) {
  return ((*val) & (-0x43 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_43uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -67
%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_43uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -67
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void test(int n) {
  int arr[n];
  int i;
  for (i = 0; i < n; ++i)
    arr[i] = i + 1;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1164 <test+0x64>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1139 <test+0x39>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ colour_is_ok(int);
int /*<<< orphan*/ my_fatal(char *, char *, int);
int colour_opp(int colour) {
  {
    if (!(colour_is_ok(colour)))
      my_fatal("file \"%s\", line %d, assertion \""
               "colour_is_ok(colour)"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/colour.c",
               49);
  };
  return colour ^ ((1 << 0) ^ (1 << 1));
}


x86 assembly (clang, -O0):
<colour_opp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <colour_is_ok@plt>
cmp    $0x0,%eax
jne    1154 <colour_opp+0x34>
lea    0xebd(%rip),%rdi
lea    0xef3(%rip),%rsi
mov    $0x31,%edx
call   1030 <my_fatal@plt>
mov    -0x4(%rbp),%eax
xor    $0x3,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colour_opp>:
push   %rbx
mov    %edi,%ebx
call   1040 <colour_is_ok@plt>
test   %eax,%eax
jne    1144 <colour_opp+0x24>
lea    0xecd(%rip),%rdi
lea    0xf03(%rip),%rsi
mov    $0x31,%edx
call   1030 <my_fatal@plt>
xor    $0x3,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [61 x i8] c"file \22%s\22, line %d, assertion \22colour_is_ok(colour)\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/colour.c\00"
define i32 @colour_opp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @colour_is_ok(i32 %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @my_fatal(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 49)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
%10 = xor i32 %9, 3
ret i32 %10
}

LLVM IR (-O2):
@.str = [61 x i8] c"file \22%s\22, line %d, assertion \22colour_is_ok(colour)\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/colour.c\00"
define i32 @colour_opp(i32 %0) {
%2 = tail call i32 @colour_is_ok(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @my_fatal(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 49)
br label %6
6: ; preds = %4, %1
%7 = xor i32 %0, 3
ret i32 %7
}
/* Variables and functions */
unsigned char pcibios_read_config_byte(int /*<<< orphan*/, scalar_t__, int);
int /*<<< orphan*/ pcibios_write_config_byte(int /*<<< orphan*/, scalar_t__,
                                             int, unsigned char);
void set_ram_command(unsigned command) {
  unsigned char byte;
  command &= 0x7;
  byte = pcibios_read_config_byte(0, ((0x00 << 3) + 0), 0x76);
  byte &= 0x1f;
  byte |= (command << 5);
  pcibios_write_config_byte(0, ((0x00 << 3) + 0), 0x76, byte);
}


x86 assembly (clang, -O0):
<set_ram_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0x4(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x76,%edx
call   1040 <pcibios_read_config_byte@plt>
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
and    $0x1f,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%ecx
shl    $0x5,%ecx
movzbl -0x5(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x5(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x76,%edx
movzbl -0x5(%rbp),%ecx
call   1030 <pcibios_write_config_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ram_command>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x76,%edx
call   1040 <pcibios_read_config_byte@plt>
and    $0x1f,%al
shl    $0x5,%bl
or     %al,%bl
movzbl %bl,%ecx
xor    %edi,%edi
xor    %esi,%esi
mov    $0x76,%edx
pop    %rbx
jmp    1030 <pcibios_write_config_byte@plt>

LLVM IR (-O0):
define void @set_ram_command(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 7
store i32 %5, i32* %2
%6 = call zeroext i8 @pcibios_read_config_byte(i32 0, i64 0, i32 118)
store i8 %6, i8* %3
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = and i32 %8, 31
%10 = trunc i32 %9 to i8
store i8 %10, i8* %3
%11 = load i32, i32* %2
%12 = shl i32 %11, 5
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %14, %12
%16 = trunc i32 %15 to i8
store i8 %16, i8* %3
%17 = load i8, i8* %3
%18 = call i32 @pcibios_write_config_byte(i32 0, i64 0, i32 118, i8 zeroext %17)
ret void
}

LLVM IR (-O2):
define void @set_ram_command(i32 %0) {
%2 = tail call zeroext i8 @pcibios_read_config_byte(i32 0, i64 0, i32 118)
%3 = and i8 %2, 31
%4 = trunc i32 %0 to i8
%5 = shl i8 %4, 5
%6 = or i8 %3, %5
%7 = tail call i32 @pcibios_write_config_byte(i32 0, i64 0, i32 118, i8 zeroext %6)
ret void
}
void ble_evt_sm_smp_data(const struct ble_msg_sm_smp_data_evt_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_sm_smp_data_evt_t = type opaque
define void @ble_evt_sm_smp_data(%struct.ble_msg_sm_smp_data_evt_t* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ update_crc(int /*<<< orphan*/ *, scalar_t__, scalar_t__ *);
uint32_t get_crc(uint8_t *p, uint32_t len) {
  uint32_t crc;
  crc = 0;
  update_crc(p, len, &crc);
  return crc;
}


x86 assembly (clang, -O0):
<get_crc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <update_crc@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_crc>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdx
call   1030 <update_crc@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_crc(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %5
%6 = load i32*, i32** %3
%7 = load i64, i64* %4
%8 = call i32 @update_crc(i32* %6, i64 %7, i64* %5)
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @get_crc(i32* %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = call i32 @update_crc(i32* %0, i64 %1, i64* %3)
%6 = load i64, i64* %3
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ _outsw(unsigned short *, short *, int);
void outsw(int port, short *ptr, int len) {
  unsigned short *io_ptr =
      (unsigned short *)(((unsigned long)0x80000000) + port);
  _outsw(io_ptr, ptr, len);
}


x86 assembly (clang, -O0):
<outsw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x80000000,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <_outsw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsw>:
movslq %edi,%rdi
sub    $0xffffffff80000000,%rdi
jmp    1030 <_outsw@plt>

LLVM IR (-O0):
define void @outsw(i32 %0, i16* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i16*
store i32 %0, i32* %4
store i16* %1, i16** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = add i64 2147483648, %9
%11 = inttoptr i64 %10 to i16*
store i16* %11, i16** %7
%12 = load i16*, i16** %7
%13 = load i16*, i16** %5
%14 = load i32, i32* %6
%15 = call i32 @_outsw(i16* %12, i16* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @outsw(i32 %0, i16* %1, i32 %2) {
%4 = sext i32 %0 to i64
%5 = add nsw i64 %4, 2147483648
%6 = inttoptr i64 %5 to i16*
%7 = tail call i32 @_outsw(i16* %6, i16* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, char *, unsigned int);
void print_block_error(char *s, unsigned blk, unsigned inum) {
  printf("%u %s I=%u\n", blk, s, inum);
}


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"%u %s I=%u\0A\00"
define void @print_block_error(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %0, i32 %2)
ret void
}
unsigned int ascii_length(char *in) {
  unsigned int length = 0;
  while (*in++)
    length++;
  return length;
}


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

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

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

LLVM IR (-O2):
define i32 @ascii_length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
int f10_0(unsigned x) {
  switch (x) {
  default:
    x += 1;
  case 10 ... 0xFFFFFFFF:
    return 0;
  }
}


x86 assembly (clang, -O0):
<f10_0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    111f <f10_0+0x1f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
cmp    $0xfffffff5,%eax
jbe    111b <f10_0+0x1b>
jmp    1112 <f10_0+0x12>

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

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

LLVM IR (-O2):
define i32 @f10_0(i32 %0) {
ret i32 0
}
/* Variables and functions */
double foo(float);
void foo_loop(double *x, float *y, int N) {
  for (int i = 0; i < N; ++i) {
    x[i] = foo(y[i]);
  }
}


x86 assembly (clang, -O0):
<foo_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1163 <foo_loop+0x53>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <foo_loop+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_loop>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    114a <foo_loop+0x3a>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movss  (%r14,%rbx,4),%xmm0
call   1030 <foo@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <foo_loop+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @foo_loop(double* nocapture writeonly %0, float* nocapture %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 %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %14, %8 ]
%10 = getelementptr inbounds float, float* %1, i64 %9
%11 = load float, float* %10
%12 = tail call double @foo(float %11)
%13 = getelementptr inbounds double, double* %0, i64 %9
store double %12, double* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %7, label %8
}
int ebc_isupper(char c) {
  return (c >= 0xC1 && c <= 0xC9) || (c >= 0xD1 && c <= 0xD9) ||
         (c >= 0xE2 && c <= 0xE9);
}


x86 assembly (clang, -O0):
<ebc_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xc1,%eax
jl     112e <ebc_isupper+0x2e>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xc9,%ecx
mov    %al,-0x2(%rbp)
jle    117c <ebc_isupper+0x7c>
movsbl -0x1(%rbp),%eax
cmp    $0xd1,%eax
jl     1152 <ebc_isupper+0x52>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd9,%ecx
mov    %al,-0x2(%rbp)
jle    117c <ebc_isupper+0x7c>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xe2,%ecx
mov    %al,-0x3(%rbp)
jl     1176 <ebc_isupper+0x76>
movsbl -0x1(%rbp),%eax
cmp    $0xe9,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ebc_isupper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 193
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 201
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 209
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 217
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 226
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 233
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @ebc_isupper(i8 signext %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ call_ext(char *, char *, char *);
void ext_onl(char *user, char *status) { call_ext("xstat", user, status); }


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

x86 assembly (clang, -O2):
<ext_onl>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <call_ext@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"xstat\00"
define void @ext_onl(i8* %0, i8* %1) {
%3 = tail call i32 @call_ext(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
void exchange(char *a, char *b) {
  char temp;
  temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<exchange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @exchange(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @exchange(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
float exp(float);
float fexp(float x) { return exp(x); }


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

x86 assembly (clang, -O2):
<fexp>:
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define float @fexp(float %0) {
%2 = tail call float @exp(float %0)
ret float %2
}
/* Type definitions */
struct vec4i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec4i(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/);
__attribute__((always_)) struct vec4i *
psvec4i(struct vec4i *result, int32_t x, int32_t y, int32_t z, int32_t w) {
  vec4i((int32_t *)result, x, y, z, w);
  return result;
}


x86 assembly (clang, -O0):
<psvec4i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <vec4i@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec4i>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec4i@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i(%struct.vec4i* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.vec4i*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.vec4i* %0, %struct.vec4i** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.vec4i*, %struct.vec4i** %6
%12 = bitcast %struct.vec4i* %11 to i32*
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = call i32 @vec4i(i32* %12, i32 %13, i32 %14, i32 %15, i32 %16)
%18 = load %struct.vec4i*, %struct.vec4i** %6
ret %struct.vec4i* %18
}

LLVM IR (-O2):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i(%struct.vec4i* returned %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = getelementptr %struct.vec4i, %struct.vec4i* %0, i64 0, i32 0
%7 = tail call i32 @vec4i(i32* %6, i32 %1, i32 %2, i32 %3, i32 %4)
ret %struct.vec4i* %0
}
int fun313() { return 313; }


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

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

LLVM IR (-O0):
define i32 @fun313() {
ret i32 313
}

LLVM IR (-O2):
define i32 @fun313() {
ret i32 313
}
/* Variables and functions */
void *sringstart(void *);
void *sdatastart(void *shm) { return sringstart(shm) + 4096; }


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

x86 assembly (clang, -O2):
<sdatastart>:
push   %rax
call   1030 <sringstart@plt>
add    $0x1000,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @sdatastart(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @sringstart(i8* %3)
%5 = getelementptr i8, i8* %4, i64 4096
ret i8* %5
}

LLVM IR (-O2):
define i8* @sdatastart(i8* %0) {
%2 = tail call i8* @sringstart(i8* %0)
%3 = getelementptr i8, i8* %2, i64 4096
ret i8* %3
}
unsigned int arikkei_unicode_utf8_bytes(unsigned int uval) {
  if (uval < 0x80)
    return 1;
  if (uval < 0x800)
    return 2;
  if (uval < 0x10000)
    return 3;
  if (uval < 0x200000)
    return 4;
  if (uval < 0x4000000)
    return 5;
  return 6;
}


x86 assembly (clang, -O0):
<arikkei_unicode_utf8_bytes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jae    1120 <arikkei_unicode_utf8_bytes+0x20>
movl   $0x1,-0x4(%rbp)
jmp    118b <arikkei_unicode_utf8_bytes+0x8b>
cmpl   $0x800,-0x8(%rbp)
jae    1139 <arikkei_unicode_utf8_bytes+0x39>
movl   $0x2,-0x4(%rbp)
jmp    118b <arikkei_unicode_utf8_bytes+0x8b>
cmpl   $0x10000,-0x8(%rbp)
jae    1152 <arikkei_unicode_utf8_bytes+0x52>
movl   $0x3,-0x4(%rbp)
jmp    118b <arikkei_unicode_utf8_bytes+0x8b>
cmpl   $0x200000,-0x8(%rbp)
jae    116b <arikkei_unicode_utf8_bytes+0x6b>
movl   $0x4,-0x4(%rbp)
jmp    118b <arikkei_unicode_utf8_bytes+0x8b>
cmpl   $0x4000000,-0x8(%rbp)
jae    1184 <arikkei_unicode_utf8_bytes+0x84>
movl   $0x5,-0x4(%rbp)
jmp    118b <arikkei_unicode_utf8_bytes+0x8b>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arikkei_unicode_utf8_bytes>:
mov    $0x1,%eax
cmp    $0x80,%edi
jb     1142 <arikkei_unicode_utf8_bytes+0x42>
mov    $0x2,%eax
cmp    $0x800,%edi
jb     1142 <arikkei_unicode_utf8_bytes+0x42>
mov    $0x3,%eax
cmp    $0x10000,%edi
jb     1142 <arikkei_unicode_utf8_bytes+0x42>
mov    $0x4,%eax
cmp    $0x200000,%edi
jb     1142 <arikkei_unicode_utf8_bytes+0x42>
cmp    $0x4000000,%edi
mov    $0x6,%eax
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @arikkei_unicode_utf8_bytes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 128
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %24
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp ult i32 %8, 2048
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 2, i32* %2
br label %24
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp ult i32 %12, 65536
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 3, i32* %2
br label %24
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp ult i32 %16, 2097152
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 4, i32* %2
br label %24
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp ult i32 %20, 67108864
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 5, i32* %2
br label %24
23: ; preds = %19
store i32 6, i32* %2
br label %24
24: ; preds = %23, %22, %18, %14, %10, %6
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @arikkei_unicode_utf8_bytes(i32 %0) {
%2 = icmp ult i32 %0, 128
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 2048
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 65536
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 2097152
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 67108864
%11 = select i1 %10, i32 5, i32 6
br label %12
12: ; preds = %9, %7, %5, %3, %1
%13 = phi i32 [ 1, %1 ], [ 2, %3 ], [ 3, %5 ], [ 4, %7 ], [ %11, %9 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ EBADF;
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __dup3(int fd, int fd2, int flags) {
  if (fd < 0 || fd2 < 0) {
    __set_errno(EBADF);
    return -1;
  }
  if (fd == fd2)
    return fd2;
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__dup3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1135 <__dup3+0x25>
cmpl   $0x0,-0xc(%rbp)
jge    114f <__dup3+0x3f>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <__dup3+0x6b>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1166 <__dup3+0x56>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <__dup3+0x6b>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dup3>:
push   %rax
mov    %esi,%ecx
or     %edi,%ecx
js     1126 <__dup3+0x16>
mov    %esi,%eax
cmp    %esi,%edi
je     1139 <__dup3+0x29>
mov    0x2ec4(%rip),%rax
jmp    112d <__dup3+0x1d>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@EBADF = global i32 0
@ENOSYS = global i32 0
define i32 @__dup3(i32 %0, i32 %1, i32 %2) {
%4 = or i32 %1, %0
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = icmp eq i32 %0, %1
br i1 %7, label %12, label %8
8: ; preds = %6, %3
%9 = phi i32* [ @EBADF, %3 ], [ @ENOSYS, %6 ]
%10 = load i32, i32* %9
%11 = tail call i32 @__set_errno(i32 %10)
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ %1, %6 ], [ -1, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(void *, char *, unsigned long, int, float, float,
                           float);
void utilisation_print(void *l, unsigned long int time, int task, float cpu,
                       float cpuw, float cpua) {
  if (l == NULL) {
    return;
  }
  fprintf(l, "%ld %d util %f %f %f\n", time, task, cpu, cpuw, cpua);
}


x86 assembly (clang, -O0):
<utilisation_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movss  %xmm0,-0x18(%rbp)
movss  %xmm1,-0x1c(%rbp)
movss  %xmm2,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1142 <utilisation_print+0x32>
jmp    1168 <utilisation_print+0x58>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm2
lea    0xe9d(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utilisation_print>:
test   %rdi,%rdi
je     1126 <utilisation_print+0x16>
mov    %edx,%ecx
mov    %rsi,%rdx
lea    0xedf(%rip),%rsi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%ld %d util %f %f %f\0A\00"
define void @utilisation_print(i8* %0, i64 %1, i32 %2, float %3, float %4, float %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i8* %0, i8** %7
store i64 %1, i64* %8
store i32 %2, i32* %9
store float %3, float* %10
store float %4, float* %11
store float %5, float* %12
%13 = load i8*, i8** %7
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %16
15: ; preds = %6
br label %24
16: ; preds = %6
%17 = load i8*, i8** %7
%18 = load i64, i64* %8
%19 = load i32, i32* %9
%20 = load float, float* %10
%21 = load float, float* %11
%22 = load float, float* %12
%23 = call i32 @fprintf(i8* %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 %18, i32 %19, float %20, float %21, float %22)
br label %24
24: ; preds = %16, %15
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%ld %d util %f %f %f\0A\00"
define void @utilisation_print(i8* %0, i64 %1, i32 %2, float %3, float %4, float %5) {
%7 = icmp eq i8* %0, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @fprintf(i8* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 %1, i32 %2, float %3, float %4, float %5)
br label %10
10: ; preds = %6, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ curs_set(int);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ resetty();
void finish(int sigage) {
  curs_set(1);
  clear();
  refresh();
  resetty();
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1080 <curs_set@plt>
mov    $0x0,%al
call   1070 <clear@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1030 <resetty@plt>
mov    $0x0,%al
call   1050 <endwin@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<finish>:
push   %rax
mov    $0x1,%edi
call   1080 <curs_set@plt>
xor    %eax,%eax
call   1070 <clear@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
xor    %eax,%eax
call   1030 <resetty@plt>
xor    %eax,%eax
call   1050 <endwin@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @finish(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @curs_set(i32 1)
%4 = call i32 (...) @clear()
%5 = call i32 (...) @refresh()
%6 = call i32 (...) @resetty()
%7 = call i32 (...) @endwin()
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @finish(i32 %0) {
%2 = tail call i32 @curs_set(i32 1)
%3 = tail call i32 (...) @clear()
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 (...) @resetty()
%6 = tail call i32 (...) @endwin()
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int digitalRead(int);
int /*<<< orphan*/ ino(int);
int digitalReadX(int x, int pin) {
  ino(x);
  return (digitalRead(pin));
}


x86 assembly (clang, -O0):
<digitalReadX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ino@plt>
mov    -0x8(%rbp),%edi
call   1040 <digitalRead@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitalReadX>:
push   %rbx
mov    %esi,%ebx
call   1030 <ino@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <digitalRead@plt>

LLVM IR (-O0):
define i32 @digitalReadX(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @ino(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @digitalRead(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @digitalReadX(i32 %0, i32 %1) {
%3 = tail call i32 @ino(i32 %0)
%4 = tail call i32 @digitalRead(i32 %1)
ret i32 %4
}
unsigned int cpuid_signature() {
  unsigned eax;
  asm("cpuid" : "=a"(eax) : "0"(1) : "ecx", "ebx", "edx");
  return eax;
}


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

x86 assembly (clang, -O2):
<cpuid_signature>:
push   %rbx
mov    $0x1,%eax
cpuid
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid_signature() {
%1 = alloca i32
%2 = call i32 asm "cpuid", "={ax},0,~{ecx},~{ebx},~{edx},~{dirflag},~{fpsr},~{flags}"(i32 1)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @cpuid_signature() {
%1 = tail call i32 asm "cpuid", "={ax},0,~{ecx},~{ebx},~{edx},~{dirflag},~{fpsr},~{flags}"(i32 1)
ret i32 %1
}
int ypos(int pos) { return pos % 64; }


x86 assembly (clang, -O0):
<ypos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ypos>:
mov    %edi,%eax
lea    0x3f(%rax),%ecx
test   %edi,%edi
cmovns %edi,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ypos(i32 %0) {
%2 = srem i32 %0, 64
ret i32 %2
}
__attribute__((always_)) void __writel(unsigned int val, volatile void *addr) {
  asm volatile("mov"
               "l"
               " %0,%1"
               :
               : "r"(val), "m"(*(volatile unsigned int *)addr));
}


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

x86 assembly (clang, -O2):
<__writel>:
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @__writel(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
tail call void asm sideeffect "movl $0,$1", "r,*m,~{dirflag},~{fpsr},~{flags}"(i32 %0, i32* elementtype(i32) %3)
ret void
}
void ch_asm_pause() { asm("pause"); }


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

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

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

LLVM IR (-O2):
define void @ch_asm_pause() {
tail call void asm sideeffect "pause", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int clearbit(int num, int i) {
  int mask = ~(1 << i);
  return num & mask;
}


x86 assembly (clang, -O0):
<clearbit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @clearbit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
store i32 %8, i32* %5
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = and i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @clearbit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Variables and functions */
void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, int c) {
  if (*currlen < maxlen) {
    if (buffer != NULL)
      buffer[(*currlen)] = (char)c;
    (*currlen)++;
  }
  return;
}


x86 assembly (clang, -O0):
<dopr_outch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jae    1150 <dopr_outch+0x50>
cmpq   $0x0,-0x8(%rbp)
je     1142 <dopr_outch+0x42>
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dopr_outch>:
mov    (%rsi),%rax
cmp    %rdx,%rax
jae    111a <dopr_outch+0x1a>
test   %rdi,%rdi
je     1113 <dopr_outch+0x13>
mov    %cl,(%rdi,%rax,1)
mov    (%rsi),%rax
add    $0x1,%rax
mov    %rax,(%rsi)
ret

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

LLVM IR (-O2):
define void @dopr_outch(i8* writeonly %0, i64* nocapture %1, i64 %2, i32 %3) {
%5 = load i64, i64* %1
%6 = icmp ult i64 %5, %2
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = icmp eq i8* %0, null
br i1 %8, label %13, label %9
9: ; preds = %7
%10 = trunc i32 %3 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %10, i8* %11
%12 = load i64, i64* %1
br label %13
13: ; preds = %9, %7
%14 = phi i64 [ %12, %9 ], [ %5, %7 ]
%15 = add i64 %14, 1
store i64 %15, i64* %1
br label %16
16: ; preds = %13, %4
ret void
}
/* Variables and functions */
double _get_schar(const char *data, size_t pos) {
  signed char *buf = (signed char *)data;
  return ((double)buf[pos]);
}


x86 assembly (clang, -O0):
<_get_schar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_schar>:
movsbl (%rdi,%rsi,1),%eax
cvtsi2sd %eax,%xmm0
ret

LLVM IR (-O0):
define double @_get_schar(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i64, i64* %4
%9 = getelementptr inbounds i8, i8* %7, i64 %8
%10 = load i8, i8* %9
%11 = sitofp i8 %10 to double
ret double %11
}

LLVM IR (-O2):
define double @_get_schar(i8* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 %1
%4 = load i8, i8* %3
%5 = sitofp i8 %4 to double
ret double %5
}