xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ iBit;

/* Variables and functions */
int /*<<< orphan*/ UARTD2_SendData(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int strlen(char *);
void Test_MCU_Chip_System(void) {
  int iBit = 12315;
  char sTemp[128] = {0};
  sprintf(sTemp, "This MCU chip is a %d-byte system.\n\n", sizeof(iBit));
  UARTD2_SendData(sTemp, strlen(sTemp) * sizeof(char));
  return;
}


x86 assembly (clang, -O0):
<Test_MCU_Chip_System>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x301b,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x4,%edx
call   1060 <sprintf@plt>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x98(%rbp),%rdi
cltq
shl    $0x0,%rax
mov    %eax,%esi
call   1050 <UARTD2_SendData@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test_MCU_Chip_System>:
push   %rbx
sub    $0x80,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe97(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <UARTD2_SendData@plt>
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"This MCU chip is a %d-byte system.\0A\0A\00"
define void @Test_MCU_Chip_System() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 12315, i32* %1
%3 = bitcast [128 x i8]* %2 to i8*
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = call i32 @UARTD2_SendData(i8* %6, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"This MCU chip is a %d-byte system.\0A\0A\00"
define void @Test_MCU_Chip_System() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = call i32 @strlen(i8* %2)
%5 = call i32 @UARTD2_SendData(i8* %2, i32 %4)
ret void
}
/* Type definitions */
struct tm {
  double tm_min;
  double tm_sec;
};

/* Variables and functions */
float Mymin(struct tm *ptr) {
  return (float)((3.1415926535898 / 2) -
                 ((ptr->tm_min + ptr->tm_sec / 60.0) / 60) * 2 *
                     3.1415926535898);
}


x86 assembly (clang, -O0):
<Mymin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xef7(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xee7(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xed3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xea0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mymin>:
movsd  0x8(%rdi),%xmm0
movsd  0xef3(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  (%rdi),%xmm0
divsd  %xmm1,%xmm0
mulsd  0xee7(%rip),%xmm0
mulsd  0xee7(%rip),%xmm0
addsd  0xee7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
%struct.tm = type { double, double }
define float @Mymin(%struct.tm* %0) {
%2 = alloca %struct.tm*
store %struct.tm* %0, %struct.tm** %2
%3 = load %struct.tm*, %struct.tm** %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
%5 = load double, double* %4
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%8 = load double, double* %7
%9 = fdiv double %8, 6.000000e+01
%10 = fadd double %5, %9
%11 = fdiv double %10, 6.000000e+01
%12 = fmul double %11, 2.000000e+00
%13 = fneg double %12
%14 = call double @llvm.fmuladd.f64(double %13, double 0x400921FB54442D28, double 0x3FF921FB54442D28)
%15 = fptrunc double %14 to float
ret float %15
}

LLVM IR (-O2):
%struct.tm = type { double, double }
define float @Mymin(%struct.tm* nocapture %0) {
%2 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.tm, %struct.tm* %0, i64 0, i32 1
%5 = load double, double* %4
%6 = fdiv double %5, 6.000000e+01
%7 = fadd double %3, %6
%8 = fdiv double %7, 6.000000e+01
%9 = fmul double %8, -2.000000e+00
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x400921FB54442D28, double 0x3FF921FB54442D28)
%11 = fptrunc double %10 to float
ret float %11
}
/* Type definitions */
typedef int /*<<< orphan*/ enable;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              void *, int);
void noly_set_tcp_nodelay(int sk) {
  int enable = 1;
  setsockopt(sk, IPPROTO_TCP, TCP_NODELAY, (void *)&enable, sizeof(enable));
}


x86 assembly (clang, -O0):
<noly_set_tcp_nodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb4(%rip),%rax
mov    (%rax),%esi
mov    0x2eb3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<noly_set_tcp_nodelay>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define void @noly_set_tcp_nodelay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_TCP
%6 = load i32, i32* @TCP_NODELAY
%7 = bitcast i32* %3 to i8*
%8 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i8* %7, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define void @noly_set_tcp_nodelay(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_NODELAY
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i8* %3, i32 4)
ret void
}
void BSP_GPIO_Init(unsigned int port, unsigned int value) {
  unsigned int temp = (unsigned int)(volatile unsigned int *)0x56000000;
  volatile unsigned int *conReg;
  port = port << 4;
  conReg = (volatile unsigned int *)(temp | port);
  *conReg = value;
}


x86 assembly (clang, -O0):
<BSP_GPIO_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x56000000,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_GPIO_Init>:
shl    $0x4,%edi
or     $0x56000000,%rdi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @BSP_GPIO_Init(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 ptrtoint (i32* inttoptr (i64 1442840576 to i32*) to i32), i32* %5
%7 = load i32, i32* %3
%8 = shl i32 %7, 4
store i32 %8, i32* %3
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = or i32 %9, %10
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %6
%14 = load i32, i32* %4
%15 = load i32*, i32** %6
store volatile i32 %14, i32* %15
ret void
}

LLVM IR (-O2):
define void @BSP_GPIO_Init(i32 %0, i32 %1) {
%3 = shl i32 %0, 4
%4 = or i32 %3, 1442840576
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
store volatile i32 %1, i32* %6
ret void
}
/* Variables and functions */
double inc_list_sum(double, double, int);
double pow(double, int);
double math_calc(int year, double price, double year_rent, double inc_ratio) {
  return (price * pow(inc_ratio, year) - price +
          inc_list_sum(year_rent, inc_ratio, year));
}


x86 assembly (clang, -O0):
<math_calc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x4(%rbp),%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    -0x4(%rbp),%edi
call   1040 <inc_list_sum@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_calc>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %edi,%ebx
movapd %xmm2,%xmm0
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
mov    %ebx,%edi
call   1040 <inc_list_sum@plt>
addsd  0x8(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @math_calc(i32 %0, double %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %6
%10 = load double, double* %8
%11 = load i32, i32* %5
%12 = call double @pow(double %10, i32 %11)
%13 = load double, double* %6
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %9, double %12, double %14)
%16 = load double, double* %7
%17 = load double, double* %8
%18 = load i32, i32* %5
%19 = call double @inc_list_sum(double %16, double %17, i32 %18)
%20 = fadd double %15, %19
ret double %20
}

LLVM IR (-O2):
define double @math_calc(i32 %0, double %1, double %2, double %3) {
%5 = tail call double @pow(double %3, i32 %0)
%6 = fneg double %1
%7 = tail call double @llvm.fmuladd.f64(double %1, double %5, double %6)
%8 = tail call double @inc_list_sum(double %2, double %3, i32 %0)
%9 = fadd double %7, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int yyerror(char *s) {
  printf("Se ha encontrado un error en el archivo de:\n%s\n", s);
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [48 x i8] c"Se ha encontrado un error en el archivo de:\0A%s\0A\00"
define i32 @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [48 x i8] c"Se ha encontrado un error en el archivo de:\0A%s\0A\00"
define i32 @yyerror(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
char *strcat(char *, char const *);
char *C_strcat(char *destination, const char *source) {
  return strcat(destination, source);
}


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

x86 assembly (clang, -O2):
<C_strcat>:
jmp    1030 <strcat@plt>

LLVM IR (-O0):
define i8* @C_strcat(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 i8* @strcat(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @C_strcat(i8* returned %0, i8* nocapture %1) {
%3 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int repeatWord(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char *word = (char *)malloc(sizeof(char));
  scanf("%s", word);
  printf("\n%d", repeatWord(word, "CHEF"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1050 <repeatWord@plt>
mov    %eax,%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
mov    %rax,%rsi
call   1060 <scanf@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1050 <repeatWord@plt>
lea    0xe90(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [5 x i8] c"CHEF\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 1)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @repeatWord(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [5 x i8] c"CHEF\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 1)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @repeatWord(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ OTG_FS_IRQHandler();
void Default_Handler76(void) {
  OTG_FS_IRQHandler();
  return;
}


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

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

LLVM IR (-O0):
define void @Default_Handler76() {
%1 = call i32 (...) @OTG_FS_IRQHandler()
ret void
}

LLVM IR (-O2):
define void @Default_Handler76() {
%1 = tail call i32 (...) @OTG_FS_IRQHandler()
ret void
}
/* Variables and functions */
void *malloc(long);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, long);
void *bitvector_new(long length) {
  void *ret = malloc(length / sizeof(char) + 1);
  memset(ret, 0, length / sizeof(char) + 1);
  return ret;
}


x86 assembly (clang, -O0):
<bitvector_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shr    $0x0,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
shr    $0x0,%rdx
add    $0x1,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitvector_new>:
push   %r14
push   %rbx
push   %rax
lea    0x1(%rdi),%r14
mov    %r14,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @bitvector_new(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = udiv i64 %4, 1
%6 = add i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i64, i64* %2
%10 = udiv i64 %9, 1
%11 = add i64 %10, 1
%12 = call i32 @memset(i8* %8, i32 0, i64 %11)
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @bitvector_new(i64 %0) {
%2 = add i64 %0, 1
%3 = tail call i8* @malloc(i64 %2)
%4 = tail call i32 @memset(i8* %3, i32 0, i64 %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sumOfTwo();
int main(void) {
  printf("sum of two: %d\n", sumOfTwo());
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"sum of two: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @sumOfTwo()
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"sum of two: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @sumOfTwo()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
unsigned int foo(unsigned int x) {
  if (x < 5)
    x = 4;
  else
    x = 8;
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jae    111d <foo+0x1d>
movl   $0x4,-0x4(%rbp)
jmp    1124 <foo+0x24>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0x5,%edi
setae  %al
lea    0x4(,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 5
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 4, i32* %2
br label %7
6: ; preds = %1
store i32 8, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp ugt i32 %0, 4
%3 = select i1 %2, i32 8, i32 4
ret i32 %3
}
int __syscall_error(void) {
  register int err_no __asm__("%rcx");
  __asm__("mov %rax, %rcx\n\t"
          "neg %rcx");
  __set_errno(err_no);
  return -1;
}


x86 assembly (clang, -O0):
<__syscall_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rax,%rcx
neg    %rcx
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__syscall_error>:
push   %rax
mov    %rax,%rcx
neg    %rcx
xor    %eax,%eax
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @__syscall_error() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 (i32, ...) bitcast (i32 (...)* @__set_errno to i32 (i32, ...)*)(i32 %2)
ret i32 -1
}

LLVM IR (-O2):
define i32 @__syscall_error() {
tail call void asm sideeffect "mov %rax, %rcx\0A\09neg %rcx", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @__set_errno to i32 (i32, ...)*)(i32 undef)
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_BF3403(unsigned short uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_BF3403>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_BF3403>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_BF3403(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = trunc i16 %5 to i8
%7 = load i16, i16* %4
%8 = trunc i16 %7 to i8
%9 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %6, i8 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_BF3403(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = trunc i16 %1 to i8
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %3, i8 zeroext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_scale(double);
void set_scale_2() { set_scale(1.0 / 2); }


x86 assembly (clang, -O0):
<set_scale_2>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
call   1030 <set_scale@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_scale_2>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <set_scale@plt>

LLVM IR (-O0):
define void @set_scale_2() {
%1 = call i32 @set_scale(double 5.000000e-01)
ret void
}

LLVM IR (-O2):
define void @set_scale_2() {
%1 = tail call i32 @set_scale(double 5.000000e-01)
ret void
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_YELLOW_LED_PIN() { return 0x01 & (inp_emulate(0x35) >> 0); }


x86 assembly (clang, -O0):
<TOSH_READ_YELLOW_LED_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x35,%edi
call   1030 <inp_emulate@plt>
sar    $0x0,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_YELLOW_LED_PIN>:
push   %rax
mov    $0x35,%edi
call   1030 <inp_emulate@plt>
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_YELLOW_LED_PIN() {
%1 = call i32 @inp_emulate(i32 53)
%2 = ashr i32 %1, 0
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_YELLOW_LED_PIN() {
%1 = tail call i32 @inp_emulate(i32 53)
%2 = trunc i32 %1 to i8
%3 = and i8 %2, 1
ret i8 %3
}
int is_bit_set(unsigned char *c, int i) {
  if ((128 >> (i % 8) & c[i / 8]))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_bit_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x80,%eax
sar    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x18(%rbp),%eax
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1154 <is_bit_set+0x54>
movl   $0x1,-0x4(%rbp)
jmp    115b <is_bit_set+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bit_set>:
mov    %esi,%ecx
and    $0x7,%cl
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
sar    $0x3,%eax
cltq
movzbl (%rdi,%rax,1),%eax
shl    %cl,%eax
movzbl %al,%eax
shr    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @is_bit_set(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = srem i32 %6, 8
%8 = ashr i32 128, %7
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = sdiv i32 %10, 8
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = and i32 %8, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 1, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @is_bit_set(i8* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = lshr i32 128, %3
%5 = sdiv i32 %1, 8
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = and i32 %4, %9
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
int userRead(int addr) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @userRead(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo(int n) {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j)
      bar();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1169 <foo+0x59>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <foo+0x46>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <foo+0x25>
jmp    115b <foo+0x4b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <foo+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1144 <foo+0x34>
mov    %edi,%r14d
xor    %ebp,%ebp
nopl   (%rax)
mov    %r14d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <bar@plt>
add    $0xffffffff,%ebx
jne    1130 <foo+0x20>
add    $0x1,%ebp
cmp    %r14d,%ebp
jne    1120 <foo+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1, %6
%4 = phi i32 [ %7, %6 ], [ 0, %1 ]
br label %9
5: ; preds = %6, %1
ret void
6: ; preds = %9
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %5, label %3
9: ; preds = %3, %9
%10 = phi i32 [ %12, %9 ], [ 0, %3 ]
%11 = tail call i32 (...) @bar()
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %0
br i1 %13, label %6, label %9
}
unsigned number_of_bits_set(unsigned v) {
  unsigned c;
  for (c = 0; v; c++) {
    v &= v - 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<number_of_bits_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <number_of_bits_set+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <number_of_bits_set+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_bits_set>:
xor    %eax,%eax
test   %edi,%edi
je     111c <number_of_bits_set+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <number_of_bits_set+0x10>
ret

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

LLVM IR (-O2):
define i32 @number_of_bits_set(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
void print_if(struct __NMC3_thread_descriptor *thr_dscr) {}


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

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

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

LLVM IR (-O2):
%struct.__NMC3_thread_descriptor = type opaque
define void @print_if(%struct.__NMC3_thread_descriptor* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_read_buf();
int /*<<< orphan*/ test_read_fd();
void test_read(void) {
  test_read_fd();
  test_read_buf();
}


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

x86 assembly (clang, -O2):
<test_read>:
push   %rax
xor    %eax,%eax
call   1040 <test_read_fd@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_read_buf@plt>

LLVM IR (-O0):
define void @test_read() {
%1 = call i32 (...) @test_read_fd()
%2 = call i32 (...) @test_read_buf()
ret void
}

LLVM IR (-O2):
define void @test_read() {
%1 = tail call i32 (...) @test_read_fd()
%2 = tail call i32 (...) @test_read_buf()
ret void
}
/* Variables and functions */
int LOG_CONS;
int LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ openlog(char const *, int, int /*<<< orphan*/);
void lamb_log_init(const char *ident) {
  openlog(ident, LOG_CONS | LOG_PID, LOG_USER);
  return;
}


x86 assembly (clang, -O0):
<lamb_log_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
or     (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
call   1030 <openlog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lamb_log_init>:
mov    0x2eb9(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
jmp    1030 <openlog@plt>

LLVM IR (-O0):
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_USER = global i32 0
define void @lamb_log_init(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @LOG_CONS
%5 = load i32, i32* @LOG_PID
%6 = or i32 %4, %5
%7 = load i32, i32* @LOG_USER
%8 = call i32 @openlog(i8* %3, i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_USER = global i32 0
define void @lamb_log_init(i8* %0) {
%2 = load i32, i32* @LOG_CONS
%3 = load i32, i32* @LOG_PID
%4 = or i32 %3, %2
%5 = load i32, i32* @LOG_USER
%6 = tail call i32 @openlog(i8* %0, i32 %4, i32 %5)
ret void
}
/* Variables and functions */
int fabs(float);
int diffetinate(float b) { return fabs(b); }


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

x86 assembly (clang, -O2):
<diffetinate>:
jmp    1030 <fabs@plt>

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

LLVM IR (-O2):
define i32 @diffetinate(float %0) {
%2 = tail call i32 @fabs(float %0)
ret i32 %2
}
/* Variables and functions */
int ENODEV;
int uniphier_cache_init(void) { return -ENODEV; }


x86 assembly (clang, -O0):
<uniphier_cache_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    0x2ed3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uniphier_cache_init>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

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

LLVM IR (-O2):
@ENODEV = global i32 0
define i32 @uniphier_cache_init() {
%1 = load i32, i32* @ENODEV
%2 = sub nsw i32 0, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
void UARTIntDisable(unsigned long ulBase, unsigned long ulIntFlags) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  (*((volatile unsigned long *)(ulBase + 0x00000038))) &= ~(ulIntFlags);
}


x86 assembly (clang, -O0):
<UARTIntDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x38(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTIntDisable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
not    %rbx
and    %rbx,0x38(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @UARTIntDisable(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 = call i32 @UARTBaseValid(i64 %5)
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i64, i64* %4
%9 = xor i64 %8, -1
%10 = load i64, i64* %3
%11 = add i64 %10, 56
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, %9
store volatile i64 %14, i64* %12
ret void
}

LLVM IR (-O2):
define void @UARTIntDisable(i64 %0, i64 %1) {
%3 = tail call i32 @UARTBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = xor i64 %1, -1
%6 = add i64 %0, 56
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, %5
store volatile i64 %9, i64* %7
ret void
}
long charlong(s)
unsigned char *s;
{
  int I;
  long l;
  l = 0;
  for (I = 4; I > 0; --I)
    l = l * 256 + s[I - 1];
  return l;
}


x86 assembly (clang, -O0):
<charlong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x4,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    114f <charlong+0x4f>
mov    -0x18(%rbp),%rax
shl    $0x8,%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1117 <charlong+0x17>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @charlong(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %4, 16
%9 = shl nuw nsw i64 %7, 8
%10 = or i64 %8, %9
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = or i64 %10, %13
%15 = shl nuw nsw i64 %14, 8
%16 = load i8, i8* %0
%17 = zext i8 %16 to i64
%18 = or i64 %15, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void module_main(void) {
  fprintf(stdout, "Hello from lib2.c\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<module_main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_main>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [19 x i8] c"Hello from lib2.c\0A\00"
define void @module_main() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [19 x i8] c"Hello from lib2.c\0A\00"
define void @module_main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
/* Variables and functions */
scalar_t__ mib_set(scalar_t__, void *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setupPortFW();
int setPortForwardingCapability(unsigned char enabled) {
  if (mib_set(0 + 34, (void *)&enabled) == 0) {
    printf("Set port forwarding error!\n");
    return -1;
  }
  setupPortFW();
  return 0;
}


x86 assembly (clang, -O0):
<setPortForwardingCapability>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0x22,%edi
lea    -0x5(%rbp),%rsi
call   1030 <mib_set@plt>
cmp    $0x0,%rax
jne    116e <setPortForwardingCapability+0x3e>
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <setPortForwardingCapability+0x4c>
mov    $0x0,%al
call   1050 <setupPortFW@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPortForwardingCapability>:
push   %rbx
sub    $0x10,%rsp
mov    %dil,0xf(%rsp)
lea    0xf(%rsp),%rsi
mov    $0x22,%edi
call   1040 <mib_set@plt>
test   %rax,%rax
je     1159 <setPortForwardingCapability+0x29>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <setupPortFW@plt>
jmp    116a <setPortForwardingCapability+0x3a>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Set port forwarding error!\0A\00"
define i32 @setPortForwardingCapability(i8 zeroext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i64 @mib_set(i64 34, i8* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %10
8: ; preds = %1
%9 = call i32 (...) @setupPortFW()
store i32 0, i32* %2
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@str = [27 x i8] c"Set port forwarding error!\00"
define i32 @setPortForwardingCapability(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i64 @mib_set(i64 34, i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 (...) @setupPortFW()
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ -1, %5 ], [ 0, %7 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printat(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void wipe(void) {
  printat(0, 0);
  printf("\033[J");
}


x86 assembly (clang, -O0):
<wipe>:
push   %rbp
mov    %rsp,%rbp
xor    %esi,%esi
mov    %esi,%edi
call   1040 <printat@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wipe>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1040 <printat@plt>
lea    0xecf(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[J\00"
define void @wipe() {
%1 = call i32 @printat(i32 0, i32 0)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[J\00"
define void @wipe() {
%1 = tail call i32 @printat(i32 0, i32 0)
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_20(unsigned int a, unsigned int b) { return (a >> 31) ^ (b >> 31); }


x86 assembly (clang, -O0):
<test_20>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1f,%eax
mov    -0x8(%rbp),%ecx
shr    $0x1f,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_20>:
mov    %edi,%eax
xor    %esi,%eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @test_20(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 = lshr i32 %5, 31
%7 = load i32, i32* %4
%8 = lshr i32 %7, 31
%9 = xor i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_20(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = lshr i32 %3, 31
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int Hex2N(int const);
uint8_t Hex2Sym(const uint8_t *d, size_t sh) {
  return (Hex2N(d[sh]) << 4) | Hex2N(d[sh + 1]);
}


x86 assembly (clang, -O0):
<Hex2Sym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <Hex2N@plt>
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rax,%rcx,4),%edi
call   1030 <Hex2N@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hex2Sym>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi,%rsi,4),%edi
call   1030 <Hex2N@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
mov    0x4(%rbx,%r14,4),%edi
call   1030 <Hex2N@plt>
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Hex2Sym(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = load i64, i64* %4
%7 = getelementptr inbounds i32, i32* %5, i64 %6
%8 = load i32, i32* %7
%9 = call i32 @Hex2N(i32 %8)
%10 = shl i32 %9, 4
%11 = load i32*, i32** %3
%12 = load i64, i64* %4
%13 = add i64 %12, 1
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @Hex2N(i32 %15)
%17 = or i32 %10, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @Hex2Sym(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = load i32, i32* %3
%5 = tail call i32 @Hex2N(i32 %4)
%6 = shl i32 %5, 4
%7 = add i64 %1, 1
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @Hex2N(i32 %9)
%11 = or i32 %10, %6
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ PR_SET_NAME;
int /*<<< orphan*/ prctl(int /*<<< orphan*/, unsigned long, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
void set_thread_name(const char *name) {
  prctl(PR_SET_NAME, (unsigned long)name, 0, 0, 0);
}


x86 assembly (clang, -O0):
<set_thread_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <prctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_thread_name>:
mov    %rdi,%rsi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <prctl@plt>

LLVM IR (-O0):
@PR_SET_NAME = global i32 0
define void @set_thread_name(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @PR_SET_NAME
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = call i32 @prctl(i32 %3, i64 %5, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@PR_SET_NAME = global i32 0
define void @set_thread_name(i8* %0) {
%2 = load i32, i32* @PR_SET_NAME
%3 = ptrtoint i8* %0 to i64
%4 = tail call i32 @prctl(i32 %2, i64 %3, i32 0, i32 0, i32 0)
ret void
}
int main() {
  int *crashpls = (void *)0;
  return *crashpls;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 undef
}
void DTW_counter_init(void) {
  *(volatile unsigned int *)0xE000EDFC |= 0x01000000;
  *(volatile unsigned int *)0xE0001000 |= 0x1;
  return;
}


x86 assembly (clang, -O0):
<DTW_counter_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000edfc,%eax
mov    (%rax),%ecx
or     $0x1000000,%ecx
mov    $0xe000edfc,%eax
mov    %ecx,(%rax)
mov    $0xe0001000,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0xe0001000,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DTW_counter_init>:
mov    $0xe0001000,%eax
orl    $0x1000000,0xddfc(%rax)
orl    $0x1,(%rax)
ret

LLVM IR (-O0):
define void @DTW_counter_init() {
%1 = load volatile i32, i32* inttoptr (i64 3758157308 to i32*)
%2 = or i32 %1, 16777216
store volatile i32 %2, i32* inttoptr (i64 3758157308 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 3758100480 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 3758100480 to i32*)
ret void
}

LLVM IR (-O2):
define void @DTW_counter_init() {
%1 = load volatile i32, i32* inttoptr (i64 3758157308 to i32*)
%2 = or i32 %1, 16777216
store volatile i32 %2, i32* inttoptr (i64 3758157308 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 3758100480 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 3758100480 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  float a[2];
  unsigned int temp;
  a[0] = 0.375f;
  temp = (unsigned int)(a[0] / 0.03125f);
  assert(temp == 12);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3ec00000,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xed4(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%rax
mov    %eax,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [2 x float]
%2 = alloca i32
%3 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
store float 3.750000e-01, float* %3
%4 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
%5 = load float, float* %4
%6 = fdiv float %5, 3.125000e-02
%7 = fptoui float %6 to i32
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 12
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
void glPopAttrib(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glPopAttrib() {
ret void
}