#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int uint8_t;
typedef void *time_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ localtime(void **);
int /*<<< orphan*/ lseek(int, int, int /*<<< orphan*/);
void *make_bytes_int(int *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, int *, int);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd = open("/dev/sdb1", O_RDONLY);
  uint8_t buff[1024];
  lseek(fd, 1024, SEEK_SET);
  read(fd, buff, 1024);
  printf("Ext2 signature : %x %x\n", buff[56], buff[57]);
  printf("File system state : %1x %1x\n", buff[58], buff[59]);
  int os_id = make_bytes_int(buff, 72);
  printf("OS ID : %d\n", os_id);
  time_t last_written_time = make_bytes_int(buff, 48);
  char timestr[100];
  strftime(timestr, 100, "%Y-%m-%d %H:%M:%S.000",
           localtime(&last_written_time));
  printf("Last written time : %s\n", timestr);
  time_t last_mount_time = make_bytes_int(buff, 44);
  strftime(timestr, 100, "%Y-%m-%d %H:%M:%S.000",
           localtime(&last_written_time));
  printf("Last mount time : %s\n", timestr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10c0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e5f(%rip),%rax
mov    (%rax),%esi
lea    0xe6e(%rip),%rdi
call   1090 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <lseek@plt>
mov    -0x14(%rbp),%edi
lea    -0x1020(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    -0xf40(%rbp),%esi
mov    -0xf3c(%rbp),%edx
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xf38(%rbp),%esi
mov    -0xf34(%rbp),%edx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1020(%rbp),%rdi
mov    $0x48,%esi
call   1060 <make_bytes_int@plt>
mov    %eax,-0x1024(%rbp)
mov    -0x1024(%rbp),%esi
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1020(%rbp),%rdi
mov    $0x30,%esi
call   1060 <make_bytes_int@plt>
mov    %rax,-0x1030(%rbp)
lea    -0x10a0(%rbp),%rax
mov    %rax,-0x10b8(%rbp)
lea    -0x1030(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x10b8(%rbp),%rdi
mov    %eax,%ecx
mov    $0x64,%esi
lea    0xde1(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x10a0(%rbp),%rsi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1020(%rbp),%rdi
mov    $0x2c,%esi
call   1060 <make_bytes_int@plt>
mov    %rax,-0x10a8(%rbp)
lea    -0x10a0(%rbp),%rax
mov    %rax,-0x10b0(%rbp)
lea    -0x1030(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x10b0(%rbp),%rdi
mov    %eax,%ecx
mov    $0x64,%esi
lea    0xd80(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x10a0(%rbp),%rsi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1088,%rsp
mov    0x2e63(%rip),%rax
mov    (%rax),%esi
lea    0xe72(%rip),%rdi
call   1090 <open@plt>
mov    %eax,%ebx
mov    0x2e3c(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    $0x400,%esi
call   1050 <lseek@plt>
lea    0x80(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    0x160(%rsp),%esi
mov    0x164(%rsp),%edx
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x168(%rsp),%esi
mov    0x16c(%rsp),%edx
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x48,%esi
call   1060 <make_bytes_int@plt>
lea    0xe32(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x30,%esi
call   1060 <make_bytes_int@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%r15
mov    %r15,%rdi
call   1030 <localtime@plt>
lea    0xe0f(%rip),%r12
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
mov    %eax,%ecx
call   1080 <strftime@plt>
lea    0xe07(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    $0x2c,%esi
call   1060 <make_bytes_int@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r12,%rdx
mov    %eax,%ecx
call   1080 <strftime@plt>
lea    0xde7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1088,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"/dev/sdb1\00"
@O_RDONLY = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [24 x i8] c"Ext2 signature : %x %x\0A\00"
@.str.2 = [29 x i8] c"File system state : %1x %1x\0A\00"
@.str.3 = [12 x i8] c"OS ID : %d\0A\00"
@.str.4 = [22 x i8] c"%Y-%m-%d %H:%M:%S.000\00"
@.str.5 = [24 x i8] c"Last written time : %s\0A\00"
@.str.6 = [22 x i8] c"Last mount time : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [1024 x i32]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca [100 x i8]
%10 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%11 = load i32, i32* @O_RDONLY
%12 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @lseek(i32 %13, i32 1024, i32 %14)
%16 = load i32, i32* %5
%17 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 0
%18 = call i32 @read(i32 %16, i32* %17, i32 1024)
%19 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 56
%20 = load i32, i32* %19
%21 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 57
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %20, i32 %22)
%24 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 58
%25 = load i32, i32* %24
%26 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 59
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %25, i32 %27)
%29 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 0
%30 = call i8* @make_bytes_int(i32* %29, i32 72)
%31 = ptrtoint i8* %30 to i32
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 0
%35 = call i8* @make_bytes_int(i32* %34, i32 48)
store i8* %35, i8** %8
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%37 = call i32 @localtime(i8** %8)
%38 = call i32 @strftime(i8* %36, i32 100, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %39)
%41 = getelementptr inbounds [1024 x i32], [1024 x i32]* %6, i64 0, i64 0
%42 = call i8* @make_bytes_int(i32* %41, i32 44)
store i8* %42, i8** %10
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%44 = call i32 @localtime(i8** %8)
%45 = call i32 @strftime(i8* %43, i32 100, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %44)
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"/dev/sdb1\00"
@O_RDONLY = global i32 0
@SEEK_SET = global i32 0
@.str.1 = [24 x i8] c"Ext2 signature : %x %x\0A\00"
@.str.2 = [29 x i8] c"File system state : %1x %1x\0A\00"
@.str.3 = [12 x i8] c"OS ID : %d\0A\00"
@.str.4 = [22 x i8] c"%Y-%m-%d %H:%M:%S.000\00"
@.str.5 = [24 x i8] c"Last written time : %s\0A\00"
@.str.6 = [22 x i8] c"Last mount time : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i32]
%4 = alloca i8*
%5 = alloca [100 x i8]
%6 = load i32, i32* @O_RDONLY
%7 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [1024 x i32]* %3 to i8*
%9 = load i32, i32* @SEEK_SET
%10 = tail call i32 @lseek(i32 %7, i32 1024, i32 %9)
%11 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 0
%12 = call i32 @read(i32 %7, i32* %11, i32 1024)
%13 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 56
%14 = load i32, i32* %13
%15 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 57
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %14, i32 %16)
%18 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 58
%19 = load i32, i32* %18
%20 = getelementptr inbounds [1024 x i32], [1024 x i32]* %3, i64 0, i64 59
%21 = load i32, i32* %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i32 %19, i32 %21)
%23 = call i8* @make_bytes_int(i32* %11, i32 72)
%24 = ptrtoint i8* %23 to i64
%25 = trunc i64 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = bitcast i8** %4 to i8*
%28 = call i8* @make_bytes_int(i32* %11, i32 48)
store i8* %28, i8** %4
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%30 = call i32 @localtime(i8** %4)
%31 = call i32 @strftime(i8* %29, i32 100, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%33 = call i8* @make_bytes_int(i32* %11, i32 44)
%34 = call i32 @localtime(i8** %4)
%35 = call i32 @strftime(i8* %29, i32 100, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i8* %29)
ret i32 0
}